resolved conflicts
|
@ -54,6 +54,18 @@ AGENT_WIN_FILE="$CODEHOME/pandora_agents/win32/pandora.cc"
|
|||
AGENT_WIN_MPI_FILE="$CODEHOME/pandora_agents/win32/installer/pandora.mpi"
|
||||
AGENT_WIN_RC_FILE="$CODEHOME/pandora_agents/win32/versioninfo.rc"
|
||||
SATELLITE_FILE="$PANDHOME_ENT/satellite_server/satellite_server.pl"
|
||||
PERL_PLUGIN_FILES="$PANDHOME_ENT/pandora_plugins/NGINX/nginx_requests_queued.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Sybase/sybase_plugin.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/MarkLogic/pandora_marklogic.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Apache/pandora_apache.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Oracle/Database/pandora_oracle.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/OpenNebula/pandora_opennebula.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Nutanix/pandora_nutanix.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/MTL/pandora_mtl.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Informix/informix.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Ruckus/ruckus.pl \
|
||||
$PANDHOME_ENT/pandora_server/util/plugins/vmware-plugin.pl"
|
||||
PLUGIN_LIB_FILE="$CODEHOME/pandora_server/lib/PandoraFMS/PluginTools.pm"
|
||||
|
||||
# Update version in spec files
|
||||
function update_spec_version {
|
||||
|
@ -87,6 +99,14 @@ function update_installer_version {
|
|||
sed -i -e "/^PI_VERSION/s/=.*/=\"$VERSION\"/" -e "/^PI_BUILD/s/=.*/=\"$BUILD\"/" "$FILE"
|
||||
}
|
||||
|
||||
# Update version in Perl files
|
||||
function update_perl_version {
|
||||
FILE=$1
|
||||
|
||||
sed -i -e "s/my\s\s*\$pandora_version\s*=.*/my \$pandora_version = \"$VERSION\";/" "$FILE"
|
||||
sed -i -e "s/my\s\s*\$pandora_build\s*=.*/my \$pandora_build = \"$BUILD\";/" "$FILE"
|
||||
}
|
||||
|
||||
# Spec files
|
||||
for file in $SPEC_FILES; do
|
||||
echo "Updating spec file $file..."
|
||||
|
@ -105,6 +125,12 @@ for file in $INSTALLER_FILES; do
|
|||
update_installer_version $file
|
||||
done
|
||||
|
||||
# Perl plugins files
|
||||
for file in $PERL_PLUGIN_FILES; do
|
||||
echo "Updating plugin file $file..."
|
||||
update_perl_version $file
|
||||
done
|
||||
|
||||
# Pandora Server
|
||||
echo "Updating Pandora Server version..."
|
||||
sed -i -e "s/my\s\s*\$pandora_version\s*=.*/my \$pandora_version = \"$VERSION\";/" "$SERVER_FILE"
|
||||
|
@ -116,6 +142,9 @@ sed -i -e "s/my\s\s*\$version\s*=.*/my \$version = \"$VERSION PS$BUILD\";/" "$SE
|
|||
sed -i -e "s/\s*\#\s*\Version.*/\# Version $VERSION/" "$SERVER_CONF_FILE"
|
||||
sed -i -e "s/\s*\!define PRODUCT_VERSION.*/\!define PRODUCT_VERSION \"$VERSION\"/" "$SERVER_WIN_MPI_OPEN_FILE"
|
||||
sed -i -e "s/\s*\!define PRODUCT_VERSION.*/\!define PRODUCT_VERSION \"$VERSION\"/" "$SERVER_WIN_MPI_ENT_FILE"
|
||||
echo "Updateing Pandora PluginTools version..."
|
||||
sed -i -e "s/my\s\s*\$pandora_version\s*=.*/my \$pandora_version = \"$VERSION\";/" "$PLUGIN_LIB_FILE"
|
||||
sed -i -e "s/my\s\s*\$pandora_build\s*=.*/my \$pandora_build = \"$BUILD\";/" "$PLUGIN_LIB_FILE"
|
||||
|
||||
# Pandora Satellite Server
|
||||
echo "Updating Pandora Satellite Server version..."
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, AIX version
|
||||
# Version 7.0NG.718, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, FreeBSD Version
|
||||
# Version 7.0NG.718, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, HP-UX Version
|
||||
# Version 7.0NG.718, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, GNU/Linux
|
||||
# Version 7.0NG.718, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, GNU/Linux
|
||||
# Version 7.0NG.718, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, Solaris Version
|
||||
# Version 7.0NG.718, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2010 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.715
|
||||
# Version 7.0NG.718
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.715, AIX version
|
||||
# Version 7.0NG.718, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.715
|
||||
# Version 7.0NG.718
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.715, HPUX Version
|
||||
# Version 7.0NG.718, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715
|
||||
# Version 7.0NG.718
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715
|
||||
# Version 7.0NG.718
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715
|
||||
# Version 7.0NG.718
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.715, Solaris version
|
||||
# Version 7.0NG.718, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, AIX version
|
||||
# Version 7.0NG.718, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.715-171122
|
||||
Version: 7.0NG.718
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
package: pandorafms-agent-unix
|
||||
<<<<<<< HEAD
|
||||
Version: 7.0NG-170406
|
||||
=======
|
||||
Version: 7.0NG-170418
|
||||
>>>>>>> develop
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
Installed-Size: 260
|
||||
Maintainer: Miguel de Dios <miguel.dedios@artica.es>
|
||||
Homepage: http://pandorafms.org/
|
||||
Depends: coreutils, perl, unzip
|
||||
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. It’s possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.715-171122"
|
||||
pandora_version="7.0NG.718"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1,132 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#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 Lesser 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.
|
||||
|
||||
<<<<<<< HEAD
|
||||
pandora_version="7.0NG-170406"
|
||||
=======
|
||||
pandora_version="7.0NG-170418"
|
||||
>>>>>>> develop
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
if [ $? = 1 ]
|
||||
then
|
||||
echo "No found \"dpkg-deb\" aplication, please install."
|
||||
exit 1
|
||||
else
|
||||
echo "Found \"dpkg-debs\"."
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
echo "Make a \"temp_package\" temp dir for job."
|
||||
|
||||
mkdir -p temp_package/usr
|
||||
mkdir -p temp_package/usr/share/pandora_agent/
|
||||
mkdir -p temp_package/usr/bin/
|
||||
mkdir -p temp_package/usr/sbin/
|
||||
mkdir -p temp_package/etc/pandora/plugins
|
||||
mkdir -p temp_package/etc/pandora/collections
|
||||
mkdir -p temp_package/etc/init.d/
|
||||
mkdir -p temp_package/lib/systemd/system/
|
||||
mkdir -p temp_package/var/log/pandora/
|
||||
mkdir -p temp_package/var/spool/pandora/data_out
|
||||
mkdir -p temp_package/usr/share/man/man1/
|
||||
mkdir -p temp_package/usr/share/pandora_agent/plugins
|
||||
mkdir -p temp_package/tmp
|
||||
mkdir -p temp_package/etc/logrotate.d/
|
||||
|
||||
echo "Make directory system tree for package."
|
||||
cp DEBIAN temp_package -R
|
||||
chmod 755 -R temp_package/DEBIAN
|
||||
|
||||
#Next lines is same to
|
||||
#cp -aRf * temp_package/usr/share/pandora_agent/
|
||||
#but don't copy recursive the temp_package into temp_package
|
||||
|
||||
for item in `ls | grep -v NT4 | grep -v AIX | grep -v FreeBSD | grep -v HP-UX | grep -v SunOS | grep -v temp_package`
|
||||
do
|
||||
#if [ \( $item != 'temp_package' \) -a \( $item != 'NT4' \) ]
|
||||
#then
|
||||
cp -aRf $item temp_package/usr/share/pandora_agent/
|
||||
#fi
|
||||
done
|
||||
cp -aRf tentacle_client temp_package/usr/bin/
|
||||
cp -aRf pandora_agent temp_package/usr/bin/
|
||||
cp -aRf pandora_agent_exec temp_package/usr/bin/pandora_agent_exec
|
||||
cp -aRf pandora_agent_daemon temp_package/etc/init.d/pandora_agent_daemon
|
||||
cp -aRf pandora_agent_daemon.service temp_package/lib/systemd/system/pandora_agent_daemon.service
|
||||
cp -aRf pandora_agent_logrotate temp_package/etc/logrotate.d/pandora_agent
|
||||
cp Linux/pandora_agent.conf temp_package/etc/pandora/
|
||||
|
||||
cp -aRf man/man1/* temp_package/usr/share/man/man1/
|
||||
|
||||
# Relocate plugins to the final dir and delete
|
||||
mv temp_package/usr/share/pandora_agent/plugins/* temp_package/etc/pandora/plugins
|
||||
|
||||
echo "Official plugins are placed on /etc/pandora/plugins" > temp_package/usr/share/pandora_agent/plugins/README
|
||||
|
||||
#Disabled, now the package overwrite the previous files.
|
||||
##Create a temp file for to update files of plugins dir but don't crush dir.
|
||||
##cp -aRf temp_package/usr/share/pandora_agent/plugins temp_package/tmp
|
||||
##rm -rf temp_package/usr/share/pandora_agent/plugins/*
|
||||
|
||||
echo "Remove the SVN files and other temp files."
|
||||
for item in `find temp_package`
|
||||
do
|
||||
echo -n "."
|
||||
echo $item | grep "svn" > /dev/null
|
||||
#last command success
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
rm -rf $item
|
||||
fi
|
||||
|
||||
echo $item | grep "make_deb_package.sh" > /dev/null
|
||||
#last command success
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
rm -rf $item
|
||||
fi
|
||||
done
|
||||
echo "END"
|
||||
|
||||
echo "Calcule md5sum for md5sums file control of package"
|
||||
for item in `find temp_package`
|
||||
do
|
||||
echo -n "."
|
||||
if [ ! -d $item ]
|
||||
then
|
||||
echo $item | grep "DEBIAN" > /dev/null
|
||||
#last command success
|
||||
if [ $? -eq 1 ]
|
||||
then
|
||||
md5=`md5sum $item | cut -d" " -f1`
|
||||
|
||||
#delete "temp_package" in the path
|
||||
final_path=${item#temp_package}
|
||||
echo $md5" "$final_path >> temp_package/DEBIAN/md5sums
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "END"
|
||||
|
||||
echo "Make the package \"Pandorafms console\"."
|
||||
dpkg-deb --build temp_package
|
||||
mv temp_package.deb pandorafms.agent_unix_$pandora_version.deb
|
||||
|
||||
echo "Delete the \"temp_package\" temp dir for job."
|
||||
rm -rf temp_package
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, GNU/Linux
|
||||
# Version 7.0NG.718, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, FreeBSD Version
|
||||
# Version 7.0NG.718, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, HP-UX Version
|
||||
# Version 7.0NG.718, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, GNU/Linux
|
||||
# Version 7.0NG.718, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, GNU/Linux
|
||||
# Version 7.0NG.718, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, NetBSD Version
|
||||
# Version 7.0NG.718, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, Solaris Version
|
||||
# Version 7.0NG.718, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -40,8 +40,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.715';
|
||||
use constant AGENT_BUILD => '171122';
|
||||
use constant AGENT_VERSION => '7.0NG.718';
|
||||
use constant AGENT_BUILD => '180124';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -832,19 +832,23 @@ sub read_config (;$) {
|
|||
config_update('agent_name', $Conf{'agent_name'});
|
||||
} elsif ($Conf{'agent_name_cmd'} ne '') {
|
||||
my $result = `$Conf{'agent_name_cmd'}`;
|
||||
|
||||
# Use only the first line.
|
||||
my ($temp_agent_name, $remain) = split(/\n/, $result);
|
||||
chomp ($temp_agent_name);
|
||||
|
||||
# Remove white spaces of the first and last.
|
||||
$temp_agent_name =~ s/^ *(.*?) *$/$1/;
|
||||
|
||||
$Conf{'agent_name'} = $temp_agent_name if ($temp_agent_name ne '');
|
||||
} else {
|
||||
$Conf{'agent_name'} = hostname();
|
||||
if($result ne '') {
|
||||
# Use only the first line.
|
||||
my ($temp_agent_name, $remain) = split(/\n/, $result);
|
||||
chomp ($temp_agent_name);
|
||||
|
||||
# Remove white spaces of the first and last.
|
||||
$temp_agent_name =~ s/^ *(.*?) *$/$1/;
|
||||
|
||||
$Conf{'agent_name'} = $temp_agent_name if ($temp_agent_name ne '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Fall back to the hostname if agent_name is still empty.
|
||||
if ($Conf{'agent_name'} eq '') {
|
||||
$Conf{'agent_name'} = hostname();
|
||||
}
|
||||
|
||||
# Update the agent MD5 since agent_name may have changed
|
||||
$AgentMD5 = md5 ($Conf{'agent_name'});
|
||||
|
@ -1244,7 +1248,11 @@ sub check_collections () {
|
|||
|
||||
# Delete old collections if there are no broker agents
|
||||
if ($BrokerEnabled == 0) {
|
||||
opendir (DIR, "$ConfDir/collections") || return;
|
||||
if(!opendir (DIR, "$ConfDir/collections")){
|
||||
log_message ('Collection', "Could not open dir $ConfDir/collections");
|
||||
return;
|
||||
}
|
||||
|
||||
while (defined (my $file_name = readdir(DIR))) {
|
||||
next if ($file_name eq '.' || $file_name eq '..');
|
||||
|
||||
|
@ -1252,8 +1260,14 @@ sub check_collections () {
|
|||
$file_name =~ s/\.md5$//;
|
||||
|
||||
if (! defined ($Collections{$file_name})) {
|
||||
rmrf ("$ConfDir/collections/$file_name");
|
||||
unlink ("$ConfDir/collections/$file_name.md5");
|
||||
if(opendir (DIR_check, "$ConfDir/collections/$file_name")){
|
||||
closedir (DIR_check);
|
||||
rmrf ("$ConfDir/collections/$file_name");
|
||||
unlink ("$ConfDir/collections/$file_name.md5");
|
||||
}
|
||||
else {
|
||||
log_message ('Collection', "Could not open dir $ConfDir/collections/$file_name");
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir (DIR);
|
||||
|
@ -1272,7 +1286,11 @@ 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, $Conf{'server_path_md5'}) == 0);
|
||||
if(recv_file ($collection_md5_file, $Conf{'server_path_md5'}) != 0){
|
||||
log_message ('Collection', "Could not write $collection_md5_file on " . $Conf{'server_path_md5'});
|
||||
next;
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -1280,9 +1298,14 @@ sub check_collections () {
|
|||
|
||||
# Read local md5
|
||||
my $local_collection_md5 = '';
|
||||
if (defined (open (MD5_FILE, "< $ConfDir/collections/$collection_md5_file"))) {
|
||||
$local_collection_md5 = <MD5_FILE>;
|
||||
close MD5_FILE;
|
||||
if (-f "$ConfDir/collections/$collection_md5_file") {
|
||||
if (open (MD5_FILE, "< $ConfDir/collections/$collection_md5_file")) {
|
||||
$local_collection_md5 = <MD5_FILE>;
|
||||
close MD5_FILE;
|
||||
} else {
|
||||
log_message ('Collection', "Could not open dir $ConfDir/collections/$collection_md5_file");
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
# Check for changes
|
||||
|
@ -1290,7 +1313,10 @@ sub check_collections () {
|
|||
next if ($local_collection_md5 eq $remote_collection_md5);
|
||||
|
||||
# Download and unzip
|
||||
next unless (recv_file ($collection_file, $Conf{'server_path_zip'}) == 0);
|
||||
if (recv_file ($collection_file, $Conf{'server_path_zip'}) != 0) {
|
||||
log_message ('Collection', "Could not write $collection_file on " . $Conf{'server_path_zip'});
|
||||
next;
|
||||
}
|
||||
rmrf ("$ConfDir/collections/$collection");
|
||||
`unzip -d "$ConfDir/collections/$collection" "$Conf{'temporal'}/$collection_file" 2>$DevNull`;
|
||||
unlink ("$Conf{'temporal'}/$collection_file");
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.715
|
||||
%define release 171122
|
||||
%define version 7.0NG.718
|
||||
%define release 1
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -1,145 +0,0 @@
|
|||
#
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG
|
||||
<<<<<<< HEAD
|
||||
%define release 170406
|
||||
=======
|
||||
%define release 170418
|
||||
>>>>>>> develop
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
License: GPL
|
||||
Vendor: ArticaST <http://www.artica.es>
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
URL: http://pandorafms.org
|
||||
Group: System/Monitoring
|
||||
Packager: Sancho Lerena <slerena@artica.es>
|
||||
Prefix: /usr/share
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
||||
BuildArch: noarch
|
||||
Requires(pre): shadow-utils
|
||||
Requires(post): chkconfig /bin/ln
|
||||
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)
|
||||
# Required by plugins
|
||||
#Requires: sh-utils sed passwd net-tools rpm
|
||||
AutoReq: 0
|
||||
Provides: %{name}-%{version}
|
||||
|
||||
%description
|
||||
Pandora FMS agent for unix. Pandora FMS is an OpenSource full-featured monitoring software.
|
||||
|
||||
%prep
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%setup -q -n unix
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/bin/
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
|
||||
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
|
||||
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
|
||||
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
|
||||
|
||||
install -m 0644 pandora_agent_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_agent
|
||||
|
||||
if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec ] ; then
|
||||
rm $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec
|
||||
fi
|
||||
|
||||
%clean
|
||||
rm -Rf $RPM_BUILD_ROOT
|
||||
|
||||
%pre
|
||||
getent passwd pandora >/dev/null || \
|
||||
/usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora
|
||||
exit 0
|
||||
chown pandora:root /var/log/pandora
|
||||
|
||||
%post
|
||||
if [ ! -d /etc/pandora ] ; then
|
||||
mkdir -p /etc/pandora
|
||||
fi
|
||||
|
||||
if [ ! -f /usr/share/pandora_agent/pandora_agent.conf ] ; then
|
||||
cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/pandora/pandora_agent.conf ] ; then
|
||||
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
|
||||
else
|
||||
ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew
|
||||
fi
|
||||
|
||||
if [ ! -e /etc/pandora/plugins ]; then
|
||||
ln -s /usr/share/pandora_agent/plugins /etc/pandora
|
||||
fi
|
||||
|
||||
if [ ! -e /etc/pandora/collections ]; then
|
||||
ln -s /usr/share/pandora_agent/collections /etc/pandora
|
||||
fi
|
||||
|
||||
mkdir -p /var/spool/pandora/data_out
|
||||
if [ ! -d /var/log/pandora ]; then
|
||||
mkdir -p /var/log/pandora
|
||||
fi
|
||||
/sbin/chkconfig --add pandora_agent_daemon
|
||||
/sbin/chkconfig pandora_agent_daemon on
|
||||
|
||||
%preun
|
||||
|
||||
# Upgrading
|
||||
if [ "$1" = "1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
/sbin/chkconfig --del pandora_agent_daemon
|
||||
/etc/rc.d/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || :
|
||||
|
||||
# Remove symbolic links
|
||||
pushd /etc/pandora
|
||||
for f in pandora_agent.conf plugins collections
|
||||
do
|
||||
[ -L $f ] && rm -f $f
|
||||
done
|
||||
exit 0
|
||||
|
||||
%files
|
||||
%defattr(750,root,root)
|
||||
/usr/bin/pandora_agent
|
||||
|
||||
%defattr(755,pandora,root)
|
||||
%{prefix}/pandora_agent
|
||||
|
||||
%defattr(755,root,root)
|
||||
/usr/bin/pandora_agent_exec
|
||||
/usr/bin/tentacle_client
|
||||
/etc/rc.d/init.d/pandora_agent_daemon
|
||||
|
||||
%defattr(644,root,root)
|
||||
/usr/share/man/man1/pandora_agent.1.gz
|
||||
/usr/share/man/man1/tentacle_client.1.gz
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_agent
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.715
|
||||
%define release 171122
|
||||
%define version 7.0NG.718
|
||||
%define release 1
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -1,142 +0,0 @@
|
|||
#
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG
|
||||
<<<<<<< HEAD
|
||||
%define release 170406
|
||||
=======
|
||||
%define release 170418
|
||||
>>>>>>> develop
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
License: GPL
|
||||
Vendor: ArticaST <http://www.artica.es>
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
URL: http://pandorafms.org
|
||||
Group: System/Monitoring
|
||||
Packager: Sancho Lerena <slerena@artica.es>
|
||||
Prefix: /usr/share
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
||||
BuildArch: noarch
|
||||
PreReq: %fillup_prereq %insserv_prereq /usr/bin/sed /usr/bin/grep /usr/sbin/useradd
|
||||
Requires: coreutils unzip perl
|
||||
AutoReq: 0
|
||||
Provides: %{name}-%{version}
|
||||
|
||||
%description
|
||||
Pandora FMS agent for unix. Pandora FMS is an OpenSource full-featured monitoring software.
|
||||
|
||||
%prep
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%setup -q -n unix
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/bin/
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/init.d/
|
||||
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
|
||||
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/init.d/pandora_agent_daemon
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/init.d/pandora_agent_daemon
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
|
||||
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
|
||||
|
||||
#if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec ] ; then
|
||||
# rm $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec
|
||||
#fi
|
||||
|
||||
%clean
|
||||
rm -Rf $RPM_BUILD_ROOT
|
||||
|
||||
%pre
|
||||
if [ "`id pandora | grep uid | wc -l`" = 0 ]
|
||||
then
|
||||
/usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora
|
||||
fi
|
||||
|
||||
%post
|
||||
chown pandora:root /var/log/pandora
|
||||
if [ ! -d /etc/pandora ] ; then
|
||||
mkdir -p /etc/pandora
|
||||
fi
|
||||
|
||||
if [ ! -f /usr/share/pandora_agent/pandora_agent.conf ] ; then
|
||||
cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/pandora/pandora_agent.conf ] ; then
|
||||
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
|
||||
else
|
||||
ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew
|
||||
fi
|
||||
|
||||
if [ ! -e /etc/pandora/plugins ]; then
|
||||
ln -s /usr/share/pandora_agent/plugins /etc/pandora
|
||||
fi
|
||||
|
||||
if [ ! -e /etc/pandora/collections ]; then
|
||||
ln -s /usr/share/pandora_agent/collections /etc/pandora
|
||||
fi
|
||||
cp -aRf /usr/share/pandora_agent/pandora_agent_logrotate /etc/logrotate.d/pandora_agent
|
||||
|
||||
mkdir -p /var/spool/pandora/data_out
|
||||
chkconfig pandora_agent_daemon on
|
||||
|
||||
%preun
|
||||
|
||||
# Upgrading
|
||||
if [ "$1" = "1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
chkconfig --del pandora_agent_daemon
|
||||
/etc/init.d/pandora_agent_daemon stop
|
||||
rm /etc/init.d/pandora_agent_daemon
|
||||
/usr/sbin/userdel pandora
|
||||
rm -Rf /etc/pandora/pandora_agent.conf
|
||||
rm -Rf /var/log/pandora/pandora_agent* 2> /dev/null
|
||||
rm -Rf /usr/share/pandora_agent
|
||||
rm -Rf /usr/share/man/man1/pandora_agent.1.gz
|
||||
rm -Rf /usr/share/man/man1/tentacle_client.1.gz
|
||||
exit 0
|
||||
|
||||
%postun
|
||||
|
||||
# Upgrading
|
||||
if [ "$1" = "1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
rm -Rf /etc/logrotate.d/pandora_agent
|
||||
|
||||
%files
|
||||
%defattr(750,pandora,root)
|
||||
/usr/bin/pandora_agent
|
||||
/usr/bin/pandora_agent_exec
|
||||
|
||||
%defattr(755,pandora,root)
|
||||
/usr/bin/tentacle_client
|
||||
/etc/init.d/pandora_agent_daemon
|
||||
%docdir %{prefix}/pandora_agents/docs
|
||||
%{prefix}/pandora_agent
|
||||
|
||||
%defattr(644,pandora,root)
|
||||
/usr/share/man/man1/pandora_agent.1.gz
|
||||
/usr/share/man/man1/tentacle_client.1.gz
|
||||
|
|
@ -9,8 +9,8 @@
|
|||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.715"
|
||||
PI_BUILD="171122"
|
||||
PI_VERSION="7.0NG.718"
|
||||
PI_BUILD="180124"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -1,557 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# **********************************************************************
|
||||
# Pandora FMS Agent Installer for Unix (generic installer)
|
||||
# (c) 2008-2015 Artica ST
|
||||
# (c) 2008-2010 Sancho Lerena <slerena@gmail.com>
|
||||
#
|
||||
# This is a generic installer for all Unix-like systems.(AIX, HP-UX, SunOS, Linux, FreeBSD, NetBSD)
|
||||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG"
|
||||
<<<<<<< HEAD
|
||||
PI_BUILD="170406"
|
||||
=======
|
||||
PI_BUILD="170418"
|
||||
>>>>>>> develop
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
||||
|
||||
PREFIX=/usr
|
||||
if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ]
|
||||
then
|
||||
PREFIX=/usr/local
|
||||
fi
|
||||
PANDORA_HOME=$PREFIX/share/pandora_agent
|
||||
PANDORA_BIN=$PREFIX/bin/pandora_agent
|
||||
PANDORA_EXEC_BIN=$PREFIX/bin/pandora_agent_exec
|
||||
PANDORA_REVENT_BIN=$PREFIX/bin/pandora_revent
|
||||
PANDORA_TEMP=/var/spool/pandora
|
||||
PANDORA_CFG=/etc/pandora
|
||||
PANDORA_LOG_DIR=/var/log/pandora
|
||||
PANDORA_LOG=pandora_agent.log
|
||||
TENTACLE=$PREFIX/bin/tentacle_client
|
||||
TENTACLE_SERVER=$PREFIX/bin/tentacle_server
|
||||
PANDORA_MAN=$PREFIX/share/man
|
||||
PANDORA_STARTUP=/etc/init.d/pandora_agent_daemon
|
||||
DAEMON_SCRIPT=pandora_agent_daemon
|
||||
PANDORA_USER="root"
|
||||
PANDORA_PERL_PATH="perl"
|
||||
WITHOUT_TENTACLE_SERVER=0
|
||||
FAKEROOT=0
|
||||
|
||||
# defaults for each platforms
|
||||
case $OS_NAME in
|
||||
AIX)
|
||||
PANDORA_STARTUP=/etc/rc.pandora_agent_daemon
|
||||
;;
|
||||
HP-UX)
|
||||
PANDORA_STARTUP=/sbin/init.d/pandora_agent_daemon
|
||||
;;
|
||||
FreeBSD)
|
||||
PANDORA_CFG=$PREFIX/etc/pandora
|
||||
PANDORA_MAN=$PREFIX/man
|
||||
PANDORA_STARTUP=$PREFIX/etc/rc.d/pandora_agent
|
||||
DAEMON_SCRIPT=$OS_NAME/pandora_agent
|
||||
PANDORA_PERL_PATH=/usr/local/bin/perl
|
||||
;;
|
||||
NetBSD)
|
||||
PANDORA_CFG=/usr/local/etc/pandora
|
||||
PANDORA_STARTUP=/etc/rc.d/pandora_agent
|
||||
DAEMON_SCRIPT=$OS_NAME/pandora_agent
|
||||
PANDORA_PERL_PATH=/usr/pkg/bin/perl
|
||||
;;
|
||||
esac
|
||||
|
||||
MODE=$1
|
||||
|
||||
# options
|
||||
while :
|
||||
do
|
||||
case "$2" in
|
||||
"--no-tentacle-server") WITHOUT_TENTACLE_SERVER=1;;
|
||||
"--fakeroot") FAKEROOT=1;;
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
PANDORA_BASE=`echo $2 | sed -e 's|/$||'`
|
||||
if [ "$3" != "" ]
|
||||
then
|
||||
PANDORA_USER=$3
|
||||
if [ -z "$PANDORA_BASE" ]
|
||||
then
|
||||
echo "When specifying a custom user the agent must be installed to a custom location where that user has write permissions!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
[ "$4" ] && PANDORA_PERL_PATH=$4
|
||||
|
||||
# Check for Perl 5.6.x or higher available
|
||||
PERL_VERSION=`$PANDORA_PERL_PATH -v | egrep 'v5.[6-9]|v5.[12][0-9]' | grep perl`
|
||||
|
||||
if [ -z "$PERL_VERSION" ]
|
||||
then
|
||||
echo "Perl 5.6.x or higher is not detected. This is required for Pandora FMS"
|
||||
echo "Detected: $PERL_VERSION "
|
||||
echo "Aborting install..."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ -z "`echo Linux HP-UX SunOS AIX Solaris Darwin BSD bsd FreeBSD NetBSD | grep \"$OS_NAME\"`" ]
|
||||
then
|
||||
echo "This system: '$OS_NAME' is not supported by this script"
|
||||
echo "Please make the install yourself as it's described in documentation"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# check for root to do the install
|
||||
if [ $FAKEROOT -ne 1 ] && [ -z "`id | grep \"uid=0(root)\"`" ]
|
||||
then
|
||||
echo "You need to be root to do the install. Please made a manual install"
|
||||
echo "if you want to install Pandora FMS agent without root"
|
||||
echo " "
|
||||
echo "Aborting install"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
help () {
|
||||
echo "Syntax":
|
||||
echo " "
|
||||
echo " ./pandora_agent_installer < --mode > [ --option ] [ destination_path ] [ user_to_run_as ] [custom_perl_path]"
|
||||
echo " "
|
||||
echo "Modes:"
|
||||
echo " "
|
||||
echo " --force-install To force installation if already installed on system"
|
||||
echo " --install To install Pandora FMS Agent on this system"
|
||||
echo " --uninstall To uninstall/remove Pandora FMS Agent on this System"
|
||||
echo " "
|
||||
echo "Option:"
|
||||
echo " "
|
||||
echo " --no-tentacle-server Skip tentacle server installation (by default tentalce server installed)"
|
||||
echo " --fakeroot treate \"destination_path\" as root directory"
|
||||
echo " "
|
||||
echo "Some exaples of how to use the installer:"
|
||||
echo " "
|
||||
echo " ./pandora_agent_installer --install"
|
||||
echo " ./pandora_agent_installer --install /opt/pandora"
|
||||
echo " ./pandora_agent_installer --install \"\" pandora"
|
||||
echo " ./pandora_agent_installer --install /opt/pandora root /opt/pandora/perl5/usr/local/bin/perl"
|
||||
echo " ./pandora_agent_installer --uninstall /opt/pandora"
|
||||
echo " "
|
||||
}
|
||||
|
||||
uninstall () {
|
||||
if [ "$OS_NAME" = "Darwin" ]
|
||||
then
|
||||
launchctl remove com.pandorafms.pandorafms
|
||||
rm /Library/LaunchDaemons/com.pandorafms.pandorafms.plist 2> /dev/null
|
||||
fi
|
||||
|
||||
echo "Removing Pandora FMS Agent..."
|
||||
rm -Rf $PANDORA_BASE$PANDORA_BIN 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE$PANDORA_EXEC_BIN 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE$PANDORA_REVENT_BIN 2> /dev/null
|
||||
rm -f $DESTDIR/etc/logrotate.d/pandora_agent
|
||||
|
||||
#Test if exist Pandora Server in this machine
|
||||
if [ -d $PANDORA_BASE$PANDORA_TEMP/data_in ]
|
||||
then
|
||||
echo "You have a Pandora Server in this machine. Then don't delete "$PANDORA_TEMP
|
||||
rm -Rf $PANDORA_BASE$PANDORA_TEMP/data_out 2> /dev/null
|
||||
else
|
||||
rm -Rf $PANDORA_BASE$PANDORA_TEMP 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE$TENTACLE_SERVER 2> /dev/null
|
||||
fi
|
||||
rm -Rf $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf 2> /dev/null
|
||||
|
||||
rm -Rf $PANDORA_BASE/etc/init.d/pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/sbin/init.d/pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/etc/rc.pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/etc/rc?.d/S90pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/sbin/rc?.d/S90pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/etc/rc?.d/S90pandora_agent 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/sbin/rc?.d/S90pandora_agent 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/etc/rc.d/rc?.d/S90pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/etc/rc.d/rc?.d/S90pandora_agent 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/usr/local/etc/rc.d/pandora_agent 2> /dev/null
|
||||
if [ $FAKEROOT -ne 1 ]
|
||||
then
|
||||
rm -Rf /etc/init.d/pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf /sbin/init.d/pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf /etc/rc.pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf /etc/rc?.d/S90pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf /sbin/rc?.d/S90pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf /etc/rc?.d/S90pandora_agent 2> /dev/null
|
||||
rm -Rf /sbin/rc?.d/S90pandora_agent 2> /dev/null
|
||||
rm -Rf /etc/rc.d/rc?.d/S90pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf /etc/rc.d/rc?.d/S90pandora_agent 2> /dev/null
|
||||
rm -Rf /usr/local/etc/rc.d/pandora_agent 2> /dev/null
|
||||
fi
|
||||
|
||||
rm -Rf $PANDORA_BASE$PANDORA_HOME 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE$TENTACLE 2> /dev/null
|
||||
|
||||
rm -Rf $PANDORA_BASE$PANDORA_MAN/{man1,cat1}/tentacle_client.1.gz 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE$PANDORA_MAN/{man1,cat1}/pandora_agent.1.gz 2> /dev/null
|
||||
|
||||
# Skip delete of /etc/pandora if exists configuration of a server or satellite
|
||||
if [ ! -f $PANDORA_BASE/$PANDORA_CFG/pandora_server.conf -a ! -f $PANDORA_BASE/$PANDORA_CFG/satellite_server.conf ]
|
||||
then
|
||||
rm -Rf $PANDORA_BASE/$PANDORA_CFG 2> /dev/null
|
||||
fi
|
||||
|
||||
if [ ! -z "$PANDORA_BASE" ]
|
||||
then
|
||||
echo "Please delete manually $PANDORA_BASE for complete uninstall"
|
||||
fi
|
||||
|
||||
echo " "
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
#
|
||||
# install_perl_script [OPTIONS] SRCFILE DESTFILE
|
||||
# Install perl script. If PANDORA_PERL_DECODED_PATH is set, path of the perl
|
||||
# in shebang line is replaced with PANDORA_PERL_DECODED_PATH value.
|
||||
# OPTIONS:
|
||||
# -o OWNER owner of the installed script
|
||||
# -g GROUP group of the installed script
|
||||
# -m PREM mode of the installed script
|
||||
#
|
||||
install_perl_script () {
|
||||
OWNER=""; GROUP=""; PERM=""
|
||||
while :
|
||||
do
|
||||
case $1 in
|
||||
-o) OWNER=$2;;
|
||||
-g) GROUP=$2;;
|
||||
-m) PERM=$2;;
|
||||
*) break;;
|
||||
esac
|
||||
shift;shift
|
||||
done
|
||||
SRC="$1"
|
||||
DEST="$2"
|
||||
|
||||
# do install
|
||||
if echo $PANDORA_PERL_PATH | grep "/" > /dev/null && [ "$PANDORA_PERL_PATH" != "/usr/bin/perl" ]
|
||||
then
|
||||
sed -e "s:^#\!.*:#\!$PANDORA_PERL_PATH:g" $SRC > $DEST
|
||||
else
|
||||
cp $SRC $DEST
|
||||
fi
|
||||
|
||||
# set owner, group and permissions
|
||||
[ "$OWNER" ] && chown $OWNER $DEST 2>/dev/null
|
||||
[ "$GROUP" ] && chgrp $GROUP $DEST 2>/dev/null
|
||||
[ "$PERM" ] && chmod $PERM $DEST
|
||||
}
|
||||
|
||||
install () {
|
||||
OS_VERSION=`uname -r`
|
||||
OLDFILENAMETMP=`date +"%Y-%m-%d"`
|
||||
|
||||
echo "Detecting Unix distribution: $OS_NAME version $OS_VERSION"
|
||||
if [ -f $PANDORA_BASE$PANDORA_HOME ] && [ "$FORCE" = "0" ]
|
||||
then
|
||||
echo "Seems that default dir already exists. Please use --force-install to"
|
||||
echo "force installer to install on $PANDORA_BASE$PANDORA_HOME"
|
||||
exit
|
||||
else
|
||||
echo "Checking default dir $PANDORA_BASE$PANDORA_HOME..."
|
||||
fi
|
||||
|
||||
if [ -f $PANDORA_BASE$PANDORA_BIN ] && [ "$FORCE" = "0" ]
|
||||
then
|
||||
echo "Seems that $PANDORA_BASE$PANDORA_BIN already exists. Please use --force-install to"
|
||||
echo "force installer to reinstall overwriting it"
|
||||
echo " "
|
||||
exit
|
||||
else
|
||||
echo "Checking Pandora FMS Agent on $PANDORA_BASE$PANDORA_BIN...."
|
||||
fi
|
||||
|
||||
# Alter dynamically the daemon launcher and setup the new path
|
||||
# if PANDORA_BASE is customized.
|
||||
if [ "$PANDORA_BASE" ] && [ $FAKEROOT -ne 1 ]
|
||||
then
|
||||
DAEMON_TEMP=pandora_agent_daemon_temp
|
||||
|
||||
# Backup the daemon script
|
||||
cp -f "$DAEMON_SCRIPT" "${DAEMON_SCRIPT}.bak"
|
||||
|
||||
AGENT_CFG=$OS_NAME/pandora_agent.conf
|
||||
AGENT_CFG_TEMP=$OS_NAME/pandora_agent.conf.temp
|
||||
|
||||
# Backup the configuration file
|
||||
cp -f "$AGENT_CFG" "${AGENT_CFG}.bak"
|
||||
|
||||
if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ]
|
||||
then
|
||||
sed -e "\|^PATH=|s|=|=$PANDORA_BASE$PREFIX/bin:|" \
|
||||
-e "s|/usr/local/etc/pandora|$PANDORA_BASE$PANDORA_CFG|g" \
|
||||
-e "s|/usr/local/bin/pandora_agent|$PANDORA_BASE$PANDORA_BIN|g" \
|
||||
$DAEMON_SCRIPT > $DAEMON_TEMP
|
||||
mv $DAEMON_TEMP $DAEMON_SCRIPT
|
||||
else
|
||||
sed -e "\|^PATH=|s|=|=$PANDORA_BASE/usr/bin:|" \
|
||||
-e "\|^PANDORA_PATH=|s|=|=$PANDORA_BASE|" \
|
||||
-e "\|^LOGFILE=|s|=|=$PANDORA_BASE|" \
|
||||
-e "\|^DAEMON=|s|=|=$PANDORA_BASE|" \
|
||||
-e "\|^DAEMON_TENTACLE=|s|=|=$PANDORA_BASE|" \
|
||||
-e "s/^PANDORA_USER=.*/PANDORA_USER=$PANDORA_USER/" \
|
||||
$DAEMON_SCRIPT > $DAEMON_TEMP
|
||||
mv $DAEMON_TEMP $DAEMON_SCRIPT
|
||||
fi
|
||||
|
||||
sed -e "s|^temporal[ \t][ \t]*|temporal $PANDORA_BASE|" \
|
||||
-e "s|^logfile[ \t][ \t]*|logfile $PANDORA_BASE|" \
|
||||
$AGENT_CFG > $AGENT_CFG_TEMP
|
||||
mv $AGENT_CFG_TEMP $AGENT_CFG
|
||||
fi
|
||||
echo "Creating Pandora FMS Agent home directory at $PANDORA_BASE$PANDORA_HOME"
|
||||
if [ "$PANDORA_BASE" ]
|
||||
then
|
||||
mkdir -p $PANDORA_BASE 2> /dev/null
|
||||
mkdir -p $PANDORA_BASE/var/log 2> /dev/null
|
||||
mkdir -p $PANDORA_BASE/$PANDORA_MAN/man1 2> /dev/null
|
||||
mkdir -p $PANDORA_BASE$PREFIX/bin 2> /dev/null
|
||||
fi
|
||||
|
||||
mkdir -p $PANDORA_BASE$PANDORA_HOME 2> /dev/null
|
||||
|
||||
# Create directories based on PANDORA_BASE
|
||||
|
||||
mkdir -p $PANDORA_BASE/tmp 2> /dev/null
|
||||
mkdir -p $PANDORA_BASE$PANDORA_TEMP/data_out 2> /dev/null
|
||||
mkdir -p $PANDORA_BASE$PANDORA_CFG 2> /dev/null
|
||||
mkdir -p $PANDORA_BASE$PANDORA_LOG_DIR 2> /dev/null
|
||||
|
||||
# Set the user the agent will run as
|
||||
if [ "$PANDORA_USER" != "root" ]
|
||||
then
|
||||
sed -e "s/.*pandora_user .*/pandora_user $PANDORA_USER/" $AGENT_CFG > $AGENT_CFG_TEMP 2> /dev/null && \
|
||||
mv $AGENT_CFG_TEMP $AGENT_CFG
|
||||
chmod 755 pandora_agent_daemon
|
||||
chown -R $PANDORA_USER $PANDORA_BASE 2>/dev/null
|
||||
fi
|
||||
|
||||
# Create logfile
|
||||
if [ ! -z "`touch $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG`" ]
|
||||
then
|
||||
echo "Seems to be a problem generating logfile ($PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG) please check it";
|
||||
else
|
||||
echo "Created logfile at $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG..."
|
||||
fi
|
||||
echo "$LOG_TIMESTAMP Pandora FMS installer has created this file at startup" > $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG
|
||||
|
||||
# Copying agent and securing it
|
||||
echo "Copying Pandora FMS Agent to $PANDORA_BASE$PANDORA_BIN..."
|
||||
install_perl_script -m 755 -o $PANDORA_USER -g 0 pandora_agent $PANDORA_BASE$PANDORA_BIN
|
||||
install_perl_script -m 755 -o $PANDORA_USER -g 0 pandora_agent_exec $PANDORA_BASE$PANDORA_EXEC_BIN
|
||||
install_perl_script -m 755 -o $PANDORA_USER -g 0 pandora_revent $PANDORA_BASE$PANDORA_REVENT_BIN
|
||||
|
||||
echo "Copying Pandora FMS Agent configuration file to $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf..."
|
||||
if [ -f $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf ]
|
||||
then
|
||||
cp $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf.$OLDFILENAMETMP
|
||||
echo "Backing up old configuration file to $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf.$OLDFILENAMETMP"
|
||||
fi
|
||||
|
||||
echo "Copying Pandora FMS Agent plugins to $PANDORA_BASE$PANDORA_HOME/plugins..."
|
||||
|
||||
[ -d $PANDORA_BASE$PANDORA_HOME/plugins ] || mkdir -p $PANDORA_BASE$PANDORA_HOME/plugins >/dev/null 2>&1
|
||||
for PLUGIN in plugins/*
|
||||
do
|
||||
if grep '^#!.*/perl' $PLUGIN >/dev/null 2>&1
|
||||
then
|
||||
install_perl_script $PLUGIN $PANDORA_BASE$PANDORA_HOME/$PLUGIN
|
||||
else
|
||||
cp $PLUGIN $PANDORA_BASE$PANDORA_HOME/plugins
|
||||
fi
|
||||
done
|
||||
chmod -R 700 $PANDORA_BASE$PANDORA_HOME/plugins
|
||||
|
||||
PANDORA_BASE_REAL="$PANDORA_BASE"
|
||||
[ $FAKEROOT -eq 1 ] && PANDORA_BASE_REAL=""
|
||||
|
||||
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/plugins $PANDORA_BASE$PANDORA_CFG
|
||||
|
||||
echo "Copying Pandora FMS Agent collections to $PANDORA_BASE$PANDORA_HOME/collections..."
|
||||
cp -r collections $PANDORA_BASE$PANDORA_HOME
|
||||
chmod -R 700 $PANDORA_BASE$PANDORA_HOME/collections
|
||||
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG
|
||||
|
||||
if [ $WITHOUT_TENTACLE_SERVER -eq 0 ]
|
||||
then
|
||||
echo "Copying tentacle server to $PANDORA_BASE$TENTACLE_SERVER"
|
||||
install_perl_script -m 755 -o $PANDORA_USER -g 0 tentacle_server $PANDORA_BASE$TENTACLE_SERVER
|
||||
fi
|
||||
|
||||
echo "Copying tentacle client to $PANDORA_BASE$TENTACLE"
|
||||
install_perl_script -m 755 -o $PANDORA_USER -g 0 tentacle_client $PANDORA_BASE$TENTACLE
|
||||
|
||||
echo "Installing the Pandora Agent and Tentacle Client manuals"
|
||||
cp man/man1/tentacle_client.1.gz $PANDORA_BASE/$PANDORA_MAN/man1
|
||||
chmod 644 $PANDORA_BASE/$PANDORA_MAN/man1/tentacle_client.1.gz
|
||||
cp man/man1/pandora_agent.1.gz $PANDORA_BASE/$PANDORA_MAN/man1
|
||||
chmod 644 $PANDORA_BASE/$PANDORA_MAN/man1/pandora_agent.1.gz
|
||||
|
||||
echo "Setting secure permissions and ownership for all Pandora FMS Agent files..."
|
||||
chown -R $PANDORA_USER $PANDORA_BASE$PANDORA_HOME 2>/dev/null
|
||||
chmod -R 700 $PANDORA_BASE$PANDORA_TEMP/data_out
|
||||
chmod 711 $PANDORA_BASE$PANDORA_LOG_DIR
|
||||
chmod 640 $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG
|
||||
chown $PANDORA_USER:0 $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG 2>/dev/null
|
||||
if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ]
|
||||
then
|
||||
chown $PANDORA_USER:daemon $PANDORA_BASE$PANDORA_TEMP 2>/dev/null
|
||||
chmod -R 770 $PANDORA_BASE$PANDORA_TEMP
|
||||
chmod 775 $PANDORA_BASE$PANDORA_TEMP
|
||||
fi
|
||||
|
||||
echo "Copying default agent configuration to $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf"
|
||||
|
||||
cp $OS_NAME/pandora_agent.conf $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf
|
||||
chmod 600 $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf
|
||||
chown $PANDORA_USER $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf 2>/dev/null
|
||||
|
||||
echo "Linking start-up daemon script '$DAEMON_SCRIPT' on $OS_NAME";
|
||||
|
||||
if [ "$OS_NAME" = "Darwin" ]
|
||||
then
|
||||
# Specific service install on Darwin/macOSX
|
||||
launchctl load -F Darwin/com.pandorafms.pandorafms.plist
|
||||
echo "Start Pandora FMS service with 'launchctl start com.pandorafms.pandorafms'"
|
||||
echo "This service has been scheduled to launch on each system startup"
|
||||
else
|
||||
DESTDIR=""
|
||||
[ "$PANDORA_BASE" ] && [ $FAKEROOT -eq 1 ] && DESTDIR=$PANDORA_BASE
|
||||
|
||||
cp $DAEMON_SCRIPT $DESTDIR$PANDORA_STARTUP
|
||||
chmod 755 $DESTDIR$PANDORA_STARTUP
|
||||
chown root:0 $DESTDIR$PANDORA_STARTUP 2>/dev/null
|
||||
|
||||
RCDIRS=""
|
||||
MSG=""
|
||||
if [ "$OS_NAME" = "AIX" ]
|
||||
then
|
||||
RCDIRS=/etc/rc.d/rc2.d
|
||||
MSG="Pandora FMS agent has been included in $DESTDIR/etc/rc.d/rc2.d/S90pandora_agent_daemon"
|
||||
elif [ "$OS_NAME" = "HP-UX" ]
|
||||
then
|
||||
RCDIRS="/sbin/rc2.d /sbin/rc3.d"
|
||||
MSG="Pandora FMS agent has been included in $DESTDIR/sbin/rcX.d/S90pandora_agent_daemon"
|
||||
elif [ "$OS_NAME" = "SunOS" ]
|
||||
then
|
||||
RCDIRS=/etc/rc2.d
|
||||
MSG="Pandora FMS agent has been included in $DESTDIR/etc/rc2.d/S90pandora_agent_daemon"
|
||||
elif [ "$OS_NAME" = "Linux" ]
|
||||
then
|
||||
if [ -d /etc/rc.d/ ]
|
||||
then
|
||||
RCDIRS="/etc/rc.d/rc2.d /etc/rc.d/rc3.d"
|
||||
else
|
||||
RCDIRS="/etc/rc2.d /etc/rc3.d"
|
||||
fi
|
||||
fi
|
||||
[ "$RCDIRS" ] && for RCDIR in $RCDIRS
|
||||
do
|
||||
[ $FAKEROOT -eq 1 ] && [ ! -d $DESTDIR$RCDIR ] && mkdir -p $DESTDIR$RCDIR >/dev/null 2>&1
|
||||
ln -s $PANDORA_STARTUP $DESTDIR$RCDIR/S90pandora_agent 2> /dev/null
|
||||
done
|
||||
[ "$MSG" ] && echo "$MSG"
|
||||
fi
|
||||
|
||||
if [ -d /etc/logrotate.d ]
|
||||
then
|
||||
[ -d $DESTDIR/etc/logrotate.d ] && mkdir -p $DESTDIR/etc/logrotate.d
|
||||
echo "Creating logrotate.d entry for Pandora FMS log management"
|
||||
sed -e "s|^/var/log/pandora/pandora_agent.log|$PANDORA_BASE_REAL$PANDORA_LOG_DIR/$PANDORA_LOG|" pandora_agent_logrotate \
|
||||
> $DESTDIR/etc/logrotate.d/pandora_agent
|
||||
else
|
||||
echo "Please add a log rotation schedule manually to your log rotation daemon (if any)"
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
echo " "
|
||||
echo "You have your startup script ready at $PANDORA_STARTUP"
|
||||
echo " "
|
||||
echo "Tentacle is the default transfer mode since 2.0 version."
|
||||
echo " "
|
||||
echo "If you want to use SSH, firstly you need to copy your public SSH keys "
|
||||
echo " ($HOME/.ssh/id_dsa) under /home/pandora/.ssh/authorized_keys "
|
||||
echo "on your Pandora FMS Server host"
|
||||
echo " "
|
||||
echo "You may need to install manually some additional required dependencies:"
|
||||
echo "perl-Sys-Syslog"
|
||||
echo " "
|
||||
echo "You also need to setup your $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf config file"
|
||||
echo " "
|
||||
if [ "$OS_NAME" = "FreeBSD" ]
|
||||
then
|
||||
echo "Define 'pandora_agent_enable=\"YES\"' in /etc/rc.conf to enable the daemon."
|
||||
elif [ "$OS_NAME" = "NetBSD" ]
|
||||
then
|
||||
echo "Define 'pandora_agent=\"YES\"' in /etc/rc.conf to enable the daemon."
|
||||
else
|
||||
echo "Check your startup configuration to be sure Pandora FMS Agent is ready "
|
||||
echo "to start automatically when system restarts":
|
||||
fi
|
||||
|
||||
# Restore the daemon script
|
||||
cp -f "$DAEMON_SCRIPT.bak" "$DAEMON_SCRIPT" >/dev/null 2>&1
|
||||
rm -f "$DAEMON_SCRIPT.bak" >/dev/null 2>&1
|
||||
|
||||
# Restore the configuration file
|
||||
cp -f "$AGENT_CFG.bak" "$AGENT_CFG" >/dev/null 2>&1
|
||||
rm -f "$AGENT_CFG.bak" >/dev/null 2>&1
|
||||
|
||||
}
|
||||
|
||||
if [ ! -f "pandora_agent" ]
|
||||
then
|
||||
echo " "
|
||||
echo "Execute installer from the directory where you have your files. "
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Script banner at start
|
||||
echo " "
|
||||
echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2015 ArticaST"
|
||||
echo "This program is licensed under GPL2 Terms. http://pandorafms.com"
|
||||
echo " "
|
||||
|
||||
|
||||
case "$MODE" in
|
||||
|
||||
'--force-install')
|
||||
FORCE=1
|
||||
install
|
||||
exit
|
||||
;;
|
||||
|
||||
'--install')
|
||||
install
|
||||
exit
|
||||
;;
|
||||
|
||||
'--uninstall')
|
||||
uninstall
|
||||
exit
|
||||
;;
|
||||
|
||||
*)
|
||||
help
|
||||
;;
|
||||
esac
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2014 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.715
|
||||
# (c) 2006-2017 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.718
|
||||
|
||||
# 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
|
||||
|
@ -21,6 +21,13 @@ server_ip $ServerIP$
|
|||
server_path /var/spool/pandora/data_in
|
||||
temporal "%ProgramFiles%\pandora_agent\temp"
|
||||
|
||||
# Group assigned for this agent (descriptive, p.e: Servers)
|
||||
group $GroupName$
|
||||
|
||||
# If set to 1 allows the agent to be configured via the web console
|
||||
# (only works on enterprise version). Set to 0 to disable it
|
||||
remote_config 0
|
||||
|
||||
#include "C:\Archivos de programa\pandora_agent\pandora_agent_alt.conf"
|
||||
#broker_agent name_agent
|
||||
|
||||
|
@ -43,15 +50,10 @@ agent_name_cmd __rand__
|
|||
|
||||
# address: Enforce to server a ip address to this agent
|
||||
# You can also try to detect the first IP using "auto", for example
|
||||
|
||||
address auto
|
||||
|
||||
# or setting a fixed IP address, like for example:
|
||||
#address 192.168.36.73
|
||||
|
||||
# Group assigned for this agent (descriptive, p.e: Servers)
|
||||
group Servers
|
||||
|
||||
# This limits operation if temporal dir has not enough free disk.
|
||||
#temporal_min_size 1024
|
||||
|
||||
|
@ -80,10 +82,6 @@ server_port 41121
|
|||
# Debug mode renames XML in the temp folder and continues running
|
||||
# debug 1
|
||||
|
||||
# If set to 1 allows the agent to be configured via the web console
|
||||
# (only works on enterprise version). Set to 0 to disable it
|
||||
remote_config 0
|
||||
|
||||
# XML encoding (ISO-8859-1 by default). Most windows servers experience problems when you set to UTF-8. Other special codepages may be specified here.
|
||||
#encoding ISO-8859-1
|
||||
|
||||
|
@ -102,6 +100,10 @@ xml_buffer 1
|
|||
# Agent mode: Learn (default), No-learn, Autodisable
|
||||
# agent_mode autodisable
|
||||
|
||||
# EHorus configuration file default full path.
|
||||
#It try to find the EKID and set it like a custom field.
|
||||
ehorus_conf "C:\Program Files\ehorus_agent\ehorus_agent.conf"
|
||||
|
||||
# Secondary server configuration
|
||||
# ==============================
|
||||
|
||||
|
@ -127,74 +129,166 @@ xml_buffer 1
|
|||
#process_firefox_stop killall firefox
|
||||
#service_messenger 1
|
||||
|
||||
###############################################
|
||||
# Module Definition
|
||||
# Check online documentation and module library at http://pandorafms.org
|
||||
# =================
|
||||
|
||||
# Get Network information using Agent plugin
|
||||
module_plugin cscript //B "%ProgramFiles%\Pandora_Agent\util\nettraffic.vbs"
|
||||
|
||||
# Get disk occupation (percent)
|
||||
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent.vbs"
|
||||
|
||||
# External inventory plugin
|
||||
module_begin
|
||||
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\software_installed.vbs"
|
||||
module_interval 288
|
||||
# 288 x 5min = 24 hr, one execution per day, using module_interval <factor>
|
||||
module_end
|
||||
|
||||
# CPU Load
|
||||
|
||||
# CPU Load using WMI
|
||||
module_begin
|
||||
module_name CPU Load
|
||||
module_type generic_data
|
||||
#module_wmiquery SELECT LoadPercentage FROM Win32_Processor
|
||||
#module_wmicolumn LoadPercentage
|
||||
module_cpuusage all
|
||||
module_description CPU Load (%)
|
||||
module_unit %
|
||||
module_min_warning 80
|
||||
module_wmiquery SELECT LoadPercentage FROM Win32_Processor
|
||||
module_wmicolumn LoadPercentage
|
||||
module_max 100
|
||||
module_min 0
|
||||
module_description User CPU Usage (%)
|
||||
module_min_warning 70
|
||||
module_max_warning 90
|
||||
module_min_critical 91
|
||||
module_max_critical 100
|
||||
module_unit %
|
||||
module_group System
|
||||
module_end
|
||||
|
||||
# Number processes
|
||||
# Basic info about TCP Connection
|
||||
module_begin
|
||||
module_name Number processes
|
||||
module_type generic_data
|
||||
module_exec tasklist | gawk "NR > 3 {print$0}" | wc -l
|
||||
module_description Number of processes running
|
||||
module_min_warning 175
|
||||
module_max_warning 249
|
||||
module_min_critical 250
|
||||
module_max_critical 300
|
||||
module_name TCP_Connections
|
||||
module_type generic_data
|
||||
module_exec netstat -an | find /c /v "estab"
|
||||
module_description Total number of TCP connections active
|
||||
module_group Networking
|
||||
module_end
|
||||
|
||||
# Example plugin to retrieve drive usage
|
||||
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent_used.vbs"
|
||||
|
||||
# Example plugin to retrieve memory usage
|
||||
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\mem_percent_used.vbs"
|
||||
|
||||
# Example plugin to retrieve network usage
|
||||
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\network.vbs"
|
||||
|
||||
## Windows inventory module (This information will be displayed only in enterprise version)
|
||||
## Please check the WMI is healthy before activate this functionality
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cpuinfo.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\moboinfo.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\diskdrives.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cdromdrives.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\videocardinfo.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\ifaces.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\monitors.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\printers.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\raminfo.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\software_installed.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\userslogged.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productkey.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productID.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#########################################
|
||||
# EXAMPLES #
|
||||
#########################################
|
||||
|
||||
# Example: get Network information using Agent plugin
|
||||
#module_plugin cscript //B "%ProgramFiles%\Pandora_Agent\util\nettraffic.vbs"
|
||||
|
||||
# External inventory plugin
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\software_installed.vbs"
|
||||
#module_interval 288
|
||||
## 288 x 5min = 24 hr, one execution per day, using module_interval <factor>
|
||||
#module_end
|
||||
|
||||
# Free Memory
|
||||
module_begin
|
||||
module_name FreeMemory
|
||||
module_type generic_data
|
||||
module_freepercentmemory
|
||||
module_unit %
|
||||
module_description Free memory (%).
|
||||
module_min_warning 21
|
||||
module_max_warning 30
|
||||
module_min_critical 0
|
||||
module_max_critical 20
|
||||
module_end
|
||||
#module_begin
|
||||
#module_name FreeMemory
|
||||
#module_type generic_data
|
||||
#module_freepercentmemory
|
||||
#module_description Free memory (%).
|
||||
#module_min_warning 21
|
||||
#module_max_warning 30
|
||||
#module_min_critical 0
|
||||
#module_max_critical 20
|
||||
#module_end
|
||||
|
||||
# Log events
|
||||
#module_begin
|
||||
#module_name System Events (TermService)
|
||||
#module_type async_string
|
||||
#module_logevent
|
||||
#module_description Log Events coming from Terminal Service
|
||||
#module_source System
|
||||
#module_application TermService
|
||||
#module_end
|
||||
|
||||
module_begin
|
||||
module_name Security Events (Invalid Login)
|
||||
module_type async_string
|
||||
module_description Security log events for invalid login attempt
|
||||
module_logevent
|
||||
module_source Security
|
||||
module_eventcode 529
|
||||
module_end
|
||||
#module_begin
|
||||
#module_name Security Events (Invalid Login)
|
||||
#module_type async_string
|
||||
#module_description Security log events for invalid login attempt
|
||||
#module_logevent
|
||||
#module_source Security
|
||||
#module_eventcode 529
|
||||
#module_end
|
||||
|
||||
# Check if Dhcp service is enabled
|
||||
#module_begin
|
||||
#module_name DHCP Enabled
|
||||
#module_type generic_proc
|
||||
#module_service Dhcp
|
||||
#module_description Check DCHP service enabled
|
||||
#module_end
|
||||
|
||||
#Antivirus monitoring
|
||||
#This modules checks the antivirus is running on your system, if there is and antivirus
|
||||
|
@ -207,72 +301,51 @@ module_end
|
|||
#module_description Last update for Antivirus Signature file
|
||||
#module_end
|
||||
|
||||
## Windows inventory module (This information will be displayed only in enterprise version)
|
||||
## Please check the WMI is healthy before activate this functionality
|
||||
# Number processes
|
||||
#module_begin
|
||||
#module_name Number processes
|
||||
#module_type generic_data
|
||||
#module_exec tasklist | gawk "NR > 3 {print$0}" | wc -l
|
||||
#module_description Number of processes running
|
||||
#module_min_warning 175
|
||||
#module_max_warning 249
|
||||
#module_min_critical 250
|
||||
#module_max_critical 300
|
||||
#module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cpuinfo.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
# Example plugin to retrieve drive usage
|
||||
#module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df.vbs"
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\moboinfo.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
# Free space on disk C: (%)
|
||||
#module_begin
|
||||
#module_name FreeDiskC
|
||||
#module_type generic_data
|
||||
#module_freepercentdisk C:
|
||||
#module_description Free space on drive C: (%)
|
||||
#module_min_warning 31
|
||||
#module_max_warning 40
|
||||
#module_min_critical 0
|
||||
#module_max_critical 30
|
||||
#module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\diskdrives.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
# CPU usage percentage
|
||||
#module_begin
|
||||
#module_name CPUUse
|
||||
#module_type generic_data
|
||||
#module_cpuusage all
|
||||
#module_description CPU# usage
|
||||
#module_min_warning 70
|
||||
#module_max_warning 90
|
||||
#module_min_critical 91
|
||||
#module_max_critical 100
|
||||
#module_end
|
||||
|
||||
# Free space on disk D: (%)
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cdromdrives.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\videocardinfo.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\ifaces.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\monitors.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\printers.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\raminfo.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\software_installed.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\userslogged.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productkey.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productID.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_name FreeDiskD
|
||||
# module_type generic_data
|
||||
# module_freepercentdisk D:
|
||||
# module_description Free space on drive D: (%)
|
||||
# module_end
|
||||
|
||||
## Plugin example for custom fields (version, architecture, IP, IPv6, MAC)
|
||||
|
@ -281,10 +354,9 @@ module_end
|
|||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
# This samples below need to be reconfigured and uncommented. Please read documentation
|
||||
# on how to setup pandora fms windows agent at http://wiki.pandorafms.com
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
# Example plugin to retrieve last 5 min events in log4x format
|
||||
# module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\logevent_log4x.vbs" Aplicacion System 300
|
||||
|
||||
# Sample on how to get a value from registry
|
||||
# This returns the last time user launch microsoft Windows update
|
||||
#module_begin
|
||||
|
@ -391,11 +463,11 @@ module_end
|
|||
#module_description Postcondition test module
|
||||
#module_end
|
||||
|
||||
#Example of when module_native_encoding is necessary
|
||||
#Dont uncomment module_native_encoding tag to see the difference
|
||||
# Example of native encoding.
|
||||
#module_begin
|
||||
#module_name Accent_example
|
||||
#module_name Written Accent
|
||||
#module_type generic_data_string
|
||||
#module_exec echo Bordón
|
||||
#module_native_encoding OEM
|
||||
#module_end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.715}
|
||||
{Pandora FMS Windows Agent v7.0NG.718}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{171122}
|
||||
{180124}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives
|
|||
{No}
|
||||
|
||||
Windows,Executable
|
||||
{<%AppName%>-<%Version%>-Setup<%Ext%>}
|
||||
{<%AppName%>-Setup<%Ext%>}
|
||||
|
||||
Windows,FileDescription
|
||||
{<%AppName%> <%Version%> Setup}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.715(Build 171122)")
|
||||
#define PANDORA_VERSION ("7.0NG.718(Build 180124)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -1,345 +0,0 @@
|
|||
/* Common functions to any Pandora program.
|
||||
Copyright (C) 2006 Artica ST.
|
||||
Written by Esteban Sanchez.
|
||||
|
||||
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 <stdio.h>
|
||||
#include <iostream>
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include "pandora.h"
|
||||
#include "pandora_strutils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
<<<<<<< HEAD
|
||||
#define PANDORA_VERSION ("7.0NG(Build 170406)")
|
||||
=======
|
||||
#define PANDORA_VERSION ("7.0NG(Build 170418)")
|
||||
>>>>>>> develop
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
bool pandora_debug;
|
||||
bool pandora_log_disable;
|
||||
string pandora_version = PANDORA_VERSION;
|
||||
|
||||
/**
|
||||
* Parses a string and initialize the key and the value.
|
||||
*
|
||||
* The string should be in the format:
|
||||
* - <code>key value</code>
|
||||
* - <code>key "value with blankspaces"</code>
|
||||
*/
|
||||
void
|
||||
Key_Value::parseLine (string str) {
|
||||
int pos;
|
||||
list<string> tokens;
|
||||
list<string>::iterator iter;
|
||||
string trimmedstr;
|
||||
|
||||
trimmedstr = trim (str);
|
||||
|
||||
/* Check if the string has " */
|
||||
pos = trimmedstr.find ("\"");
|
||||
if (pos == string::npos) {
|
||||
stringtok (tokens, trimmedstr, " \t");
|
||||
} else {
|
||||
stringtok (tokens, trimmedstr, "\"");
|
||||
}
|
||||
|
||||
/* Pick the first and the last value of the token list */
|
||||
iter = tokens.begin ();
|
||||
key = trim (*iter);
|
||||
transform (key.begin(), key.end(), key.begin(), (int(*)(int)) tolower);
|
||||
iter = tokens.end ();
|
||||
iter--;
|
||||
/* Check if the line has only one token */
|
||||
if (iter != tokens.begin ()) {
|
||||
value = trim (*iter);
|
||||
} else {
|
||||
value = "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a string by position and initialize the key and the value.
|
||||
*/
|
||||
void
|
||||
Key_Value::parseLineByPosition (string str, int pos) {
|
||||
string trimmedstr;
|
||||
|
||||
trimmedstr = trim (str);
|
||||
|
||||
key = trim (trimmedstr.substr (0, pos));
|
||||
value = trim (trimmedstr.substr (pos));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the key of the object.
|
||||
*
|
||||
* @return The key
|
||||
*/
|
||||
string
|
||||
Key_Value::getKey () {
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the key of the object.
|
||||
*
|
||||
*/
|
||||
void
|
||||
Key_Value::setKey (const string key) {
|
||||
this->key = key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of the object.
|
||||
*
|
||||
* @return The value
|
||||
*/
|
||||
string
|
||||
Key_Value::getValue () {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of the object.
|
||||
*
|
||||
* @return The value
|
||||
*/
|
||||
void
|
||||
Key_Value::setValue (const string value) {
|
||||
this->value = value;
|
||||
}
|
||||
|
||||
void
|
||||
pandoraWriteLog (string filename, string line) {
|
||||
string buffer;
|
||||
char str_time[25];
|
||||
FILE *file;
|
||||
string filepath;
|
||||
SYSTEMTIME st;
|
||||
|
||||
GetLocalTime(&st);
|
||||
sprintf (str_time, "%d-%02d-%02d %02d:%02d:%02d ", st.wYear, st.wMonth, st.wDay,
|
||||
st.wHour, st.wMinute, st.wSecond);
|
||||
|
||||
buffer = (char *) str_time;
|
||||
buffer += line;
|
||||
|
||||
filepath = pandora_dir + filename;
|
||||
|
||||
file = fopen (filepath.c_str (), "a+");
|
||||
if (file != NULL) {
|
||||
fprintf (file, "%s\n", buffer.c_str ());
|
||||
fclose (file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a message in the log file.
|
||||
*
|
||||
* The log file is used to write the output of errors and problems of the
|
||||
* agent.
|
||||
*
|
||||
* @param format String output format (like printf).
|
||||
* @param ... Variable argument list
|
||||
*/
|
||||
void
|
||||
Pandora::pandoraLog (const char *format, ...) {
|
||||
if (!pandora_log_disable) {
|
||||
va_list args;
|
||||
char msg[5000];
|
||||
|
||||
va_start (args, format);
|
||||
vsprintf (msg, format, args);
|
||||
va_end (args);
|
||||
|
||||
pandoraWriteLog ("pandora_agent.log", (char *) msg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a message in the debug file.
|
||||
*
|
||||
* The log file is used to write the output of debugging information of the
|
||||
* agent.
|
||||
*
|
||||
* @param format String output format.
|
||||
* @param ... Variable argument list
|
||||
*/
|
||||
void
|
||||
Pandora::pandoraDebug (const char *format, ...) {
|
||||
if (pandora_debug) {
|
||||
va_list args;
|
||||
char msg[5000];
|
||||
|
||||
va_start (args, format);
|
||||
vsprintf (msg, format, args);
|
||||
va_end (args);
|
||||
|
||||
pandoraWriteLog ("pandora_debug.log", (char *) msg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Secure free of a pointer.
|
||||
*
|
||||
* @param pointer pointer to free.
|
||||
*/
|
||||
void
|
||||
Pandora::pandoraFree (void * pointer) {
|
||||
if (pointer != NULL)
|
||||
free (pointer);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the installation directory of the application.
|
||||
*
|
||||
* This directory is the path to the directory which holds
|
||||
* the binary file.
|
||||
*
|
||||
* @param dir The path to the directory.
|
||||
*
|
||||
* @see getPandoraInstallDir
|
||||
*/
|
||||
void
|
||||
Pandora::setPandoraInstallDir (string dir) {
|
||||
pandora_dir = dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the installation directory of the application.
|
||||
*
|
||||
* This directory is the path to the directory which holds
|
||||
* the binary file.
|
||||
*
|
||||
* @return The path to the directory.
|
||||
*
|
||||
* @see setPandoraInstallDir
|
||||
*/
|
||||
string
|
||||
Pandora::getPandoraInstallDir () {
|
||||
return pandora_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the installation path of the application.
|
||||
*
|
||||
* This the complete path to the binary file.
|
||||
*
|
||||
* @param path The path to the binary file.
|
||||
*
|
||||
* @see getPandoraInstallPath
|
||||
*/
|
||||
void
|
||||
Pandora::setPandoraInstallPath (string path) {
|
||||
pandora_path = path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the installation path of the application.
|
||||
*
|
||||
* This the complete path to the binary file.
|
||||
*
|
||||
* @return The path.
|
||||
*
|
||||
* @see setPandoraInstallPath
|
||||
*/
|
||||
string
|
||||
Pandora::getPandoraInstallPath () {
|
||||
return pandora_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the debug flag.
|
||||
*
|
||||
* If the flag is true output wil be generated and XML files will not be deleted.
|
||||
*
|
||||
* @param dbg Turns the debug flag on/off.
|
||||
*
|
||||
* @see getPandoraDebug
|
||||
* @see pandoraDebug
|
||||
*/
|
||||
void
|
||||
Pandora::setPandoraDebug (bool dbg) {
|
||||
pandora_debug = dbg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the debug flag value.
|
||||
*
|
||||
* If the flag is truee output wil be generated and XML files will not be deleted.
|
||||
*
|
||||
* @see setPandoraDebug
|
||||
* @see pandoraDebug
|
||||
*/
|
||||
bool
|
||||
Pandora::getPandoraDebug () {
|
||||
return pandora_debug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the disable logfile flag.
|
||||
*
|
||||
* If the flag is true no logs will be written.
|
||||
*
|
||||
* @param dbg Turns the debug flag on/off.
|
||||
*
|
||||
*/
|
||||
void
|
||||
Pandora::setPandoraLogDisable (bool dbg) {
|
||||
pandora_log_disable = dbg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the version of the agent.
|
||||
*
|
||||
* @return The version.
|
||||
*/
|
||||
string
|
||||
Pandora::getPandoraAgentVersion () {
|
||||
return pandora_version;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Pandora::is_enabled (string value) {
|
||||
static string enabled_values[] = {"enabled", "1", "on", "yes", "si", "sí", "ok", "true", ""};
|
||||
int i = 0;
|
||||
|
||||
if (value == "") {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (enabled_values[i] != "") {
|
||||
if (enabled_values[i] == value) {
|
||||
return true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return false;
|
||||
}
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.715(Build 171122))"
|
||||
VALUE "ProductVersion", "(7.0NG.718(Build 180124))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
1 VERSIONINFO
|
||||
FILEVERSION 1,0,0,0
|
||||
PRODUCTVERSION 1,0,0,0
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "080904E4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Artica ST"
|
||||
VALUE "FileDescription", "Pandora FMS Agent for Windows Platform"
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
<<<<<<< HEAD
|
||||
VALUE "ProductVersion", "(7.0NG(Build 170406))"
|
||||
=======
|
||||
VALUE "ProductVersion", "(7.0NG(Build 170418))"
|
||||
>>>>>>> develop
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x809, 1252
|
||||
END
|
||||
END
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.715-171122
|
||||
Version: 7.0NG.718
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
package: pandorafms-console
|
||||
<<<<<<< HEAD
|
||||
Version: 7.0NG-170406
|
||||
=======
|
||||
Version: 7.0NG-170418
|
||||
>>>>>>> develop
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
Installed-Size: 42112
|
||||
Maintainer: Artica ST <deptec@artica.es>
|
||||
Homepage: http://pandorafms.org/
|
||||
Depends: php5, php5-snmp, php5-gd, php5-mysql, php-db, php5-xmlrpc, php-gettext, php5-curl, graphviz, dbconfig-common, php5-ldap, mysql-client | virtual-mysql-client
|
||||
Description: Pandora FMS is an Open Source monitoring tool. It monitor your systems and applications, and allows you to control the status of any element of them. The web console is the graphical user interface (GUI) to manage the pool and to generate reports and graphs from the Pandora FMS monitoring process.
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.715-171122"
|
||||
pandora_version="7.0NG.718"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -1,168 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#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 Lesser 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.
|
||||
|
||||
<<<<<<< HEAD
|
||||
pandora_version="7.0NG-170406"
|
||||
=======
|
||||
pandora_version="7.0NG-170418"
|
||||
>>>>>>> develop
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
||||
for param in $@
|
||||
do
|
||||
if [ $param = "-h" -o $param = "--help" ]
|
||||
then
|
||||
echo "For only make packages of pear type +pear"
|
||||
echo "For not make packages of pear type -pear"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $param = "+pear" ]
|
||||
then
|
||||
package_pandora=0
|
||||
fi
|
||||
if [ $param = "-pear" ]
|
||||
then
|
||||
package_pear=0
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $package_pandora -eq 1 ]
|
||||
then
|
||||
echo "Test if you have all the needed tools to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
if [ $? = 1 ]
|
||||
then
|
||||
echo "No found \"dpkg-deb\" aplication, please install."
|
||||
exit 1
|
||||
else
|
||||
echo "Found \"dpkg-debs\"."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $package_pear -eq 1 ]
|
||||
then
|
||||
whereis dh-make-pear | cut -d":" -f2 | grep dh-make-pear > /dev/null
|
||||
if [ $? = 1 ]
|
||||
then
|
||||
echo " \"dh-make-pear\" aplication not found, please install."
|
||||
exit 1
|
||||
else
|
||||
echo "Found \"dh-make-pear\"."
|
||||
fi
|
||||
|
||||
whereis fakeroot | cut -d":" -f2 | grep fakeroot > /dev/null
|
||||
if [ $? = 1 ]
|
||||
then
|
||||
echo " \"fakeroot\" aplication not found, please install."
|
||||
exit 1
|
||||
else
|
||||
echo "Found \"fakeroot\"."
|
||||
fi
|
||||
fi
|
||||
|
||||
whereis dpkg-buildpackage | cut -d":" -f2 | grep dpkg-buildpackage > /dev/null
|
||||
if [ $? = 1 ]
|
||||
then
|
||||
echo " \"dpkg-buildpackage\" aplication not found, please install."
|
||||
exit 1
|
||||
else
|
||||
echo "Found \"dpkg-buildpackage\"."
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
echo "Make a \"temp_package\" temporary dir for job."
|
||||
mkdir -p temp_package
|
||||
if [ $package_pandora -eq 1 ]
|
||||
then
|
||||
mkdir -p temp_package/var/www/pandora_console
|
||||
mkdir -p temp_package/etc/logrotate.d
|
||||
|
||||
echo "Make directory system tree for package."
|
||||
cp -R $(ls | grep -v temp_package | grep -v DEBIAN ) temp_package/var/www/pandora_console
|
||||
cp -R DEBIAN temp_package
|
||||
cp -aRf pandora_console_logrotate_ubuntu temp_package/etc/logrotate.d/pandora_console
|
||||
find temp_package/var/www/pandora_console -name ".svn" | xargs rm -Rf
|
||||
rm -Rf temp_package/var/www/pandora_console/pandora_console.spec
|
||||
chmod 755 -R temp_package/DEBIAN
|
||||
touch temp_package/var/www/pandora_console/include/config.php
|
||||
|
||||
|
||||
echo "Remove the SVN files and other temp files."
|
||||
for item in `find temp_package`
|
||||
do
|
||||
echo -n "."
|
||||
echo $item | grep "svn" > /dev/null
|
||||
#last command success
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
rm -rf $item
|
||||
fi
|
||||
|
||||
echo $item | grep "make_deb_package.sh" > /dev/null
|
||||
#last command success
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
rm -rf $item
|
||||
fi
|
||||
done
|
||||
echo "END"
|
||||
|
||||
echo "Calculate md5sum for md5sums package control file."
|
||||
for item in `find temp_package`
|
||||
do
|
||||
echo -n "."
|
||||
if [ ! -d $item ]
|
||||
then
|
||||
echo $item | grep "DEBIAN" > /dev/null
|
||||
#last command success
|
||||
if [ $? -eq 1 ]
|
||||
then
|
||||
md5=`md5sum $item | cut -d" " -f1`
|
||||
|
||||
#delete "temp_package" in the path
|
||||
final_path=${item#temp_package}
|
||||
echo $md5" "$final_path >> temp_package/DEBIAN/md5sums
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "END"
|
||||
|
||||
echo "Make the package \"Pandorafms console\"."
|
||||
dpkg-deb --build temp_package
|
||||
mv temp_package.deb pandorafms.console_$pandora_version.deb
|
||||
fi
|
||||
|
||||
if [ $package_pear -eq 1 ]
|
||||
then
|
||||
echo "Make the package \"php-xml-rpc\"."
|
||||
cd temp_package
|
||||
dh-make-pear --maintainer "Miguel de Dios <miguel.dedios@artica.es>" XML_RPC
|
||||
cd php-xml-rpc-*
|
||||
dpkg-buildpackage -rfakeroot
|
||||
cd ..
|
||||
mv php-xml-rpc*.deb ..
|
||||
cd ..
|
||||
fi
|
||||
|
||||
|
||||
echo "Delete the \"temp_package\" temporary dir for job."
|
||||
rm -Rf temp_package
|
||||
|
||||
echo "DONE: Package ready at: ../pandorafms.console_$pandora_version.deb"
|
|
@ -14,17 +14,16 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
include_once($config['homedir'] . "/include/functions_agents.php");
|
||||
include_once($config['homedir'] . "/include/functions_modules.php");
|
||||
include_once($config['homedir'] . '/include/functions_users.php');
|
||||
$refr = get_parameter('refresh', 0); // By default 30 seconds
|
||||
|
||||
function mainAgentsModules() {
|
||||
global $config;
|
||||
|
||||
// Load global vars
|
||||
require_once ("include/config.php");
|
||||
require_once ("include/functions_reporting.php");
|
||||
include_once($config['homedir'] . "/include/functions_agents.php");
|
||||
include_once($config['homedir'] . "/include/functions_modules.php");
|
||||
include_once($config['homedir'] . '/include/functions_users.php');
|
||||
|
||||
check_login ();
|
||||
// ACL Check
|
||||
|
@ -52,7 +51,6 @@ function mainAgentsModules() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if ($config["realtimestats"] == 0) {
|
||||
$updated_info = __('Last update'). " : ". ui_print_timestamp (db_get_sql ("SELECT min(utimestamp) FROM tgroup_stat"), true);
|
||||
}
|
||||
|
@ -103,7 +101,6 @@ function mainAgentsModules() {
|
|||
serialize_in_temp($agents_id, $config['id_user']."_agents", 1);
|
||||
}
|
||||
|
||||
|
||||
if ($config["pure"] == 0) {
|
||||
if($modules_selected[0] && $agents_id[0]){
|
||||
|
||||
|
@ -128,7 +125,6 @@ function mainAgentsModules() {
|
|||
. "</a>";
|
||||
|
||||
} else {
|
||||
|
||||
$fullscreen['text'] = '<a href="index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&pure=1&
|
||||
offset='.$offset.'&group_id='.$group_id.'&modulegroup='.$modulegroup.'&refresh='.$refr.'">'
|
||||
. html_print_image ("images/full_screen.png", true, array ("title" => __('Full screen mode')))
|
||||
|
@ -247,7 +243,6 @@ function mainAgentsModules() {
|
|||
ui_require_css_file('countdown');
|
||||
}
|
||||
|
||||
|
||||
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)).'">';
|
||||
|
@ -321,8 +316,7 @@ function mainAgentsModules() {
|
|||
foreach ($result_sql as $key => $value) {
|
||||
$all_modules[$value['id_agente_modulo']] = io_safe_output($name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
@ -353,7 +347,6 @@ function mainAgentsModules() {
|
|||
$name = '';
|
||||
$cont = 0;
|
||||
|
||||
|
||||
foreach ($all_modules as $key => $module) {
|
||||
if ($module == $name) {
|
||||
$modules_by_name[$cont-1]['id'][] = $key;
|
||||
|
@ -454,7 +447,7 @@ function mainAgentsModules() {
|
|||
"selection_a_m=" . $selection_a_m . "&" .
|
||||
"hor_offset=" . $new_hor_offset . "&".
|
||||
"offset=" . $offset .
|
||||
"'>" .
|
||||
"'>" .
|
||||
html_print_image(
|
||||
"images/arrow.png", true,
|
||||
array('title' => __('More modules'))) .
|
||||
|
@ -585,7 +578,13 @@ function mainAgentsModules() {
|
|||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_NOTINIT . ";'></div></td><td>" . __("Cell turns blue when the module is in 'not initialize' status") . "</td></tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
$pure_var = $config['pure'];
|
||||
if($pure_var){
|
||||
$pure_var = 1;
|
||||
}
|
||||
else{
|
||||
$pure_var = 0;
|
||||
}
|
||||
echo "
|
||||
<style type='text/css'>
|
||||
.rotate_text_module {
|
||||
|
@ -597,6 +596,7 @@ function mainAgentsModules() {
|
|||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type='text/javascript'>
|
||||
$(document).ready(function () {
|
||||
//Get max width of name of modules
|
||||
|
@ -619,9 +619,211 @@ function mainAgentsModules() {
|
|||
$(\"#div_module_r_\" + id).css('margin-top', (max_width - 20) + 'px');
|
||||
$(\"#div_module_r_\" + id).show();
|
||||
});
|
||||
|
||||
var refr =" . $refr . ";
|
||||
var pure =" . $pure_var . ";
|
||||
var href ='" . ui_get_url_refresh ($ignored_params) . "';
|
||||
|
||||
if (pure) {
|
||||
var startCountDown = function (duration, cb) {
|
||||
$('div.vc-countdown').countdown('destroy');
|
||||
if (!duration) return;
|
||||
var t = new Date();
|
||||
t.setTime(t.getTime() + duration * 1000);
|
||||
$('div.vc-countdown').countdown({
|
||||
until: t,
|
||||
format: 'MS',
|
||||
layout: '(%M%nn%M:%S%nn%S" . __('Until refresh') . ") ',
|
||||
alwaysExpire: true,
|
||||
onExpiry: function () {
|
||||
$('div.vc-countdown').countdown('destroy');
|
||||
url = js_html_entity_decode( href ) + duration;
|
||||
$(document).attr (\"location\", url);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
startCountDown(refr, false);
|
||||
var controls = document.getElementById('vc-controls');
|
||||
autoHideElement(controls, 1000);
|
||||
|
||||
$('select#refresh').change(function (event) {
|
||||
refr = Number.parseInt(event.target.value, 10);
|
||||
startCountDown(refr, false);
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
||||
var agentes_id = $(\"#id_agents2\").val();
|
||||
var id_agentes = $.get(\"full_agents_id\");
|
||||
if (agentes_id === null && id_agentes !== null) {
|
||||
id_agentes = id_agentes.split(\";\")
|
||||
id_agentes.forEach(function(element) {
|
||||
$(\"#id_agents2 option[value=\"+ element +\"]\").attr(\"selected\",true);
|
||||
});
|
||||
|
||||
selection_agent_module();
|
||||
}
|
||||
|
||||
$('#refresh').change(function () {
|
||||
$('#hidden-vc_refr').val($('#refresh option:selected').val());
|
||||
});
|
||||
}
|
||||
|
||||
$(\"#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\" : \"_\",
|
||||
\"recursion\" : $('#checkbox-recursion').is(':checked')
|
||||
},
|
||||
function (data, status) {
|
||||
$(\"#id_agents2\").html('');
|
||||
$(\"#module\").html('');
|
||||
jQuery.each (data, function (id, value) {
|
||||
// Remove keys_prefix from the index
|
||||
id = id.substring(1);
|
||||
|
||||
option = $(\"<option></option>\")
|
||||
.attr (\"value\", value[\"id_agente\"])
|
||||
.html (value[\"alias\"]);
|
||||
$(\"#id_agents\").append (option);
|
||||
$(\"#id_agents2\").append (option);
|
||||
});
|
||||
},
|
||||
\"json\"
|
||||
);
|
||||
});
|
||||
|
||||
$(\"#checkbox-recursion\").change (function () {
|
||||
jQuery.post (\"ajax.php\",
|
||||
{\"page\" : \"operation/agentes/ver_agente\",
|
||||
\"get_agents_group_json\" : 1,
|
||||
\"id_group\" : $(\"#group_id\").val(),
|
||||
\"privilege\" : \"AW\",
|
||||
\"keys_prefix\" : \"_\",
|
||||
\"recursion\" : $('#checkbox-recursion').is(':checked')
|
||||
},
|
||||
function (data, status) {
|
||||
$(\"#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\",
|
||||
\"get_modules_group_json\" : 1,
|
||||
\"id_module_group\" : this.value,
|
||||
\"id_agents\" : $(\"#id_agents2\").val(),
|
||||
\"selection\" : $(\"#selection_agent_module\").val()
|
||||
},
|
||||
function (data, status) {
|
||||
$(\"#module\").html('');
|
||||
if(data){
|
||||
jQuery.each (data, function (id, value) {
|
||||
option = $(\"<option></option>\")
|
||||
.attr (\"value\", value[\"id_agente_modulo\"])
|
||||
.html (value[\"nombre\"]);
|
||||
$(\"#module\").append (option);
|
||||
});
|
||||
}
|
||||
},
|
||||
\"json\"
|
||||
);
|
||||
});
|
||||
|
||||
$(\"#id_agents2\").click (function(){
|
||||
selection_agent_module();
|
||||
});
|
||||
|
||||
$(\"#selection_agent_module\").change(function() {
|
||||
jQuery.post (\"ajax.php\",
|
||||
{\"page\" : \"operation/agentes/ver_agente\",
|
||||
\"get_modules_group_json\" : 1,
|
||||
\"id_module_group\" : $(\"#modulegroup\").val(),
|
||||
\"id_agents\" : $(\"#id_agents2\").val(),
|
||||
\"selection\" : $(\"#selection_agent_module\").val()
|
||||
},
|
||||
function (data, status) {
|
||||
$(\"#module\").html('');
|
||||
if(data){
|
||||
jQuery.each (data, function (id, value) {
|
||||
option = $(\"<option></option>\")
|
||||
.attr (\"value\", value[\"id_agente_modulo\"])
|
||||
.html (value[\"nombre\"]);
|
||||
$(\"#module\").append (option);
|
||||
});
|
||||
}
|
||||
},
|
||||
\"json\"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
function selection_agent_module() {
|
||||
jQuery.post (\"ajax.php\",
|
||||
{\"page\" : \"operation/agentes/ver_agente\",
|
||||
\"get_modules_group_json\" : 1,
|
||||
\"id_module_group\" : $(\"#modulegroup\").val(),
|
||||
\"id_agents\" : $(\"#id_agents2\").val(),
|
||||
\"selection\" : $(\"#selection_agent_module\").val()
|
||||
},
|
||||
function (data, status) {
|
||||
$(\"#module\").html('');
|
||||
if(data){
|
||||
jQuery.each (data, function (id, value) {
|
||||
option = $(\"<option></option>\")
|
||||
.attr (\"value\", value[\"id_agente_modulo\"])
|
||||
.html (value[\"nombre\"]);
|
||||
$(\"#module\").append (option);
|
||||
});
|
||||
|
||||
var id_modules = $.get(\"full_modules_selected\");
|
||||
if(id_modules !== null) {
|
||||
id_modules = id_modules.split(\";\");
|
||||
id_modules.forEach(function(element) {
|
||||
$(\"#module option[value=\"+ element +\"]\").attr(\"selected\",true);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
\"json\"
|
||||
);
|
||||
}
|
||||
|
||||
(function($) {
|
||||
$.get = function(key) {
|
||||
key = key.replace(/[\[]/, '\\[');
|
||||
key = key.replace(/[\]]/, '\\]');
|
||||
var pattern = \"[\\?&]\" + key + \"=([^&#]*)\";
|
||||
var regex = new RegExp(pattern);
|
||||
var url = unescape(window.location.href);
|
||||
var results = regex.exec(url);
|
||||
if (results === null) {
|
||||
return null;
|
||||
} else {
|
||||
return results[1];
|
||||
}
|
||||
}
|
||||
})(jQuery);
|
||||
</script>
|
||||
";
|
||||
";
|
||||
}
|
||||
|
||||
extensions_add_operation_menu_option(__("Agents/Modules view"), 'estado', 'agents_modules/icon_menu.png', "v1r1","view");
|
||||
|
@ -629,213 +831,4 @@ extensions_add_main_function('mainAgentsModules');
|
|||
|
||||
$ignored_params['refresh']='';
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
var refr = <?php echo (int)$refr; ?>;
|
||||
var pure = <?php echo (int) $config['pure']; ?>;
|
||||
var href = "<?php echo ui_get_url_refresh ($ignored_params); ?>";
|
||||
|
||||
|
||||
if (pure) {
|
||||
var startCountDown = function (duration, cb) {
|
||||
$('div.vc-countdown').countdown('destroy');
|
||||
if (!duration) return;
|
||||
var t = new Date();
|
||||
t.setTime(t.getTime() + duration * 1000);
|
||||
$('div.vc-countdown').countdown({
|
||||
until: t,
|
||||
format: 'MS',
|
||||
layout: '(%M%nn%M:%S%nn%S <?php echo __('Until refresh'); ?>) ',
|
||||
alwaysExpire: true,
|
||||
onExpiry: function () {
|
||||
$('div.vc-countdown').countdown('destroy');
|
||||
url = js_html_entity_decode( href ) + duration;
|
||||
$(document).attr ("location", url);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
startCountDown(refr, false);
|
||||
//~ // Auto hide controls
|
||||
var controls = document.getElementById('vc-controls');
|
||||
autoHideElement(controls, 1000);
|
||||
|
||||
$('select#refresh').change(function (event) {
|
||||
refr = Number.parseInt(event.target.value, 10);
|
||||
startCountDown(refr, false);
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
||||
var agentes_id = $("#id_agents2").val();
|
||||
var id_agentes = $.get("full_agents_id");
|
||||
if (agentes_id === null && id_agentes !== null) {
|
||||
id_agentes = id_agentes.split(";")
|
||||
id_agentes.forEach(function(element) {
|
||||
$("#id_agents2 option[value="+ element +"]").attr("selected",true);
|
||||
});
|
||||
|
||||
selection_agent_module();
|
||||
}
|
||||
|
||||
$('#refresh').change(function () {
|
||||
$('#hidden-vc_refr').val($('#refresh option:selected').val());
|
||||
});
|
||||
}
|
||||
|
||||
$("#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" : "_",
|
||||
"recursion" : $('#checkbox-recursion').is(':checked')
|
||||
},
|
||||
function (data, status) {
|
||||
$("#id_agents2").html('');
|
||||
$("#module").html('');
|
||||
jQuery.each (data, function (id, value) {
|
||||
// Remove keys_prefix from the index
|
||||
id = id.substring(1);
|
||||
|
||||
option = $("<option></option>")
|
||||
.attr ("value", value["id_agente"])
|
||||
.html (value["alias"]);
|
||||
$("#id_agents").append (option);
|
||||
$("#id_agents2").append (option);
|
||||
});
|
||||
},
|
||||
"json"
|
||||
);
|
||||
});
|
||||
|
||||
$("#checkbox-recursion").change (function () {
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/agentes/ver_agente",
|
||||
"get_agents_group_json" : 1,
|
||||
"id_group" : $("#group_id").val(),
|
||||
"privilege" : "AW",
|
||||
"keys_prefix" : "_",
|
||||
"recursion" : $('#checkbox-recursion').is(':checked')
|
||||
},
|
||||
function (data, status) {
|
||||
$("#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",
|
||||
"get_modules_group_json" : 1,
|
||||
"id_module_group" : this.value,
|
||||
"id_agents" : $("#id_agents2").val(),
|
||||
"selection" : $("#selection_agent_module").val()
|
||||
},
|
||||
function (data, status) {
|
||||
$("#module").html('');
|
||||
if(data){
|
||||
jQuery.each (data, function (id, value) {
|
||||
option = $("<option></option>")
|
||||
.attr ("value", value["id_agente_modulo"])
|
||||
.html (value["nombre"]);
|
||||
$("#module").append (option);
|
||||
});
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
});
|
||||
|
||||
$("#id_agents2").click (function(){
|
||||
selection_agent_module();
|
||||
});
|
||||
|
||||
$("#selection_agent_module").change(function() {
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/agentes/ver_agente",
|
||||
"get_modules_group_json" : 1,
|
||||
"id_module_group" : $("#modulegroup").val(),
|
||||
"id_agents" : $("#id_agents2").val(),
|
||||
"selection" : $("#selection_agent_module").val()
|
||||
},
|
||||
function (data, status) {
|
||||
$("#module").html('');
|
||||
if(data){
|
||||
jQuery.each (data, function (id, value) {
|
||||
option = $("<option></option>")
|
||||
.attr ("value", value["id_agente_modulo"])
|
||||
.html (value["nombre"]);
|
||||
$("#module").append (option);
|
||||
});
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function selection_agent_module() {
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/agentes/ver_agente",
|
||||
"get_modules_group_json" : 1,
|
||||
"id_module_group" : $("#modulegroup").val(),
|
||||
"id_agents" : $("#id_agents2").val(),
|
||||
"selection" : $("#selection_agent_module").val()
|
||||
},
|
||||
function (data, status) {
|
||||
$("#module").html('');
|
||||
if(data){
|
||||
jQuery.each (data, function (id, value) {
|
||||
option = $("<option></option>")
|
||||
.attr ("value", value["id_agente_modulo"])
|
||||
.html (value["nombre"]);
|
||||
$("#module").append (option);
|
||||
});
|
||||
|
||||
var id_modules = $.get("full_modules_selected");
|
||||
if(id_modules !== null) {
|
||||
id_modules = id_modules.split(";");
|
||||
id_modules.forEach(function(element) {
|
||||
$("#module option[value="+ element +"]").attr("selected",true);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
|
||||
(function($) {
|
||||
$.get = function(key) {
|
||||
key = key.replace(/[\[]/, '\\[');
|
||||
key = key.replace(/[\]]/, '\\]');
|
||||
var pattern = "[\\?&]" + key + "=([^&#]*)";
|
||||
var regex = new RegExp(pattern);
|
||||
var url = unescape(window.location.href);
|
||||
var results = regex.exec(url);
|
||||
if (results === null) {
|
||||
return null;
|
||||
} else {
|
||||
return results[1];
|
||||
}
|
||||
}
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
?>
|
|
@ -259,80 +259,60 @@ 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 set the type with %s.',
|
||||
$name_field, $table, $value));
|
||||
ui_print_info_message(
|
||||
__('You can execute this SQL query for to fix.') . "<br />" .
|
||||
'<pre>' .
|
||||
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $value . ";" .
|
||||
'</pre>'
|
||||
);
|
||||
break;
|
||||
case 'null':
|
||||
ui_print_error_message(
|
||||
__('Unsuccessful the field %s in the table %s must be null: (%s).',
|
||||
$name_field, $table, $value));
|
||||
$info_message = "";
|
||||
$error_message = "";
|
||||
if($diff['type']){
|
||||
$error_message .= "Unsuccessful the field ".$name_field." in the table ".$table." must be set the type with ".$diff['type']."<br>";
|
||||
}
|
||||
|
||||
if($diff['null']){
|
||||
$error_message .= "Unsuccessful the field $name_field in the table $table must be null: (".$diff['null'].").<br>";
|
||||
}
|
||||
|
||||
if($diff['default']){
|
||||
$error_message .= "Unsuccessful the field $name_field in the table $table must be set ".$diff['default']." as default value.<br>";
|
||||
}
|
||||
|
||||
if($field_test['null'] == "YES" || !isset($field_test['null']) || $field_test['null'] == ""){
|
||||
$null_defect = " NULL";
|
||||
}
|
||||
else{
|
||||
$null_defect = " NOT NULL";
|
||||
}
|
||||
|
||||
if(!isset($field_test['default']) || $field_test['default'] == ""){
|
||||
$default_value = "";
|
||||
}
|
||||
else{
|
||||
$default_value = " DEFAULT ".$field_test['default'];
|
||||
}
|
||||
|
||||
if($diff['type'] || $diff['null'] || $diff['default']){
|
||||
$info_message .= "ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . $null_defect . $default_value.";";
|
||||
}
|
||||
|
||||
if($diff['key']){
|
||||
$error_message .= "Unsuccessful the field $name_field in the table $table must be set the key as defined in the SQL file.<br>";
|
||||
$info_message .= "<br><br>Please check the SQL file for to know the kind of key needed.";
|
||||
}
|
||||
|
||||
if($diff['extra']){
|
||||
$error_message .= "Unsuccessful the field $name_field in the table $table must be set as defined in the SQL file.<br>";
|
||||
$info_message .= "<br><br>Please check the SQL file for to know the kind of extra config needed.";
|
||||
}
|
||||
|
||||
ui_print_error_message(
|
||||
__($error_message));
|
||||
|
||||
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 . " " . $field_test['type'] . " NULL;" .
|
||||
'</pre>'
|
||||
);
|
||||
}
|
||||
else {
|
||||
ui_print_info_message(
|
||||
__('You can execute this SQL query for to fix.') . "<br />" .
|
||||
'<pre>' .
|
||||
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . " NOT NULL;" .
|
||||
'</pre>'
|
||||
);
|
||||
}
|
||||
ui_print_info_message(
|
||||
__($info_message));
|
||||
|
||||
break;
|
||||
case 'key':
|
||||
ui_print_error_message(
|
||||
__('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 set %s as default value.',
|
||||
$name_field, $table, $value));
|
||||
ui_print_info_message(
|
||||
__('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 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.'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($correct_fields) {
|
||||
ui_print_success_message(
|
||||
|
@ -366,4 +346,4 @@ function extension_db_status_execute_sql_file($url, $connection) {
|
|||
|
||||
extensions_add_godmode_function('extension_db_status');
|
||||
extensions_add_godmode_menu_option(__('DB Schema check'), 'DM', 'gextensions', null, "v1r1", 'gdbman');
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -154,100 +154,105 @@ function main_net_tools () {
|
|||
$operation = get_parameter ("operation", 0);
|
||||
$community = get_parameter ("community", "public");
|
||||
$ip = get_parameter("select_ips");
|
||||
|
||||
switch($operation) {
|
||||
case 1:
|
||||
$traceroute = whereis_the_command ('traceroute');
|
||||
if (empty($traceroute)) {
|
||||
ui_print_error_message(__('Traceroute executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<h3>".__("Traceroute to "). $ip. "</h3>";
|
||||
echo "<pre>";
|
||||
echo system ("$traceroute $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
$ping = whereis_the_command ('ping');
|
||||
if (empty($ping)) {
|
||||
ui_print_error_message(__('Ping executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<h3>" . __("Ping to %s", $ip) . "</h3>";
|
||||
echo "<pre>";
|
||||
echo system ("$ping -c 5 $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
$nmap = whereis_the_command ('nmap');
|
||||
if (empty($nmap)) {
|
||||
ui_print_error_message(__('Nmap executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<h3>".__("Basic TCP Scan on "). $ip. "</h3>";
|
||||
echo "<pre>";
|
||||
echo system ("$nmap -F $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
echo "<h3>".__("Domain and IP information for "). $ip. "</h3>";
|
||||
|
||||
$dig = whereis_the_command ('dig');
|
||||
if (empty($dig)) {
|
||||
ui_print_error_message(__('Dig executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<pre>";
|
||||
echo system ("dig $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
|
||||
$whois = whereis_the_command ('whois');
|
||||
if (empty($whois)) {
|
||||
ui_print_error_message(__('Whois executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<pre>";
|
||||
echo system ("whois $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
echo "<h3>".__("SNMP information for "). $ip. "</h3>";
|
||||
|
||||
$snmpget = whereis_the_command ('snmpget');
|
||||
if (empty($snmpget)) {
|
||||
ui_print_error_message(__('SNMPget executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<h4>" . __("Uptime") . "</h4>";
|
||||
echo "<pre>";
|
||||
echo exec ("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.3.0 ");
|
||||
echo "</pre>";
|
||||
echo "<h4>" . __("Device info") . "</h4>";
|
||||
echo "<pre>";
|
||||
|
||||
echo system ("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.1.0 ");
|
||||
echo "</pre>";
|
||||
|
||||
echo "<h4>Interface Information</h4>";
|
||||
echo "<table class=databox>";
|
||||
echo "<tr><th>".__("Interface");
|
||||
echo "<th>".__("Status");
|
||||
|
||||
$int_max = exec ("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.1.0 ");
|
||||
|
||||
for ($ax=0; $ax < $int_max; $ax++) {
|
||||
$interface = exec ("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.2.$ax ");
|
||||
$estado = exec ("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.8.$ax ");
|
||||
echo "<tr><td>$interface<td>$estado";
|
||||
|
||||
if(!validate_address($ip)){
|
||||
ui_print_error_message(__('The ip or dns name entered cannot be resolved'));
|
||||
}
|
||||
else{
|
||||
switch($operation) {
|
||||
case 1:
|
||||
$traceroute = whereis_the_command ('traceroute');
|
||||
if (empty($traceroute)) {
|
||||
ui_print_error_message(__('Traceroute executable does not exist.'));
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
break;
|
||||
else {
|
||||
echo "<h3>".__("Traceroute to "). $ip. "</h3>";
|
||||
echo "<pre>";
|
||||
echo system ("$traceroute $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
$ping = whereis_the_command ('ping');
|
||||
if (empty($ping)) {
|
||||
ui_print_error_message(__('Ping executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<h3>" . __("Ping to %s", $ip) . "</h3>";
|
||||
echo "<pre>";
|
||||
echo system ("$ping -c 5 $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
$nmap = whereis_the_command ('nmap');
|
||||
if (empty($nmap)) {
|
||||
ui_print_error_message(__('Nmap executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<h3>".__("Basic TCP Scan on "). $ip. "</h3>";
|
||||
echo "<pre>";
|
||||
echo system ("$nmap -F $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
echo "<h3>".__("Domain and IP information for "). $ip. "</h3>";
|
||||
|
||||
$dig = whereis_the_command ('dig');
|
||||
if (empty($dig)) {
|
||||
ui_print_error_message(__('Dig executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<pre>";
|
||||
echo system ("dig $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
|
||||
$whois = whereis_the_command ('whois');
|
||||
if (empty($whois)) {
|
||||
ui_print_error_message(__('Whois executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<pre>";
|
||||
echo system ("whois $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
echo "<h3>".__("SNMP information for "). $ip. "</h3>";
|
||||
|
||||
$snmpget = whereis_the_command ('snmpget');
|
||||
if (empty($snmpget)) {
|
||||
ui_print_error_message(__('SNMPget executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<h4>" . __("Uptime") . "</h4>";
|
||||
echo "<pre>";
|
||||
echo exec ("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.3.0 ");
|
||||
echo "</pre>";
|
||||
echo "<h4>" . __("Device info") . "</h4>";
|
||||
echo "<pre>";
|
||||
|
||||
echo system ("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.1.0 ");
|
||||
echo "</pre>";
|
||||
|
||||
echo "<h4>Interface Information</h4>";
|
||||
echo "<table class=databox>";
|
||||
echo "<tr><th>".__("Interface");
|
||||
echo "<th>".__("Status");
|
||||
|
||||
$int_max = exec ("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.1.0 ");
|
||||
|
||||
for ($ax=0; $ax < $int_max; $ax++) {
|
||||
$interface = exec ("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.2.$ax ");
|
||||
$estado = exec ("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.8.$ax ");
|
||||
echo "<tr><td>$interface<td>$estado";
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
echo "</div>";
|
||||
|
|
|
@ -69,9 +69,9 @@ function pandoralogs_extension_main () {
|
|||
|
||||
ui_print_page_header (__("System logfile viewer"), "images/extensions.png", false, "", true, "" );
|
||||
|
||||
echo "<p>" . __('This tool is used just to view your Pandora FMS system logfiles directly from console') . "</p>";
|
||||
echo "<p>" . __('Use this tool to view your Pandora FMS logfiles directly on the console') . "</p>";
|
||||
|
||||
echo "<p>" . __('You can control the size information to show in general setup (Log size limit in view extension), actually ') . $config['max_log_size'] * 1000 . "B" . "</p>";
|
||||
echo "<p>" . __('You can choose the amount of information shown in general setup (Log size limit in system logs viewer extension), ' . $config['max_log_size'] * 1000 . 'B at the moment') . "</p>";
|
||||
|
||||
$logs_directory = (!empty($config["server_log_dir"])) ? io_safe_output($config["server_log_dir"]) : "/var/log/pandora";
|
||||
|
||||
|
|
|
@ -140,14 +140,19 @@ function snmpBrowserWindow () {
|
|||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 780,
|
||||
height: 430
|
||||
width: 920,
|
||||
height: 500
|
||||
});
|
||||
}
|
||||
|
||||
// Set the form OID to the value selected in the SNMP browser
|
||||
function setOID () {
|
||||
$('#text-snmp_oid').val($('#snmp_selected_oid').text());
|
||||
|
||||
if($('#snmp_browser_version').val() == '3'){
|
||||
$('#text-snmp_oid').val($('#table1-0-1').text());
|
||||
} else {
|
||||
$('#text-snmp_oid').val($('#snmp_selected_oid').text());
|
||||
}
|
||||
|
||||
// Close the SNMP browser
|
||||
$('.ui-dialog-titlebar-close').trigger('click');
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE tsnmp_filter ADD unified_filters_id int(10) NOT NULL DEFAULT 0;
|
||||
ALTER TABLE treport_content_template ADD COLUMN hide_no_data tinyint(1) DEFAULT 0;
|
||||
ALTER TABLE tgraph_source ADD COLUMN `field_order` int(10) NOT NULL default 0;
|
||||
UPDATE tgraph_source c, (SELECT @n := 0) m SET c.field_order = @n := @n + 1;
|
||||
|
||||
ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0';
|
||||
ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0';
|
||||
ALTER TABLE tgraph ADD COLUMN `modules_series` tinyint(1) UNSIGNED NOT NULL default '0';
|
||||
|
||||
COMMIT;
|
|
@ -0,0 +1,18 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tlayout` ADD `is_favourite` int(1) NOT NULL DEFAULT 0;
|
||||
|
||||
UPDATE tlayout SET is_favourite = 1 WHERE name REGEXP '^(' OR name REGEXP '^\\[';
|
||||
|
||||
SELECT max(unified_filters_id) INTO @max FROM tsnmp_filter;
|
||||
UPDATE tsnmp_filter tsf,(SELECT @max:= @max) m SET tsf.unified_filters_id = @max:= @max + 1 where tsf.unified_filters_id=0;
|
||||
|
||||
ALTER TABLE tgraph ADD COLUMN `fullscale` tinyint(1) UNSIGNED NOT NULL default '0';
|
||||
|
||||
ALTER TABLE tcontainer_item ADD COLUMN `fullscale` tinyint(1) UNSIGNED NOT NULL default '0';
|
||||
|
||||
ALTER TABLE treport_content ADD COLUMN hide_no_data tinyint(1) DEFAULT 0;
|
||||
|
||||
ALTER TABLE tagente_estado ADD COLUMN last_unknown_update bigint(20) NOT NULL default 0;
|
||||
|
||||
COMMIT;
|
|
@ -728,6 +728,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
|
|||
`lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0',
|
||||
`lapse` int(11) UNSIGNED NOT NULL default '300',
|
||||
`visual_format` tinyint(1) UNSIGNED NOT NULL default '0',
|
||||
`hide_no_data` tinyint(1) default 0,
|
||||
PRIMARY KEY(`id_rc`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -1109,6 +1110,7 @@ ALTER TABLE tserver ADD COLUMN `server_keepalive` int(11) DEFAULT 0;
|
|||
ALTER TABLE tagente_estado MODIFY `status_changes` tinyint(4) unsigned default 0;
|
||||
ALTER TABLE tagente_estado CHANGE `last_known_status` `known_status` tinyint(4) default 0;
|
||||
ALTER TABLE tagente_estado ADD COLUMN `last_known_status` tinyint(4) default 0;
|
||||
ALTER TABLE tagente_estado ADD COLUMN last_unknown_update bigint(20) NOT NULL default 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `talert_actions`
|
||||
|
@ -1233,6 +1235,9 @@ UPDATE tagente SET tagente.alias = tagente.nombre;
|
|||
-- Table `tlayout`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tlayout ADD `background_color` varchar(50) NOT NULL default '#FFF';
|
||||
ALTER TABLE tlayout ADD `is_favourite` int(1) NOT NULL DEFAULT 0;
|
||||
|
||||
UPDATE tlayout SET is_favourite = 1 WHERE name REGEXP '^(' OR name REGEXP '^\\[';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlayout_data`
|
||||
|
@ -1262,6 +1267,8 @@ UPDATE tagente_modulo SET cron_interval = '' WHERE cron_interval LIKE '% %';
|
|||
ALTER TABLE tgraph ADD COLUMN `percentil` int(4) unsigned default '0';
|
||||
ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0';
|
||||
ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0';
|
||||
ALTER TABLE tgraph ADD COLUMN `modules_series` tinyint(1) UNSIGNED NOT NULL default '0';
|
||||
ALTER TABLE tgraph ADD COLUMN `fullscale` tinyint(1) UNSIGNED NOT NULL default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tnetflow_filter`
|
||||
|
@ -1286,6 +1293,7 @@ ALTER TABLE treport_content ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAU
|
|||
ALTER TABLE treport_content ADD COLUMN `lapse_calc` tinyint(1) default '0';
|
||||
ALTER TABLE treport_content ADD COLUMN `lapse` int(11) default '300';
|
||||
ALTER TABLE treport_content ADD COLUMN `visual_format` tinyint(1) default '0';
|
||||
ALTER TABLE treport_content ADD COLUMN `hide_no_data` tinyint(1) default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmodule_relationship`
|
||||
|
@ -1403,6 +1411,7 @@ CREATE TABLE IF NOT EXISTS `tcontainer_item` (
|
|||
`agent` varchar(100) NOT NULL default '',
|
||||
`module` varchar(100) NOT NULL default '',
|
||||
`id_tag` integer(10) unsigned NOT NULL DEFAULT 0,
|
||||
`fullscale` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
PRIMARY KEY(`id_ci`),
|
||||
FOREIGN KEY (`id_container`) REFERENCES tcontainer(`id_container`)
|
||||
ON DELETE CASCADE
|
||||
|
@ -1433,6 +1442,7 @@ ALTER TABLE tserver_export MODIFY `name` varchar(600) BINARY NOT NULL default ''
|
|||
-- ---------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE tgraph_source ADD COLUMN id_server int(11) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE tgraph_source ADD COLUMN `field_order` int(10) NOT NULL default 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tserver_export_data`
|
||||
|
@ -1466,3 +1476,9 @@ INSERT INTO ttipo_modulo VALUES (25,'web_analysis', 8, 'Web analysis data', 'mod
|
|||
-- Table `tdashboard`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE `tdashboard` ADD COLUMN `cells_slideshow` TINYINT(1) NOT NULL default 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tsnmp_filter`
|
||||
-- ---------------------------------------------------------------------
|
||||
SELECT max(unified_filters_id) INTO @max FROM tsnmp_filter;
|
||||
UPDATE tsnmp_filter tsf,(SELECT @max:= @max) m SET tsf.unified_filters_id = @max:= @max + 1 where tsf.unified_filters_id=0;
|
||||
|
|
|
@ -388,6 +388,12 @@ config_check();
|
|||
$do_refresh = false;
|
||||
}
|
||||
}
|
||||
|
||||
$new_dashboard = get_parameter('new_dashboard',0);
|
||||
|
||||
if ($_GET['sec2'] == 'enterprise/dashboard/main_dashboard' && $new_dashboard) {
|
||||
$do_refresh = false;
|
||||
}
|
||||
|
||||
if ($do_refresh) {
|
||||
?>
|
||||
|
|
|
@ -25,6 +25,24 @@ include_once($homedir . 'include/functions_ui.php');
|
|||
include_once($homedir . 'include/functions.php');
|
||||
include_once($homedir . 'include/functions_html.php');
|
||||
|
||||
|
||||
if($config['visual_animation']){
|
||||
echo
|
||||
'<style>
|
||||
@keyframes login_move {
|
||||
from {margin-left: 10%;margin-right: 10%;opacity:0.1}
|
||||
to {margin-left: 5%;margin-right: 5%;opacity:1}
|
||||
}
|
||||
|
||||
|
||||
div.container_login{
|
||||
animation-name: login_move;
|
||||
animation-duration: 3s;
|
||||
}
|
||||
</style>';
|
||||
}
|
||||
|
||||
|
||||
if (!isset($login_screen)) {
|
||||
$login_screen = 'login';
|
||||
}
|
||||
|
|
|
@ -168,9 +168,6 @@ if(!$new_agent && $alias != ''){
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Remote configuration available
|
||||
if (!$new_agent) {
|
||||
if (isset($filename)) {
|
||||
|
|
|
@ -67,7 +67,7 @@ if ($snmpwalk) {
|
|||
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
|
||||
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.4.34.1.3", $tcp_port,
|
||||
$server_to_exec);
|
||||
|
||||
|
||||
// Build a [<interface id>] => [<interface ip>] array
|
||||
if (!empty($snmp_int_ip)) {
|
||||
foreach ($snmp_int_ip as $key => $value) {
|
||||
|
@ -92,11 +92,11 @@ if ($snmpwalk) {
|
|||
$snmpis = array_merge(($snmpis === false ? array() : $snmpis), ($ifxitems === false ? array() : $ifxitems));
|
||||
|
||||
$interfaces = array();
|
||||
|
||||
|
||||
// We get here only the interface part of the MIB, not full mib
|
||||
foreach($snmpis as $key => $snmp) {
|
||||
|
||||
$data = explode(': ',$snmp);
|
||||
$data = explode (': ',$snmp, 2);
|
||||
$keydata = explode('::',$key);
|
||||
$keydata2 = explode('.',$keydata[1]);
|
||||
|
||||
|
@ -107,9 +107,8 @@ if ($snmpwalk) {
|
|||
|
||||
if (array_key_exists(1,$data)) {
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = $data[0];
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[1];
|
||||
}
|
||||
else {
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[1];
|
||||
} else {
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = '';
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[0];
|
||||
}
|
||||
|
|
|
@ -151,11 +151,21 @@ $module_macros = array ();
|
|||
|
||||
// Create agent
|
||||
if ($create_agent) {
|
||||
$mssg_warning = 0;
|
||||
$alias = (string) get_parameter_post("alias",'');
|
||||
$alias_as_name = (int) get_parameter_post("alias_as_name", 0);
|
||||
$direccion_agente = (string) get_parameter_post("direccion",'');
|
||||
|
||||
//safe_output only validate ip
|
||||
$direccion_agente = trim(io_safe_output($direccion_agente));
|
||||
|
||||
if(!validate_address($direccion_agente)){
|
||||
$mssg_warning = 1;
|
||||
}
|
||||
|
||||
//safe-input before validate ip
|
||||
$direccion_agente = io_safe_input($direccion_agente);
|
||||
|
||||
$nombre_agente = hash("sha256",$alias . "|" .$direccion_agente ."|". time() ."|". sprintf("%04d", rand(0,10000)));
|
||||
$grupo = (int) get_parameter_post ("grupo");
|
||||
$intervalo = (string) get_parameter_post ("intervalo", SECONDS_5MINUTES);
|
||||
|
@ -184,7 +194,7 @@ if ($create_agent) {
|
|||
foreach ($fields as $field) {
|
||||
$field_values[$field['id_field']] = (string) get_parameter_post ('customvalue_'.$field['id_field'], '');
|
||||
}
|
||||
|
||||
|
||||
// Check if agent exists (BUG WC-50518-2)
|
||||
if ($alias == "") {
|
||||
$agent_creation_error = __('No agent alias specified');
|
||||
|
@ -232,9 +242,9 @@ if ($create_agent) {
|
|||
if ($id_agente !== false) {
|
||||
// Create custom fields for this agent
|
||||
foreach ($field_values as $key => $value) {
|
||||
db_process_sql_insert ('tagent_custom_data',
|
||||
array('id_field' => $key, 'id_agent' => $id_agente,
|
||||
'description' => $value));
|
||||
$update_custom = db_process_sql_insert ('tagent_custom_data',
|
||||
array('id_field' => $key, 'id_agent' => $id_agente,
|
||||
'description' => $value));
|
||||
}
|
||||
// Create address for this agent in taddress
|
||||
if ( $direccion_agente != '') {
|
||||
|
@ -637,6 +647,10 @@ if ($create_agent) {
|
|||
ui_print_result_message ($agent_created_ok,
|
||||
__('Successfully created'),
|
||||
$agent_creation_error);
|
||||
|
||||
if($mssg_warning){
|
||||
ui_print_warning_message(__('The ip or dns name entered cannot be resolved'));
|
||||
}
|
||||
}
|
||||
|
||||
// Fix / Normalize module data
|
||||
|
@ -678,13 +692,22 @@ $update_agent = (bool) get_parameter ('update_agent');
|
|||
|
||||
// Update AGENT
|
||||
if ($update_agent) { // if modified some agent paramenter
|
||||
$mssg_warning = 0;
|
||||
$id_agente = (int) get_parameter_post ("id_agente");
|
||||
$nombre_agente = str_replace('`','‘',(string) get_parameter_post ("agente", ""));
|
||||
$alias = str_replace('`','‘',(string) get_parameter_post ("alias", ""));
|
||||
$alias_as_name = (int) get_parameter_post ('alias_as_name', 0);
|
||||
$direccion_agente = (string) get_parameter_post ("direccion", '');
|
||||
//safe_output only validate ip
|
||||
$direccion_agente = trim(io_safe_output($direccion_agente));
|
||||
|
||||
if(!validate_address($direccion_agente)){
|
||||
$mssg_warning = 1;
|
||||
}
|
||||
|
||||
//safe-input before validate ip
|
||||
$direccion_agente = io_safe_input($direccion_agente);
|
||||
|
||||
$address_list = (string) get_parameter_post ("address_list", '');
|
||||
|
||||
if ($address_list != $direccion_agente &&
|
||||
|
@ -728,22 +751,29 @@ if ($update_agent) { // if modified some agent paramenter
|
|||
$field_values[$field['id_field']] = (string) get_parameter_post ('customvalue_'.$field['id_field'], '');
|
||||
}
|
||||
|
||||
|
||||
foreach ($field_values as $key => $value) {
|
||||
$old_value = db_get_all_rows_filter('tagent_custom_data',
|
||||
array('id_agent' => $id_agente, 'id_field' => $key));
|
||||
|
||||
if ($old_value === false) {
|
||||
// Create custom field if not exist
|
||||
db_process_sql_insert ('tagent_custom_data',
|
||||
$update_custom = db_process_sql_insert ('tagent_custom_data',
|
||||
array('id_field' => $key,'id_agent' => $id_agente, 'description' => $value));
|
||||
}
|
||||
else {
|
||||
db_process_sql_update ('tagent_custom_data',
|
||||
$update_custom = db_process_sql_update ('tagent_custom_data',
|
||||
array('description' => $value),
|
||||
array('id_field' => $key,'id_agent' => $id_agente));
|
||||
|
||||
if($update_custom == 1){
|
||||
$update_custom_result = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($mssg_warning){
|
||||
ui_print_warning_message(__('The ip or dns name entered cannot be resolved'));
|
||||
}
|
||||
|
||||
//Verify if there is another agent with the same name but different ID
|
||||
if ($alias == "") {
|
||||
|
@ -799,14 +829,16 @@ 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 && $update_custom_result == false) {
|
||||
ui_print_error_message(
|
||||
__('There was a problem updating the agent'));
|
||||
}
|
||||
else {
|
||||
// Update the agent from the metaconsole cache
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
enterprise_hook ('agent_update_from_cache', array($id_agente, $values));
|
||||
enterprise_hook ('agent_update_from_cache', array($id_agente, $values,$server_name));
|
||||
|
||||
if ($old_interval != $intervalo) {
|
||||
enterprise_hook('config_agents_update_config_interval', array($id_agente, $intervalo));
|
||||
|
@ -996,7 +1028,7 @@ if ($update_module || $create_module) {
|
|||
|
||||
$custom_string_2 = (string) get_parameter ('custom_string_2', $custom_string_2_default);
|
||||
$custom_string_3 = (string) get_parameter ('custom_string_3', $custom_string_3_default);
|
||||
$custom_integer_2 = (int) get_parameter ('custom_integer_2', $custom_integer_2_default);
|
||||
$custom_integer_2 = (int) get_parameter ('custom_integer_2', 0);
|
||||
|
||||
// Get macros
|
||||
$macros = (string) get_parameter ('macros');
|
||||
|
|
|
@ -24,6 +24,7 @@ $sortField = get_parameter('sort_field');
|
|||
$sort = get_parameter('sort', 'none');
|
||||
$recursion = (bool) get_parameter('recursion',false);
|
||||
$disabled = get_parameter('disabled', 0);
|
||||
$os = get_parameter('os', 0);
|
||||
|
||||
if ($ag_group == -1 )
|
||||
$ag_group = (int) get_parameter ("ag_group", -1);
|
||||
|
@ -66,6 +67,14 @@ $agent_to_delete = (int)get_parameter('borrar_agente');
|
|||
$enable_agent = (int)get_parameter('enable_agent');
|
||||
$disable_agent = (int)get_parameter('disable_agent');
|
||||
|
||||
if($disable_agent != 0){
|
||||
$server_name = db_get_row_sql('select server_name from tagente where id_agente = '.$disable_agent);
|
||||
}
|
||||
elseif ($enable_agent != 0) {
|
||||
$server_name = db_get_row_sql('select server_name from tagente where id_agente = '.$enable_agent);
|
||||
}
|
||||
|
||||
|
||||
$result = null;
|
||||
|
||||
if ($agent_to_delete) {
|
||||
|
@ -105,7 +114,7 @@ if ($enable_agent) {
|
|||
// Update the agent from the metaconsole cache
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
$values = array('disabled' => 0);
|
||||
enterprise_hook ('agent_update_from_cache', array($enable_agent, $values));
|
||||
enterprise_hook ('agent_update_from_cache', array($enable_agent, $values,$server_name));
|
||||
|
||||
db_pandora_audit("Agent management", 'Enable ' . $alias);
|
||||
}
|
||||
|
@ -125,7 +134,7 @@ if ($disable_agent) {
|
|||
// Update the agent from the metaconsole cache
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
$values = array('disabled' => 1);
|
||||
enterprise_hook ('agent_update_from_cache', array($disable_agent, $values));
|
||||
enterprise_hook ('agent_update_from_cache', array($disable_agent, $values,$server_name));
|
||||
|
||||
db_pandora_audit("Agent management", 'Disable ' . $alias);
|
||||
}
|
||||
|
@ -163,6 +172,20 @@ html_print_select($fields,"disabled",$disabled,'this.form.submit()');
|
|||
|
||||
echo "</td>";
|
||||
|
||||
echo "<td>";
|
||||
echo __('Operative System') . ' ';
|
||||
|
||||
$pre_fields = db_get_all_rows_sql('select distinct(tagente.id_os),tconfig_os.description from tagente,tconfig_os where tagente.id_os = tconfig_os.id_os');
|
||||
$fields = array();
|
||||
|
||||
foreach ($pre_fields as $key => $value) {
|
||||
$fields[$value['id_os']] = $value['description'];
|
||||
}
|
||||
|
||||
html_print_select($fields,"os",$os,'this.form.submit()','All',0);
|
||||
|
||||
echo "</td>";
|
||||
|
||||
echo "<td>";
|
||||
echo __('Recursion') . ' ';
|
||||
html_print_checkbox ("recursion", 1, $recursion, false, false, 'this.form.submit()');
|
||||
|
@ -171,6 +194,8 @@ echo "</td><td>";
|
|||
echo __('Search') . ' ';
|
||||
html_print_input_text ("search", $search, '', 12);
|
||||
|
||||
echo ui_print_help_tip(__('Search filter by alias, name, description, IP address or custom fields content'), true);
|
||||
|
||||
echo "</td><td>";
|
||||
echo "<input name='srcbutton' type='submit' class='sub search' value='".__('Search')."'>";
|
||||
echo "</form>";
|
||||
|
@ -296,20 +321,26 @@ if ($search != "") {
|
|||
}else{
|
||||
$search_sql = " AND ( nombre " . $order_collation . "
|
||||
LIKE LOWER('%$search%') OR alias " . $order_collation . "
|
||||
LIKE LOWER('%$search%')) ";
|
||||
LIKE LOWER('%$search%') OR comentarios " . $order_collation . " LIKE LOWER('%$search%')
|
||||
OR EXISTS (SELECT * FROM tagent_custom_data
|
||||
WHERE id_agent = id_agente AND description LIKE '%$search%'))";
|
||||
}
|
||||
}
|
||||
|
||||
if ($disabled == 1)
|
||||
{
|
||||
$search_sql = " AND disabled = ". $disabled . $search_sql;
|
||||
$search_sql .= " AND disabled = ". $disabled . $search_sql;
|
||||
}
|
||||
else {
|
||||
if ($disabled == 0) {
|
||||
$search_sql = " AND disabled = 0" . $search_sql;
|
||||
$search_sql .= " AND disabled = 0" . $search_sql;
|
||||
}
|
||||
}
|
||||
|
||||
if($os != 0){
|
||||
$search_sql .= " AND id_os = " . $os;
|
||||
}
|
||||
|
||||
// Show only selected groups
|
||||
if ($ag_group > 0) {
|
||||
|
||||
|
@ -471,27 +502,27 @@ if (($config['dbtype'] == 'oracle') && ($agents !== false)) {
|
|||
}
|
||||
|
||||
// Prepare pagination
|
||||
ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled", $offset);
|
||||
ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
|
||||
|
||||
if ($agents !== false) {
|
||||
|
||||
echo "<table cellpadding='4' id='agent_list' cellspacing='4' width='100%' class='databox data'>";
|
||||
echo "<th>".__('Agent name') . ' ' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=name&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
||||
echo "</th>";
|
||||
echo "<th title='".__('Remote agent configuration')."'>".__('R'). ' ' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=remote&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectRemoteUp)) . '</a>' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=remote&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectRemoteDown)) . '</a>';
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectRemoteUp)) . '</a>' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectRemoteDown)) . '</a>';
|
||||
echo "</th>";
|
||||
echo "<th>".__('OS'). ' ' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=os&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '</a>' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=os&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . '</a>';
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=os&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '</a>' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=os&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . '</a>';
|
||||
echo "</th>";
|
||||
echo "<th>".__('Type'). "</th>";
|
||||
echo "<th>".__('Group'). ' ' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=group&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '</a>' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=group&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . '</a>';
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '</a>' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . '</a>';
|
||||
echo "</th>";
|
||||
echo "<th>" . __('Description') . "</th>";
|
||||
echo "<th style='text-align:left'>" . __('Actions') . "</th>";
|
||||
|
@ -666,7 +697,7 @@ if ($agents !== false) {
|
|||
echo "</td>";
|
||||
}
|
||||
echo "</table>";
|
||||
ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled", $offset);
|
||||
ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
|
||||
echo "<table width='100%'><tr><td align='right'>";
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -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="350px" height="200px" style="padding:40px; padding-left: 100px; margin-bottom: 60px;"></svg>';
|
||||
$table_simple->data[4][2] = '<svg id="svg_dinamic" width="800" height="300"> </svg>';
|
||||
$table_simple->colspan[4][2] = 2;
|
||||
$table_simple->rowspan[4][2] = 3;
|
||||
}
|
||||
|
@ -590,8 +590,7 @@ $table_advanced->colspan[10][1] = 6;
|
|||
if (isset($id_agente) && $moduletype == MODULE_DATA) {
|
||||
$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"]));
|
||||
if ($has_remote_conf) {
|
||||
$table_advanced->data[11][0] = __('Cron from') .
|
||||
ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
|
||||
$table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true);
|
||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
|
||||
$table_advanced->colspan[11][1] = 6;
|
||||
|
||||
|
@ -600,8 +599,7 @@ if (isset($id_agente) && $moduletype == MODULE_DATA) {
|
|||
$table_advanced->colspan[12][1] = 6;
|
||||
}
|
||||
else {
|
||||
$table_advanced->data[11][0] = __('Cron from') .
|
||||
ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
|
||||
$table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true);
|
||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, true);
|
||||
$table_advanced->colspan[11][1] = 6;
|
||||
|
||||
|
@ -611,8 +609,7 @@ if (isset($id_agente) && $moduletype == MODULE_DATA) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
$table_advanced->data[11][0] = __('Cron from') .
|
||||
ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
|
||||
$table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true);
|
||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
|
||||
$table_advanced->colspan[11][1] = 6;
|
||||
|
||||
|
@ -1178,9 +1175,10 @@ function delete_relation (num_row, id_relation) {
|
|||
|
||||
function validate_post_process() {
|
||||
var post_process = $("#text-post_process").val();
|
||||
var new_post_process = post_process.replace(',', '.');
|
||||
|
||||
$("#text-post_process").val(new_post_process);
|
||||
if(post_process !== undefined){
|
||||
var new_post_process = post_process.replace(',', '.');
|
||||
$("#text-post_process").val(new_post_process);
|
||||
}
|
||||
}
|
||||
|
||||
//function paint graph
|
||||
|
@ -1202,294 +1200,34 @@ function paint_graph_values(){
|
|||
//inicialiced error
|
||||
var error_w = 0;
|
||||
var error_c = 0;
|
||||
//if haven't error
|
||||
if(max_w == 0 || max_w > min_w){
|
||||
if(max_c == 0 || max_c > min_c){
|
||||
paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, error_w, error_c);
|
||||
} else {
|
||||
error_c = 1;
|
||||
paint_graph_status(0,0,0,0,0,0, error_w, error_c);
|
||||
}
|
||||
} else {
|
||||
error_w = 1;
|
||||
paint_graph_status(0,0,0,0,0,0, error_w, error_c);
|
||||
}
|
||||
}
|
||||
|
||||
//function use d3.js for paint graph
|
||||
function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, error_w, error_c) {
|
||||
|
||||
//Check if they are numbers
|
||||
if(isNaN(min_w)){ min_w = 0; };
|
||||
if(isNaN(max_w)){ max_w = 0; };
|
||||
if(isNaN(min_c)){ min_c = 0; };
|
||||
if(isNaN(max_c)){ max_c = 0; };
|
||||
|
||||
//messages legend
|
||||
var legend_normal = '<?php echo __("Normal Status");?>';
|
||||
var legend_warning = '<?php echo __("Warning Status");?>';
|
||||
var legend_critical = '<?php echo __("Critical Status");?>';
|
||||
|
||||
//remove elements
|
||||
d3.select("#svg_dinamic rect").remove();
|
||||
$("#text-max_warning").removeClass("input_error");
|
||||
$("#text-max_critical").removeClass("input_error");
|
||||
|
||||
//if haven't errors
|
||||
if (error_w == 0 && error_c == 0){
|
||||
//parse element
|
||||
min_w = parseFloat(min_w);
|
||||
min_c = parseFloat(min_c);
|
||||
max_w = parseFloat(max_w);
|
||||
max_c = parseFloat(max_c);
|
||||
|
||||
//inicialize var
|
||||
var range_min = 0;
|
||||
var range_max = 0;
|
||||
var range_max_min = 0;
|
||||
var range_max_min = 0;
|
||||
|
||||
//Find the lowest possible value
|
||||
if(min_w < 0 || min_c < 0){
|
||||
if(min_w < min_c){
|
||||
range_min = min_w - 100;
|
||||
} else {
|
||||
range_min = min_c - 100;
|
||||
}
|
||||
} else if (min_w > 0 || min_c > 0) {
|
||||
if(min_w > min_c){
|
||||
range_max_min = min_w;
|
||||
} else {
|
||||
range_max_min = min_c;
|
||||
}
|
||||
//messages error
|
||||
var message_error_warning = '<?php echo __("Please introduce a maximum warning higher than the minimun warning") ?>';
|
||||
var message_error_critical = '<?php echo __("Please introduce a maximum critical higher than the minimun critical") ?>';
|
||||
|
||||
//if haven't error
|
||||
if(max_w == 0 || max_w > min_w){
|
||||
if(max_c == 0 || max_c > min_c){
|
||||
paint_graph_status(min_w, max_w, min_c, max_c, inverse_w,
|
||||
inverse_c, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical);
|
||||
} else {
|
||||
if(min_w < min_c){
|
||||
range_min = min_w - 100;
|
||||
} else {
|
||||
range_min = min_c - 100;
|
||||
}
|
||||
error_c = 1;
|
||||
paint_graph_status(0,0,0,0,0,0, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical);
|
||||
}
|
||||
|
||||
//Find the maximum possible value
|
||||
if(max_w > max_c){
|
||||
range_max = max_w + 100 + range_max_min;
|
||||
} else {
|
||||
range_max = max_c + 100 + range_max_min;
|
||||
}
|
||||
|
||||
//Controls whether the maximum = 0 is infinite
|
||||
if((max_w == 0 || max_w == 0.00) && min_w != 0){
|
||||
max_w = range_max;
|
||||
}
|
||||
if((max_c == 0 || max_c == 0.00) && min_c != 0){
|
||||
max_c = range_max;
|
||||
}
|
||||
|
||||
//Scale according to the position
|
||||
position = 200 / (range_max-range_min);
|
||||
|
||||
//axes
|
||||
var yScale = d3.scale.linear()
|
||||
.domain([range_min, range_max])
|
||||
.range([100, -100]);
|
||||
|
||||
var yAxis = d3.svg.axis()
|
||||
.orient("left")
|
||||
.scale(yScale);
|
||||
|
||||
//create svg
|
||||
var svg = d3.select("#svg_dinamic");
|
||||
//delete elements
|
||||
svg.selectAll("g").remove();
|
||||
svg.selectAll("rect").remove();
|
||||
svg.selectAll("text").remove();
|
||||
svg.append("g")
|
||||
.attr("transform", "translate(0, 100)")
|
||||
.call(yAxis);
|
||||
|
||||
//legend Normal text
|
||||
svg.append("text")
|
||||
.attr("x", 0)
|
||||
.attr("y", -20)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 10)
|
||||
.html(legend_normal)
|
||||
.style("text-anchor", "first");
|
||||
|
||||
//legend Normal rect
|
||||
svg.append("rect")
|
||||
.attr("id", "legend_normal")
|
||||
.attr("x", 72)
|
||||
.attr("y", -30)
|
||||
.attr("width", '10px')
|
||||
.attr("height", '10px')
|
||||
.style("fill", "#82B92E");
|
||||
|
||||
//legend Warning text
|
||||
svg.append("text")
|
||||
.attr("x", 91)
|
||||
.attr("y", -20)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 10)
|
||||
.html(legend_warning)
|
||||
.style("text-anchor", "first");
|
||||
|
||||
//legend Warning rect
|
||||
svg.append("rect")
|
||||
.attr("id", "legend_warning")
|
||||
.attr("x", 168)
|
||||
.attr("y", -30)
|
||||
.attr("width", '10px')
|
||||
.attr("height", '10px')
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
//legend Critical text
|
||||
svg.append("text")
|
||||
.attr("x", 187)
|
||||
.attr("y", -20)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 10)
|
||||
.html(legend_critical)
|
||||
.style("text-anchor", "first");
|
||||
|
||||
//legend critical rect
|
||||
svg.append("rect")
|
||||
.attr("id", "legend_critical")
|
||||
.attr("x", 258)
|
||||
.attr("y", -30)
|
||||
.attr("width", '10px')
|
||||
.attr("height", '10px')
|
||||
.style("fill", "#fc4444");
|
||||
|
||||
//styles for number and axes
|
||||
svg.selectAll("g .domain")
|
||||
.style("stroke-width", 2)
|
||||
.style("fill", "none")
|
||||
.style("stroke", "black");
|
||||
|
||||
svg.selectAll("g .tick text")
|
||||
.style("font-size", "9pt")
|
||||
.style("font-weight", "initial");
|
||||
|
||||
//estatus normal
|
||||
svg.append("rect")
|
||||
.attr("id", "warning_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 0)
|
||||
.attr("width", '300px')
|
||||
.attr("height", '200px')
|
||||
.style("fill", "#82B92E");
|
||||
|
||||
//controls the inverse warning
|
||||
if(inverse_w == 0){
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", ((range_max - min_w) * position) - ((max_w - min_w) * position))
|
||||
.attr("width", 300)
|
||||
.attr("height", ((max_w - min_w) * position))
|
||||
.style("fill", "#ffd731");
|
||||
}
|
||||
else {
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 200 - ((min_w -range_min) * position))
|
||||
.attr("width", 300)
|
||||
.attr("height", (min_w -range_min) * position)
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_inverse_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 0)
|
||||
.attr("width", 300)
|
||||
.attr("height", ((range_max - min_w) * position) - ((max_w - min_w) * position))
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
}
|
||||
//controls the inverse critical
|
||||
if(inverse_c == 0){
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", ((range_max - min_c) * position) - ((max_c - min_c) * position))
|
||||
.attr("width", 300)
|
||||
.attr("height", ((max_c - min_c) * position))
|
||||
.style("fill", "#fc4444");
|
||||
}
|
||||
else {
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 200 - ((min_c -range_min) * position))
|
||||
.attr("width", 300)
|
||||
.attr("height", (min_c -range_min) * position)
|
||||
.style("fill", "#fc4444");
|
||||
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_inverse_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 0)
|
||||
.attr("width", 300)
|
||||
.attr("height", ((range_max - min_c) * position) - ((max_c - min_c) * position))
|
||||
.style("fill", "#fc4444");
|
||||
}
|
||||
}
|
||||
else {
|
||||
var message_error_warning = '<?php echo __("Please introduce a maximum warning higher than the minimun warning") ?>';
|
||||
var message_error_critical = '<?php echo __("Please introduce a maximum critical higher than the minimun critical") ?>';
|
||||
|
||||
d3.select("#svg_dinamic rect").remove();
|
||||
//create svg
|
||||
var svg = d3.select("#svg_dinamic");
|
||||
svg.selectAll("g").remove();
|
||||
svg.selectAll("rect").remove();
|
||||
svg.selectAll("text").remove();
|
||||
//message error warning
|
||||
if (error_w == 1) {
|
||||
$("#text-max_warning").addClass("input_error");
|
||||
svg.append("text")
|
||||
.attr("x", -90)
|
||||
.attr("y", 10)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 14)
|
||||
.style("fill", "red")
|
||||
.html(message_error_warning)
|
||||
.style("text-anchor", "first");
|
||||
}
|
||||
//message error critical
|
||||
if (error_c == 1) {
|
||||
$("#text-max_critical").addClass("input_error");
|
||||
svg.append("text")
|
||||
.attr("x", -90)
|
||||
.attr("y", 105)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 14)
|
||||
.style("fill", "red")
|
||||
.html(message_error_critical)
|
||||
.style("text-anchor", "first");
|
||||
}
|
||||
|
||||
} else {
|
||||
error_w = 1;
|
||||
paint_graph_status(0,0,0,0,0,0, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical);
|
||||
}
|
||||
}
|
||||
|
||||
/* End of relationship javascript */
|
||||
|
||||
/* ]]> */
|
||||
|
|
|
@ -414,14 +414,19 @@ function snmpBrowserWindow () {
|
|||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 780,
|
||||
height: 430
|
||||
width: 920,
|
||||
height: 500
|
||||
});
|
||||
}
|
||||
|
||||
// Set the form OID to the value selected in the SNMP browser
|
||||
function setOID () {
|
||||
$('#text-snmp_oid').val($('#snmp_selected_oid').text());
|
||||
|
||||
if($('#snmp_browser_version').val() == '3'){
|
||||
$('#text-snmp_oid').val($('#table1-0-1').text());
|
||||
} else {
|
||||
$('#text-snmp_oid').val($('#snmp_selected_oid').text());
|
||||
}
|
||||
|
||||
// Close the SNMP browser
|
||||
$('.ui-dialog-titlebar-close').trigger('click');
|
||||
|
|
|
@ -132,8 +132,8 @@ $form_filter .= "</tr>";
|
|||
$form_filter .= "<tr>";
|
||||
$form_filter .= "<td style='font-weight: bold;'>".__('Enabled / Disabled')."</td><td>";
|
||||
$ed_list = array ();
|
||||
$ed_list[0] = __('Enable');
|
||||
$ed_list[1] = __('Disable');
|
||||
$ed_list[0] = __('Enabled');
|
||||
$ed_list[1] = __('Disabled');
|
||||
$form_filter .= html_print_select ($ed_list, 'enabledisable', $enabledisable, '', __('All'), -1, true);
|
||||
$form_filter .= "</td><td style='font-weight: bold;'>".__('Standby')."</td><td>";
|
||||
$sb_list = array ();
|
||||
|
|
|
@ -30,15 +30,15 @@ $default = (int) get_parameter('default', 0);
|
|||
|
||||
|
||||
if ($default != 0) {
|
||||
$event_fields = io_safe_input('evento,id_agente,estado,timestamp');
|
||||
$fields_selected = explode (',', $event_fields);
|
||||
//$event_fields = io_safe_input('evento,id_agente,estado,timestamp');
|
||||
$fields_selected = explode (',', $config['event_fields']);
|
||||
}
|
||||
else if ($update != '') {
|
||||
$fields_selected = (array)get_parameter('fields_selected');
|
||||
|
||||
if ($fields_selected[0] == '') {
|
||||
$event_fields = io_safe_input('evento,id_agente,estado,timestamp');
|
||||
$fields_selected = explode (',', $event_fields);
|
||||
//$event_fields = io_safe_input('evento,id_agente,estado,timestamp');
|
||||
$fields_selected = explode (',', $config['event_fields']);
|
||||
}
|
||||
else {
|
||||
$event_fields = implode (',', $fields_selected);
|
||||
|
@ -130,7 +130,7 @@ $event = array();
|
|||
|
||||
echo '<h3>'.__('Show event fields');
|
||||
echo ' <a href="index.php?sec=geventos&sec2=godmode/events/events§ion=fields&default=1">';
|
||||
html_print_image ('images/clean.png', false, array ('title' => __('Load default event fields'), 'onclick' => "if (! confirm ('" . __('Default event fields will be loaded. Do you want to continue?') ."')) return false"));
|
||||
html_print_image ('images/clean.png', false, array ('title' => __('Load the fields from previous events'), 'onclick' => "if (! confirm ('" . __('Event fields will be loaded. Do you want to continue?') ."')) return false"));
|
||||
echo '</a></h3>';
|
||||
|
||||
$table = new stdClass();
|
||||
|
|
|
@ -130,7 +130,7 @@ if (is_ajax ()) {
|
|||
}
|
||||
else {
|
||||
$agents = agents_get_group_agents($id_group, $filter, "none",
|
||||
false, $recursion, false, '|', $add_alert_bulk_op);
|
||||
true, $recursion, false, '|', $add_alert_bulk_op);
|
||||
}
|
||||
|
||||
$agents_disabled = array();
|
||||
|
@ -334,7 +334,13 @@ if (($delete_group) && (check_acl($config['id_user'], 0, "PM"))) {
|
|||
}
|
||||
}
|
||||
db_clean_cache();
|
||||
$groups = users_get_groups_tree ($config['id_user'], "AR", true);
|
||||
|
||||
if ($create_group || $delete_group || $update_group) {
|
||||
$groups = users_get_groups ($config['id_user'], "AR", true, true, null, 'id_grupo', false);
|
||||
$groups = groups_get_groups_tree_recursive($groups);
|
||||
} else {
|
||||
$groups = users_get_groups_tree ($config['id_user'], "AR", true);
|
||||
}
|
||||
|
||||
$table->width = '100%';
|
||||
|
||||
|
@ -342,7 +348,7 @@ $all_parents = array();
|
|||
$groups_count = 0;
|
||||
$sons = array();
|
||||
|
||||
|
||||
$groups_count = count($groups);
|
||||
|
||||
foreach ($groups as $k => $g) {
|
||||
if ($g['parent'] != 0) {
|
||||
|
@ -360,8 +366,6 @@ foreach ($all_parents as $parent) {
|
|||
}
|
||||
|
||||
|
||||
$groups_count = count($groups);
|
||||
|
||||
if (!empty($groups)) {
|
||||
$table->class = "databox data";
|
||||
$table->head = array ();
|
||||
|
|
|
@ -698,8 +698,6 @@ $(document).ready (function () {
|
|||
|
||||
$("#checkbox-recursion").click(function () {
|
||||
recursion = this.checked ? 1 : 0;
|
||||
|
||||
$("#groups_select").trigger("change");
|
||||
});
|
||||
|
||||
$("#groups_select").change (
|
||||
|
@ -790,33 +788,33 @@ $(document).ready (function () {
|
|||
});
|
||||
|
||||
$('#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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -410,6 +410,7 @@ $table->data[1][0] = __('Module definition') . ui_print_help_icon("module_defini
|
|||
$table->data[1][1] = __('No change').' '.html_print_radio_button_extended ("mode", -1, '', $mode, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[1][1] .= __('Learning mode').' '.html_print_radio_button_extended ("mode", 1, '', $mode, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[1][1] .= __('Normal mode').' '.html_print_radio_button_extended ("mode", 0, '', $mode, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[1][1] .= __('Autodisable mode').' '.html_print_radio_button_extended ("mode", 2, '', $mode, false, '', 'style="margin-right: 40px;"', true);
|
||||
|
||||
// Status (Disabled / Enabled)
|
||||
$table->data[2][0] = __('Status');
|
||||
|
|
|
@ -296,8 +296,7 @@ $table->data['form_agents_1'][1] = html_print_select_groups (false, 'AW', true,
|
|||
html_print_checkbox ("recursion", 1, false, true, false);
|
||||
$table->data['form_agents_1'][3] = __('Select all modules of this group') . ' ' .
|
||||
html_print_checkbox_extended ("force_group", 'group', '', '', false,
|
||||
'', 'style="margin-right: 40px;"', true);
|
||||
|
||||
'', 'style="margin-right: 40px;"');
|
||||
|
||||
$table->rowclass['form_modules_3'] = '';
|
||||
$table->data['form_modules_3'][0] = __('Module Status');
|
||||
|
@ -388,7 +387,7 @@ $table->data['edit0'][3] .= html_print_checkbox ("dynamic_two_tailed", 1, '', tr
|
|||
|
||||
$table->data['edit1'][0] = __('Warning status');
|
||||
$table->data['edit1'][1] = '<table width="100%">';
|
||||
$table->data['edit1'][1] .= '<tr>';
|
||||
$table->data['edit1'][1] .= "<tr id='edit1-1-min'>";
|
||||
$table->data['edit1'][1] .= '<td>';
|
||||
$table->data['edit1'][1] .= '<em>' . __('Min.') . '</em>';
|
||||
$table->data['edit1'][1] .= '</td>';
|
||||
|
@ -397,7 +396,7 @@ $table->data['edit1'][1] = '<table width="100%">';
|
|||
'min_warning', '', '', 5, 255, true);
|
||||
$table->data['edit1'][1] .= '</td>';
|
||||
$table->data['edit1'][1] .= '</tr>';
|
||||
$table->data['edit1'][1] .= '<tr>';
|
||||
$table->data['edit1'][1] .= "<tr id='edit1-1-max'>";
|
||||
$table->data['edit1'][1] .= '<td>';
|
||||
$table->data['edit1'][1] .= '<em>' . __('Max.') . '</em>';
|
||||
$table->data['edit1'][1] .= '</td>';
|
||||
|
@ -406,7 +405,7 @@ $table->data['edit1'][1] = '<table width="100%">';
|
|||
'max_warning', '', '', 5, 255, true);
|
||||
$table->data['edit1'][1] .= '</td>';
|
||||
$table->data['edit1'][1] .= '</tr>';
|
||||
$table->data['edit1'][1] .= '<tr>';
|
||||
$table->data['edit1'][1] .= "<tr id='edit1-1-str'>";
|
||||
$table->data['edit1'][1] .= '<td>';
|
||||
$table->data['edit1'][1] .= '<em>' . __('Str.') . '</em>';
|
||||
$table->data['edit1'][1] .= '</td>';
|
||||
|
@ -434,8 +433,8 @@ $table->data['edit1'][1] .= '</table>';
|
|||
|
||||
$table->data['edit1'][2] = __('Critical status');
|
||||
$table->data['edit1'][3] = '<table width="100%">';
|
||||
$table->data['edit1'][3] .= '<tr>';
|
||||
$table->data['edit1'][3] .= '<td>';
|
||||
$table->data['edit1'][3] .= "<tr id='edit1-3-min'>";
|
||||
$table->data['edit1'][3] .= "<td>";
|
||||
$table->data['edit1'][3] .= '<em>' . __('Min.') . '</em>';
|
||||
$table->data['edit1'][3] .= '</td>';
|
||||
$table->data['edit1'][3] .= '<td align="right">';
|
||||
|
@ -443,7 +442,7 @@ $table->data['edit1'][3] = '<table width="100%">';
|
|||
'min_critical', '', '', 5, 255, true);
|
||||
$table->data['edit1'][3] .= '</td>';
|
||||
$table->data['edit1'][3] .= '</tr>';
|
||||
$table->data['edit1'][3] .= '<tr>';
|
||||
$table->data['edit1'][3] .= "<tr id='edit1-3-max'>";
|
||||
$table->data['edit1'][3] .= '<td>';
|
||||
$table->data['edit1'][3] .= '<em>' . __('Max.') . '</em>';
|
||||
$table->data['edit1'][3] .= '</td>';
|
||||
|
@ -452,7 +451,7 @@ $table->data['edit1'][3] = '<table width="100%">';
|
|||
'max_critical', '', '', 5, 255, true);
|
||||
$table->data['edit1'][3] .= '</td>';
|
||||
$table->data['edit1'][3] .= '</tr>';
|
||||
$table->data['edit1'][3] .= '<tr>';
|
||||
$table->data['edit1'][3] .= "<tr id='edit1-3-str'>";
|
||||
$table->data['edit1'][3] .= '<td>';
|
||||
$table->data['edit1'][3] .= '<em>'.__('Str.').'</em>';
|
||||
$table->data['edit1'][3] .= '</td>';
|
||||
|
@ -695,7 +694,6 @@ $(document).ready (function () {
|
|||
|
||||
clean_lists();
|
||||
|
||||
|
||||
$(".select_modules_row").css('display', '<?php echo $modules_row?>');
|
||||
$(".select_agents_row").css('display', '<?php echo $agents_row?>');
|
||||
$(".select_modules_row_2").css('display', 'none');
|
||||
|
@ -807,6 +805,64 @@ $(document).ready (function () {
|
|||
"tr#delete_table-edit13, " +
|
||||
"tr#delete_table-edit14, " +
|
||||
"tr#delete_table-edit15").show ();
|
||||
|
||||
switch($('#module_type').val()) {
|
||||
case '3':
|
||||
case '23':
|
||||
case '33':
|
||||
$("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max,#delete_table-edit15," +
|
||||
"#delete_table-edit3-2,#delete_table-edit3-3,#delete_table-edit35").hide();
|
||||
$("#edit1-1-str,#edit1-3-str").show();
|
||||
break;
|
||||
case '6':
|
||||
case '7':
|
||||
$("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show();
|
||||
$("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," +
|
||||
"#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," +
|
||||
"#delete_table-edit5").hide();
|
||||
break;
|
||||
case '8':
|
||||
case '9':
|
||||
case '11':
|
||||
$("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show();
|
||||
$("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," +
|
||||
"#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," +
|
||||
"#delete_table-edit5").hide();
|
||||
break;
|
||||
case '10':
|
||||
$("#edit1-1-str,#edit1-3-str").show();
|
||||
$("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," +
|
||||
"#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," +
|
||||
"#delete_table-edit5").hide();
|
||||
break;
|
||||
case '15':
|
||||
case '16':
|
||||
case '18':
|
||||
$("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show();
|
||||
$("#edit1-1-str,#edit1-3-str,#delete_table-edit5").hide();
|
||||
break;
|
||||
case '17':
|
||||
$("#edit1-1-str,#edit1-3-str").show();
|
||||
$("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max,#delete_table-edit5").hide();
|
||||
break;
|
||||
case '1':
|
||||
case '2':
|
||||
case '4':
|
||||
case '5':
|
||||
case '21':
|
||||
case '22':
|
||||
case '24':
|
||||
case '25':
|
||||
case '30':
|
||||
case '31':
|
||||
case '32':
|
||||
case '100':
|
||||
$("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show();
|
||||
$("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," +
|
||||
"#delete_table-edit3-3,#delete_table-edit35").hide();
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
function clean_lists() {
|
||||
|
@ -890,7 +946,7 @@ $(document).ready (function () {
|
|||
}
|
||||
}
|
||||
else if (this.id == "checkbox-recursion") {
|
||||
$("#checkbox-force_group").attr("checked", false);
|
||||
$("#checkbox-force_group").prop("checked", false);
|
||||
$("#groups_select").trigger("change");
|
||||
}
|
||||
else if (this.id == "checkbox-warning_inverse") {
|
||||
|
@ -904,7 +960,7 @@ $(document).ready (function () {
|
|||
}
|
||||
else {
|
||||
if (this.id == "checkbox-force_group") {
|
||||
$("#checkbox-recursion").attr("checked", false);
|
||||
$("#checkbox-recursion").prop("checked", false);
|
||||
}
|
||||
|
||||
if (this.checked) {
|
||||
|
@ -1000,8 +1056,6 @@ $(document).ready (function () {
|
|||
|
||||
$("#checkbox-recursion").click(function () {
|
||||
recursion = this.checked ? 1 : 0;
|
||||
|
||||
$("#groups_select").trigger("change");
|
||||
});
|
||||
|
||||
$("#groups_select").change (
|
||||
|
@ -1044,11 +1098,11 @@ $(document).ready (function () {
|
|||
"get_agents_group_json" : 1,
|
||||
"recursion" : recursion,
|
||||
"id_group" : this.value,
|
||||
status_agents: function () {
|
||||
return $("#status_agents").val();
|
||||
},
|
||||
// Add a key prefix to avoid auto sorting in js object conversion
|
||||
"keys_prefix" : "_"
|
||||
status_agents: function () {
|
||||
return $("#status_agents").val();
|
||||
},
|
||||
// Add a key prefix to avoid auto sorting in js object conversion
|
||||
"keys_prefix" : "_"
|
||||
},
|
||||
function (data, status) {
|
||||
$("#id_agents").html('');
|
||||
|
@ -1072,7 +1126,6 @@ $(document).ready (function () {
|
|||
$("#groups_select").trigger("change");
|
||||
});
|
||||
|
||||
|
||||
if("<?php echo $update ?>"){
|
||||
if("<?php echo $selection_mode ?>" == 'agents'){
|
||||
$("#groups_select").trigger("change");
|
||||
|
@ -1080,7 +1133,6 @@ $(document).ready (function () {
|
|||
}
|
||||
|
||||
$("#status_module").change(function() {
|
||||
|
||||
selector = $("#form_edit input[name=selection_mode]:checked").val();
|
||||
if(selector == 'agents') {
|
||||
$("#id_agents").trigger("change");
|
||||
|
@ -1100,33 +1152,33 @@ $(document).ready (function () {
|
|||
});
|
||||
|
||||
$('#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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -338,7 +338,7 @@ if (is_array ($config['extensions'])) {
|
|||
|
||||
|
||||
|
||||
if($extension['godmode_menu']['name'] != 'DB Schema check' && $extension['godmode_menu']['name'] != 'DB interface'){
|
||||
if($extension['godmode_menu']['name'] != __('DB Schema check') && $extension['godmode_menu']['name'] != __('DB interface')){
|
||||
$extmenu = $extension['godmode_menu'];
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ $table->data[4][1] .= html_print_input_text ('str_warning', $str_warning,
|
|||
$table->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
$table->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true);
|
||||
|
||||
$table->data[4][2] = '<svg id="svg_dinamic" width="350" height="200" style="padding:40px; padding-left: 100px; margin-bottom: 60px;"> </svg>';
|
||||
$table->data[4][2] = '<svg id="svg_dinamic" width="800" height="300"> </svg>';
|
||||
$table->colspan[4][2] = 2;
|
||||
$table->rowspan[4][2] = 3;
|
||||
|
||||
|
@ -349,294 +349,37 @@ $next_row++;
|
|||
if(!inverse_w){ inverse_w = 0; }
|
||||
var inverse_c = $('input:checkbox[name=critical_inverse]:checked').val();
|
||||
if(!inverse_c){ inverse_c = 0; }
|
||||
|
||||
//inicialiced error
|
||||
var error_w = 0;
|
||||
var error_c = 0;
|
||||
//if haven't error
|
||||
if(max_w == 0 || max_w > min_w){
|
||||
if(max_c == 0 || max_c > min_c){
|
||||
paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, error_w, error_c);
|
||||
} else {
|
||||
error_c = 1;
|
||||
paint_graph_status(0,0,0,0,0,0, error_w, error_c);
|
||||
}
|
||||
} else {
|
||||
error_w = 1;
|
||||
paint_graph_status(0,0,0,0,0,0, error_w, error_c);
|
||||
}
|
||||
}
|
||||
|
||||
//function use d3.js for paint graph
|
||||
function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, error_w, error_c) {
|
||||
|
||||
//Check if they are numbers
|
||||
if(isNaN(min_w)){ min_w = 0; };
|
||||
if(isNaN(max_w)){ max_w = 0; };
|
||||
if(isNaN(min_c)){ min_c = 0; };
|
||||
if(isNaN(max_c)){ max_c = 0; };
|
||||
|
||||
//messages legend
|
||||
var legend_normal = '<?php echo __("Normal Status");?>';
|
||||
var legend_warning = '<?php echo __("Warning Status");?>';
|
||||
var legend_critical = '<?php echo __("Critical Status");?>';
|
||||
|
||||
//remove elements
|
||||
d3.select("#svg_dinamic rect").remove();
|
||||
$("#text-max_warning").removeClass("input_error");
|
||||
$("#text-max_critical").removeClass("input_error");
|
||||
|
||||
//if haven't errors
|
||||
if (error_w == 0 && error_c == 0){
|
||||
//parse element
|
||||
min_w = parseFloat(min_w);
|
||||
min_c = parseFloat(min_c);
|
||||
max_w = parseFloat(max_w);
|
||||
max_c = parseFloat(max_c);
|
||||
|
||||
//inicialize var
|
||||
var range_min = 0;
|
||||
var range_max = 0;
|
||||
var range_max_min = 0;
|
||||
var range_max_min = 0;
|
||||
|
||||
//Find the lowest possible value
|
||||
if(min_w < 0 || min_c < 0){
|
||||
if(min_w < min_c){
|
||||
range_min = min_w - 100;
|
||||
} else {
|
||||
range_min = min_c - 100;
|
||||
}
|
||||
} else if (min_w > 0 || min_c > 0) {
|
||||
if(min_w > min_c){
|
||||
range_max_min = min_w;
|
||||
} else {
|
||||
range_max_min = min_c;
|
||||
}
|
||||
//messages error
|
||||
var message_error_warning = '<?php echo __("Please introduce a maximum warning higher than the minimun warning") ?>';
|
||||
var message_error_critical = '<?php echo __("Please introduce a maximum critical higher than the minimun critical") ?>';
|
||||
|
||||
//if haven't error
|
||||
if(max_w == 0 || max_w > min_w){
|
||||
if(max_c == 0 || max_c > min_c){
|
||||
paint_graph_status(min_w, max_w, min_c, max_c, inverse_w,
|
||||
inverse_c, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical);
|
||||
} else {
|
||||
if(min_w < min_c){
|
||||
range_min = min_w - 100;
|
||||
} else {
|
||||
range_min = min_c - 100;
|
||||
}
|
||||
error_c = 1;
|
||||
paint_graph_status(0,0,0,0,0,0, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical);
|
||||
}
|
||||
|
||||
//Find the maximum possible value
|
||||
if(max_w > max_c){
|
||||
range_max = max_w + 100 + range_max_min;
|
||||
} else {
|
||||
range_max = max_c + 100 + range_max_min;
|
||||
}
|
||||
|
||||
//Controls whether the maximum = 0 is infinite
|
||||
if((max_w == 0 || max_w == 0.00) && min_w != 0){
|
||||
max_w = range_max;
|
||||
}
|
||||
if((max_c == 0 || max_c == 0.00) && min_c != 0){
|
||||
max_c = range_max;
|
||||
}
|
||||
|
||||
//Scale according to the position
|
||||
position = 200 / (range_max-range_min);
|
||||
|
||||
//axes
|
||||
var yScale = d3.scale.linear()
|
||||
.domain([range_min, range_max])
|
||||
.range([100, -100]);
|
||||
|
||||
var yAxis = d3.svg.axis()
|
||||
.orient("left")
|
||||
.scale(yScale);
|
||||
|
||||
//create svg
|
||||
var svg = d3.select("#svg_dinamic");
|
||||
//delete elements
|
||||
svg.selectAll("g").remove();
|
||||
svg.selectAll("rect").remove();
|
||||
svg.selectAll("text").remove();
|
||||
svg.append("g")
|
||||
.attr("transform", "translate(0, 100)")
|
||||
.call(yAxis);
|
||||
|
||||
//legend Normal text
|
||||
svg.append("text")
|
||||
.attr("x", 0)
|
||||
.attr("y", -20)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 10)
|
||||
.html(legend_normal)
|
||||
.style("text-anchor", "first");
|
||||
|
||||
//legend Normal rect
|
||||
svg.append("rect")
|
||||
.attr("id", "legend_normal")
|
||||
.attr("x", 72)
|
||||
.attr("y", -30)
|
||||
.attr("width", '10px')
|
||||
.attr("height", '10px')
|
||||
.style("fill", "#82B92E");
|
||||
|
||||
//legend Warning text
|
||||
svg.append("text")
|
||||
.attr("x", 91)
|
||||
.attr("y", -20)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 10)
|
||||
.html(legend_warning)
|
||||
.style("text-anchor", "first");
|
||||
|
||||
//legend Warning rect
|
||||
svg.append("rect")
|
||||
.attr("id", "legend_warning")
|
||||
.attr("x", 168)
|
||||
.attr("y", -30)
|
||||
.attr("width", 10)
|
||||
.attr("height", 10)
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
//legend Critical text
|
||||
svg.append("text")
|
||||
.attr("x", 187)
|
||||
.attr("y", -20)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 10)
|
||||
.html(legend_critical)
|
||||
.style("text-anchor", "first");
|
||||
|
||||
//legend critical rect
|
||||
svg.append("rect")
|
||||
.attr("id", "legend_critical")
|
||||
.attr("x", 258)
|
||||
.attr("y", -30)
|
||||
.attr("width", 10)
|
||||
.attr("height", 10)
|
||||
.style("fill", "#fc4444");
|
||||
|
||||
//styles for number and axes
|
||||
svg.selectAll("g .domain")
|
||||
.style("stroke-width", 2)
|
||||
.style("fill", "none")
|
||||
.style("stroke", "black");
|
||||
|
||||
svg.selectAll("g .tick text")
|
||||
.style("font-size", "9pt")
|
||||
.style("font-weight", "initial");
|
||||
|
||||
//estatus normal
|
||||
svg.append("rect")
|
||||
.attr("id", "warning_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 0)
|
||||
.attr("width", 300)
|
||||
.attr("height", 200)
|
||||
.style("fill", "#82B92E");
|
||||
|
||||
//controls the inverse warning
|
||||
if(inverse_w == 0){
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", ((range_max - min_w) * position) - ((max_w - min_w) * position))
|
||||
.attr("width", 300)
|
||||
.attr("height", ((max_w - min_w) * position))
|
||||
.style("fill", "#ffd731");
|
||||
}
|
||||
else {
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 200 - ((min_w -range_min) * position))
|
||||
.attr("width", 300)
|
||||
.attr("height", (min_w -range_min) * position)
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_inverse_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 0)
|
||||
.attr("width", 300)
|
||||
.attr("height", ((range_max - min_w) * position) - ((max_w - min_w) * position))
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
}
|
||||
//controls the inverse critical
|
||||
if(inverse_c == 0){
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", ((range_max - min_c) * position) - ((max_c - min_c) * position))
|
||||
.attr("width", 300)
|
||||
.attr("height", ((max_c - min_c) * position))
|
||||
.style("fill", "#fc4444");
|
||||
}
|
||||
else {
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 200 - ((min_c -range_min) * position))
|
||||
.attr("width", 300)
|
||||
.attr("height", (min_c -range_min) * position)
|
||||
.style("fill", "#fc4444");
|
||||
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_inverse_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 0)
|
||||
.attr("width", 300)
|
||||
.attr("height", ((range_max - min_c) * position) - ((max_c - min_c) * position))
|
||||
.style("fill", "#fc4444");
|
||||
}
|
||||
}
|
||||
else {
|
||||
var message_error_warning = '<?php echo __("Please introduce a maximum warning higher than the minimun warning") ?>';
|
||||
var message_error_critical = '<?php echo __("Please introduce a maximum critical higher than the minimun critical") ?>';
|
||||
|
||||
d3.select("#svg_dinamic rect").remove();
|
||||
//create svg
|
||||
var svg = d3.select("#svg_dinamic");
|
||||
svg.selectAll("g").remove();
|
||||
svg.selectAll("rect").remove();
|
||||
svg.selectAll("text").remove();
|
||||
//message error warning
|
||||
if (error_w == 1) {
|
||||
$("#text-max_warning").addClass("input_error");
|
||||
svg.append("text")
|
||||
.attr("x", -90)
|
||||
.attr("y", 10)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 14)
|
||||
.style("fill", "red")
|
||||
.html(message_error_warning)
|
||||
.style("text-anchor", "first");
|
||||
}
|
||||
//message error critical
|
||||
if (error_c == 1) {
|
||||
$("#text-max_critical").addClass("input_error");
|
||||
svg.append("text")
|
||||
.attr("x", -90)
|
||||
.attr("y", 105)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 14)
|
||||
.style("fill", "red")
|
||||
.html(message_error_critical)
|
||||
.style("text-anchor", "first");
|
||||
}
|
||||
|
||||
} else {
|
||||
error_w = 1;
|
||||
paint_graph_status(0,0,0,0,0,0, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
@ -42,19 +42,30 @@ if (is_ajax()){
|
|||
$id_agent_module = get_parameter('id_agent_module');
|
||||
$time_lapse = get_parameter('time_lapse');
|
||||
$only_avg = get_parameter('only_avg');
|
||||
$fullscale = get_parameter('fullscale');
|
||||
if($only_avg != 'false'){
|
||||
$only_avg = 1;
|
||||
}
|
||||
else{
|
||||
$only_avg = 0;
|
||||
}
|
||||
|
||||
if($fullscale != 'false'){
|
||||
$fullscale = 1;
|
||||
}
|
||||
else{
|
||||
$fullscale = 0;
|
||||
}
|
||||
|
||||
$values = array(
|
||||
'id_container' => $id_container2,
|
||||
'type' => "simple_graph",
|
||||
'id_agent' => $id_agent,
|
||||
'id_agent_module' => $id_agent_module,
|
||||
'time_lapse' => $time_lapse,
|
||||
'only_average' => $only_avg);
|
||||
'only_average' => $only_avg,
|
||||
'fullscale' => $fullscale
|
||||
);
|
||||
|
||||
$id_item = db_process_sql_insert('tcontainer_item', $values);
|
||||
return;
|
||||
|
@ -63,12 +74,21 @@ if (is_ajax()){
|
|||
if($add_custom){
|
||||
$time_lapse = get_parameter('time_lapse');
|
||||
$id_custom = get_parameter('id_custom');
|
||||
|
||||
$fullscale = get_parameter('fullscale');
|
||||
if($fullscale != 'false'){
|
||||
$fullscale = 1;
|
||||
}
|
||||
else{
|
||||
$fullscale = 0;
|
||||
}
|
||||
|
||||
$values = array(
|
||||
'id_container' => $id_container2,
|
||||
'type' => "custom_graph",
|
||||
'time_lapse' => $time_lapse,
|
||||
'id_graph' => $id_custom);
|
||||
'id_graph' => $id_custom,
|
||||
'fullscale' => $fullscale,
|
||||
);
|
||||
|
||||
$id_item = db_process_sql_insert('tcontainer_item', $values);
|
||||
return;
|
||||
|
@ -88,6 +108,15 @@ if (is_ajax()){
|
|||
else{
|
||||
$only_avg = 0;
|
||||
}
|
||||
|
||||
$fullscale = get_parameter('fullscale');
|
||||
if($fullscale != 'false'){
|
||||
$fullscale = 1;
|
||||
}
|
||||
else{
|
||||
$fullscale = 0;
|
||||
}
|
||||
|
||||
$values = array(
|
||||
'id_container' => $id_container2,
|
||||
'type' => "dynamic_graph",
|
||||
|
@ -97,7 +126,9 @@ if (is_ajax()){
|
|||
'agent' => $agent_alias,
|
||||
'module' => $module_name,
|
||||
'id_tag' => $tag,
|
||||
'only_average' => $only_avg);
|
||||
'only_average' => $only_avg,
|
||||
'fullscale' => $fullscale
|
||||
);
|
||||
$id_item = db_process_sql_insert('tcontainer_item', $values);
|
||||
return;
|
||||
}
|
||||
|
@ -270,7 +301,7 @@ if($edit_container){
|
|||
|
||||
$single_table = "<table width='100%' cellpadding=4 cellspacing=4>";
|
||||
$single_table .= "<tr id='row_time_lapse' style='' class='datos'>";
|
||||
$single_table .= "<td style='font-weight:bold;width: 12%;'>";
|
||||
$single_table .= "<td style='font-weight:bold;width: 13%;'>";
|
||||
$single_table .= __('Time lapse');
|
||||
$single_table .= ui_print_help_tip(__('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '),true);
|
||||
$single_table .= "</td>";
|
||||
|
@ -328,6 +359,14 @@ if($edit_container){
|
|||
$single_table .= html_print_checkbox('only_avg', 1, true,true);
|
||||
$single_table .= "</td>";
|
||||
$single_table .= "</tr>";
|
||||
$single_table .= "<tr id='row_fullscale' style='' class='datos'>";
|
||||
$single_table .= "<td style='font-weight:bold;'>";
|
||||
$single_table .= __('Show full scale graph (TIP)') . ui_print_help_tip('This option may cause performance issues', true);
|
||||
$single_table .= "</td>";
|
||||
$single_table .= "<td>";
|
||||
$single_table .= html_print_checkbox('fullscale', 1, false,true);
|
||||
$single_table .= "</td>";
|
||||
$single_table .= "</tr>";
|
||||
$single_table .= "<tr>";
|
||||
$single_table .= "<td >";
|
||||
$single_table .= "</td>";
|
||||
|
@ -353,7 +392,7 @@ if($edit_container){
|
|||
$table->class = 'dat';
|
||||
|
||||
$table->styleTable = 'font-weight: bold;';
|
||||
$table->style[0] = 'width: 12%';
|
||||
$table->style[0] = 'width: 13%';
|
||||
$table->data = array();
|
||||
|
||||
$data = array();
|
||||
|
@ -377,6 +416,13 @@ if($edit_container){
|
|||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Show full scale graph (TIP)') .
|
||||
ui_print_help_tip('This option may cause performance issues', true);
|
||||
$data[1] = html_print_checkbox('fullscale_2', 1, false,true);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = array();
|
||||
$data[0] = "";
|
||||
$data[1] = "<input style='float:right;' type=submit name='add_custom' class='sub add' value='".__('Add item')."'>";
|
||||
|
@ -401,7 +447,7 @@ if($edit_container){
|
|||
$table->class = 'dat';
|
||||
|
||||
$table->styleTable = 'font-weight: bold;';
|
||||
$table->style[0] = 'width: 12%';
|
||||
$table->style[0] = 'width: 13%';
|
||||
$table->data = array();
|
||||
|
||||
$data = array();
|
||||
|
@ -450,7 +496,14 @@ if($edit_container){
|
|||
$data[1] = html_print_checkbox('only_avg_2', 1, false,true);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Show full scale graph (TIP)') .
|
||||
ui_print_help_tip('This option may cause performance issues', true);
|
||||
$data[1] = html_print_checkbox('fullscale_3', 1, false,true);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = array();
|
||||
$data[0] = "";
|
||||
$data[1] = "<input style='float:right;' type=submit name='add_dynamic' class='sub add' value='".__('Add item')."'>";
|
||||
|
@ -561,6 +614,7 @@ echo html_print_input_hidden('id_agent', 0);
|
|||
var id_agent = $("#hidden-id_agent").attr('value');
|
||||
var time_lapse = $("#hidden-period_single").attr('value');
|
||||
var only_avg = $("#checkbox-only_avg").prop("checked");
|
||||
var fullscale = $("#checkbox-fullscale").prop("checked");
|
||||
var id_container = <?php echo $id_container; ?>;
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "godmode/reporting/create_container",
|
||||
|
@ -569,6 +623,7 @@ echo html_print_input_hidden('id_agent', 0);
|
|||
"id_agent_module" : id_agent_module,
|
||||
"time_lapse" : time_lapse,
|
||||
"only_avg" : only_avg,
|
||||
"fullscale" : fullscale,
|
||||
"id_container" : id_container,
|
||||
},
|
||||
function (data, status) {
|
||||
|
@ -580,9 +635,9 @@ echo html_print_input_hidden('id_agent', 0);
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
$("input[name=add_custom]").click (function () {
|
||||
var id_custom = $("#id_custom_graph").val();
|
||||
var fullscale = $("#checkbox-fullscale_2").prop("checked");
|
||||
if (id_custom !== '0'){
|
||||
var time_lapse = $("#hidden-period_custom").attr('value');
|
||||
var id_container = <?php echo $id_container; ?>;
|
||||
|
@ -592,6 +647,7 @@ echo html_print_input_hidden('id_agent', 0);
|
|||
"time_lapse" : time_lapse,
|
||||
"id_custom" : id_custom,
|
||||
"id_container" : id_container,
|
||||
"fullscale" : fullscale,
|
||||
},
|
||||
function (data, status) {
|
||||
var url = location.href.replace('&update_container=1', "");
|
||||
|
@ -611,6 +667,7 @@ echo html_print_input_hidden('id_agent', 0);
|
|||
var tag = $("#tag").val();
|
||||
var only_avg = $("#checkbox-only_avg_2").prop("checked");
|
||||
var id_container = <?php echo $id_container; ?>;
|
||||
var fullscale = $("#checkbox-fullscale_3").prop("checked");
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "godmode/reporting/create_container",
|
||||
"add_dynamic" : 1,
|
||||
|
@ -622,6 +679,7 @@ echo html_print_input_hidden('id_agent', 0);
|
|||
"tag" : tag,
|
||||
"id_container" : id_container,
|
||||
"only_avg" : only_avg,
|
||||
"fullscale" : fullscale,
|
||||
},
|
||||
function (data, status) {
|
||||
var url = location.href.replace('&update_container=1', "");
|
||||
|
|
|
@ -32,6 +32,7 @@ require_once($config['homedir'] . "/include/functions_modules.php");
|
|||
require_once($config['homedir'] . "/include/functions_groups.php");
|
||||
|
||||
$editGraph = (bool) get_parameter('edit_graph', 0);
|
||||
$action = get_parameter('action', '');
|
||||
|
||||
if (isset ($_GET["get_agent"])) {
|
||||
$id_agent = $_POST["id_agent"];
|
||||
|
@ -39,6 +40,122 @@ if (isset ($_GET["get_agent"])) {
|
|||
$chunkdata = $_POST["chunk"];
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'sort_items':
|
||||
$resultOperationDB = null;
|
||||
$position_to_sort = (int)get_parameter('position_to_sort', 1);
|
||||
$ids_serialize = (string)get_parameter('ids_items_to_sort', '');
|
||||
$move_to = (string)get_parameter('move_to', 'after');
|
||||
|
||||
$countItems = db_get_sql('
|
||||
SELECT COUNT(id_gs)
|
||||
FROM tgraph_source
|
||||
WHERE id_graph = ' . $id_graph);
|
||||
|
||||
if (($countItems < $position_to_sort) || ($position_to_sort < 1)) {
|
||||
$resultOperationDB = false;
|
||||
}
|
||||
else if (!empty($ids_serialize)) {
|
||||
$ids = explode('|', $ids_serialize);
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$items = db_get_all_rows_sql('
|
||||
SELECT id_gs, `field_order`
|
||||
FROM tgraph_source
|
||||
WHERE id_graph = ' . $id_graph . '
|
||||
ORDER BY `field_order`');
|
||||
break;
|
||||
}
|
||||
|
||||
if ($items === false) $items = array();
|
||||
|
||||
|
||||
// Clean the repeated order values
|
||||
$order_temp = 1;
|
||||
foreach ($items as $item) {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
db_process_sql_update('tgraph_source',
|
||||
array('`field_order`' => $order_temp),
|
||||
array('id_gs' => $item['id_rc']));
|
||||
break;
|
||||
}
|
||||
|
||||
$order_temp++;
|
||||
}
|
||||
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$items = db_get_all_rows_sql('
|
||||
SELECT id_gs, `field_order`
|
||||
FROM tgraph_source
|
||||
WHERE id_graph = ' . $id_graph . '
|
||||
ORDER BY `field_order`');
|
||||
break;
|
||||
}
|
||||
|
||||
if ($items === false) $items = array();
|
||||
|
||||
|
||||
|
||||
$temp = array();
|
||||
|
||||
$temp = array();
|
||||
foreach ($items as $item) {
|
||||
//Remove the contents from the block to sort
|
||||
if (array_search($item['id_gs'], $ids) === false) {
|
||||
$temp[$item['field_order']] = $item['id_gs'];
|
||||
}
|
||||
}
|
||||
$items = $temp;
|
||||
|
||||
|
||||
|
||||
$sorted_items = array();
|
||||
foreach ($items as $pos => $id_unsort) {
|
||||
if ($pos == $position_to_sort) {
|
||||
if ($move_to == 'after') {
|
||||
$sorted_items[] = $id_unsort;
|
||||
}
|
||||
|
||||
foreach ($ids as $id) {
|
||||
$sorted_items[] = $id;
|
||||
}
|
||||
|
||||
if ($move_to != 'after') {
|
||||
$sorted_items[] = $id_unsort;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sorted_items[] = $id_unsort;
|
||||
}
|
||||
}
|
||||
|
||||
$items = $sorted_items;
|
||||
|
||||
|
||||
|
||||
foreach ($items as $order => $id) {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
|
||||
db_process_sql_update('tgraph_source',
|
||||
array('`field_order`' => ($order + 1)),
|
||||
array('id_gs' => $id));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$resultOperationDB = true;
|
||||
}
|
||||
else {
|
||||
$resultOperationDB = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($editGraph) {
|
||||
$graphRows = db_get_all_rows_sql("SELECT t1.*,
|
||||
(SELECT t3.alias
|
||||
|
@ -49,7 +166,8 @@ if ($editGraph) {
|
|||
WHERE t2.id_agente_modulo = t1.id_agent_module))
|
||||
AS agent_name
|
||||
FROM tgraph_source t1
|
||||
WHERE t1.id_graph = " . $id_graph);
|
||||
WHERE t1.id_graph = " . $id_graph . " order by `field_order`");
|
||||
$position_array = array();
|
||||
$module_array = array();
|
||||
$weight_array = array();
|
||||
$agent_array = array();
|
||||
|
@ -65,6 +183,7 @@ if ($editGraph) {
|
|||
$weight_array[] = $graphRow['weight'];
|
||||
$label_array[] = $graphRow['label'];
|
||||
$agent_array[] = $graphRow['agent_name'];
|
||||
$position_array[] = $graphRow['field_order'];
|
||||
}
|
||||
|
||||
$graphInTgraph = db_get_row_sql("SELECT * FROM tgraph WHERE id_graph = " . $id_graph);
|
||||
|
@ -81,11 +200,13 @@ if ($editGraph) {
|
|||
if (count($module_array) > 0) {
|
||||
echo "<table width='100%' cellpadding=4 cellpadding=4 class='databox filters'>";
|
||||
echo "<tr>
|
||||
<th>".__('P.')."</th>
|
||||
<th>".__('Agent')."</th>
|
||||
<th>".__('Module')."</th>
|
||||
<th>".__('Label')."</th>
|
||||
<th>".__('Weight')."</th>
|
||||
<th>".__('Delete')."</th>";
|
||||
<th>".__('Delete')."</th>
|
||||
<th>".__('Sort')."</th>";
|
||||
$color = 0;
|
||||
for ($a = 0; $a < count($module_array); $a++) {
|
||||
// Calculate table line color
|
||||
|
@ -98,7 +219,8 @@ if (count($module_array) > 0) {
|
|||
$color = 1;
|
||||
}
|
||||
|
||||
echo "<tr><td class='$tdcolor'>" . $agent_array[$a] . "</td>";
|
||||
echo "<tr><td class='$tdcolor'>$position_array[$a]</td>";
|
||||
echo "<td class='$tdcolor'>" . $agent_array[$a] . "</td>";
|
||||
echo "<td class='$tdcolor'>";
|
||||
echo modules_get_agentmodule_name ($module_array[$a])."</td>";
|
||||
|
||||
|
@ -126,11 +248,55 @@ if (count($module_array) > 0) {
|
|||
echo "<td class='$tdcolor' align=''>";
|
||||
echo "<a href='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&tab=graph_editor&delete_module=1&id=". $id_graph ."&delete=" . $idgs_array[$a] . "'>".html_print_image('images/cross.png', true, array ('title' => __('Delete')))."</a>";
|
||||
|
||||
echo "</td></tr>";
|
||||
echo "</td>";
|
||||
|
||||
echo "<td>";
|
||||
|
||||
echo html_print_checkbox_extended('sorted_items[]', $idgs_array[$a], false, false, '', 'class="selected_check"', true);
|
||||
|
||||
echo "</td>";
|
||||
|
||||
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->colspan[0][0] = 3;
|
||||
$table->size = array();
|
||||
$table->size[0] = '25%';
|
||||
$table->size[1] = '25%';
|
||||
$table->size[2] = '25%';
|
||||
$table->size[3] = '25%';
|
||||
if (defined("METACONSOLE")) {
|
||||
$table->class = "databox data";
|
||||
$table->head[0] = __("Sort items");
|
||||
$table->head_colspan[0] = 4;
|
||||
$table->headstyle[0] = 'text-align: center';
|
||||
}
|
||||
else {
|
||||
$table->data[0][0] = "<b>". __("Sort items") . "</b>";
|
||||
}
|
||||
$table->data[1][0] = __('Sort selected items');
|
||||
$table->data[1][1] = html_print_select_style(
|
||||
array('before' => __('before to'), 'after' => __('after to')), 'move_to',
|
||||
'', '', '', '', 0, true);
|
||||
$table->data[1][2] = html_print_input_text_extended('position_to_sort', 1,
|
||||
'text-position_to_sort', '', 3, 10, false, "only_numbers('position_to_sort');", '', true);
|
||||
$table->data[1][2] .= html_print_input_hidden('ids_items_to_sort', '', true);
|
||||
$table->data[1][3] = html_print_submit_button(__('Sort'), 'sort_submit', false, 'class="sub upd"', true);
|
||||
$table->data[1][4] = html_print_input_hidden('action', 'sort_items', true);
|
||||
|
||||
echo "<form action='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&tab=graph_editor&edit_graph=1&id=".$id_graph."' method='post' onsubmit='return added_ids_sorted_items_to_hidden_input();'>";
|
||||
html_print_table($table);
|
||||
echo "</form>";
|
||||
|
||||
echo "<br>";
|
||||
|
||||
|
||||
//Configuration form
|
||||
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
|
||||
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&tab=graph_editor&add_module=1&edit_graph=1&id=" . $id_graph . "'>";
|
||||
|
@ -217,4 +383,28 @@ function filterByGroup(idGroup) {
|
|||
"json"
|
||||
);
|
||||
}
|
||||
|
||||
function added_ids_sorted_items_to_hidden_input() {
|
||||
var ids = '';
|
||||
var first = true;
|
||||
|
||||
$("input.selected_check:checked").each(function(i, val) {
|
||||
if (!first)
|
||||
ids = ids + '|';
|
||||
first = false;
|
||||
|
||||
ids = ids + $(val).val();
|
||||
});
|
||||
|
||||
$("input[name='ids_items_to_sort']").val(ids);
|
||||
|
||||
if (ids == '') {
|
||||
alert("<?php echo __("Please select any item to order");?>");
|
||||
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -66,6 +66,10 @@ if ($edit_graph) {
|
|||
$height = $graphInTgraph['height'];
|
||||
$check = false;
|
||||
$percentil = $graphInTgraph['percentil'];
|
||||
$summatory_series = $graphInTgraph['summatory_series'];
|
||||
$average_series = $graphInTgraph['average_series'];
|
||||
$modules_series = $graphInTgraph['modules_series'];
|
||||
$fullscale = $graphInTgraph['fullscale'];
|
||||
|
||||
if ($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
|
||||
$stacked = CUSTOM_GRAPH_BULLET_CHART;
|
||||
|
@ -84,10 +88,17 @@ else {
|
|||
$stacked = 4;
|
||||
$check = false;
|
||||
$percentil = 0;
|
||||
$summatory_series = 0;
|
||||
$average_series = 0;
|
||||
$modules_series = 0;
|
||||
if($config['full_scale_option'] == 1){
|
||||
$fullscale = 1;
|
||||
}
|
||||
else{
|
||||
$fullscale = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -----------------------
|
||||
// CREATE/EDIT GRAPH FORM
|
||||
// -----------------------
|
||||
|
@ -166,17 +177,27 @@ $stackeds = array(
|
|||
);
|
||||
html_print_select ($stackeds, 'stacked', $stacked);
|
||||
|
||||
echo "<div style='float:right' id='thresholdDiv' name='thresholdDiv'> <b>".__('Equalize maximum thresholds')."</b>" .
|
||||
ui_print_help_tip (__("If an option is selected, all graphs will have the highest value from all modules included in the graph as a maximum threshold"), true);
|
||||
|
||||
html_print_checkbox('threshold', CUSTOM_GRAPH_BULLET_CHART_THRESHOLD, $check, false, false, '', false);
|
||||
echo "</div>";
|
||||
|
||||
echo "</div></td>";
|
||||
echo "</div></td></tr>";
|
||||
|
||||
echo "<tr><td class='datos2'><b>".__('Percentil')."</b></td>";
|
||||
echo "<td class='datos2'>" . html_print_checkbox ("percentil", 1, $percentil, true) . "</td></tr>";
|
||||
echo "<td class='datos2'>" . html_print_checkbox ("percentil", 1, $percentil, true) . "</td>";
|
||||
echo "<td class='datos2'><div id='thresholdDiv' name='thresholdDiv'><b>".__('Equalize maximum thresholds')."</b>" .
|
||||
ui_print_help_tip (__("If an option is selected, all graphs will have the highest value from all modules included in the graph as a maximum threshold"), true);
|
||||
html_print_checkbox('threshold', CUSTOM_GRAPH_BULLET_CHART_THRESHOLD, $check, false, false, '', false);
|
||||
echo "</div></td></tr>";
|
||||
echo "<tr><td class='datos2'><b>".__('Add summatory series') .
|
||||
ui_print_help_tip (__("Adds synthetic series to the graph, using all module
|
||||
values to calculate the summation and/or average in each time interval.
|
||||
This feature could be used instead of synthetic modules if you only want to see a graph."), true) . "</b></td>";
|
||||
echo "<td class='datos2'>" . html_print_checkbox ("summatory_series", 1, $summatory_series, true) . "</td>
|
||||
<td class='datos2'><b>".__('Add average series')."</b></td>";
|
||||
echo "<td class='datos2'>" . html_print_checkbox ("average_series", 1, $average_series, true) . "</td></tr>";
|
||||
echo "<tr><td class='datos2'><b>".__('Modules and series')."</b></td>";
|
||||
|
||||
echo "<td class='datos2'>" . html_print_checkbox ("modules_series", 1, $modules_series, true) . "</td>";
|
||||
echo "<td class='datos2'><b>".__('Show full scale graph (TIP)') . ui_print_help_tip(__('This option may cause performance issues'), true) . "</td>";
|
||||
echo "<td class='datos2'>" . html_print_checkbox ("fullscale", 1, $fullscale, true) . "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
|
||||
if ($edit_graph) {
|
||||
|
@ -195,6 +216,12 @@ echo '<script type="text/javascript">
|
|||
}else{
|
||||
$("#thresholdDiv").hide();
|
||||
}
|
||||
|
||||
if(!$("#checkbox-summatory_series").is(":checked") && !$("#checkbox-average_series").is(":checked")){
|
||||
$("#checkbox-modules_series").attr("disabled", true);
|
||||
$("#checkbox-modules_series").attr("checked", false);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("#stacked").change(function(){
|
||||
|
@ -214,6 +241,24 @@ echo '<script type="text/javascript">
|
|||
$("#thresholdDiv").hide();
|
||||
}
|
||||
});
|
||||
|
||||
$("#checkbox-summatory_series").change(function() {
|
||||
if($("#checkbox-summatory_series").is(":checked") && $("#checkbox-modules_series").is(":disabled")) {
|
||||
$("#checkbox-modules_series").removeAttr("disabled");
|
||||
} else if(!$("#checkbox-average_series").is(":checked")) {
|
||||
$("#checkbox-modules_series").attr("disabled", true);
|
||||
$("#checkbox-modules_series").attr("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
$("#checkbox-average_series").change(function() {
|
||||
if($("#checkbox-average_series").is(":checked") && $("#checkbox-modules_series").is(":disabled")) {
|
||||
$("#checkbox-modules_series").removeAttr("disabled");
|
||||
} else if(!$("#checkbox-summatory_series").is(":checked")) {
|
||||
$("#checkbox-modules_series").attr("disabled", true);
|
||||
$("#checkbox-modules_series").attr("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
</script>';
|
||||
?>
|
||||
|
|
|
@ -87,6 +87,10 @@ if ($add_graph) {
|
|||
$period = get_parameter_post ("period");
|
||||
$threshold = get_parameter('threshold');
|
||||
$percentil = get_parameter ("percentil", 0);
|
||||
$summatory_series = get_parameter ("summatory_series", 0);
|
||||
$average_series = get_parameter ("average_series", 0);
|
||||
$modules_series = get_parameter ("modules_series", 0);
|
||||
$fullscale = get_parameter ("fullscale", 0);
|
||||
|
||||
if ($threshold == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
|
||||
$stacked = $threshold;
|
||||
|
@ -103,7 +107,11 @@ if ($add_graph) {
|
|||
'private' => 0,
|
||||
'id_group' => $idGroup,
|
||||
'stacked' => $stacked,
|
||||
'percentil' => $percentil
|
||||
'percentil' => $percentil,
|
||||
'summatory_series' => $summatory_series,
|
||||
'average_series' => $average_series,
|
||||
'modules_series' => $modules_series,
|
||||
'fullscale' => $fullscale
|
||||
);
|
||||
|
||||
if (trim($name) != "") {
|
||||
|
@ -131,8 +139,12 @@ if ($update_graph) {
|
|||
$period = get_parameter('period');
|
||||
$stacked = get_parameter('stacked');
|
||||
$percentil = get_parameter('percentil');
|
||||
$summatory_series = get_parameter ("summatory_series");
|
||||
$average_series = get_parameter ("average_series");
|
||||
$modules_series = get_parameter ("modules_series");
|
||||
$alerts = get_parameter('alerts');
|
||||
$threshold = get_parameter('threshold');
|
||||
$fullscale = get_parameter('fullscale');
|
||||
|
||||
if ($threshold == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
|
||||
$stacked = $threshold;
|
||||
|
@ -141,7 +153,10 @@ if ($update_graph) {
|
|||
if (trim($name) != "") {
|
||||
|
||||
$success = db_process_sql_update('tgraph',
|
||||
array('name' => $name, 'id_group' => $id_group, 'description' => $description, 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked, 'percentil' => $percentil ),
|
||||
array('name' => $name, 'id_group' => $id_group, 'description' => $description,
|
||||
'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked,
|
||||
'percentil' => $percentil, 'summatory_series' => $summatory_series,
|
||||
'average_series' => $average_series, 'modules_series' => $modules_series, 'fullscale' => $fullscale),
|
||||
array('id_graph' => $id_graph));
|
||||
if ($success !== false)
|
||||
db_pandora_audit("Report management", "Update graph #$id_graph");
|
||||
|
@ -179,10 +194,14 @@ if ($add_module) {
|
|||
implode("','", $id_modules).
|
||||
"')");
|
||||
|
||||
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
|
||||
foreach($id_agent_modules as $id_agent_module)
|
||||
$result = db_process_sql_insert('tgraph_source', array('id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight));
|
||||
}
|
||||
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
|
||||
$order = db_get_row_sql("SELECT `field_order` from tgraph_source ORDER BY `field_order` DESC");
|
||||
$order = $order['field_order'];
|
||||
foreach($id_agent_modules as $id_agent_module){
|
||||
$order++;
|
||||
$result = db_process_sql_insert('tgraph_source', array('id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight, 'field_order' => $order));
|
||||
}
|
||||
}
|
||||
else
|
||||
$result = false;
|
||||
}
|
||||
|
|
|
@ -18,12 +18,18 @@ global $config;
|
|||
// Check user credentials
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "RW")) {
|
||||
if (! check_acl ($config['id_user'], 0, "RR")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Inventory Module Management");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
$report_r = check_acl ($config['id_user'], 0, "RR");
|
||||
$report_w = check_acl ($config['id_user'], 0, "RW");
|
||||
$report_m = check_acl ($config['id_user'], 0, "RM");
|
||||
$access = ($report_r == true) ? 'RR' : (($report_w == true) ? 'RW' : (($report_m == true) ? 'RM' : 'RR'));
|
||||
|
||||
require_once ('include/functions_container.php');
|
||||
|
||||
$delete_container = get_parameter('delete_container',0);
|
||||
|
@ -72,13 +78,13 @@ $container = folder_get_folders();
|
|||
|
||||
$tree = folder_get_folders_tree_recursive($container);
|
||||
echo folder_togge_tree_folders($tree);
|
||||
|
||||
echo "<div style='float: right;'>";
|
||||
echo '<form method="post" style="float:right;" action="index.php?sec=reporting&sec2=godmode/reporting/create_container">';
|
||||
html_print_submit_button (__('Create container'), 'create', false, 'class="sub next" style="margin-right:5px;margin-top: 15px;"');
|
||||
echo "</form>";
|
||||
echo "</div>";
|
||||
|
||||
if($report_r && $report_w){
|
||||
echo "<div style='float: right;'>";
|
||||
echo '<form method="post" style="float:right;" action="index.php?sec=reporting&sec2=godmode/reporting/create_container">';
|
||||
html_print_submit_button (__('Create container'), 'create', false, 'class="sub next" style="margin-right:5px;margin-top: 15px;"');
|
||||
echo "</form>";
|
||||
echo "</div>";
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -102,7 +108,7 @@ echo "</div>";
|
|||
}
|
||||
|
||||
$('div[class *= bullet]').css('margin-left','0');
|
||||
$('div[class *= graph]').css('margin-left','0');
|
||||
$('div[class = graph]').css('margin-left','0');
|
||||
$('div[id *= gauge_]').css('width','100%');
|
||||
|
||||
$('select[id *= period_container_'+hash+']').change(function() {
|
||||
|
@ -117,13 +123,12 @@ echo "</div>";
|
|||
if(e.which == 13) {
|
||||
var time = $('input[id *= hidden-period_container_'+hash+']').val();
|
||||
get_graphs_container(id_container,hash,time);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$(document).ready (function () {
|
||||
$('a[id *= tgl]').click(function(e) {
|
||||
var id = e.currentTarget.id;
|
||||
|
|
|
@ -34,10 +34,14 @@ $hack_metaconsole = '';
|
|||
if (defined('METACONSOLE'))
|
||||
$hack_metaconsole = '../../';
|
||||
|
||||
$buttons['visual_console_favorite'] = array('active' => false,
|
||||
'text' => '<a href="index.php?sec=network&sec2=godmode/reporting/visual_console_favorite">' .
|
||||
html_print_image ("images/list.png", true, array ("title" => __('Visual Favourite Console'))) .'</a>');
|
||||
|
||||
if (!defined('METACONSOLE')) {
|
||||
ui_print_page_header(
|
||||
__('Reporting') .' » ' . __('Visual Console'),
|
||||
"images/op_reporting.png", false, "map_builder");
|
||||
"images/op_reporting.png", false, "map_builder", false, $buttons);
|
||||
}
|
||||
|
||||
$id_layout = (int) get_parameter ('id_layout');
|
||||
|
|
|
@ -362,7 +362,7 @@ switch ($action) {
|
|||
break;
|
||||
case 'sql':
|
||||
$description = $item['description'];
|
||||
$sql = $item['external_source'];
|
||||
$sql_query_report = $item['external_source'];
|
||||
$idCustom = $item['treport_custom_sql_id'];
|
||||
$header = $item['header_definition'];
|
||||
$historical_db = $item['historical_db'];
|
||||
|
@ -940,7 +940,7 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
$agents = agents_get_group_agents($group);
|
||||
if ((empty($agents)) || $agents == -1) $agents = array();
|
||||
|
||||
$sql = 'SELECT source
|
||||
$sql_log = 'SELECT source
|
||||
FROM tagente,tagent_module_log
|
||||
WHERE tagente.id_agente = tagent_module_log.id_agent ';
|
||||
|
||||
|
@ -948,16 +948,16 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
$index = 0;
|
||||
foreach ($agents as $key => $a) {
|
||||
if ($index == 0) {
|
||||
$sql .= ' AND (id_agente = ' . $key;
|
||||
$sql_log .= ' AND (id_agente = ' . $key;
|
||||
}
|
||||
else {
|
||||
$sql .= ' OR id_agente = ' . $key;
|
||||
$sql_log .= ' OR id_agente = ' . $key;
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
$sql .= ")";
|
||||
$sql_log .= ")";
|
||||
}
|
||||
html_print_select_from_sql ($sql, 'source', $source, '', __('All'), '', false, false, false);
|
||||
html_print_select_from_sql ($sql_log, 'source', $source, '', __('All'), '', false, false, false);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -1076,10 +1076,10 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
<td style="font-weight:bold;"><?php echo __('Agents'); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
$sql = 'SELECT id_agente, alias
|
||||
$sql_log_report = 'SELECT id_agente, alias
|
||||
FROM tagente, tagent_module_log
|
||||
WHERE tagente.id_agente = tagent_module_log.id_agent';
|
||||
$all_agent_log = db_get_all_rows_sql($sql);
|
||||
$all_agent_log = db_get_all_rows_sql($sql_log_report);
|
||||
|
||||
foreach ($all_agent_log as $key => $value) {
|
||||
$agents2[$value['id_agente']] = $value['alias'];
|
||||
|
@ -1278,7 +1278,7 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
<td style="font-weight:bold;"><?php echo __('SQL query'); ?></td>
|
||||
<td style="" id="sql_entry">
|
||||
<?php
|
||||
html_print_textarea('sql', 5, 25, $sql);
|
||||
html_print_textarea('sql', 5, 25, $sql_query_report);
|
||||
?>
|
||||
</td>
|
||||
<td style="" id="sql_example"></td>
|
||||
|
|
|
@ -2104,7 +2104,7 @@ if ($resultOperationDB !== null) {
|
|||
$err.='';
|
||||
break;
|
||||
}
|
||||
ui_print_result_message ($resultOperationDB, __('Successfull action'), __('Unsuccessfull action<br><br>'.$err));
|
||||
ui_print_result_message ($resultOperationDB, __('Successfull action'), __('Unsuccessful action<br><br>'.$err));
|
||||
}
|
||||
|
||||
switch ($activeTab) {
|
||||
|
|
|
@ -177,6 +177,9 @@ $table->data[5][1] .= '<span class="opt" style="visibility:hidden;">
|
|||
value="modsize">' . __('Get default image size') .
|
||||
'</button></span>';
|
||||
|
||||
$table->data[6][0] = __('Favourite visual console');
|
||||
$table->data[6][1] = html_print_checkbox('is_favourite', 0, $is_favourite, true);
|
||||
|
||||
if ($action == 'new') {
|
||||
$textButtonSubmit = __('Save');
|
||||
$classButtonSubmit = 'sub wand';
|
||||
|
@ -204,10 +207,11 @@ $(document).ready (function () {
|
|||
|
||||
var metaconsole = null;
|
||||
function is_metaconsole() {
|
||||
|
||||
if (metaconsole === null)
|
||||
metaconsole = $("input[name='metaconsole']").val();
|
||||
|
||||
if (metaconsole != 0)
|
||||
if (metaconsole != 0 && metaconsole != undefined)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
@ -326,7 +330,9 @@ $(document).ready (function () {
|
|||
var size_changer_state = false;
|
||||
|
||||
$("#background").change(function() {
|
||||
|
||||
$('#imagen2').attr('src', url_hack_metaconsole + 'images/console/background/'+$('#background').val());
|
||||
|
||||
$('#imagen2').width(230);
|
||||
$('#imagen2').show();
|
||||
});
|
||||
|
@ -376,6 +382,22 @@ $(document).ready (function () {
|
|||
|
||||
$("#text-background_color").attachColorPicker();
|
||||
|
||||
if($("#checkbox-is_favourite").is(":checked")) {
|
||||
$("#hidden-is_favourite_sent").val(1);
|
||||
}
|
||||
else{
|
||||
$("#hidden-is_favourite_sent").val(0);
|
||||
}
|
||||
|
||||
$("#checkbox-is_favourite").change(function(){
|
||||
if($(this).is(":checked")) {
|
||||
$("#hidden-is_favourite_sent").val(1);
|
||||
}
|
||||
else{
|
||||
$("#hidden-is_favourite_sent").val(0);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
|
@ -375,7 +375,7 @@ function update_button_palette_callback() {
|
|||
}
|
||||
|
||||
|
||||
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
$("#image_" + idItem).removeAttr('height');
|
||||
$("#image_" + idItem).attr('width', 70);
|
||||
|
@ -503,7 +503,7 @@ function update_button_palette_callback() {
|
|||
}
|
||||
|
||||
|
||||
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
$("#image_" + idItem).removeAttr('height');
|
||||
$("#image_" + idItem).attr('width', 70);
|
||||
|
@ -679,7 +679,7 @@ function update_button_palette_callback() {
|
|||
}
|
||||
$("#image_" + idItem).attr('src', "images/spinner.gif");
|
||||
if ((values['width'] == 0) || (values['height'] == 0)) {
|
||||
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
$("#image_" + idItem).removeAttr('height');
|
||||
$("#image_" + idItem).attr('width', 70);
|
||||
|
@ -1976,7 +1976,7 @@ function set_static_graph_status(idElement, image, status) {
|
|||
data: parameter,
|
||||
success: function (data) {
|
||||
set_static_graph_status(idElement, image, data);
|
||||
if(values['show_statistics'] == 1){
|
||||
if(data['show_statistics'] == 1){
|
||||
if($('#'+idElement+' table').css('float') == 'right' || $('#'+idElement+ ' table').css('float') == 'left'){
|
||||
$('#'+idElement+ ' img').css('margin-top', parseInt($('#'+idElement).css('height'))/2 - parseInt($('#'+idElement+ ' img').css('height'))/2);
|
||||
}
|
||||
|
@ -2807,7 +2807,7 @@ function createItem(type, values, id_data) {
|
|||
// Do none
|
||||
if(values['image'] != '' && values['image'] != 'none'){
|
||||
|
||||
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
$image.attr('width', '70')
|
||||
.attr('height', '70');
|
||||
}
|
||||
|
@ -2932,7 +2932,7 @@ function createItem(type, values, id_data) {
|
|||
|
||||
if(values['image'] != '' && values['image'] != 'none'){
|
||||
// Do none
|
||||
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
$image.attr('width', '70')
|
||||
.attr('height', '70');
|
||||
}
|
||||
|
@ -3030,18 +3030,15 @@ function createItem(type, values, id_data) {
|
|||
if ((values['width'] == 0) || (values['height'] == 0)) {
|
||||
// Do none
|
||||
if(values['image'] != '' && values['image'] != 'none'){
|
||||
|
||||
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
$image.attr('width', '70')
|
||||
.attr('height', '70');
|
||||
}
|
||||
else{
|
||||
$image.attr('width', $('#preview > img')[0].naturalWidth)
|
||||
.attr('height', $('#preview > img')[0].naturalHeight);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
$image.attr('width', '70')
|
||||
.attr('height', '70');
|
||||
}
|
||||
else{
|
||||
$image.attr('width', $('#preview > img')[0].naturalWidth)
|
||||
.attr('height', $('#preview > img')[0].naturalHeight);
|
||||
}
|
||||
}
|
||||
else{
|
||||
$image.attr('width', '70')
|
||||
.attr('height', '70');
|
||||
|
@ -3166,7 +3163,7 @@ function createItem(type, values, id_data) {
|
|||
|
||||
if(values['image'] != '' && values['image'] != 'none'){
|
||||
// Do none
|
||||
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
$image.attr('width', '70')
|
||||
.attr('height', '70');
|
||||
}
|
||||
|
@ -3447,7 +3444,7 @@ function createItem(type, values, id_data) {
|
|||
break;
|
||||
case 'icon':
|
||||
if ((values['width'] == 0) || (values['height'] == 0)) {
|
||||
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
sizeStyle = 'width: ' + '70' + 'px; height: ' + '70' + 'px;';
|
||||
imageSize = 'width="' + '70' + '" height="' + '70' + '"';
|
||||
}
|
||||
|
|
|
@ -180,6 +180,7 @@ ui_require_javascript_file ('encode_decode_base64');
|
|||
tinyMCE.init({
|
||||
mode : "exact",
|
||||
elements: "text-label",
|
||||
convert_urls: false,
|
||||
theme : "advanced",
|
||||
<?php
|
||||
if ($config['style'] == 'pandora_legacy') {
|
||||
|
|
|
@ -107,6 +107,7 @@ switch ($activeTab) {
|
|||
$width = '';
|
||||
$height = '';
|
||||
$visualConsoleName = '';
|
||||
$is_favourite = 0;
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
|
@ -117,7 +118,8 @@ switch ($activeTab) {
|
|||
$width = (int) get_parameter('width');
|
||||
$height = (int) get_parameter('height');
|
||||
$visualConsoleName = (string) get_parameter('name');
|
||||
|
||||
$is_favourite = (int) get_parameter('is_favourite_sent');
|
||||
|
||||
// ACL for the new visual console
|
||||
//$vconsole_read_new = check_acl ($config['id_user'], $idGroup, "VR");
|
||||
$vconsole_write_new = check_acl ($config['id_user'], $idGroup, "VW");
|
||||
|
@ -137,7 +139,8 @@ switch ($activeTab) {
|
|||
'background' => $background,
|
||||
'background_color' => $background_color,
|
||||
'width' => $width,
|
||||
'height' => $height
|
||||
'height' => $height,
|
||||
'is_favourite' => $is_favourite
|
||||
);
|
||||
|
||||
$error = $_FILES['background_image']['error'];
|
||||
|
@ -268,6 +271,7 @@ switch ($activeTab) {
|
|||
$background_color = $visualConsole['background_color'];
|
||||
$width = $visualConsole['width'];
|
||||
$height = $visualConsole['height'];
|
||||
$is_favourite = $visualConsole['is_favourite'];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -296,7 +300,7 @@ switch ($activeTab) {
|
|||
'flag' => true,
|
||||
'message' => ui_print_result_message($result,
|
||||
__('Successfully multiple delete.'),
|
||||
__('Unsuccessfull multiple delete.'), '', true));
|
||||
__('Unsuccessful multiple delete.'), '', true));
|
||||
break;
|
||||
case 'update':
|
||||
//Update background
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
global $config;
|
||||
|
||||
require_once ($config['homedir'] . '/include/functions_visual_map.php');
|
||||
|
||||
// ACL for the general permission
|
||||
$vconsoles_read = check_acl ($config['id_user'], 0, "VR");
|
||||
$vconsoles_write = check_acl ($config['id_user'], 0, "VW");
|
||||
$vconsoles_manage = check_acl ($config['id_user'], 0, "VM");
|
||||
|
||||
if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access map builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$buttons['map_builder'] = array('active' => false,
|
||||
'text' => '<a href="index.php?sec=network&sec2=godmode/reporting/map_builder">' .
|
||||
html_print_image ("images/visual_console.png", true, array ("title" => __('Visual Console'))) .'</a>');
|
||||
|
||||
if (!defined('METACONSOLE')) {
|
||||
ui_print_page_header(
|
||||
__('Reporting') .' » ' . __('Visual Favourite Console'),
|
||||
"images/op_reporting.png", false, "map_builder", false, $buttons);
|
||||
}
|
||||
|
||||
$search = (string) get_parameter("search","");
|
||||
$ag_group = (int) get_parameter("ag_group",0);
|
||||
$recursion = (int) get_parameter("recursion",0);
|
||||
|
||||
|
||||
if(!is_metaconsole()){
|
||||
echo "<form method='post'
|
||||
action='index.php?sec=network&sec2=godmode/reporting/visual_console_favorite'>";
|
||||
} else {
|
||||
echo "<form method='post'
|
||||
action='index.php?sec=screen&sec2=screens/screens&action=visualmap'>";
|
||||
}
|
||||
echo "<ul class='form_flex'><li class='first_elements'>";
|
||||
echo "<ul><li>";
|
||||
echo __('Search') . ' ';
|
||||
html_print_input_text ("search", $search, '', 50);
|
||||
echo "</li><li>";
|
||||
echo __('Group') . ' ';
|
||||
$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 "</li></ul></li><li class='second_elements'><ul><li>";
|
||||
echo __('Group Recursion');
|
||||
html_print_checkbox ("recursion", 1, $recursion, false, false, 'this.form.submit()');
|
||||
echo "</li><li>";
|
||||
echo "<input name='search_visual_console' type='submit' class='sub search' value='".__('Search')."'>";
|
||||
echo "</li></ul></li></ul>";
|
||||
echo "</form>";
|
||||
|
||||
|
||||
$returnAllGroups = 0;
|
||||
$filters = array();
|
||||
if(!empty($search)){
|
||||
$filters['name'] = io_safe_input($search);
|
||||
}
|
||||
|
||||
if ($ag_group > 0) {
|
||||
$ag_groups = array();
|
||||
$ag_groups = (array)$ag_group;
|
||||
if ($recursion) {
|
||||
$ag_groups = groups_get_id_recursive($ag_group, true);
|
||||
}
|
||||
}
|
||||
elseif($own_info['is_admin']){
|
||||
$returnAllGroups = 1;
|
||||
}
|
||||
|
||||
if($ag_group){
|
||||
$filters['group'] = array_flip($ag_groups);
|
||||
}
|
||||
|
||||
$favorite_array = visual_map_get_user_layouts ($config['id_user'],false,$filters,$returnAllGroups,true);
|
||||
|
||||
echo "<div id='is_favourite'>";
|
||||
if($favorite_array == false){
|
||||
ui_print_error_message(__('No data to show'));
|
||||
}
|
||||
else{
|
||||
echo "<ul class='container'>";
|
||||
foreach( $favorite_array as $favorite_k => $favourite_v ){
|
||||
echo "<a href='index.php?sec=network&sec2=operation/visual_console/render_view&id=" . $favourite_v["id"] .
|
||||
"' title='Visual console". $favourite_v["name"] ."' alt='". $favourite_v["name"] ."'><li>";
|
||||
echo "<div class='icon_img'>";
|
||||
echo html_print_image ("images/groups_small/" . groups_get_icon($favourite_v["id_group"]).".png",
|
||||
true,
|
||||
array ("style" => '')
|
||||
);
|
||||
echo "</div>";
|
||||
echo "<div class='text'>";
|
||||
echo $favourite_v["name"];
|
||||
echo "</div>";
|
||||
echo "</li></a>";
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
echo "</div>";
|
||||
?>
|
|
@ -106,6 +106,18 @@ if (is_ajax ()) {
|
|||
$row['name'] = __('Login attribute');
|
||||
$row['control'] = html_print_input_text ('ldap_login_attr', $config['ldap_login_attr'], '', 60, 100, true);
|
||||
$table->data['ldap_login_attr'] = $row;
|
||||
|
||||
// Admin LDAP login
|
||||
$row = array();
|
||||
$row['name'] = __('Admin LDAP login');
|
||||
$row['control'] = html_print_input_text ('ldap_admin_login', $config['ldap_admin_login'], '', 60, 100, true);
|
||||
$table->data['ldap_admin_login'] = $row;
|
||||
|
||||
// Admin LDAP password
|
||||
$row = array();
|
||||
$row['name'] = __('Admin LDAP password');
|
||||
$row['control'] = html_print_input_password ('ldap_admin_pass', $config['ldap_admin_pass'], $alt = '', 60, 100, true);
|
||||
$table->data['ldap_admin_pass'] = $row;
|
||||
break;
|
||||
|
||||
case 'pandora':
|
||||
|
|
|
@ -121,8 +121,8 @@ echo '<br />';
|
|||
echo '<div style="font-family: lato, "Helvetica Neue", Helvetica, Arial, sans-serif; color: #515151;">';
|
||||
echo __('Remote Management System');
|
||||
echo '</div>';
|
||||
echo '<a target="_blank" rel="noopener noreferrer" href="http://ehorus.com">';
|
||||
echo 'http://ehorus.com';
|
||||
echo '<a target="_blank" rel="noopener noreferrer" href="https://ehorus.com">';
|
||||
echo 'https://ehorus.com';
|
||||
echo '</a>';
|
||||
echo '</div>';
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ $table->data[32][0] = __('Server logs directory') . ui_print_help_tip (__("Direc
|
|||
$table->data[32][1] = html_print_input_text ('server_log_dir',
|
||||
$config["server_log_dir"], '', 50, 255, true);
|
||||
|
||||
$table->data[33][0] = __('Log size limit in system logs viewer extension') . ui_print_help_tip (__("Maximun size to show in system log extension."), true);
|
||||
$table->data[33][0] = __('Log size limit in system logs viewer extension') . ui_print_help_tip (__("Max size (in bytes) for the logs to be shown."), true);
|
||||
$table->data[33][1] = html_print_input_text ('max_log_size',
|
||||
$config["max_log_size"], '', 10, 255, true) . html_print_label(" x1000", "max_log_size", true);
|
||||
|
||||
|
@ -209,8 +209,8 @@ $table->data[34][0] = __('Allow create planned downtimes in the past') .
|
|||
$table->data[34][1] = __('Yes').' '.html_print_radio_button ('past_planned_downtimes', 1, '', $config["past_planned_downtimes"], true).' ';
|
||||
$table->data[34][1] .= __('No').' '.html_print_radio_button ('past_planned_downtimes', 0, '', $config["past_planned_downtimes"], true);
|
||||
|
||||
$table->data[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][0] = __('Limit for bulk operations') .
|
||||
ui_print_help_tip(__('Your PHP environment is set to 1000 max_input_vars. This parameter should have the same value or lower.', ini_get("max_input_vars")), true);
|
||||
$table->data[35][1] = html_print_input_text('limit_parameters_massive',
|
||||
$config['limit_parameters_massive'], '', 10, 10, true);
|
||||
|
||||
|
|
|
@ -281,6 +281,13 @@ $table_styles->data[$row][1] .= __('No') . ' ' .
|
|||
$table_styles->data['autohidden'][0] = __('Autohidden menu');
|
||||
$table_styles->data['autohidden'][1] = html_print_checkbox('autohidden_menu',
|
||||
1, $config['autohidden_menu'], true);
|
||||
|
||||
$table_styles->data[$row][0] = __('Visual effects and animation');
|
||||
$table_styles->data[$row][1] = __('Yes') . ' ' .
|
||||
html_print_radio_button ('visual_animation', 1, '', $config["visual_animation"], true) .
|
||||
' ';
|
||||
$table_styles->data[$row][1] .= __('No') . ' ' .
|
||||
html_print_radio_button ('visual_animation', 0, '', $config["visual_animation"], true);
|
||||
|
||||
echo "<fieldset>";
|
||||
echo "<legend>" . __('Style configuration') . "</legend>";
|
||||
|
@ -561,6 +568,41 @@ html_print_table ($table_chars);
|
|||
echo "</fieldset>";
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Visual Consoles
|
||||
//----------------------------------------------------------------------
|
||||
$table_vc = new stdClass();
|
||||
$table_vc->width = '100%';
|
||||
$table_vc->class = "databox filters";
|
||||
$table_vc->style[0] = 'font-weight: bold';
|
||||
$table_vc->size[0] = '50%';
|
||||
$table_vc->data = array ();
|
||||
|
||||
$vc_favourite_view_array[0] = 'Classic view';
|
||||
$vc_favourite_view_array[1] = 'View of favorites';
|
||||
$table_vc->data[$row][0] = __('Type of view of visual consoles') .
|
||||
ui_print_help_tip(__('Allows you to directly display the list of favorite visual consoles'), true);
|
||||
$table_vc->data[$row][1] = html_print_select($vc_favourite_view_array, 'vc_favourite_view', $config["vc_favourite_view"], '', '', 0, true);
|
||||
$row++;
|
||||
|
||||
$table_vc->data[$row][0] = __('Number of favorite visual consoles to show in the menu') .
|
||||
ui_print_help_tip(__('If the number is 0 it will not show the pull-down menu and maximum 25 favorite consoles'), true);
|
||||
//$table_vc->data[$row][1] = html_print_input_text ('vc_menu_items', $config["vc_menu_items"], '', 5, 5, true);
|
||||
$table_vc->data[$row][1] = "<input type ='number' value=".$config["vc_menu_items"]." size='5' name='vc_menu_items' min='0' max='25'>";
|
||||
$row++;
|
||||
|
||||
if (empty($config["vc_line_thickness"])) $config["vc_line_thickness"] = 2;
|
||||
$table_vc->data[$row][0] = __('Default line thickness for the Visual Console') .
|
||||
ui_print_help_tip(__('This interval will affect to the lines between elements on the Visual Console'), true);
|
||||
$table_vc->data[$row][1] = html_print_input_text ('vc_line_thickness', $config["vc_line_thickness"], '', 5, 5, true);
|
||||
|
||||
|
||||
echo "<fieldset>";
|
||||
echo "<legend>" . __('Visual consoles configuration') . "</legend>";
|
||||
html_print_table ($table_vc);
|
||||
echo "</fieldset>";
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// OTHER CONFIGURATION
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -571,11 +613,6 @@ $table_other->style[0] = 'font-weight: bold;';
|
|||
$table_other->size[0] = '50%';
|
||||
$table_other->data = array ();
|
||||
|
||||
if (empty($config["vc_line_thickness"])) $config["vc_line_thickness"] = 2;
|
||||
$table_other->data[$row][0] = __('Default line thickness for the Visual Console') . ui_print_help_tip(__('This interval will affect to the lines between elements on the Visual Console'), true);
|
||||
$table_other->data[$row][1] = html_print_input_text ('vc_line_thickness', $config["vc_line_thickness"], '', 5, 5, true);
|
||||
$row++;
|
||||
|
||||
// Enrique (27/01/2017) New feature: Show report info on top of reports
|
||||
$table_other->data[$row][0] = __('Show report info with description') .
|
||||
ui_print_help_tip(
|
||||
|
@ -624,7 +661,7 @@ $table_other->data['custom_report_front-logo'][0] = __('Custom report front') .
|
|||
$table_other->data['custom_report_front-logo'][1] = html_print_select(
|
||||
$customLogos,
|
||||
'custom_report_front_logo',
|
||||
$config['custom_report_front_logo'],
|
||||
io_safe_output($config['custom_report_front_logo']),
|
||||
'showPreview()',
|
||||
__('Default'),
|
||||
'',
|
||||
|
|
|
@ -644,7 +644,7 @@ if ($create_alert || $update_alert) {
|
|||
echo ui_print_help_icon ("snmp_alert_custom", true);
|
||||
|
||||
echo '</td><td class="datos">';
|
||||
html_print_textarea ("custom_value", $custom_value, 2, $custom_value, 'style="width:400px;"');
|
||||
html_print_textarea ("custom_value", 2, 2, $custom_value, 'style="width:400px;"');
|
||||
|
||||
echo '</td></tr>';
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
|
||||
// Check ACL
|
||||
if (! check_acl ($config['id_user'], 0, "LW")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
|
@ -28,6 +27,7 @@ $update_filter = (int) get_parameter ('update_filter', -2);
|
|||
$delete_filter = (int) get_parameter ('delete_filter', -1);
|
||||
$description = (string) get_parameter ('description', '');
|
||||
$filter = (string) get_parameter ('filter', '');
|
||||
$index_post = (int) get_parameter('index_post', 0);
|
||||
|
||||
// Create/update header
|
||||
if ($edit_filter > -2) {
|
||||
|
@ -44,9 +44,35 @@ else {// Overview header
|
|||
|
||||
// Create/update filter
|
||||
if ($update_filter > -2) {
|
||||
// UPDATE
|
||||
if ($update_filter > -1) {
|
||||
$values = array('description' => $description, 'filter' => $filter);
|
||||
$result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $update_filter));
|
||||
$new_unified_id = (db_get_value_sql("SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $update_filter));
|
||||
$elements = get_parameter('elements', array());
|
||||
|
||||
$elements = explode(",", $elements);
|
||||
foreach ($elements as $e) {
|
||||
$filter = get_parameter('filter_' . $e);
|
||||
$values = array('description' => $description, 'filter' => $filter, 'unified_filters_id' => $new_unified_id);
|
||||
$result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $e));
|
||||
}
|
||||
if (count($elements) == 1) {
|
||||
$new_unified_id = (db_get_value_sql("SELECT MAX(unified_filters_id) FROM tsnmp_filter")) + 1;
|
||||
|
||||
$filter = get_parameter('filter_' . $elements[0]);
|
||||
$values = array('description' => $description, 'filter' => $filter, 'unified_filters_id' => $new_unified_id);
|
||||
$result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $elements[0]));
|
||||
}
|
||||
for ($i = 1; $i < $index_post; $i++) {
|
||||
$filter = get_parameter('filter_' . $i);
|
||||
if ($filter != "") {
|
||||
$values = array(
|
||||
'description' => $description,
|
||||
'filter' => $filter,
|
||||
'unified_filters_id' => $new_unified_id);
|
||||
$result = db_process_sql_insert('tsnmp_filter', $values);
|
||||
}
|
||||
}
|
||||
|
||||
if ($result === false) {
|
||||
ui_print_error_message (__('There was a problem updating the filter'));
|
||||
}
|
||||
|
@ -54,11 +80,29 @@ if ($update_filter > -2) {
|
|||
ui_print_success_message (__('Successfully updated'));
|
||||
}
|
||||
}
|
||||
// CREATE
|
||||
else {
|
||||
$values = array(
|
||||
'description' => $description,
|
||||
'filter' => $filter);
|
||||
$result = db_process_sql_insert('tsnmp_filter', $values);
|
||||
$new_unified_id = (db_get_value_sql("SELECT MAX(unified_filters_id) FROM tsnmp_filter")) + 1;
|
||||
|
||||
if ($index_post == 1) {
|
||||
$filter = get_parameter('filter_0');
|
||||
$values = array(
|
||||
'description' => $description,
|
||||
'filter' => $filter,
|
||||
'unified_filters_id' => $new_unified_id);
|
||||
$result = db_process_sql_insert('tsnmp_filter', $values);
|
||||
}
|
||||
else {
|
||||
for ($i = 0; $i < $index_post; $i++) {
|
||||
$filter = get_parameter('filter_' . $i);
|
||||
$values = array(
|
||||
'description' => $description,
|
||||
'filter' => $filter,
|
||||
'unified_filters_id' => $new_unified_id);
|
||||
$result = db_process_sql_insert('tsnmp_filter', $values);
|
||||
}
|
||||
}
|
||||
|
||||
if ($result === false) {
|
||||
ui_print_error_message (__('There was a problem creating the filter'));
|
||||
}
|
||||
|
@ -68,7 +112,15 @@ if ($update_filter > -2) {
|
|||
}
|
||||
}
|
||||
else if ($delete_filter > -1) { // Delete
|
||||
$result = db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $delete_filter));
|
||||
$unified_id_to_delete = (db_get_value_sql("SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $delete_filter));
|
||||
|
||||
if ($unified_id_to_delete == 0) {
|
||||
$result = db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $delete_filter));
|
||||
}
|
||||
else {
|
||||
$result = db_process_sql_delete('tsnmp_filter', array('unified_filters_id' => $unified_id_to_delete));
|
||||
}
|
||||
|
||||
if ($result === false) {
|
||||
ui_print_error_message (__('There was a problem deleting the filter'));
|
||||
}
|
||||
|
@ -88,19 +140,59 @@ if ($edit_filter > -1) {
|
|||
|
||||
// Create/update form
|
||||
if ($edit_filter > -2) {
|
||||
$index = $index_post;
|
||||
$table = new stdClass();
|
||||
$table->data = array ();
|
||||
$table->id = 'filter_table';
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
$table->data[0][0] = __('Description');
|
||||
$table->data[0][1] = html_print_input_text ('description', $description, '', 60, 100, true);
|
||||
$table->data[1][0] = __('Filter');
|
||||
$table->data[1][1] = html_print_input_text ('filter', $filter, '', 60, 100, true);
|
||||
$table->data[1][1] .= ui_print_help_tip (__("This field contains a substring, could be part of a IP address, a numeric OID, or a plain substring") . SEPARATOR_COLUMN, true);
|
||||
if ($edit_filter > -1) {
|
||||
$unified_filter = db_get_value_sql("SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter != 0 AND id_snmp_filter = " . $edit_filter);
|
||||
if($unified_filter){
|
||||
$filters = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = " . $unified_filter);
|
||||
}
|
||||
else{
|
||||
$filters = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE id_snmp_filter = " . $edit_filter);
|
||||
}
|
||||
|
||||
$j = 1;
|
||||
|
||||
foreach ($filters as $f) {
|
||||
if ($j != 1) {
|
||||
$table->data[$j][0] = "";
|
||||
}
|
||||
$table->data[$j][1] = html_print_input_text ('filter_' . $f['id_snmp_filter'], $f['filter'], '', 60, 100, true);
|
||||
if ($j == 1) {
|
||||
$table->data[$j][1] .= ui_print_help_tip (__("This field contains a substring, could be part of a IP address, a numeric OID, or a plain substring") . SEPARATOR_COLUMN, true);
|
||||
}
|
||||
else {
|
||||
$table->data[$j][1] .= html_print_image('images/cross.png', true, array('id' => 'delete_filter_' . $f['id_snmp_filter'], 'alt' => __('Click to remove the filter')));
|
||||
}
|
||||
$j++;
|
||||
$index++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$table->data[1][1] = html_print_input_text ('filter_' . $index, $filter, '', 60, 100, true);
|
||||
$table->data[1][1] .= ui_print_help_tip (__("This field contains a substring, could be part of a IP address, a numeric OID, or a plain substring") . SEPARATOR_COLUMN, true);
|
||||
}
|
||||
$index++;
|
||||
echo '<form action="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters" method="post">';
|
||||
html_print_input_hidden ('update_filter', $edit_filter);
|
||||
html_print_input_hidden ('index_post', $index);
|
||||
if ($edit_filter > -1) {
|
||||
$filters_to_post = array();
|
||||
foreach ($filters as $fil) {
|
||||
$filters_to_post[] = $fil['id_snmp_filter'];
|
||||
}
|
||||
html_print_input_hidden ('elements', implode(",", $filters_to_post));
|
||||
}
|
||||
html_print_table ($table);
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_image('images/add.png', false, array('id' => 'add_filter', 'alt' => __('Click to add new filter'), 'title' => __('Click to add new filter'), 'style' => 'float:left;'));
|
||||
if ($edit_filter > -1) {
|
||||
html_print_submit_button (__('Update'), 'submit_button', false, 'class="sub upd"');
|
||||
}
|
||||
|
@ -112,13 +204,14 @@ if ($edit_filter > -2) {
|
|||
// Overview
|
||||
}
|
||||
else {
|
||||
$result = db_get_all_rows_in_table ("tsnmp_filter");
|
||||
if ($result === false) {
|
||||
$result = array ();
|
||||
require_once ($config['homedir'] . "/general/firts_task/snmp_filters.php");
|
||||
return;
|
||||
$result_unified = db_get_all_rows_sql("SELECT DISTINCT(unified_filters_id) FROM tsnmp_filter ORDER BY unified_filters_id ASC");
|
||||
|
||||
$aglomerate_result = array();
|
||||
foreach ($result_unified as $res) {
|
||||
$aglomerate_result[$res['unified_filters_id']] = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = " . $res['unified_filters_id'] . " ORDER BY id_snmp_filter ASC");
|
||||
}
|
||||
|
||||
|
||||
$table = new stdClass();
|
||||
$table->data = array ();
|
||||
$table->head = array ();
|
||||
$table->size = array ();
|
||||
|
@ -133,16 +226,43 @@ else {
|
|||
$table->head[2] = __('Action');
|
||||
$table->size[2] = "50px";
|
||||
$table->align[2] = 'center';
|
||||
|
||||
foreach ($result as $row) {
|
||||
$data = array ();
|
||||
$data[0] = '<a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&edit_filter='.$row['id_snmp_filter'].'">' . $row['description'] . '</a>';
|
||||
$data[1] = $row['filter'];
|
||||
$data[2] = '<a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&edit_filter='.$row['id_snmp_filter'].'">' .
|
||||
html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '</a>' .
|
||||
' <a onclick="if (confirm(\'' . __('Are you sure?') . '\')) return true; else return false;" href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&delete_filter='.$row['id_snmp_filter'].'">' .
|
||||
html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . '</a>';
|
||||
array_push ($table->data, $data);
|
||||
|
||||
foreach ($aglomerate_result as $ind => $row) {
|
||||
if ($ind == 0) {
|
||||
foreach ($row as $r) {
|
||||
$data = array ();
|
||||
$data[0] = '<a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&edit_filter='.$r['id_snmp_filter'].'">' . $r['description'] . '</a>';
|
||||
$data[1] = $r['filter'];
|
||||
$data[2] = '<a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&edit_filter='.$r['id_snmp_filter'].'">' .
|
||||
html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '</a>' .
|
||||
' <a onclick="if (confirm(\'' . __('Are you sure?') . '\')) return true; else return false;" href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&delete_filter='.$r['id_snmp_filter'].'">' .
|
||||
html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . '</a>';
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$ind2 = 0;
|
||||
$compose_filter = array();
|
||||
$compose_id = "";
|
||||
$compose_action = "";
|
||||
foreach ($row as $i => $r) {
|
||||
if ($ind2 == 0) {
|
||||
$compose_id = '<a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&edit_filter='.$r['id_snmp_filter'].'">' . $r['description'] . '</a>';
|
||||
$compose_action = '<a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&edit_filter='.$r['id_snmp_filter'].'">' .
|
||||
html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '</a>' .
|
||||
' <a onclick="if (confirm(\'' . __('Are you sure?') . '\')) return true; else return false;" href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&delete_filter='.$r['id_snmp_filter'].'">' .
|
||||
html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . '</a>';
|
||||
$ind2++;
|
||||
}
|
||||
$compose_filter[] = $r['filter'];
|
||||
}
|
||||
$data = array ();
|
||||
$data[0] = $compose_id;
|
||||
$data[1] = implode(" AND ", $compose_filter);
|
||||
$data[2] = $compose_action;
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!empty ($table->data)) {
|
||||
|
@ -157,3 +277,45 @@ else {
|
|||
echo '</form></div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
var id = "<?php echo $index; ?>";
|
||||
var homeurl = "<?php echo $config['homeurl']; ?>";
|
||||
|
||||
$(document).ready (function () {
|
||||
$('#add_filter').click(function(e) {
|
||||
$('#filter_table').append('<tr id="filter_table-' + id + '" style="" class="datos"><td id="filter_table-' + id + '-0" style="" class="datos "></td><td id="filter_table-' + id + '-1" style="" class="datos "><input type="text" name="filter_' + id + '" value="" id="text-filter_' + id + '" size="60" maxlength="100"><img src="' + homeurl + 'images/cross.png" onclick="delete_this_row(' + id + ');" data-title="Click to delete the filter" data-use_title_for_force_title="1" class="forced_title" alt="Click to delete the filter"></td></tr>');
|
||||
|
||||
id++;
|
||||
|
||||
$('#hidden-index_post').val(id);
|
||||
});
|
||||
|
||||
$('[id^=delete_filter_]').click(function(e) {
|
||||
var elem_id = this.id;
|
||||
var id_array = elem_id.split("delete_filter_");
|
||||
var id = id_array[1];
|
||||
|
||||
params = {};
|
||||
params['page'] = "include/ajax/snmp.ajax";
|
||||
params['delete_snmp_filter'] = 1;
|
||||
params['filter_id'] = id;
|
||||
|
||||
jQuery.ajax ({
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "html",
|
||||
success: function(data){
|
||||
var elem = $('#hidden-elements').val();
|
||||
$('#hidden-elements').val(elem - 1);
|
||||
$('#' + elem_id).parent().parent().remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function delete_this_row (id_row) {
|
||||
$('#filter_table-' + id_row).remove();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -180,7 +180,7 @@ if ($create_user) {
|
|||
$values["data_section"] = $dashboard;
|
||||
} else if (io_safe_output($values['section']) == 'Visual console') {
|
||||
$values["data_section"] = $visual_console;
|
||||
} else if ($values['section'] == 'Other'){
|
||||
} else if ($values['section'] == 'Other' || io_safe_output($values['section']) == 'External link'){
|
||||
$values["data_section"] = get_parameter ('data_section');
|
||||
}
|
||||
|
||||
|
@ -304,7 +304,7 @@ if ($update_user) {
|
|||
$values["data_section"] = $dashboard;
|
||||
} else if (io_safe_output($values['section']) == 'Visual console') {
|
||||
$values["data_section"] = $visual_console;
|
||||
} else if ($values['section'] == 'Other'){
|
||||
} else if ($values['section'] == 'Other' || io_safe_output($values['section']) == 'External link'){
|
||||
$values["data_section"] = get_parameter ('data_section');
|
||||
}
|
||||
|
||||
|
@ -334,6 +334,8 @@ if ($update_user) {
|
|||
else {
|
||||
$res2 = update_user_password ($id, $password_new);
|
||||
if ($res2) {
|
||||
db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password change',
|
||||
'descripcion' => 'Access password updated','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time()));
|
||||
$res3 = save_pass_history($id, $password_new);
|
||||
}
|
||||
ui_print_result_message ($res1 || $res2,
|
||||
|
@ -345,6 +347,8 @@ if ($update_user) {
|
|||
$res2 = update_user_password ($id, $password_new);
|
||||
if ($res2) {
|
||||
$res3 = save_pass_history($id, $password_new);
|
||||
db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password change',
|
||||
'descripcion' => 'Access password updated','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time()));
|
||||
}
|
||||
ui_print_result_message ($res1 || $res2,
|
||||
__('User info successfully updated'),
|
||||
|
@ -352,6 +356,8 @@ if ($update_user) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password change',
|
||||
'descripcion' => 'Access password update failed','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time()));
|
||||
ui_print_error_message (__('Passwords does not match'));
|
||||
}
|
||||
}
|
||||
|
@ -564,6 +570,7 @@ $values = array (
|
|||
'Group view'=>__('Group view'),
|
||||
'Tactical view'=>__('Tactical view'),
|
||||
'Alert detail' => __('Alert detail'),
|
||||
'External link' => __('External link'),
|
||||
'Other'=>__('Other'));
|
||||
if (enterprise_installed() && !is_metaconsole()) {
|
||||
$values['Dashboard'] = __('Dashboard');
|
||||
|
@ -864,6 +871,11 @@ function show_data_section () {
|
|||
$("#dashboard").css("display", "none");
|
||||
$("#visual_console").css("display", "none");
|
||||
break;
|
||||
case <?php echo "'" . 'External link' . "'"; ?>:
|
||||
$("#text-data_section").css("display", "");
|
||||
$("#dashboard").css("display", "none");
|
||||
$("#visual_console").css("display", "none");
|
||||
break;
|
||||
case <?php echo "'" . 'Other' . "'"; ?>:
|
||||
$("#text-data_section").css("display", "");
|
||||
$("#dashboard").css("display", "none");
|
||||
|
|
|
@ -76,11 +76,11 @@ switch ($sortField) {
|
|||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectLastConnectUp = $selected;
|
||||
$order = array('field' => 'fullname', 'order' => 'ASC');
|
||||
$order = array('field' => 'last_connect', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectLastConnectDown = $selected;
|
||||
$order = array('field' => 'fullname', 'order' => 'DESC');
|
||||
$order = array('field' => 'last_connect', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -494,10 +494,4 @@ echo '</div>';
|
|||
enterprise_hook('close_meta_frame');
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
console.log('sknknan');
|
||||
// text-filter_search
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
After Width: | Height: | Size: 268 B |
After Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 24 KiB |