Merge branch 'develop' into 1205-Editar-OID-desde-operaciones-masivas-4406-Northern

Conflicts:
	pandora_console/godmode/massive/massive_edit_modules.php
This commit is contained in:
enriquecd 2017-10-30 15:19:49 +01:00
commit 32f5db5934
271 changed files with 61474 additions and 71499 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.712
# Version 7.0NG.714
# 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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.712, AIX version
# Version 7.0NG.714, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -58,6 +58,9 @@ server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
#transfer_mode_user apache
# Server password (Tentacle or FTP). Leave empty for no password (default).
# server_pwd mypassword

View File

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

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.712, GNU/Linux
# Version 7.0NG.714, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -88,6 +88,9 @@ server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
#transfer_mode_user apache
# Server password (Tentacle or FTP). Leave empty for no password (default).
#server_pwd mypassword

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.712, FreeBSD Version
# Version 7.0NG.714, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -98,6 +98,9 @@ server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
#transfer_mode_user apache
# timeout in seconds for file transfer programs execution (30 by default)
#transfer_timeout 30

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.712, HP-UX Version
# Version 7.0NG.714, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -60,6 +60,9 @@ server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
#transfer_mode_user apache
# Server password (Tentacle or FTP). Leave empty for no password (default).
# server_pwd mypassword

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.712, GNU/Linux
# Version 7.0NG.714, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -104,6 +104,9 @@ server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
#transfer_mode_user apache
# timeout in seconds for file transfer programs execution (30 by default)
#transfer_timeout 30

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.712, NetBSD Version
# Version 7.0NG.714, NetBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -66,6 +66,9 @@ server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
#transfer_mode_user apache
# timeout in seconds for file transfer programs execution (30 by default)
#transfer_timeout 30

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.712, Solaris Version
# Version 7.0NG.714, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -60,6 +60,9 @@ server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
#transfer_mode_user apache
# timeout in seconds for file transfer programs execution (30 by default)
#transfer_timeout 30

View File

@ -40,8 +40,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.712';
use constant AGENT_BUILD => '170908';
use constant AGENT_VERSION => '7.0NG.714';
use constant AGENT_BUILD => '171030';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -128,6 +128,9 @@ my @BrokerPid;
my %DefaultConf = (
'server_ip' => 'localhost',
'server_path' => '/var/spool/pandora/data_in',
'server_path_md5' => 'md5', #undocumented
'server_path_conf' => 'conf', #undocumented
'server_path_zip' => 'collections', #undocumented
'logfile' =>'/var/log/pandora/pandora_agent.log',
'logsize' => DEFAULT_MAX_LOG_SIZE,
'logrotate' => DEFAULT_LOG_ROTATE,
@ -146,6 +149,7 @@ my %DefaultConf = (
'encoding' => 'UTF-8',
'server_port' => 41121,
'transfer_mode' => 'tentacle',
'transfer_mode_user' => 'apache',
'transfer_timeout' => 30,
'server_user' => 'pandora',
'server_pwd' => '',
@ -906,13 +910,17 @@ sub fix_directory ($) {
################################################################################
# Sends a file to the server.
################################################################################
#sub send_file ($;$$$) {
sub send_file {
my ($file, $secondary, $rc_primary, $flag_always) = @_;
my ($file, $secondary, $rc_primary, $flag_always, $relative) = @_;
my $output;
my $pid = fork();
return 1 unless defined $pid;
# Fix remote dir to some transfer mode
my $remote_dir = $Conf{'server_path'} . "/";
$remote_dir .= fix_directory($relative) . '/' if defined($relative);
if ($pid == 0) {
# execute the transfer program by child process.
eval {
@ -935,7 +943,7 @@ sub send_file {
quit
FEOF1`
} elsif ($Conf{'transfer_mode'} eq 'local') {
$output = `cp "$file" "$Conf{'server_path'}/" 2>&1 >$DevNull`;
$output = `cp -p "$file" "$remote_dir" 2>&1 >$DevNull`;
}
alarm (0);
};
@ -966,7 +974,7 @@ sub send_file {
$rc_primary = 1;
}
swap_servers ();
$rc = send_file ($file, undef, $rc_primary);
$rc = send_file ($file, undef, $rc_primary, undef, $relative);
swap_servers ();
return $rc;
@ -1024,7 +1032,7 @@ sub send_file {
return $rc unless ($Conf{'secondary_mode'} eq 'always' || ($Conf{'secondary_mode'} eq 'on_error' && $rc != 0));
swap_servers ();
$rc = send_file ($file);
$rc = send_file ($file, undef, undef, undef, $relative);
swap_servers ();
return $rc;
}
@ -1075,12 +1083,16 @@ sub swap_servers () {
################################################################################
# Receive a file from the server.
################################################################################
sub recv_file ($) {
my $file = shift;
sub recv_file {
my ($file, $relative) = @_;
my $output;
my $pid = fork();
return 1 unless defined $pid;
return 1 unless defined $pid;
# Fix remote dir to some transfer mode
my $remote_dir = $Conf{'server_path'};
$remote_dir .= "/" . fix_directory($relative) if defined($relative);
if ($pid == 0) {
# execute the transfer program by child process.
@ -1104,7 +1116,7 @@ sub recv_file ($) {
quit
FEOF1`
} elsif ($Conf{'transfer_mode'} eq 'local') {
$output = `cp $Conf{'server_path'}/$file $Conf{'temporal'} 2>&1 >$DevNull`;
$output = `cp "$remote_dir/$file" $Conf{'temporal'} 2>&1 >$DevNull`;
}
alarm (0);
};
@ -1148,14 +1160,19 @@ sub check_remote_config () {
}
# Get the remote MD5 file
if (recv_file ($RemoteMD5File) != 0) {
if (recv_file ($RemoteMD5File, $Conf{'server_path_md5'}) != 0) {
log_message ('remote config', 'Uploading configuration for the first time.');
open (MD5_FILE, "> $Conf{'temporal'}/$RemoteMD5File") || error ("Could not open file '$ConfDir/$RemoteMD5File' for writing: $!.");
print MD5_FILE $conf_md5;
close (MD5_FILE);
copy ("$ConfDir/$ConfFile", "$Conf{'temporal'}/$RemoteConfFile");
send_file ("$Conf{'temporal'}/$RemoteConfFile");
send_file ("$Conf{'temporal'}/$RemoteMD5File");
log_message ('remote config', 'Uploading configuration for the first time.');
if ($Conf{'transfer_mode'} eq 'local') {
my (undef, undef, $uid, $gid) = getpwnam($Conf{'transfer_mode_user'});
chown ($uid, $gid, "$Conf{'temporal'}/$RemoteMD5File");
chown ($uid, $gid, "$Conf{'temporal'}/$RemoteConfFile");
}
send_file ("$Conf{'temporal'}/$RemoteConfFile", undef, undef, undef, $Conf{'server_path_conf'});
send_file ("$Conf{'temporal'}/$RemoteMD5File", undef, undef, undef, $Conf{'server_path_md5'});
unlink ("$Conf{'temporal'}/$RemoteConfFile");
unlink ("$Conf{'temporal'}/$RemoteMD5File");
return;
@ -1169,7 +1186,7 @@ sub check_remote_config () {
return if ($remote_conf_md5 eq $conf_md5);
# Get the new configuration file
return if (recv_file ($RemoteConfFile) != 0);
return if (recv_file ($RemoteConfFile, $Conf{'server_path_conf'}) != 0);
log_message ('remote config', 'Configuration has changed!');
# Save the new configuration
@ -1255,7 +1272,7 @@ sub check_collections () {
# Get remote md5
error ("File '$Conf{'temporal'}/$collection_md5_file' already exists as a symlink and could not be removed: $!.") if (-l "$Conf{'temporal'}/$collection_md5_file" && !unlink("$Conf{'temporal'}/$collection_md5_file"));
next unless (recv_file ($collection_md5_file) == 0);
next unless (recv_file ($collection_md5_file, $Conf{'server_path_md5'}) == 0);
open (MD5_FILE, "< $Conf{'temporal'}/$collection_md5_file") || error ("Could not open file '$Conf{'temporal'}/$collection_md5_file' for reading: $!.");
my $remote_collection_md5 = <MD5_FILE>;
close (MD5_FILE);
@ -1273,7 +1290,7 @@ sub check_collections () {
next if ($local_collection_md5 eq $remote_collection_md5);
# Download and unzip
next unless (recv_file ($collection_file) == 0);
next unless (recv_file ($collection_file, $Conf{'server_path_zip'}) == 0);
rmrf ("$ConfDir/collections/$collection");
`unzip -d "$ConfDir/collections/$collection" "$Conf{'temporal'}/$collection_file" 2>$DevNull`;
unlink ("$Conf{'temporal'}/$collection_file");
@ -1346,7 +1363,7 @@ sub md5 {
# Append bit /* bit, not byte */ length of unpadded message as 64-bit
# little-endian integer to message.
$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.
for (my $i = 0; $i < length ($msg); $i += 512) {
@ -1562,6 +1579,9 @@ sub guess_os_version ($) {
# AIX
} elsif ($os eq 'aix') {
$os_version = "$2.$1" if (`uname -rv` =~ /\s*(\d)\s+(\d)\s*/);
# Darwin
} elsif ($os eq 'darwin') {
$os_version = `defaults read loginwindow SystemVersionStampAsString`;
# Windows
} elsif ($os =~ /win/i) {
$os_version = `ver`;

View File

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

View File

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

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.712"
PI_BUILD="170908"
PI_VERSION="7.0NG.714"
PI_BUILD="171030"
OS_NAME=`uname -s`
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_CXXFLAGS=-g -O0
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
endif

View File

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

Binary file not shown.

Binary file not shown.

View File

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

View File

@ -248,7 +248,9 @@ Pandora_Module::parseModuleKindFromString (string kind) {
} else if (kind == module_inventory_str) {
return MODULE_INVENTORY;
} 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) {
return MODULE_WMIQUERY;
} else if (kind == module_perfcounter_str) {

View File

@ -86,6 +86,7 @@ namespace Pandora_Modules {
MODULE_FREEMEMORY_PERCENT, /**< The module checks the amount of
* freememory in the system */
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_PERFCOUNTER, /**< The module reads performance counters */
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_inventory_str = "module_inventory";
const string module_logevent_str = "module_logevent";
const string module_logchannel_str = "module_logchannel";
const string module_wmiquery_str = "module_wmiquery";
const string module_perfcounter_str = "module_perfcounter";
const string module_tcpcheck_str = "module_tcpcheck";

View File

@ -31,6 +31,7 @@
#include "pandora_module_cpuusage.h"
#include "pandora_module_inventory.h"
#include "pandora_module_logevent.h"
#include "pandora_module_logchannel.h"
#include "pandora_module_wmiquery.h"
#include "pandora_module_perfcounter.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_DESCRIPTION ("module_description ")
#define TOKEN_LOGEVENT ("module_logevent")
#define TOKEN_LOGCHANNEL ("module_logchannel")
#define TOKEN_SOURCE ("module_source ")
#define TOKEN_EVENTTYPE ("module_eventtype ")
#define TOKEN_EVENTCODE ("module_eventcode ")
@ -121,6 +123,7 @@ using namespace Pandora_Strutils;
#define TOKEN_MACRO ("module_macro")
#define TOKEN_NATIVE_ENCODING ("module_native_encoding")
#define TOKEN_ALERT_TEMPLATE ("module_alert_template")
#define TOKEN_USER_SESSION ("module_user_session ")
string
parseLine (string line, string token) {
@ -157,8 +160,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
string module_freedisk_percent, module_freememory_percent;
string module_dsn, module_freememory;
string module_logevent, module_source, module_eventtype, module_eventcode;
string module_logchannel;
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_retries, module_startdelay, module_retrydelay;
string module_perfcounter, module_tcpcheck;
@ -195,6 +199,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_proc = "";
module_service = "";
module_logevent = "";
module_logchannel = "";
module_source = "";
module_eventtype = "";
module_eventcode = "";
@ -253,6 +258,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_ff_interval = "";
module_native_encoding = "";
module_alert_template = "";
module_user_session = "";
macro = "";
stringtok (tokens, definition, "\n");
@ -342,6 +348,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_logevent == "") {
module_logevent = parseLine (line, TOKEN_LOGEVENT);
}
if (module_logchannel == "") {
module_logchannel = parseLine (line, TOKEN_LOGCHANNEL);
}
if (module_source == "") {
module_source = parseLine (line, TOKEN_SOURCE);
}
@ -507,6 +516,10 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_alert_template == "") {
module_alert_template = parseLine (line, TOKEN_ALERT_TEMPLATE);
module_alert_template.erase (0,1);
}
if (module_user_session == "") {
module_user_session = parseLine (line, TOKEN_USER_SESSION);
}
if (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 != "") {
pos_macro = module_source.find(macro_name);
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);
}
}
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->setStartDelay (atoi(module_startdelay.c_str ()));
module_proc->setRetryDelay (atoi(module_retrydelay.c_str ()));
module_proc->setUserSession (is_enabled(module_user_session));
}
}
} else if (module_service != "") {
@ -1142,7 +1170,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
try {
char buffer[100];
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->setDescription(buffer);
}
@ -1173,6 +1201,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_eventcode,
module_pattern,
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 != "") {
module = new Pandora_Module_WMIQuery (module_name,
module_wmiquery, module_wmicolumn);

View File

@ -30,12 +30,13 @@
#include "pandora_module_cpuusage.h"
#include "pandora_module_inventory.h"
#include "pandora_module_logevent.h"
#include "pandora_module_logchannel.h"
#include "pandora_module_wmiquery.h"
#include "pandora_module_perfcounter.h"
#include "pandora_module_tcpcheck.h"
#include "pandora_module_regexp.h"
#include "pandora_module_plugin.h"
#include "pandora_module_ping.h"
#include "pandora_module_ping.h"
#include "pandora_module_snmpget.h"
#include <fstream>
@ -226,12 +227,13 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
Pandora_Module_Freememory *module_freememory;
Pandora_Module_Freememory_Percent *module_freememory_percent;
Pandora_Module_Logevent *module_logevent;
Pandora_Module_Logchannel *module_logchannel;
Pandora_Module_WMIQuery *module_wmiquery;
Pandora_Module_Perfcounter *module_perfcounter;
Pandora_Module_Tcpcheck *module_tcpcheck;
Pandora_Module_Regexp *module_regexp;
Pandora_Module_Plugin *module_plugin;
Pandora_Module_Ping *module_ping;
Pandora_Module_Ping *module_ping;
Pandora_Module_SNMPGet *module_snmpget;
module = Pandora_Module_Factory::getModuleFromDefinition (definition);
@ -288,6 +290,10 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
module_logevent = (Pandora_Module_Logevent *) module;
modules->push_back (module_logevent);
break;
case MODULE_LOGCHANNEL:
module_logchannel = (Pandora_Module_Logchannel *) module;
modules->push_back (module_logchannel);
break;
case MODULE_WMIQUERY:
module_wmiquery = (Pandora_Module_WMIQuery *) module;
modules->push_back (module_wmiquery);
@ -315,7 +321,7 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
case MODULE_SNMPGET:
module_snmpget = (Pandora_Module_SNMPGet *) module;
modules->push_back (module_snmpget);
break;
break;
default:
break;
}

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

@ -169,7 +169,7 @@ Pandora_Module_Logevent::run () {
this->openLogEvent();
// Read events
this->getLogEvents (event_list, 0);
this->getLogEvents (event_list);
// No data
if (event_list.size () < 1) {
@ -215,7 +215,7 @@ Pandora_Module_Logevent::openLogEvent () {
if (this->first_run == 1) {
this->first_run = 0;
if (Pandora::getPandoraDebug() == false) {
this->getLogEvents (event_list, 1);
this->seekAtTop (event_list);
}
}
@ -237,11 +237,86 @@ Pandora_Module_Logevent::closeLogEvent () {
this->log_event = NULL;
}
/**
* Puts the event handler on top of event list
* avoiding the use of EVENTLOG_SEEK_READ because it is buggy
*/
int
Pandora_Module_Logevent::seekAtTop (list<string> &event_list) {
BYTE *buffer = NULL, *new_buffer = NULL;
DWORD to_read, read, needed;
EVENTLOGRECORD *pevlr = NULL;
bool rc = false;
DWORD last_error;
DWORD direction = EVENTLOG_BACKWARDS_READ;
if (this->log_event == NULL) {
return -1;
}
// Initialize the event record buffer
to_read = BUFFER_SIZE;
buffer = (BYTE *) malloc (sizeof (BYTE) * BUFFER_SIZE);
if (buffer == NULL) {
return -1;
}
pevlr = (EVENTLOGRECORD *) buffer;
// Read events
while (1) {
rc = ReadEventLog (this->log_event, direction | EVENTLOG_SEQUENTIAL_READ, 0, pevlr, to_read, &read, &needed);
direction = EVENTLOG_FORWARDS_READ;
if (!rc) {
// Get error details
last_error = GetLastError();
// Not enough space in the buffer
if(last_error == ERROR_INSUFFICIENT_BUFFER) {
// Initialize the new event record buffer
to_read = needed;
new_buffer = (BYTE *) realloc (buffer, sizeof (BYTE) * needed);
if (new_buffer == NULL) {
free ((void *) buffer);
return -1;
}
buffer = new_buffer;
pevlr = (EVENTLOGRECORD *) buffer;
// Try to read the event again
continue;
// File corrupted or cleared
} else if (last_error == ERROR_EVENTLOG_FILE_CORRUPT || last_error == ERROR_EVENTLOG_FILE_CHANGED) {
closeLogEvent ();
free ((void *) buffer);
return -1;
}
// Unknown error
else {
free ((void *) buffer);
return -1;
}
}
// No more events
if (read == 0) {
free ((void *) buffer);
return 0;
}
}
free ((void *) buffer);
return 0;
}
/**
* Reads available events from the event log.
*/
int
Pandora_Module_Logevent::getLogEvents (list<string> &event_list, unsigned char discard) {
Pandora_Module_Logevent::getLogEvents (list<string> &event_list) {
char message[BUFFER_SIZE], timestamp[TIMESTAMP_LEN + 1];
struct tm *time_info = NULL;
time_t epoch;
@ -313,11 +388,6 @@ Pandora_Module_Logevent::getLogEvents (list<string> &event_list, unsigned char d
free ((void *) buffer);
return 0;
}
// Discard existing events
if (discard == 1) {
continue;
}
// Process read events
while (read > 0) {

View File

@ -69,7 +69,8 @@ namespace Pandora_Modules {
HANDLE openLogEvent ();
void closeLogEvent ();
int getLogEvents (list<string> &event_list, unsigned char discard);
int getLogEvents (list<string> &event_list);
int seekAtTop (list<string> &event_list);
void timestampToSystemtime (string timestamp, SYSTEMTIME *system_time);
void getEventDescription (PEVENTLOGRECORD pevlr, char *message, DWORD flags);
string getEventDescriptionXPATH (PEVENTLOGRECORD pevlr);

View File

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

View File

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

View File

@ -20,12 +20,12 @@
*/
#include "pandora_module_service.h"
#include "pandora_module_list.h"
#include "../windows/pandora_wmi.h"
#include "../pandora_strutils.h"
#include "../pandora_windows_service.h"
#include <algorithm>
#include <cctype>
#include <sys/stat.h>
using namespace Pandora;
using namespace Pandora_Modules;
@ -83,8 +83,6 @@ async_run (Pandora_Module_Service *module) {
HANDLE event_log;
HANDLE event;
DWORD result;
int res;
string str_res;
BYTE buffer[BUFFER_SIZE];
EVENTLOGRECORD *record;
DWORD read;
@ -93,10 +91,20 @@ async_run (Pandora_Module_Service *module) {
bool service_event;
string prev_res;
Pandora_Module_List *modules;
bool polling;
prev_res = module->getLatestOutput ();
modules = new Pandora_Module_List ();
modules->addModule (module);
struct stat st;
// Use polling if there is not local politics and events
// do not emit logs. It is a way to check if there is a
// Home Edition Windows distribution
polling = (stat("C:\\Windows\\System32\\gpedit.msc", &st) != 0);
if (polling) {
pandoraLog("Async polling service %s for this Windows edition", module->getServiceName().c_str());
}
while (1) {
event_log = OpenEventLog (NULL, "Service Control Manager");
@ -113,6 +121,11 @@ async_run (Pandora_Module_Service *module) {
if (result != WAIT_OBJECT_0) {
CloseHandle (event);
CloseEventLog (event_log);
// If time out and polling,
// check the service status actively
if (result == WAIT_TIMEOUT && polling) {
module->execute_async_service(prev_res, module, modules);
}
continue;
}
@ -138,17 +151,7 @@ async_run (Pandora_Module_Service *module) {
/* A start/stop action was thrown */
if (service_event) {
res = Pandora_Wmi::isServiceRunning (module->getServiceName ());
str_res = inttostr (res);
if (str_res != prev_res) {
module->setOutput (str_res);
prev_res = str_res;
Pandora_Windows_Service::getInstance ()->sendXml (modules);
}
if (res == 0 && module->isWatchdog ()) {
Pandora_Wmi::startService (module->getServiceName ());
}
module->execute_async_service(prev_res, module, modules);
}
CloseHandle (event);
CloseEventLog (event_log);
@ -156,6 +159,31 @@ async_run (Pandora_Module_Service *module) {
delete modules;
}
/*
* Execute the service async task
*/
void
Pandora_Module_Service::execute_async_service(
string &prev_res, Pandora_Module_Service *module, Pandora_Module_List *modules
) {
string str_res;
int res;
res = Pandora_Wmi::isServiceRunning (module->getServiceName ());
str_res = inttostr (res);
if (str_res != prev_res) {
module->setOutput (str_res);
prev_res = str_res;
Pandora_Windows_Service::getInstance ()->sendXml (modules);
}
if (res == 0 && module->isWatchdog ()) {
pandoraLog("Starting service");
Pandora_Wmi::startService (module->getServiceName ());
}
}
void
Pandora_Module_Service::run () {
int res;

View File

@ -23,6 +23,7 @@
#define __PANDORA_MODULE_SERVICE_H__
#include "pandora_module.h"
#include "pandora_module_list.h"
namespace Pandora_Modules {
/**
@ -41,6 +42,7 @@ namespace Pandora_Modules {
void run ();
string getServiceName () const;
bool isWatchdog () const;
void execute_async_service (string &prev_res, Pandora_Module_Service *module, Pandora_Module_List *modules);
void setWatchdog (bool watchdog);
};

View File

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

View File

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

View File

@ -369,16 +369,16 @@ Pandora_Wmi::getOSName () {
dhGetValue (L"%s", &name, quickfix,
L".Caption");
if (name != NULL) {
// Remove the (R) character.
for (int i = 0; i < strlen(name); i++) {
if ((unsigned char)name[i] == 0xAE) {
name[i] = ' ';
}
}
ret = name;
dhFreeString (name);
}
if (name != NULL) {
// Remove the (R) character.
for (int i = 0; i < strlen(name); i++) {
if ((unsigned char)name[i] == 0xAE) {
name[i] = ' ';
}
}
ret = name;
dhFreeString (name);
}
} NEXT_THROW (quickfix);
} catch (string errstr) {
@ -411,12 +411,12 @@ Pandora_Wmi::getOSVersion () {
L".CSDVersion");
if (version != NULL) {
// Remove the (R) character.
for (int i = 0; i < strlen(version); i++) {
if ((unsigned char)version[i] == 0xAE) {
version[i] = ' ';
}
}
// Remove the (R) character.
for (int i = 0; i < strlen(version); i++) {
if ((unsigned char)version[i] == 0xAE) {
version[i] = ' ';
}
}
ret = version;
dhFreeString (version);
}
@ -501,7 +501,7 @@ Pandora_Wmi::getSystemName () {
* @param flags Process creation flags
*/
bool
Pandora_Wmi::runProgram (string command, DWORD flags) {
Pandora_Wmi::runProgram (string command, DWORD flags, BOOL user_session) {
PROCESS_INFORMATION process_info;
STARTUPINFO startup_info;
bool success;
@ -514,11 +514,75 @@ Pandora_Wmi::runProgram (string command, DWORD flags) {
startup_info.cb = sizeof (startup_info);
ZeroMemory (&process_info, sizeof (process_info));
pandoraDebug ("Start process \"%s\".", command.c_str ());
cmd = strdup (command.c_str ());
success = CreateProcess (NULL, cmd, NULL, NULL, FALSE, flags,
NULL, NULL, &startup_info, &process_info);
pandoraFree (cmd);
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 ());
cmd = strdup (command.c_str ());
success = CreateProcess (NULL, cmd, NULL, NULL, FALSE, flags,
NULL, NULL, &startup_info, &process_info);
pandoraFree (cmd);
}
if (success) {
pandoraDebug ("The process \"%s\" was started.", command.c_str ());
@ -949,7 +1013,7 @@ getIPs(VARIANT *ip_array){
if (V_VT(&pvArray[i]) == VT_BSTR) {
if (i > 0) {
ret += " , ";
}
}
LPSTR szStringA;
ret += Pandora_Strutils::strUnicodeToAnsi( V_BSTR(&pvArray[i]));
}

View File

@ -53,7 +53,7 @@ namespace Pandora_Wmi {
string getOSBuild ();
string getSystemName ();
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 stopService (string service_name);
void runWMIQuery (string wmi_query,

View File

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

View File

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

View File

@ -66,11 +66,14 @@ function mainAgentsModules() {
$modulegroup = get_parameter('modulegroup', 0);
$refr = get_parameter('refresh', 0); // By default 30 seconds
$recursion = get_parameter('recursion', 0);
$group_id = (int)get_parameter('group_id', 0);
$offset = (int)get_parameter('offset', 0);
$hor_offset = (int)get_parameter('hor_offset', 0);
$block = $config['block_size'];
if(get_parameter('modulegroup') != null){
$agents_id = (array)get_parameter('id_agents2', -1);
}
$selection_a_m = (int)get_parameter('selection_agent_module');
$modules_selected = (array)get_parameter('module', 0);
$update_item = (string)get_parameter('edit_item','');
@ -139,6 +142,8 @@ function mainAgentsModules() {
$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_recursion_label = '<b>'.__('Recursion').'</b>';
$filter_recursion = html_print_checkbox('recursion', 1, 0, true);
//groups module
$filter_module_groups_label = '<b>'.__('Module group').'</b>';
$filter_module_groups = html_print_select_from_sql ("SELECT * FROM tmodule_group ORDER BY name",
@ -245,12 +250,12 @@ function mainAgentsModules() {
if($config['pure'] != 1){
echo '<form method="post" action="'
. ui_get_url_refresh (array ('offset' => $offset, 'hor_offset' => $offset,'group_id' => $group_id, 'modulegroup' => $modulegroup)).'">';
. ui_get_url_refresh (array ('offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup)).'">';
echo '<table class="databox filters" cellpadding="0" cellspacing="0" border="0" style="width:100%;">';
echo "<tr>";
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>" . $filter_module_groups_label . "</td>";
@ -375,9 +380,14 @@ function mainAgentsModules() {
}
if ($group_id > 0) {
$filter_groups['id_grupo'] = $group_id;
if($recursion){
$filter_groups['id_grupo'] = array_merge($group_id,
groups_get_id_recursive($group_id, true));
}
else{
$filter_groups['id_grupo'] = $group_id;
}
}
$agents = agents_get_agents ($filter_groups);
$nagents = count($agents);
@ -675,12 +685,14 @@ $ignored_params['refresh']='';
}
$("#group_id").change (function () {
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_agents_group_json" : 1,
"id_group" : this.value,
"privilege" : "AW",
"keys_prefix" : "_"
"keys_prefix" : "_",
"recursion" : $('#checkbox-recursion').is(':checked')
},
function (data, status) {
$("#id_agents2").html('');
@ -699,7 +711,34 @@ $ignored_params['refresh']='';
"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) {
$("#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"
);
});
$("#modulegroup").change (function () {
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",

View File

@ -31,8 +31,6 @@ function extension_db_status_extension_tables() {
function extension_db_status() {
global $config;
$db_user = get_parameter('db_user', '');
$db_password = get_parameter('db_password', '');
$db_host = get_parameter('db_host', '');
@ -40,11 +38,11 @@ function extension_db_status() {
$db_status_execute = (bool)get_parameter('db_status_execute', false);
ui_print_page_header (__("DB Status"),
ui_print_page_header (__("DB Schema check"),
"images/extensions.png", false, "", true, "");
if (! check_acl ($config['id_user'], 0, "DM")) {
if (!is_user_admin($config['id_user'])) {
db_pandora_audit("ACL Violation",
"Trying to access db status");
require ("general/noaccess.php");
@ -184,7 +182,7 @@ function extension_db_check_tables_differences($connection_test,
ui_print_result_message(
empty($diff_tables),
__('Successful the DB Pandora has all tables'),
__('Unsuccessful the DB Pandora has not all tables. The tables lost are (%s)',
__('Pandora DB could not retrieve all tables. The missing tables are (%s)',
implode(", ", $diff_tables)));
if (!empty($diff_tables)) {
@ -233,16 +231,15 @@ function extension_db_check_tables_differences($connection_test,
if (!empty($result)) {
while ($row = mysql_fetch_array ($result)) {
$fields_system[$row[0]] = array(
'field ' => $row[0],
'type' => $row[1],
'null' => $row[2],
'key' => $row[3],
'field ' => $row[0],
'type' => $row[1],
'null' => $row[2],
'key' => $row[3],
'default' => $row[4],
'extra' => $row[5]);
'extra' => $row[5]);
}
mysql_free_result ($result);
}
foreach ($fields_test as $name_field => $field_test) {
if (!isset($fields_system[$name_field])) {
$correct_fields = false;
@ -262,13 +259,12 @@ function extension_db_check_tables_differences($connection_test,
$field_system = $fields_system[$name_field];
$diff = array_diff($field_test, $field_system);
if (!empty($diff)) {
foreach ($diff as $config_field => $value) {
switch ($config_field) {
case 'type':
ui_print_error_message(
__('Unsuccessful the field %s in the table %s must be setted the type with %s.',
__('Unsuccessful the field %s in the table %s must be set the type with %s.',
$name_field, $table, $value));
ui_print_info_message(
__('You can execute this SQL query for to fix.') . "<br />" .
@ -279,13 +275,14 @@ function extension_db_check_tables_differences($connection_test,
break;
case 'null':
ui_print_error_message(
__('Unsuccessful the field %s in the table %s must be setted the null values with %s.',
__('Unsuccessful the field %s in the table %s must be null: (%s).',
$name_field, $table, $value));
if ($value == "no") {
if ($value == "YES") {
ui_print_info_message(
__('You can execute this SQL query for to fix.') . "<br />" .
'<pre>' .
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . "INT NULL;" .
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . " NULL;" .
'</pre>'
);
}
@ -293,7 +290,7 @@ function extension_db_check_tables_differences($connection_test,
ui_print_info_message(
__('You can execute this SQL query for to fix.') . "<br />" .
'<pre>' .
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . "INT NOT NULL;" .
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . " NOT NULL;" .
'</pre>'
);
}
@ -301,21 +298,31 @@ function extension_db_check_tables_differences($connection_test,
break;
case 'key':
ui_print_error_message(
__('Unsuccessful the field %s in the table %s must be setted the key as defined in the SQL file.',
__('Unsuccessful the field %s in the table %s must be set the key as defined in the SQL file.',
$name_field, $table));
ui_print_info_message(
__('Please check the SQL file for to know the kind of key needed.'));
break;
case 'default':
if($field_test['null'] == "YES" || !isset($field_test['null']) || $field_test['null'] == ""){
$null_defect = " NULL";
}
else{
$null_defect = " NOT NULL";
}
ui_print_error_message(
__('Unsuccessful the field %s in the table %s must be setted the default value as %s.',
__('Unsuccessful the field %s in the table %s must be set %s as default value.',
$name_field, $table, $value));
ui_print_info_message(
__('Please check the SQL file for to know the kind of default value needed.'));
__('You can execute this SQL query for to fix.') . "<br />" .
'<pre>' .
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . $null_defect . " DEFAULT " . $value . ";" .
'</pre>'
);
break;
case 'extra':
ui_print_error_message(
__('Unsuccessful the field %s in the table %s must be setted as defined in the SQL file.',
__('Unsuccessful the field %s in the table %s must be set as defined in the SQL file.',
$name_field, $table));
ui_print_info_message(
__('Please check the SQL file for to know the kind of extra config needed.'));
@ -358,5 +365,5 @@ function extension_db_status_execute_sql_file($url, $connection) {
}
extensions_add_godmode_function('extension_db_status');
extensions_add_godmode_menu_option(__('DB Status'), 'DM', 'gextensions', null, "v1r1", 'gdbman');
extensions_add_godmode_menu_option(__('DB Schema check'), 'DM', 'gextensions', null, "v1r1", 'gdbman');
?>

View File

@ -114,7 +114,7 @@ function dbmgr_extension_main () {
global $config;
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
if (!is_user_admin($config['id_user'])) {
db_pandora_audit("ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php");
return;
@ -167,7 +167,7 @@ function dbmgr_extension_main () {
echo '<strong>An error has occured when querying the database.</strong><br />';
echo $error;
db_pandora_audit("Extension DB inface", "Error in SQL", false, false, $sql);
db_pandora_audit("DB Interface Extension", "Error in SQL", false, false, $sql);
return;
}
@ -175,7 +175,7 @@ function dbmgr_extension_main () {
if (! is_array ($result)) {
echo "<strong>Output: <strong>".$result;
db_pandora_audit("Extension DB inface", "SQL", false, false, $sql);
db_pandora_audit("DB Interface Extension", "SQL", false, false, $sql);
return;
}

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

@ -0,0 +1,4 @@
START TRANSACTION;
ALTER TABLE tlayout_data ADD COLUMN `show_statistics` tinyint(2) NOT NULL default '0';
COMMIT;

View File

@ -0,0 +1,3 @@
START TRANSACTION;
ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30';
COMMIT;

View File

@ -38,9 +38,10 @@ function render_row ($data, $label) {
}
else {
echo "<tr>";
echo "<td>" . $label;
echo "<td>" . $data;
echo "</td>";
echo "<td style='padding:2px;border:0px;' width='60%'><div style='padding:5px;background-color:#f2f2f2;border-radius:2px;text-align:left;border:0px;'>" . $label;
echo "</div></td>";
echo "<td style='font-weight:bold;padding:2px;border:0px;' width='40%'><div style='padding:5px;background-color:#f2f2f2;border-radius:2px;text-align:left;border:0px;'>" . $data;
echo "</div></td>";
echo "</tr>";
}
}
@ -89,35 +90,150 @@ else {
// Header
ui_print_page_header (__('Pandora FMS Diagnostic tool'), "", false, "", true);
echo "<table with='100%' class='databox data' cellpadding='4' cellspacing='4'>";
echo "<tr><th align=left>".__("Item")."</th>";
echo "<th>".__("Data value")."</th></tr>";
echo "<table width='1000px' border='0' style='border:0px;' class='databox data' cellpadding='4' cellspacing='4'>";
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__("Pandora status info")."</th></tr>";
}
render_row ($build_version, "Pandora FMS Build");
render_row ($pandora_version, "Pandora FMS Version");
render_info_data ("SELECT value FROM tconfig where token ='MR'","Minor Release");
render_row ($config["homedir"], "Homedir");
render_row ($config["homeurl"], "HomeUrl");
render_info_data ("SELECT `value`
FROM tconfig
WHERE `token` = 'enterprise_installed'", "Enterprise installed");
$full_key = db_get_sql("SELECT value
FROM tupdate_settings
WHERE `key` = 'customer_key'");
$compressed_key = substr($full_key, 0,5).'...'.substr($full_key, -5);
render_row ($compressed_key,"Update Key");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE `key` = 'updating_code_path'", "Updating code path");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE `key` = 'current_update'", "Current Update #");
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__("PHP setup")."</th></tr>";
render_row (phpversion(), "PHP Version");
render_info ("tagente");
render_info ("tagent_access");
render_info ("tagente_datos");
render_info ("tagente_datos_string");
render_info ("tagente_estado");
render_info ("tagente_modulo");
render_info ("talert_actions");
render_info ("talert_commands");
render_info ("talert_template_modules");
render_info ("tevento");
render_info ("tlayout");
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('memory_limit'), "PHP Memory limit");
render_row (ini_get('session.cookie_lifetime'), "Session cookie lifetime");
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__("Database size stats")."</th></tr>";
render_info_data ("SELECT COUNT(*) FROM tagente","Total agents");
render_info_data ("SELECT COUNT(*) FROM tagente_modulo","Total modules");
render_info_data ("SELECT COUNT(*) FROM tgrupo","Total groups");
render_info_data ("SELECT COUNT(*) FROM tagente_datos","Total module data records");
// render_info_data ("SELECT COUNT(*) FROM tagente_datos_string","Total module string data records");
// render_info_data ("SELECT COUNT(*) FROM tagente_datos_log4x","Total module log4x data records");
render_info_data ("SELECT COUNT(*) FROM tagent_access","Total agent access record");
// render_info ("tagente_estado");
// render_info ("talert_template_modules");
render_info_data ("SELECT COUNT(*) FROM tevento","Total events");
if($config['enterprise_installed'])
render_info ("tlocal_component");
render_info ("tserver");
render_info ("treport");
render_info ("ttrap");
render_info ("tusuario");
render_info ("tsesion");
render_info_data ("SELECT COUNT(*) FROM ttrap","Total traps");
render_info_data ("SELECT COUNT(*) FROM tusuario","Total users");
render_info_data ("SELECT COUNT(*) FROM tsesion","Total sessions");
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__("Database sanity")."</th></tr>";
render_info_data ("SELECT COUNT( DISTINCT tagente.id_agente)
FROM tagente_estado, tagente, tagente_modulo
WHERE tagente.disabled = 0
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND tagente_modulo.disabled = 0
AND tagente_estado.id_agente = tagente.id_agente
AND tagente_estado.estado = 3","Total unknown agents");
render_info_data ("SELECT COUNT(tagente_estado.estado)
FROM tagente_estado
WHERE tagente_estado.estado = 4","Total not-init modules");
$last_run_difference = '';
$diferencia = time() - date (
db_get_sql ("SELECT `value`
FROM tconfig
WHERE `token` = 'db_maintance'"));
$last_run_difference_months = 0;
$last_run_difference_weeks = 0;
$last_run_difference_days = 0;
$last_run_difference_minutos = 0;
$last_run_difference_seconds = 0;
while($diferencia >= 2419200){
$diferencia -= 2419200;
$last_run_difference_months++;
}
while($diferencia >= 604800){
$diferencia -= 604800;
$last_run_difference_weeks++;
}
while($diferencia >= 86400){
$diferencia -= 86400;
$last_run_difference_days++;
}
while($diferencia >= 3600){
$diferencia -= 3600;
$last_run_difference_hours++;
}
while($diferencia >= 60){
$diferencia -= 60;
$last_run_difference_minutes++;
}
$last_run_difference_seconds = $diferencia;
if($last_run_difference_months > 0){
$last_run_difference .= $last_run_difference_months.'month/s ';
}
if ($last_run_difference_weeks > 0) {
$last_run_difference .= $last_run_difference_weeks.' week/s ';
}
if ($last_run_difference_days > 0) {
$last_run_difference .= $last_run_difference_days.' day/s ';
}
if ($last_run_difference_hours > 0) {
$last_run_difference .= $last_run_difference_hours.' hour/s ';
}
if ($last_run_difference_minutes > 0) {
$last_run_difference .= $last_run_difference_minutes.' minute/s ';
}
$last_run_difference .= $last_run_difference_seconds.' second/s ago';
render_row ( date ("Y/m/d H:i:s",
db_get_sql ("SELECT `value`
FROM tconfig
WHERE `token` = 'db_maintance'")).' ('.$last_run_difference.')'.' *', "PandoraDB Last run");
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__("Database status info")."</th></tr>";
switch ($config["dbtype"]) {
case "mysql":
@ -130,23 +246,22 @@ switch ($config["dbtype"]) {
render_info_data ("SELECT `value`
FROM tconfig
WHERE `token` = 'db_scheme_build'", "DB Schema Build");
render_info_data ("SELECT `value`
FROM tconfig
WHERE `token` = 'enterprise_installed'", "Enterprise installed");
render_row ( date ("Y/m/d H:i:s",
db_get_sql ("SELECT `value`
FROM tconfig
WHERE `token` = 'db_maintance'")), "PandoraDB Last run");
if(strpos($_SERVER['HTTP_USER_AGENT'],'Windows') == false){
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__("System info")."</th></tr>";
$output = 'cat /proc/cpuinfo | grep "model name" | tail -1 | cut -f 2 -d ":"';
$output2 = 'cat /proc/cpuinfo | grep "processor" | wc -l';
render_row(exec($output).' x '.exec($output2),'CPU');
$output = 'cat /proc/meminfo | grep "MemTotal"';
render_row(exec($output),'RAM');
}
render_info_data ("SELECT value
FROM tupdate_settings
WHERE `key` = 'customer_key';", "Update Key");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE `key` = 'updating_code_path'", "Updating code path");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE `key` = 'current_update'", "Current Update #");
break;
case "postgresql":
render_info_data ("SELECT \"value\"
@ -201,4 +316,12 @@ switch ($config["dbtype"]) {
if ($console_mode == 0) {
echo "</table>";
}
echo "<hr color='#b1b1b1' size=1 width=1000 align=left>";
echo "<span>".__('(*) Please check your Pandora Server setup and be sure that database maintenance daemon is running. It\' very important to
keep up-to-date database to get the best performance and results in Pandora')."</span><br><br><br>";
?>

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 ('small_operation_step_datos_purge', '1000');
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';
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`
@ -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 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 COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30';
-- ---------------------------------------------------------------------
-- Table `tagente_modulo`
@ -1230,6 +1231,7 @@ ALTER TABLE tlayout ADD `background_color` varchar(50) NOT NULL default '#FFF';
-- ---------------------------------------------------------------------
ALTER TABLE tlayout_data ADD `type_graph` varchar(50) NOT NULL default 'area';
ALTER TABLE tlayout_data ADD `label_position` varchar(50) NOT NULL default 'down';
ALTER TABLE tlayout_data ADD COLUMN `show_statistics` tinyint(2) NOT NULL default '0';
-- ---------------------------------------------------------------------
-- Table `tagent_custom_fields`

View File

@ -191,7 +191,7 @@ config_check();
$_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']);
if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) {
@ -389,7 +389,15 @@ config_check();
$("#combo_refr").toggle ();
$("#combo_refr").css('padding-right', '9px');
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
}
}

View File

@ -205,7 +205,7 @@ if (!$new_agent) {
$table->data[1][0] = __('Alias');
$table->data[1][1] = html_print_input_text ('alias', $alias, '', 50, 100, true);
if($new_agent){
$table->data[1][1] .= html_print_checkbox ("alias_as_name", 1, $alias_as_name, true).__('Use alias as name');
$table->data[1][1] .= html_print_checkbox ("alias_as_name", 1, $config['alias_as_name'], true).__('Use alias as name');
}
$table->data[2][0] = __('IP Address');

View File

@ -793,7 +793,7 @@ if ($update_agent) { // if modified some agent paramenter
WHERE id_group = ".$group_old);
$result = db_process_sql_update ('tagente', $values, array ('id_agente' => $id_agente));
if ($result === false) {
if ($result == false) {
ui_print_error_message(
__('There was a problem updating the agent'));
}
@ -1043,9 +1043,7 @@ if ($update_module || $create_module) {
}
*/
$configuration_data = str_replace('\\', "&#92;",
io_safe_input($new_configuration_data));;
html_debug($configuration_data, true);
io_safe_input($new_configuration_data));
}
// Services are an enterprise feature,
@ -1110,7 +1108,11 @@ if ($update_module || $create_module) {
$ff_event_critical = (int) get_parameter ('ff_event_critical');
$each_ff = (int) get_parameter ('each_ff');
$ff_timeout = (int) get_parameter ('ff_timeout');
$unit = (string) get_parameter('unit');
$unit = (string) get_parameter('unit_select');
if($unit == "none"){
$unit = (string) get_parameter('unit_text');
}
$id_tag = (array) get_parameter('id_tag_selected');
$serialize_ops = (string) get_parameter('serialize_ops');
$critical_instructions = (string) get_parameter('critical_instructions');

View File

@ -181,7 +181,7 @@ $order_collation = "";
switch ($config["dbtype"]) {
case "mysql":
$order_collation = "";
//$order_collation = "COLLATE utf8_general_ci";
$order_collation = "COLLATE utf8_general_ci";
break;
case "postgresql":
case "oracle":
@ -540,10 +540,6 @@ if ($agents !== false) {
}
echo '<span class="left">';
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")) {
$main_tab = 'main';
@ -561,10 +557,30 @@ if ($agents !== false) {
'<span style="font-size: 7pt" title="' . $agent["nombre"] . '">'.$agent["alias"].'</span>' .
"</a>";
echo "</strong>";
$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"]) {
ui_print_help_tip(__('Disabled'));
if (!$in_planned_downtime) {
echo "</em>";
}
}
if ($agent['quiet']) {
echo "&nbsp;";
html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => ""));
}
if ($in_planned_downtime) {
ui_print_help_tip (__('Agent in planned downtime'), false, 'images/minireloj-16.png');
echo "</em>";
}
echo '</span><div class="left actions" style="visibility: hidden; clear: left">';
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
echo '<a href="index.php?sec=gagente&

View File

@ -45,10 +45,10 @@ echo "<tr><td class='datos' style='width:20%; font-weight: bold;'>";
echo __('Search') . ' ' .
html_print_input_text ('search_string', $search_string, '', 15, 255, true);
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"');
echo "</td>";
echo "<td class='datos' style='width:20%'></td>";
echo "<td class='datos' style='width:10%'></td>";
echo '</form>';
// Check if there is at least one server of each type available to assign that
// kind of modules. If not, do not show server type in combo
@ -119,7 +119,7 @@ if (($policy_page) || (isset($agent))) {
// Create module/type combo
echo '<form id="create_module_type" method="post" action="'.$url.'">';
if (!$policy_page) {
echo '<td class="datos" style="font-weight: bold;">';
echo '<td class="datos" style="font-weight: bold; width:20%;">';
echo __('Show in hierachy mode');
if ($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();");
echo '</td>';
}
echo '<td class="datos" style="font-weight: bold;">';
echo '<td class="datos" style="font-weight: bold; width:20%;">';
echo __("Type");
html_print_select ($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;' );
html_print_input_hidden ('edit_module', 1);
echo '</td>';
echo '<td class="datos">';
echo '<td class="datos" style="width:10%;">';
echo '<input align="right" name="updbutton" type="submit" class="sub next" value="'.__('Create').'">';
echo '</td>';
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] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true, $disabledBecauseInPolicy);
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->rowspan[4][2] = 3;
}
@ -363,8 +363,12 @@ $table_advanced->data[1][1] = html_print_input_text ('custom_id', $custom_id, ''
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
$table_advanced->data[1][3] = __('Unit');
$table_advanced->data[1][4] = html_print_input_text ('unit', $unit, '', 20, 65, true,
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
// $table_advanced->data[1][4] = html_print_input_text ('unit', $unit, '', 20, 65, true,
// $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
// $table_advanced->colspan[1][4] = 3;
$table_advanced->data[1][4] =
html_print_extended_select_for_unit('unit',
$unit, '', '', '0', false, true, false, false);
$table_advanced->colspan[1][4] = 3;
$module_id_policy_module = 0;
@ -1319,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("x", 72)
.attr("y", -30)
.attr("width", 10)
.attr("height", 10)
.attr("width", '10px')
.attr("height", '10px')
.style("fill", "#82B92E");
//legend Warning text
@ -1339,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("x", 168)
.attr("y", -30)
.attr("width", 10)
.attr("height", 10)
.attr("width", '10px')
.attr("height", '10px')
.style("fill", "#ffd731");
//legend Critical text
@ -1359,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("x", 258)
.attr("y", -30)
.attr("width", 10)
.attr("height", 10)
.attr("width", '10px')
.attr("height", '10px')
.style("fill", "#fc4444");
//styles for number and axes
@ -1378,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("x", 3)
.attr("y", 0)
.attr("width", 300)
.attr("height", 200)
.attr("width", '300px')
.attr("height", '200px')
.style("fill", "#82B92E");
//controls the inverse warning

View File

@ -20,7 +20,7 @@ $disabledBecauseInPolicy = false;
$disabledTextBecauseInPolicy = '';
$page = get_parameter('page', '');
$id_agente = get_parameter('id_agente', '');
$agent_name = get_parameter('agent_name', agents_get_name($id_agente));
$agent_name = get_parameter('agent_name', agents_get_alias($id_agente));
$id_agente_modulo= get_parameter('id_agent_module',0);
$custom_integer_2 = get_parameter ('custom_integer_2', 0);
$sql = 'SELECT *

View File

@ -88,6 +88,8 @@ $id_agent = (int) get_parameter ('id_agent');
$insert_downtime_agent = (int) get_parameter ('insert_downtime_agent');
$delete_downtime_agent = (int) get_parameter ('delete_downtime_agent');
$modules_selection_mode = (string) get_parameter('modules_selection_mode');
// User groups with AD or AW permission for ACL checks
$user_groups_ad = array_keys(users_get_groups($config['id_user'], $access));
@ -116,7 +118,20 @@ if ($insert_downtime_agent === 1) {
}
else {
foreach ($agents as $agent_id) {
//check module belongs to the agent
if($modules_selection_mode == 'all'){
$check = false;
foreach ($module_names as $module_name) {
$check_module = modules_get_agentmodule_id($module_name, $agent_id);
if (!empty($check_module)){
$check = true;
}
}
if (!$check){
continue;
}
}
// Check AD permission on agent
$agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $agent_id);
@ -710,13 +725,25 @@ if ($id_downtime > 0) {
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
echo html_print_select ($agents, "id_agents[]", -1, '', _("Any"), -2, false, true, true, '', false, 'width: 180px;');
if ($type_downtime != 'quiet'){
echo '<div id="available_modules_selection_mode" style="padding-top:20px;display: none;">';
} else {
echo '<div id="available_modules_selection_mode" style="padding-top:20px">';
}
echo html_print_select (array('common' => __('Show common modules'), 'all' => __('Show all modules')), 'modules_selection_mode',
'common', false, '', '', true,false,true,'',false,'min-width:180px;');
echo '</div>';
echo '<h4>' . __('Available modules:') .
ui_print_help_tip (__('Only for type Quiet for downtimes.'), true) . '</h4>';
if ($type_downtime != 'quiet')
if ($type_downtime != 'quiet'){
echo '<div id="available_modules" style="display: none;">';
else
} else {
echo '<div id="available_modules" style="">';
}
echo html_print_select (array(), "module[]", '', '', '', 0, false, true, true, '', false, 'width: 180px;');
echo "</div>";
echo "<br /><br /><br />";
@ -904,8 +931,10 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri
case 'disable_agents_alerts':
case 'disable_agents':
$("#available_modules").hide();
$("#available_modules_selection_mode").hide();
break;
case 'quiet':
$("#available_modules_selection_mode").show();
$("#available_modules").show();
break;
}

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

@ -35,6 +35,7 @@ if (is_ajax ()) {
$get_group_json = (bool) get_parameter ('get_group_json');
$get_group_agents = (bool) get_parameter ('get_group_agents');
$get_is_disabled = (bool) get_parameter ('get_is_disabled');
if ($get_group_json) {
$id_group = (int) get_parameter ('id_group');
@ -70,6 +71,7 @@ if (is_ajax ()) {
$search = (string) get_parameter ('search', '');
$recursion = (int) get_parameter ('recursion', 0);
$privilege = (string) get_parameter ('privilege', '');
$all_agents = (int) get_parameter ('all_agents', 0);
// Is is possible add keys prefix to avoid auto sorting in js object conversion
$keys_prefix = (string) get_parameter ('keys_prefix', '');
// This attr is for the operation "bulk alert accions add", it controls the query that take the agents
@ -96,7 +98,12 @@ if (is_ajax ()) {
$filter['id_agente'] = json_decode(io_safe_output($filter_agents_json), true);
}
$filter['disabled'] = $disabled;
if ($all_agents) {
$filter['all_agents'] = true;
}
else {
$filter['disabled'] = $disabled;
}
if ($search != '') {
$filter['string'] = $search;
@ -126,17 +133,42 @@ if (is_ajax ()) {
false, $recursion, false, '|', $add_alert_bulk_op);
}
$agents_disabled = array();
// Add keys prefix
if ($keys_prefix !== "") {
foreach($agents as $k => $v) {
$agents[$keys_prefix . $k] = $v;
unset($agents[$k]);
if ($all_agents) {
$agent_disabled = db_get_value_filter('disabled', 'tagente', array('id_agente' => $k));
$agents_disabled[$keys_prefix . $k] = $agent_disabled;
}
}
}
if ($all_agents) {
$all_agents_array = array();
$all_agents_array['agents'] = $agents;
$all_agents_array['agents_disabled'] = $agents_disabled;
$agents = $all_agents_array;
}
echo json_encode ($agents);
return;
}
if ($get_is_disabled) {
$index = get_parameter('id_agent');
$agent_disabled = db_get_value_filter('disabled', 'tagente', array('id_agente' => $index));
$return['disabled'] = $agent_disabled;
$return['id_agent'] = $index;
echo json_encode($return);
return;
}
return;
}

View File

@ -600,7 +600,7 @@ $(document).ready (function () {
var params = {
"page" : "operation/agentes/ver_agente",
"get_agent_modules_json" : 1,
"get_id_and_name" : 1,
"get_distinct_name" : 1,
"indexed" : 0,
"privilege" : "AW"
};
@ -788,6 +788,37 @@ $(document).ready (function () {
$("#module_type").trigger("change");
}
});
$('#agents').change(function(e){
for(var i=0;i<document.forms["form_modules"].agents.length;i++) {
if(document.forms["form_modules"].agents[0].selected == true){
var any = true;
}
if(i != 0 && document.forms["form_modules"].agents[i].selected){
var others = true;
}
if(any && others){
document.forms["form_modules"].agents[0].selected = false;
}
}
});
$('#module').change(function(e){
for(var i=0;i<document.forms["form_modules"].module.length;i++) {
if(document.forms["form_modules"].module[0].selected == true){
var any = true;
}
if(i != 0 && document.forms["form_modules"].module[i].selected){
var others = true;
}
if(any && others){
document.forms["form_modules"].module[0].selected = false;
}
}
});
});
/* ]]> */
</script>

View File

@ -501,7 +501,7 @@ $table->data['edit3'][1] = html_print_extended_select_for_post_process('post_pro
$table->data['edit3'][2] = __('SMNP community');
$table->data['edit3'][3] = html_print_input_text ('snmp_community', '',
'', 10, 15, true);
'', 10, 100, true);
$table->data['edit15'][2] = __('SNMP OID');
$table->data['edit15'][3] = html_print_input_text ('snmp_oid', '',
@ -569,7 +569,7 @@ foreach ($targets2 as $t) {
$table->data['edit6'][1] = html_print_select ($targets, 'id_export', '','', __('No change'), '', true, false, false);
$table->data['edit6'][2] = __('Unit');
$table->data['edit6'][3] = html_print_input_text ('unit', '', '', 15, 60, true);
$table->data['edit6'][3] = html_print_extended_select_for_unit('unit','', '', '', '0', '15', true, false, false);
/* FF stands for Flip-flop */
@ -746,7 +746,7 @@ $(document).ready (function () {
var params = {
"page" : "operation/agentes/ver_agente",
"get_agent_modules_json" : 1,
"get_id_and_name" : 1,
"get_distinct_name" : 1,
"indexed" : 0
};
@ -1098,6 +1098,37 @@ $(document).ready (function () {
selector = $("#form_edit input[name=selection_mode]:checked").val();
$("#id_agents").trigger("change");
});
$('#agents').change(function(e){
for(var i=0;i<document.forms["form_edit"].agents.length;i++) {
if(document.forms["form_edit"].agents[0].selected == true){
var any = true;
}
if(i != 0 && document.forms["form_edit"].agents[i].selected){
var others = true;
}
if(any && others){
document.forms["form_edit"].agents[0].selected = false;
}
}
});
$('#module').change(function(e){
for(var i=0;i<document.forms["form_edit"].module.length;i++) {
if(document.forms["form_edit"].module[0].selected == true){
var any = true;
}
if(i != 0 && document.forms["form_edit"].module[i].selected){
var others = true;
}
if(any && others){
document.forms["form_edit"].module[0].selected = false;
}
}
});
});
function disabled_status () {
@ -1170,6 +1201,13 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
$values['post_process'] = $value;
}
break;
case 'unit_select':
if($value == "none"){
$values['unit'] = (string) get_parameter('unit_text');
} else {
$values['unit'] = $value;
}
break;
default:
if ($value != '') {
$values[$field] = $value;

View File

@ -212,7 +212,7 @@ You can of course remove the warnings, that's why we include the source and do n
*/
ui_print_page_header(
__('Massive operations') . ' &raquo; '. $options[$option],
__('Bulk operations') . ' &raquo; '. $options[$option],
"images/gm_massive_operations.png", false, "", true, $onheader,true, "massivemodal");
// Checks if the PHP configuration is correctly

View File

@ -196,7 +196,7 @@ if (!empty($sub)) {
}
if (check_acl ($config['id_user'], 0, "AW") || check_acl ($config['id_user'], 0, "PM")) {
if (check_acl ($config['id_user'], 0, "AW") || check_acl ($config['id_user'], 0, "PM") || check_acl ($config['id_user'], 0, "RR")) {
// Servers
$menu_godmode["gservers"]["text"] = __('Servers');
$menu_godmode["gservers"]["sec2"] = "godmode/servers/modificar_server";
@ -285,6 +285,7 @@ if (check_acl ($config['id_user'], 0, "PM")) {
}
if (check_acl ($config['id_user'], 0, "PM") || check_acl ($config['id_user'], 0, "DM")) {
$menu_godmode["gextensions"]["text"] = __('Admin tools');
$menu_godmode["gextensions"]["sec2"] = "godmode/extensions";
$menu_godmode["gextensions"]["id"] = "god-extensions";
@ -303,22 +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/file_manager"]["text"] = __('File manager');
$sub["godmode/setup/file_manager"]["id"] = 'File manager';
}
if (check_acl ($config['id_user'], 0, "DM") || check_acl ($config['id_user'], 0, "PM")) {
$sub["gdbman"]["text"] = __('DB maintenance');
$sub["gdbman"]["id"] = 'DB maintenance';
$sub["gdbman"]["type"] = "direct";
$sub["gdbman"]["subtype"] = "nolink";
$sub2 = array ();
$sub2["godmode/db/db_info"]["text"] = __('DB information');
$sub2["godmode/db/db_purge"]["text"] = __('Database purge');
$sub2["godmode/db/db_refine"]["text"] = __('Database debug');
$sub2["godmode/db/db_audit"]["text"] = __('Database audit');
$sub2["godmode/db/db_event"]["text"] = __('Database event');
if(is_user_admin($config['id_user'])){
$sub["extensions/db_status"]["text"] = __('DB Schema Check');
$sub["extensions/db_status"]["id"] = 'DB Schema Check';
$sub["extensions/db_status"]["sec"] = "gbman";
$sub["extensions/dbmanager"]["text"] = __('DB Interface');
$sub["extensions/dbmanager"]["id"] = 'DB Interface';
$sub["extensions/dbmanager"]["sec"] = "gbman";
}
$sub["gdbman"]["sub2"] = $sub2;
}
$menu_godmode["gextensions"]["sub"] = $sub;
@ -330,17 +325,23 @@ if (is_array ($config['extensions'])) {
$sub2 = array ();
foreach ($config['extensions'] as $extension) {
// html_debug($extension);
//If no godmode_menu is a operation extension
if ($extension['godmode_menu'] == '') {
continue;
}
$extmenu = $extension['godmode_menu'];
if ($extmenu["name"] == 'DB interface' && !check_acl ($config['id_user'], 0, "DM")) {
if ($extension['godmode_menu']['name'] == 'System Info') {
continue;
}
if($extension['godmode_menu']['name'] != 'DB Schema check' && $extension['godmode_menu']['name'] != 'DB interface'){
$extmenu = $extension['godmode_menu'];
}
//Check the ACL for this user
if (! check_acl ($config['id_user'], 0, $extmenu['acl'])) {
continue;
@ -357,6 +358,9 @@ if (is_array ($config['extensions'])) {
if (strlen($extmenu['fatherId']) > 0) {
if (array_key_exists('subfatherId',$extmenu)) {
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']]["id"] = $extmenu['name'];
$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("x", 72)
.attr("y", -30)
.attr("width", 10)
.attr("height", 10)
.attr("width", '10px')
.attr("height", '10px')
.style("fill", "#82B92E");
//legend Warning text

View File

@ -54,6 +54,7 @@ if (enterprise_include_once('include/functions_reporting.php') !== ENTERPRISE_NO
$enterpriseEnable = true;
}
html_print_input_hidden ('custom_graph', 1);
if ($enterpriseEnable) {
$buttons = reporting_enterprise_add_template_graph_tabs($buttons);
}

View File

@ -46,6 +46,9 @@ $delete_layout = (bool) get_parameter ('delete_layout');
$refr = (int) get_parameter('refr', $config['vc_refr']);
$offset = (int) get_parameter('offset', 0);
$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) {
// 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->width = '100%';
$table->class = 'databox data';
@ -228,31 +275,69 @@ $table->align[4] = 'left';
// or has "VR" privileges, otherwise show only maps of user group
$filters['offset'] = $offset;
$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']);
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 {
$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) {
$maps = visual_map_get_user_layouts (0,false,$filters);
$total_maps = count(visual_map_get_user_layouts());
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);
unset($filters['offset']);
unset($filters['limit']);
$total_maps = count(visual_map_get_user_layouts(0,false,$filters));
}
}
else {
$maps = visual_map_get_user_layouts ($config['id_user'], false,
$filters, false);
unset($filters['offset']);
unset($filters['limit']);
$total_maps = count(visual_map_get_user_layouts ($config['id_user'], false,
false, false));
$filters, false));
}
if (!$maps && !is_metaconsole()) {
require_once ($config['homedir'] . "/general/firts_task/map_builder.php");
$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");
} else {
ui_print_info_message(
array(
'no_close'=>false,
'message'=> __('No available data to show')));
}
}
elseif (!$maps && is_metaconsole()) {
ui_print_info_message(
array(
'no_close'=>true,
'message'=> __('There are no visual console defined yet.')));
$total = count(visual_map_get_user_layouts ($config['id_user'], false,
false, false));
if(!$total){
ui_print_info_message(
array(
'no_close'=>true,
'message'=> __('There are no visual console defined yet.')));
}else{
ui_print_info_message(
array(
'no_close'=>false,
'message'=> __('No available data to show')));
}
}
else {
ui_pagination ($total_maps, $url, $offset, $pagination);

View File

@ -94,6 +94,7 @@ $inventory_modules = array();
$date = null;
// Only avg is selected by default for the simple graphs
$only_avg = true;
$fullscale = false;
$percentil = false;
$time_compare_overlapped = false;
@ -212,6 +213,7 @@ switch ($action) {
break;
case 'simple_graph':
$only_avg = isset($style['only_avg']) ? (bool) $style['only_avg'] : true;
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
$percentil = isset($style['percentil']) ? $config['percentil'] : 0;
// The break hasn't be forgotten.
case 'simple_baseline_graph':
@ -480,6 +482,7 @@ switch ($action) {
$description = $item['description'];
$group = $item['id_group'];
$period = $item['period'];
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
break;
case 'top_n':
$description = $item['description'];
@ -908,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"))
html_print_select_groups($config['id_user'],
"RM", true, 'combo_group', $group, '');
echo "&nbsp;&nbsp;&nbsp;".__('Recursion').html_print_checkbox('recursion', 1, 0, true);
?>
</td>
</tr>
@ -1076,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");
?>
</td>
@ -1353,6 +1358,11 @@ You can of course remove the warnings, that's why we include the source and do n
<td style="font-weight:bold;"><?php echo __('Only average');?></td>
<td><?php html_print_checkbox('only_avg', 1, $only_avg);?></td>
</tr>
<tr id="row_fullscale" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Full resolution graph (TIP)').
ui_print_help_tip(__('This option may cause performance issues.'), true);?></td>
<td><?php html_print_checkbox('fullscale', 1, $fullscale);?></td>
</tr>
<tr id="row_percentil" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Percentil');?></td>
<td><?php html_print_checkbox('percentil', 1, $percentil);?></td>
@ -1994,7 +2004,38 @@ $(document).ready (function () {
"get_agents_group_json" : 1,
"id_group" : this.value,
"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) {
$("#id_agents").html('');
@ -2643,6 +2684,7 @@ function chooseType() {
$("#row_show_graph").hide();
$("#row_max_min_avg").hide();
$("#row_only_avg").hide();
$("#row_fullscale").hide();
$("#row_time_compare_overlapped").hide();
$("#row_quantity").hide();
$("#row_exception_condition_value").hide();
@ -2725,6 +2767,7 @@ function chooseType() {
case 'simple_graph':
$("#row_time_compare_overlapped").show();
$("#row_only_avg").show();
$("#row_fullscale").show();
if ($("#checkbox-percentil").prop("checked"))
$("#row_percentil").show();
// The break hasn't be forgotten, this element
@ -3122,6 +3165,7 @@ function chooseType() {
$("#row_description").show();
$("#row_period").show();
$("#row_historical_db_check").hide();
$("#row_fullscale").show();
break;
case 'top_n':

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
// Pandora FMS - http://pandorafms.com
// ==================================================
@ -564,7 +598,8 @@ switch ($action) {
$next++;
if(!defined('METACONSOLE'))
$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[$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] .= 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_image ('delete', 'images/cross.png', 1, '',
$data[$next] .= html_print_input_image ('delete', 'images/cross.png', 1, 'margin-right: 10px;',
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>';
}
}
@ -733,8 +772,19 @@ switch ($action) {
else
echo '<div class="action-buttons" style="width: 100%;">';
html_print_submit_button (__('Create report'), 'create', false, 'class="sub next"');
echo "</div>";
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');
@ -1172,13 +1222,17 @@ switch ($action) {
case 'simple_graph':
// Warning. We are using this column to hold this value to avoid
// the modification of the database for compatibility reasons.
$style['only_avg'] = (int) get_parameter('only_avg');
$style['only_avg'] = (int) get_parameter('only_avg');
$style['percentil'] = (int) get_parameter('percentil');
$style['fullscale'] = (int) get_parameter('fullscale');
if ($label != '')
$style['label'] = $label;
else
$style['label'] = '';
break;
case 'network_interfaces_report':
$style['fullscale'] = (int) get_parameter('fullscale');
break;
case 'module_histogram_graph':
case 'agent_configuration':
case 'alert_report_agent':
@ -1516,13 +1570,17 @@ switch ($action) {
case 'simple_graph':
// Warning. We are using this column to hold this value to avoid
// the modification of the database for compatibility reasons.
$style['only_avg'] = (int) get_parameter('only_avg');
$style['only_avg'] = (int) get_parameter('only_avg');
$style['percentil'] = (int) get_parameter('percentil');
$style['fullscale'] = (int) get_parameter('fullscale');
if ($label != '')
$style['label'] = $label;
else
$style['label'] = '';
break;
case 'network_interfaces_report':
$style['fullscale'] = (int) get_parameter('fullscale');
break;
case 'module_histogram_graph':
case 'agent_configuration':
case 'alert_report_agent':
@ -2051,3 +2109,4 @@ switch ($activeTab) {
enterprise_hook('close_meta_frame');
?>

View File

@ -201,7 +201,23 @@ echo "</form>";
<script type="text/javascript">
$(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){
event.preventDefault();
@ -260,7 +276,7 @@ $(document).ready (function () {
}
else{
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){
alert('Default width is '+original_image.width+'px, smaller than minimum -> 1024px');
$('input[name=width]').val('1024');
@ -310,7 +326,7 @@ $(document).ready (function () {
var size_changer_state = false;
$("#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').show();
});
@ -323,7 +339,7 @@ $(document).ready (function () {
$("#background").mouseout(function() {
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=height]').val($('#imagen').height());
$('#preimagew').html($('#imagen').width());

View File

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

View File

@ -205,11 +205,7 @@ switch ($activeTab) {
// If the background is changed the size is reseted
$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['height'] = $height;
switch ($action) {
@ -237,33 +233,31 @@ switch ($activeTab) {
break;
case 'save':
if (!defined('METACONSOLE')) {
if ($values['name'] != "" && $values['background'])
$idVisualConsole = db_process_sql_insert('tlayout', $values);
else
$idVisualConsole = false;
if ($values['name'] != "" && $values['background'])
$idVisualConsole = db_process_sql_insert('tlayout', $values);
else
$idVisualConsole = false;
if ($idVisualConsole !== false) {
db_pandora_audit( "Visual console builder", "Create visual console #$idVisualConsole");
$action = 'edit';
$statusProcessInDB = array('flag' => true,
'message' => ui_print_success_message(__('Successfully created.'), '', true));
if ($idVisualConsole !== false) {
db_pandora_audit( "Visual console builder", "Create visual console #$idVisualConsole");
$action = 'edit';
$statusProcessInDB = array('flag' => true,
'message' => ui_print_success_message(__('Successfully created.'), '', true));
// Return the updated visual console
$visualConsole = db_get_row_filter('tlayout',
array('id' => $idVisualConsole));
// Update the ACL
//$vconsole_read = $vconsole_read_new;
$vconsole_write = $vconsole_write_new;
$vconsole_manage = $vconsole_manage_new;
}
else {
db_pandora_audit( "Visual console builder", "Fail try to create visual console");
$statusProcessInDB = array('flag' => false,
'message' => ui_print_error_message(__('Could not be created.'), '', true));
}
// Return the updated visual console
$visualConsole = db_get_row_filter('tlayout',
array('id' => $idVisualConsole));
// Update the ACL
//$vconsole_read = $vconsole_read_new;
$vconsole_write = $vconsole_write_new;
$vconsole_manage = $vconsole_manage_new;
}
break;
else {
db_pandora_audit( "Visual console builder", "Fail try to create visual console");
$statusProcessInDB = array('flag' => false,
'message' => ui_print_error_message(__('Could not be created.'), '', true));
}
break;
}
break;
@ -357,6 +351,7 @@ switch ($activeTab) {
break;
case GROUP_ITEM:
$values['id_group'] = get_parameter('group_' . $id, 0);
$values['show_statistics'] = get_parameter('show_statistics', 0);
break;
}
$agentName = get_parameter('agent_' . $id, '');
@ -410,6 +405,7 @@ switch ($activeTab) {
$width = (int) get_parameter ("width", 0);
$height = (int) get_parameter ("height", 0);
$period = (int) get_parameter ("period", 0);
$show_statistics = get_parameter ("show_statistics", 0);
$process_value = (int) get_parameter ("process_value", 0);
$percentileitem_width = (int) get_parameter ("percentileitem_width", 0);
$max_value = (int) get_parameter ("max_value", 0);

View File

@ -144,7 +144,7 @@ $table->data["staticgraph_modulegraph"][1] .= '&nbsp;&nbsp;&nbsp;' .
'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',

View File

@ -209,7 +209,7 @@ $table->data[34][0] = __('Allow create planned downtimes in the past') .
$table->data[34][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('past_planned_downtimes', 1, '', $config["past_planned_downtimes"], true).'&nbsp;&nbsp;';
$table->data[34][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('past_planned_downtimes', 0, '', $config["past_planned_downtimes"], true);
$table->data[35][0] = __('Limit parameters massive') .
$table->data[35][0] = __('Limit parameters bulk') .
ui_print_help_tip(__('Your PHP environment is setted with %d max_input_vars. Maybe you must not set this value with upper values.', ini_get("max_input_vars")), true);
$table->data[35][1] = html_print_input_text('limit_parameters_massive',
$config['limit_parameters_massive'], '', 10, 10, true);
@ -222,6 +222,10 @@ $table->data[37][0] = __('audit log directory') .
ui_print_help_tip (__("Directory where audit log is stored."), true);
$table->data[37][1] = html_print_input_text ('auditdir', io_safe_output($config["auditdir"]), '', 30, 100, true);
$table->data[38][0] = __('Set alias as name by default in agent creation');
$table->data[38][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('alias_as_name', 1, '', $config["alias_as_name"], true).'&nbsp;&nbsp;';
$table->data[38][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('alias_as_name', 0, '', $config["alias_as_name"], true);
echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">';
echo "<fieldset>";

View File

@ -313,7 +313,7 @@ foreach ($listIcons as $index => $value)
$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);
$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);
$table_gis->data[$row][1] .= "&nbsp;" .
html_print_button(__("View"), 'gis_icon_preview', false, '', '', true);
@ -535,6 +535,26 @@ $table_chars->data[$row][0] .= ui_print_help_tip(__('Show percentile 95 in graph
$table_chars->data[$row][1] = html_print_input_text ('percentil', $config['percentil'], '', 20, 20, true);
$row++;
$table_chars->data[$row][0] = __('Graph TIP view:');
$table_chars->data[$row][0] .= ui_print_help_tip(__('This option may cause performance issues'), true);
$options_full_escale = array();
$options_full_escale[0] = __('None');
$options_full_escale[1] = __('All');
$options_full_escale[2] = __('On Boolean graphs');
$table_chars->data[$row][1] = html_print_select($options_full_escale, 'full_scale_option', $config["full_scale_option"], '', '', 0, true, false, false);
$row++;
/*
$table_font->data[$row][0] = __('Font path');
$fonts = load_fonts();
$table_font->data[$row][1] = html_print_select($fonts, 'fontpath',
io_safe_output($config["fontpath"]), '', '', 0, true);
$row++;
*/
echo "<fieldset>";
echo "<legend>" . __('Charts configuration') . "</legend>";
html_print_table ($table_chars);
@ -914,6 +934,23 @@ tinyMCE.init({
});
$(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_color2").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 text2_mr_file = "<?php echo __('We recommend launching '); ?>\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 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";

View File

@ -565,7 +565,7 @@ $values = array (
'Tactical view'=>__('Tactical view'),
'Alert detail' => __('Alert detail'),
'Other'=>__('Other'));
if (enterprise_installed()) {
if (enterprise_installed() && !is_metaconsole()) {
$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);

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 B

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

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