diff options
Diffstat (limited to 'net-mgmt')
-rw-r--r-- | net-mgmt/pandorafms_agent/Makefile | 1 | ||||
-rw-r--r-- | net-mgmt/pandorafms_agent/distinfo | 4 | ||||
-rw-r--r-- | net-mgmt/pandorafms_agent/files/patch-update | 1288 | ||||
-rw-r--r-- | net-mgmt/pandorafms_agent/pkg-plist | 16 | ||||
-rw-r--r-- | net-mgmt/pandorafms_console/Makefile | 9 | ||||
-rw-r--r-- | net-mgmt/pandorafms_console/distinfo | 4 | ||||
-rw-r--r-- | net-mgmt/pandorafms_console/files/patch-WLB-2014110100 | 29 | ||||
-rw-r--r-- | net-mgmt/pandorafms_console/files/patch-update | 9578 | ||||
-rw-r--r-- | net-mgmt/pandorafms_console/pkg-plist | 285 | ||||
-rw-r--r-- | net-mgmt/pandorafms_server/Makefile | 7 | ||||
-rw-r--r-- | net-mgmt/pandorafms_server/bsd.pandora.mk | 8 | ||||
-rw-r--r-- | net-mgmt/pandorafms_server/distinfo | 4 | ||||
-rw-r--r-- | net-mgmt/pandorafms_server/files/patch-update | 5592 | ||||
-rw-r--r-- | net-mgmt/pandorafms_server/pkg-plist | 12 | ||||
-rw-r--r-- | net-mgmt/pandorafms_server/pkg-plist.spool | 24 |
15 files changed, 103 insertions, 16758 deletions
diff --git a/net-mgmt/pandorafms_agent/Makefile b/net-mgmt/pandorafms_agent/Makefile index fcfe9a58bd77..2b3bf5e4bb31 100644 --- a/net-mgmt/pandorafms_agent/Makefile +++ b/net-mgmt/pandorafms_agent/Makefile @@ -40,6 +40,7 @@ post-patch: post-install: @${RM} -f ${STAGEDIR}${LOGDIR}/pandora_agent.log + @${RM} -f ${STAGEDIR}${DATADIR}/collections/.empty @${MKDIR} ${STAGEDIR}${DOCSDIR} .for x in ${PORTDOCS} ${INSTALL_DATA} ${WRKSRC}/${x} ${STAGEDIR}${DOCSDIR} diff --git a/net-mgmt/pandorafms_agent/distinfo b/net-mgmt/pandorafms_agent/distinfo index 6b521f141db3..6694baca65e2 100644 --- a/net-mgmt/pandorafms_agent/distinfo +++ b/net-mgmt/pandorafms_agent/distinfo @@ -1,2 +1,2 @@ -SHA256 (pandora/pandorafms_agent_unix-5.1.tar.gz) = 9d487573716c088a5121fbb89456000bd39226dbb317ed2d88970f46d4b2bc34 -SIZE (pandora/pandorafms_agent_unix-5.1.tar.gz) = 86100 +SHA256 (pandora/pandorafms_agent_unix-5.1SP1.tar.gz) = b4e4363784a133d4679bdab22c977177ccebc9758e9b6f051d15a7a6a81a7a95 +SIZE (pandora/pandorafms_agent_unix-5.1SP1.tar.gz) = 80277 diff --git a/net-mgmt/pandorafms_agent/files/patch-update b/net-mgmt/pandorafms_agent/files/patch-update deleted file mode 100644 index 3cf74fe1ac4b..000000000000 --- a/net-mgmt/pandorafms_agent/files/patch-update +++ /dev/null @@ -1,1288 +0,0 @@ -Index: ChangeLog -=================================================================== ---- ChangeLog (revision 10314) -+++ ChangeLog (working copy) -@@ -1,3 +1,33 @@ -+2014-08-14 Koichiro Kikuchi <koichiro@rworks.jp> -+ -+ * pandora_agent_installer: Fixed symlink source path. -+ -+2014-08-13 Koichiro Kikuchi <koichiro@rworks.jp> -+ -+ * FreeBSD/pandora_agent: Small fixes: use proper rc variables, -+ remove obsolete function "set_rcvar" call and use "daemon" command -+ to start pandora_agent. -+ -+ * pandora_agent_installer: Refactored implementation and added -+ "fakeroot" installation support. -+ -+ * plugins/who.sh: Converted to bourne shell script. -+ -+ * pandora_agent_daemon: Small bug fixes and refactorings. -+ -+2014-08-12 Ramon Novoa <rnovoa@artica.es> -+ -+ * pandora_agent: Fixed to make the 'Command Snapshot' feature work. -+ -+2014-08-12 Ramon Novoa <rnovoa@artica.es> -+ -+ * pandora_agent: Trim leading and trailing whitespaces from module names -+ (like policies and windows agents do). -+ -+2014-08-07 Ramon Novoa <rnovoa@artica.es> -+ -+ * pandora_agent_daemon: Fixes the ps call on HP-UX. -+ - 2014-06-04 Koichiro KIKUCHI <koichiro@rworks.jp> - - * pandora_agent: Allow spaces in module group names. -Index: pandora_agent_installer -=================================================================== ---- pandora_agent_installer (revision 10314) -+++ pandora_agent_installer (working copy) -@@ -15,49 +15,79 @@ - - FORCE=0 - LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"` --PANDORA_HOME=/usr/share/pandora_agent --PANDORA_BIN=/usr/bin/pandora_agent --PANDORA_EXEC_BIN=/usr/bin/pandora_agent_exec --PANDORA_REVENT_BIN=/usr/bin/pandora_revent -+ -+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=/usr/bin/tentacle_client --TENTACLE_SERVER=/usr/bin/tentacle_server --PANDORA_MAN=/usr/share/man -+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 --PANDORA_BASE=`echo $2 | sed -e 's/\/$//'` -+ -+# 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 [ "$PANDORA_BASE" = "" ] -+ 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 --else -- PANDORA_USER="root" - fi - --if [ "$4" != "" ] --then -- PANDORA_PERL_PATH=$4 -- echo $PANDORA_PERL_PATH > PANDORA_PERL_PATH.temp -- sed 's/\//\\\//g' PANDORA_PERL_PATH.temp > PANDORA_PERL_PATH.temp2 -+[ "$4" ] && PANDORA_PERL_PATH=$4 - -- PANDORA_PERL_DECODED_PATH=`cat PANDORA_PERL_PATH.temp2` -- rm PANDORA_PERL_PATH.temp PANDORA_PERL_PATH.temp2 -- #PANDORA_PERL_DECODED_PATH=`echo $PANDORA_PERL_PATH | sed -e "s.\/.\\\\\/.g"` --else -- PANDORA_PERL_PATH="perl" -- if [ "$OS_NAME" = "NetBSD" ] -- then -- PANDORA_PERL_DECODED_PATH="/usr/pkg/bin/perl" -- fi --fi -- - # Check for Perl 5.6.x or higher available - PERL_VERSION=`$PANDORA_PERL_PATH -v | egrep 'v5.6|v5.7|v5.8|v5.9|v5.1[0-9]' | grep perl` - -@@ -69,17 +99,16 @@ - exit 2 - fi - --UNIX_KIND=`uname -s` --if [ -z "`echo Linux HP-UX SunOS AIX Solaris Darwin BSD bsd FreeBSD NetBSD | grep \"$UNIX_KIND\"`" ] -+if [ -z "`echo Linux HP-UX SunOS AIX Solaris Darwin BSD bsd FreeBSD NetBSD | grep \"$OS_NAME\"`" ] - then -- echo "This system: '$UNIX_KIND' is not supported by this script" -+ 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 [ -z "`id | grep \"uid=0(root)\"`" ] -+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" -@@ -91,7 +120,7 @@ - help () { - echo "Syntax": - echo " " -- echo " ./pandora_agent_installer < --mode > [ destination_path ] [ user_to_run_as ] [custom_perl_path]" -+ echo " ./pandora_agent_installer < --mode > [ --option ] [ destination_path ] [ user_to_run_as ] [custom_perl_path]" - echo " " - echo "Modes:" - echo " " -@@ -99,6 +128,11 @@ - 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" -@@ -110,38 +144,12 @@ - } - - uninstall () { -- OS_NAME=`uname -s` -- - if [ "$OS_NAME" = "Darwin" ] - then - launchctl remove com.pandorafms.pandorafms - rm /Library/LaunchDaemons/com.pandorafms.pandorafms.plist 2> /dev/null - fi - -- -- if [ "$OS_NAME" = "FreeBSD" ] -- then -- PANDORA_HOME=/usr/local/share/pandora_agent -- PANDORA_BIN=/usr/local/bin/pandora_agent -- PANDORA_EXEC_BIN=/usr/local/bin/pandora_agent_exec -- PANDORA_REVENT_BIN=/usr/local/bin/pandora_revent -- PANDORA_CFG=/usr/local/etc/pandora -- TENTACLE=/usr/local/bin/tentacle_client -- TENTACLE_SERVER=/usr/local/bin/tentacle_server -- PANDORA_MAN=/usr/local/man -- fi -- if [ "$OS_NAME" = "NetBSD" ] -- then -- PANDORA_HOME=/usr/local/share/pandora_agent -- PANDORA_BIN=/usr/local/bin/pandora_agent -- PANDORA_EXEC_BIN=/usr/local/bin/pandora_agent_exec -- PANDORA_REVENT_BIN=/usr/local/bin/pandora_revent -- PANDORA_CFG=/usr/local/etc/pandora -- TENTACLE=/usr/local/bin/tentacle_client -- TENTACLE_SERVER=/usr/local/bin/tentacle_server -- PANDORA_MAN=/usr/share/man -- 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 -@@ -168,16 +176,19 @@ - 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 -- 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 -+ 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 2> /dev/null -@@ -201,36 +212,48 @@ - echo "Done" - } - --install () { -+# -+# 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" - -- OS_VERSION=`uname -r` -- OS_NAME=`uname -s` -- OLDFILENAMETMP=`date +"%Y-%m-%d"` -- -- if [ "$OS_NAME" = "FreeBSD" ] -+ # do install -+ if echo $PANDORA_PERL_PATH | grep "/" > /dev/null && [ "$PANDORA_PERL_PATH" != "/usr/bin/perl" ] - then -- PANDORA_HOME=/usr/local/share/pandora_agent -- PANDORA_BIN=/usr/local/bin/pandora_agent -- PANDORA_EXEC_BIN=/usr/local/bin/pandora_agent_exec -- PANDORA_REVENT_BIN=/usr/local/bin/pandora_revent -- PANDORA_CFG=/usr/local/etc/pandora -- TENTACLE=/usr/local/bin/tentacle_client -- TENTACLE_SERVER=/usr/local/bin/tentacle_server -- PANDORA_MAN=/usr/local/man -+ sed -e "s:^#\!.*:#\!$PANDORA_PERL_PATH:g" $SRC > $DEST -+ else -+ cp $SRC $DEST - fi - -- if [ "$OS_NAME" = "NetBSD" ] -- then -- PANDORA_HOME=/usr/local/share/pandora_agent -- PANDORA_BIN=/usr/local/bin/pandora_agent -- PANDORA_EXEC_BIN=/usr/local/bin/pandora_agent_exec -- PANDORA_REVENT_BIN=/usr/local/bin/pandora_revent -- PANDORA_CFG=/usr/local/etc/pandora -- TENTACLE=/usr/local/bin/tentacle_client -- TENTACLE_SERVER=/usr/local/bin/tentacle_server -- PANDORA_MAN=/usr/share/man -- 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 -@@ -253,87 +276,49 @@ - - # Alter dynamically the daemon launcher and setup the new path - # if PANDORA_BASE is customized. -- if [ ! -z "$PANDORA_BASE" ] -+ if [ "$PANDORA_BASE" ] && [ $FAKEROOT -ne 1 ] - then -- if [ "$OS_NAME" = "FreeBSD" ] -- then -- DAEMON_SCRIPT=FreeBSD/pandora_agent -- DAEMON_TEMP=pandora_agent_daemon_temp -- elif [ "$OS_NAME" = "NetBSD" ] -- then -- DAEMON_SCRIPT=NetBSD/pandora_agent -- DAEMON_TEMP=pandora_agent_daemon_temp -- else -- DAEMON_SCRIPT=pandora_agent_daemon -- DAEMON_TEMP=pandora_agent_daemon_temp -- fi -+ DAEMON_TEMP=pandora_agent_daemon_temp - - # Backup the daemon script -- cp -f "$DAEMON_SCRIPT" "$DAEMON_SCRIPT.bak" -+ 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" -+ cp -f "$AGENT_CFG" "${AGENT_CFG}.bak" - -- echo $PANDORA_BASE > PANDORA_BASE.temp -- sed 's/\//\\\//g' PANDORA_BASE.temp > PANDORA_BASE.temp2 -- -- PANDORA_BASE_DECODED=`cat PANDORA_BASE.temp2` -- rm PANDORA_BASE.temp PANDORA_BASE.temp2 -- -- if [ "$OS_NAME" = "FreeBSD" -o "$OS_NAME" = "NetBSD" ] -+ if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ] - then -- sed -e "s/^PATH\=[.]*/PATH\=$PANDORA_BASE_DECODED\/usr\/local\/bin\:/g" $DAEMON_SCRIPT > $DAEMON_TEMP -+ 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 -- -- sed -e "s/^command\=[.]*/command\=$PANDORA_BASE_DECODED/g" $DAEMON_SCRIPT > $DAEMON_TEMP -- mv $DAEMON_TEMP $DAEMON_SCRIPT -- -- sed -e 's/^command_args\=\"[.]*/command_args\=\"$PANDORA_BASE_DECODED/g' $DAEMON_SCRIPT > $DAEMON_TEMP -- mv $DAEMON_TEMP $DAEMON_SCRIPT -- -- sed -e 's/^required_files\=\"[.]*/required_files\=\"$PANDORA_BASE_DECODED/g' $DAEMON_SCRIPT > $DAEMON_TEMP -- mv $DAEMON_TEMP $DAEMON_SCRIPT - else -- sed -e "s/^PATH\=[.]*/PATH\=$PANDORA_BASE_DECODED\/usr\/bin\:/g" $DAEMON_SCRIPT > $DAEMON_TEMP -+ 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 -- -- sed -e "s/^PANDORA_PATH\=[.]*/PANDORA_PATH\=$PANDORA_BASE_DECODED/g" $DAEMON_SCRIPT > $DAEMON_TEMP -- mv $DAEMON_TEMP $DAEMON_SCRIPT -- -- sed -e "s/^LOGFILE\=[.]*/LOGFILE\=$PANDORA_BASE_DECODED/g" $DAEMON_SCRIPT > $DAEMON_TEMP -- mv $DAEMON_TEMP $DAEMON_SCRIPT -- -- sed -e "s/^DAEMON\=[.]*/DAEMON\=$PANDORA_BASE_DECODED/g" $DAEMON_SCRIPT > $DAEMON_TEMP -- mv $DAEMON_TEMP $DAEMON_SCRIPT -- -- sed -e "s/^DAEMON_TENTACLE\=[.]*/DAEMON_TENTACLE\=$PANDORA_BASE_DECODED/g" $DAEMON_SCRIPT > $DAEMON_TEMP -- mv $DAEMON_TEMP $DAEMON_SCRIPT -- -- sed -e "s/^PANDORA_USER\=.*/PANDORA_USER\=$PANDORA_USER/g" $DAEMON_SCRIPT > $DAEMON_TEMP -- mv $DAEMON_TEMP $DAEMON_SCRIPT - fi - -- sed -e "s/^temporal [.]*/temporal $PANDORA_BASE_DECODED/g" $AGENT_CFG > $AGENT_CFG_TEMP -+ sed -e "s|^temporal[ ]*|temporal $PANDORA_BASE|" \ -+ -e "s|^logfile[ ]*|logfile $PANDORA_BASE|" \ -+ $AGENT_CFG > $AGENT_CFG_TEMP - mv $AGENT_CFG_TEMP $AGENT_CFG -- -- sed -e "s/^logfile [.]*/logfile $PANDORA_BASE_DECODED/g" $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 [ ! -z "$PANDORA_BASE" ] -+ 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 -- if [ "$OS_NAME" = "FreeBSD" -o "$OS_NAME" = "NetBSD" ] -- then -- mkdir -p $PANDORA_BASE/usr/local/bin 2> /dev/null -- else -- mkdir -p $PANDORA_BASE/usr/bin 2> /dev/null -- fi -+ mkdir -p $PANDORA_BASE$PREFIX/bin 2> /dev/null - fi - - mkdir -p $PANDORA_BASE$PANDORA_HOME 2> /dev/null -@@ -344,14 +329,14 @@ - 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 -+ mv $AGENT_CFG_TEMP $AGENT_CFG - chmod 755 pandora_agent_daemon -- chown -R $PANDORA_USER $PANDORA_BASE -+ chown -R $PANDORA_USER $PANDORA_BASE 2>/dev/null - fi - - # Create logfile -@@ -365,32 +350,10 @@ - - # 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 - -- if [ "$PANDORA_PERL_DECODED_PATH" != "" ] -- then -- sed -e "s:^#\!.*:#\!$PANDORA_PERL_DECODED_PATH:g" pandora_agent > $PANDORA_BASE$PANDORA_BIN -- else -- cp pandora_agent $PANDORA_BASE$PANDORA_BIN -- fi -- chmod 755 $PANDORA_BASE$PANDORA_BIN -- if [ "$PANDORA_PERL_DECODED_PATH" != "" ] -- then -- sed -e "s:^#\!.*:#\!$PANDORA_PERL_DECODED_PATH:g" pandora_agent_exec > $PANDORA_BASE$PANDORA_EXEC_BIN -- else -- cp pandora_agent_exec $PANDORA_BASE$PANDORA_EXEC_BIN -- fi -- chmod 755 $PANDORA_BASE$PANDORA_EXEC_BIN -- if [ "$PANDORA_PERL_DECODED_PATH" != "" ] -- then -- sed -e "s:^#\!.*:#\!$PANDORA_PERL_DECODED_PATH:g" pandora_revent > $PANDORA_BASE$PANDORA_REVENT_BIN -- else -- cp pandora_revent $PANDORA_BASE$PANDORA_REVENT_BIN -- fi -- chmod 755 $PANDORA_BASE$PANDORA_REVENT_BIN -- chown $PANDORA_USER:0 $PANDORA_BASE$PANDORA_BIN -- chown $PANDORA_USER:0 $PANDORA_BASE$PANDORA_EXEC_BIN -- chown $PANDORA_USER:0 $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 -@@ -400,49 +363,36 @@ - - echo "Copying Pandora FMS Agent plugins to $PANDORA_BASE$PANDORA_HOME/plugins..." - -- if [ "$OS_NAME" = "NetBSD" ] -- then -- if [ ! -d $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 -- mkdir -p $PANDORA_BASE$PANDORA_HOME/plugins -+ install_perl_script $PLUGIN $PANDORA_BASE$PANDORA_HOME/$PLUGIN -+ else -+ cp $PLUGIN $PANDORA_BASE$PANDORA_HOME/plugins - fi -- for i in `ls -1 plugins` -- do -- sed s:/usr/bin/perl:/usr/pkg/bin/perl: plugins/$i > plugins/$i.tmp -- cp plugins/$i.tmp $PANDORA_BASE$PANDORA_HOME/plugins/$i -- rm plugins/$i.tmp -- done -- else -- cp -r plugins $PANDORA_BASE$PANDORA_HOME -- fi -- -+ done - chmod -R 700 $PANDORA_BASE$PANDORA_HOME/plugins -- ln -s $PANDORA_BASE$PANDORA_HOME/plugins $PANDORA_BASE$PANDORA_CFG - -+ 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$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG -+ ln -s $PANDORA_BASE_REAL$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG - -- echo "Copying tentacle server to $PANDORA_BASE$TENTACLE_SERVER" -- if [ "$PANDORA_PERL_DECODED_PATH" != "" ] -- then -- sed -e "s:^#\!.*:#\!$PANDORA_PERL_DECODED_PATH:g" tentacle_server > $PANDORA_BASE$TENTACLE_SERVER -- else -- cp tentacle_server $PANDORA_BASE$TENTACLE_SERVER -- fi -- chmod 755 $PANDORA_BASE$TENTACLE_SERVER -- chown $PANDORA_USER:0 $PANDORA_BASE$TENTACLE_SERVER -+ 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" -- if [ "$PANDORA_PERL_DECODED_PATH" != "" ] -- then -- sed -e "s:^#\!.*:#\!$PANDORA_PERL_DECODED_PATH:g" tentacle_client > $PANDORA_BASE$TENTACLE -- else -- cp tentacle_client $PANDORA_BASE$TENTACLE -- fi -- chmod 755 $PANDORA_BASE$TENTACLE -- chown $PANDORA_USER:0 $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 -@@ -451,14 +401,14 @@ - 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 -+ 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 -- if [ "$OS_NAME" = "FreeBSD" -o "$OS_NAME" = "NetBSD" ] -+ 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 -+ 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 -@@ -467,85 +417,55 @@ - - 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 -+ chown $PANDORA_USER $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf 2>/dev/null - -- if [ "$OS_NAME" = "FreeBSD" -o "$OS_NAME" = "NetBSD" ] -+ echo "Linking start-up daemon script '$DAEMON_SCRIPT' on $OS_NAME"; -+ -+ if [ "$OS_NAME" = "Darwin" ] - then -- echo "Linking start-up daemon script 'pandora_agent' on $OS_NAME"; -+ # 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 -- echo "Linking start-up daemon script 'pandora_agent_daemon' on $OS_NAME"; -- fi -+ DESTDIR="" -+ [ "$PANDORA_BASE" ] && [ $FAKEROOT -eq 1 ] && DESTDIR=$PANDORA_BASE - -- 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" -- fi -+ cp $DAEMON_SCRIPT $DESTDIR$PANDORA_STARTUP -+ chmod 755 $DESTDIR$PANDORA_STARTUP -+ chown root:0 $DESTDIR$PANDORA_STARTUP 2>/dev/null - -- if [ "$OS_NAME" = "AIX" ] -- then -- cp pandora_agent_daemon /etc/rc.pandora_agent_daemon -- ln -s /etc/rc.pandora_agent_daemon /etc/rc.d/rc2.d/S90pandora_agent_daemon -- chmod 755 $PANDORA_STARTUP -- chown root:0 $PANDORA_STARTUP -- echo "Pandora FMS agent has been included in /etc/rc.d/rc2.d/S90pandora_agent_daemon" -- fi -- -- if [ $OS_NAME = "HP-UX" ] -- then -- PANDORA_STARTUP=/sbin/init.d/pandora_agent_daemon -- cp pandora_agent_daemon $PANDORA_STARTUP -- ln -s /sbin/init.d/pandora_agent_daemon /sbin/rc3.d/S90pandora_agent_daemon 2> /dev/null -- ln -s /sbin/init.d/pandora_agent_daemon /sbin/rc2.d/S90pandora_agent_daemon 2> /dev/null -- chmod 755 $PANDORA_STARTUP -- chown root:0 $PANDORA_STARTUP -- echo "Pandora FMS agent has been included in /sbin/rcX.d/S90pandora_agent_daemon" -- fi -- -- if [ $OS_NAME = "SunOS" ] -- then -- PANDORA_STARTUP=/etc/init.d/pandora_agent_daemon -- cp pandora_agent_daemon $PANDORA_STARTUP -- ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent_daemon 2> /dev/null -- chmod 755 $PANDORA_STARTUP -- chown root:0 $PANDORA_STARTUP -- echo "Pandora FMS agent has been included in /etc/rc2.d/S90pandora_agent_daemon" -- fi -- -- if [ $OS_NAME = "Linux" ] -- then -- PANDORA_STARTUP=/etc/init.d/pandora_agent_daemon -- cp pandora_agent_daemon $PANDORA_STARTUP -- if [ -d /etc/rc.d/ ] -+ RCDIRS="" -+ MSG="" -+ if [ "$OS_NAME" = "AIX" ] - then -- ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc2.d/S90pandora_agent 2> /dev/null -- ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc3.d/S90pandora_agent 2> /dev/null -- else -- ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent 2> /dev/null -- ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent 2> /dev/null -+ 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 -- chmod 755 $PANDORA_STARTUP -- chown root:0 $PANDORA_STARTUP -+ [ "$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 [ "$OS_NAME" = "FreeBSD" ] -- then -- PANDORA_STARTUP=/usr/local/etc/rc.d/pandora_agent -- cp FreeBSD/pandora_agent $PANDORA_STARTUP -- chmod 555 $PANDORA_STARTUP -- chown root:wheel $PANDORA_STARTUP -- fi -- -- if [ "$OS_NAME" = "NetBSD" ] -- then -- PANDORA_STARTUP=/etc/rc.d/pandora_agent -- cp NetBSD/pandora_agent $PANDORA_STARTUP -- chmod 555 $PANDORA_STARTUP -- chown root:wheel $PANDORA_STARTUP -- fi -- - echo "Done." - echo " " - echo "You have your startup script ready at $PANDORA_STARTUP" -Index: plugins/who.sh -=================================================================== ---- plugins/who.sh (revision 10314) -+++ plugins/who.sh (working copy) -@@ -1,10 +1,10 @@ --#!/bin/bash -+#!/bin/sh - echo "<module>"; - echo "<name>who</name>"; - echo "<type>async_string</type>"; - echo "<data><![CDATA[" - WHO=`who` --if [ "$WHO" == "" ]; then -+if [ "$WHO" = "" ]; then - echo "None" - else - echo $WHO -Index: tentacle_server -=================================================================== ---- tentacle_server (revision 10314) -+++ tentacle_server (working copy) -@@ -60,9 +60,15 @@ - use warnings; - use Getopt::Std; - use IO::Select; -+use threads; - use Thread::Semaphore; - use POSIX ":sys_wait_h"; -+use Time::HiRes qw(usleep); - -+# Constants for Win32 services. -+use constant WIN32_SERVICE_STOPPED => 0x01; -+use constant WIN32_SERVICE_RUNNING => 0x04; -+ - my $t_libwrap_installed = eval { require Authen::Libwrap } ? 1 : 0; - - if ($t_libwrap_installed) { -@@ -77,9 +83,8 @@ - : eval { require IO::Socket::INET } ? 'IO::Socket::INET' - : die $@; - --if ($SOCKET_MODULE eq 'IO::Socket::INET') { -- print_log ("IO::Socket::INET6 is not found. IPv6 is disabled."); --} -+# Service name for Win32. -+my $SERVICE_NAME="Tentacle Server"; - - # Program version - our $VERSION = '0.4.0'; -@@ -130,7 +135,7 @@ - my $t_select; - - # Semaphore --my $t_sem; -+my $t_sem :shared; - - # Server socket - my @t_server_sockets; -@@ -197,6 +202,7 @@ - print ("\t-p port\t\tPort to listen on (default $t_port).\n"); - print ("\t-q\t\tQuiet. Do now print error messages.\n"); - print ("\t-r number\tNumber of retries for network opertions (default $t_retries).\n"); -+ print ("\t-S (install|uninstall|run) Manage the win32 service.\n"); - print ("\t-t time\t\tTime-out for network operations in seconds (default ${t_timeout}s).\n"); - print ("\t-v\t\tBe verbose.\n"); - print ("\t-w\t\tPrompt for OpenSSL private key password.\n"); -@@ -241,27 +247,6 @@ - } - - ################################################################################ --## SUB start_win_service --## Turn the current process into a Windows service. --################################################################################ --#sub start_win_service { --# require Win32::Daemon; --# --# # Tell the OS to start the service --# Win32::Daemon::StartService (); --# --# # Wait until the service manager is ready --# while (SERVICE_START_PENDING != Win32::Daemon::State()) { --# sleep (1); --# } --# --# # Tell the service manager we are running --# Win32::Daemon::State (SERVICE_RUNNING); --# --# # Call Win32::Daemon::StopService() when done --#} -- --################################################################################ - ## SUB parse_options - ## Parse command line options and initialize global variables. - ################################################################################ -@@ -271,7 +256,7 @@ - my @t_addresses_tmp; - - # Get options -- if (getopts ('a:c:de:f:hi:k:m:op:qr:s:t:vwx:b:g:T', \%opts) == 0 || defined ($opts{'h'})) { -+ if (getopts ('a:b:c:de:f:g:hi:k:m:op:qr:s:S:t:Tvwx:', \%opts) == 0 || defined ($opts{'h'})) { - print_help (); - exit 1; - } -@@ -467,19 +452,33 @@ - error ("Authen::Libwrap is not installed."); - } - } --} - --################################################################################ --## SUB sigchld_handler --## Handle child process termination. --################################################################################ --sub sigchld_handler { -+ # Win32 service management -+ if (defined ($opts{'S'})) { -+ my $service_action = $opts{'S'}; -+ if ($^O ne 'MSWin32') { -+ error ("Windows services are only available on Win32."); -+ } else { -+ eval "use Win32::Daemon"; -+ die($@) if ($@); - -- while (waitpid(-1, &WNOHANG) > 0) { -- $t_sem->up (); -+ if ($service_action eq 'install') { -+ install_service(); -+ } elsif ($service_action eq 'uninstall') { -+ uninstall_service(); -+ } elsif ($service_action eq 'run') { -+ Win32::Daemon::RegisterCallbacks({ -+ start => \&callback_start, -+ running => \&callback_running, -+ stop => \&callback_stop, -+ }); -+ Win32::Daemon::StartService(); -+ exit 0; -+ } else { -+ error("Unknown action: $service_action"); -+ } -+ } - } -- -- $SIG{CHLD} = \&sigchld_handler; - } - - ################################################################################ -@@ -660,87 +659,86 @@ - } - - ################################################################################ --## SUB accept_connection --## Accept an incoming connection and fork. -+## SUB accept_connections -+## Manage incoming connections. - ################################################################################ --sub accept_connection { -+sub accept_connections { - my $pid; - my $t_server_socket; - -- my @ready = $select->can_read; -+ # Start server -+ start_server (); - -- foreach $t_server_socket (@ready) { -+ # Initialize semaphore -+ $t_sem = Thread::Semaphore->new ($t_max_conn); - -- # Accept connection -- $t_client_socket = $t_server_socket->accept (); -+ while (1) { -+ my @ready = $select->can_read; -+ foreach $t_server_socket (@ready) { - -- if (! defined ($t_client_socket)) { -+ # Accept connection -+ $t_client_socket = $t_server_socket->accept (); - -- # EINTR -- if ($! ne '') { -- next; -+ if (! defined ($t_client_socket)) { -+ next if ($! ne ''); # EINTR -+ error ("accept: $!."); - } - -- error ("accept: $!."); -- } -+ print_log ("Client connected from " . $t_client_socket->sockhost ()); - -- print_log ("Client connected from " . $t_client_socket->sockhost ()); -- -- # Fork and serve the client -- $pid = fork (); -- if (! defined ($pid)) { -- error ("Cannot fork: $!."); -+ # Create a new thread and serve the client -+ $t_sem->down(); -+ my $thr = threads->create(\&serve_client); -+ if (! defined ($thr)) { -+ error ("Error creating thread: $!."); -+ } -+ $thr->detach(); - } -- -- # Child -- if ($pid == 0) { -- -- # We do not need the server socket -- $t_server_socket->close (); - -- if ($t_use_libwrap) { -- if (! hosts_ctl($t_program_name, $t_client_socket)) { -- print_log ("Connection from " . $t_client_socket->sockhost() . " is closed by tcpwrappers."); -- $t_client_socket->close (); -+ usleep (1000); -+ } -+} - -- exit; -- } -- } -- -- # Add client socket to select queue -- $t_select = IO::Select->new (); -- $t_select->add ($t_client_socket); -- -- # Start SSL -- if ($t_ssl == 1) { -- start_ssl (); -- } -+################################################################################ -+## SUB serve_client -+## Serve a connected client. -+################################################################################ -+sub serve_client() { - -- # Authenticate client -- if ($t_pwd ne '') { -- auth_pwd (); -- } -+ if ($t_use_libwrap) { -+ if (! hosts_ctl($t_program_name, $t_client_socket)) { -+ print_log ("Connection from " . $t_client_socket->sockhost() . " is closed by tcpwrappers."); -+ $t_client_socket->close (); -+ $t_sem->up(); -+ return; -+ } -+ } - -- # Check if proxy mode is enable -- if (defined ($t_proxy_ip)) { -- -- serve_proxy_connection (); -+ eval { -+ # Add client socket to select queue -+ $t_select = IO::Select->new (); -+ $t_select->add ($t_client_socket); - -- } else { -- -- serve_connection (); -- } -- -- $t_client_socket->close (); -- -- # Must exit now -- exit; -+ # Start SSL -+ if ($t_ssl == 1) { -+ start_ssl (); - } -+ -+ # Authenticate client -+ if ($t_pwd ne '') { -+ auth_pwd (); -+ } -+ -+ # Check if proxy mode is enable -+ if (defined ($t_proxy_ip)) { -+ serve_proxy_connection (); -+ } else { -+ serve_connection (); -+ } -+ }; - -- # Parent -- $t_client_socket->close (); -- -- } -+ $t_client_socket->close (); -+ $t_sem->up(); - } - - ################################################################################ -@@ -1045,10 +1043,8 @@ - sub error { - - if ($t_quiet == 0) { -- print (STDERR "[err] $_[0]\n"); -+ die("[err] $_[0]\n\n"); - } -- -- exit 1; - } - - ################################################################################ -@@ -1414,6 +1410,91 @@ - } - - ################################################################################ -+## SUB install_service -+## Install the Windows service. -+################################################################################ -+sub install_service() { -+ -+ my $service_path = $0; -+ my $service_params = "-s \"$t_directory\" -S run"; -+ -+ my %service_hash = ( -+ machine => '', -+ name => 'TENTACLESRV', -+ display => $SERVICE_NAME, -+ path => $service_path, -+ user => '', -+ pwd => '', -+ description => 'Tentacle Server http://sourceforge.net/projects/tentacled/', -+ parameters => $service_params -+ ); -+ -+ if (Win32::Daemon::CreateService(\%service_hash)) { -+ print "Successfully added.\n"; -+ exit 0; -+ } else { -+ print "Failed to add service: " . Win32::FormatMessage(Win32::Daemon::GetLastError()) . "\n"; -+ exit 1; -+ } -+} -+ -+################################################################################ -+## SUB uninstall_service -+## Install the Windows service. -+################################################################################ -+sub uninstall_service() { -+ if (Win32::Daemon::DeleteService('', 'TENTACLESRV')) { -+ print "Successfully deleted.\n"; -+ exit 0; -+ } else { -+ print "Failed to delete service: " . Win32::FormatMessage(Win32::Daemon::GetLastError()) . "\n"; -+ exit 1; -+ } -+} -+ -+################################################################################ -+## SUB callback_running -+## Windows service callback function for the running event. -+################################################################################ -+sub callback_running { -+ -+ if (Win32::Daemon::State() == WIN32_SERVICE_RUNNING) { -+ } -+} -+ -+################################################################################ -+## SUB callback_start -+## Windows service callback function for the start event. -+################################################################################ -+sub callback_start { -+ -+ # Accept_connections (); -+ my $thr = threads->create(\&accept_connections); -+ if (!defined($thr)) { -+ Win32::Daemon::State(WIN32_SERVICE_STOPPED); -+ Win32::Daemon::StopService(); -+ return; -+ } -+ $thr->detach(); -+ -+ Win32::Daemon::State(WIN32_SERVICE_RUNNING); -+} -+ -+################################################################################ -+## SUB callback_stop -+## Windows service callback function for the stop event. -+################################################################################ -+sub callback_stop { -+ -+ foreach my $t_server_socket (@t_server_sockets) { -+ $t_server_socket->close (); -+ } -+ -+ Win32::Daemon::State(WIN32_SERVICE_STOPPED); -+ Win32::Daemon::StopService(); -+} -+ -+################################################################################ - # Main - ################################################################################ - -@@ -1444,25 +1525,16 @@ - - # Handle ctr-c - if ($^O eq 'MSWin32') { -+ no warnings; - $SIG{INT2} = \&stop_server; -+ use warnings; - } - else { - $SIG{INT} = \&stop_server; - } - --# Handle SIGCHLD --$SIG{CHLD} = \&sigchld_handler; -- --start_server (); -- --# Initialize semaphore --$t_sem = Thread::Semaphore->new ($t_max_conn); -- - # Accept connections --while (1) { -- $t_sem->down (); -- accept_connection (); --} -+accept_connections(); - - __END__ - -Index: pandora_agent_daemon -=================================================================== ---- pandora_agent_daemon (revision 10314) -+++ pandora_agent_daemon (working copy) -@@ -34,38 +34,39 @@ - OS_NAME=`uname -s` - if [ $OS_NAME = "HP-UX" ] - then -- PANDORA_PID=`ps -ex | grep "$DAEMON $PANDORA_PATH" | grep -v grep | head -1 | awk '{ print $1 }'` -- else -- if [ "$OS_NAME" = "SunOS" ] -+ PANDORA_PID=`ps -ef | grep "/usr/bin/perl $DAEMON" | grep -v grep | awk '{print $2}'` -+ elif [ "$OS_NAME" = "SunOS" ] -+ then -+ ZONENAME_CMD="/bin/zonename" -+ TRUNCATED_DAEMON=`echo "$DAEMON $PANDORA_PATH" | cut -c1-20` -+ if [ -x $ZONENAME_CMD ] - then -- ZONENAME_CMD="/bin/zonename" -- TRUNCATED_DAEMON=`echo "$DAEMON $PANDORA_PATH" | cut -c1-20` -- if [ -x $ZONENAME_CMD ] -- then -- ZONE=`$ZONENAME_CMD` -- else -- ZONE= -- fi -- if [ "$ZONE" = "global" ] -- then -- PANDORA_PID=`ps -f -z global | grep "$TRUNCATED_DAEMON" | grep -v grep | head -1 | awk '{ print $2 }'` -- else -- PANDORA_PID=`ps -Af | grep "$TRUNCATED_DAEMON" | grep -v grep | head -1 | awk '{ print $2 }'` -- fi -- elif [ "$OS_NAME" = "Linux" -a -x /usr/sbin/vzpid ] -+ ZONE=`$ZONENAME_CMD` -+ else -+ ZONE= -+ fi -+ if [ "$ZONE" = "global" ] - then -- for _pid in `ps -Af | grep "$DAEMON $PANDORA_PATH" | grep -v grep | awk '{ print $2 }'` -- do -- _ctid=`/usr/sbin/vzpid $_pid | awk '$1 == '$_pid' { print $2 }'` -- if [ "X$_ctid" = "X0" ] -- then -- PANDORA_PID=$_pid -- break -- fi -- done -+ PANDORA_PID=`ps -f -z global | grep "$TRUNCATED_DAEMON" | grep -v grep | head -1 | awk '{ print $2 }'` - else -- PANDORA_PID=`ps -Af | grep "$DAEMON $PANDORA_PATH" | grep -v grep | head -1 | awk '{ print $2 }'` -+ PANDORA_PID=`ps -Af | grep "$TRUNCATED_DAEMON" | grep -v grep | head -1 | awk '{ print $2 }'` - fi -+ elif [ "$OS_NAME" = "Linux" ] && [ -x /usr/sbin/vzpid ] -+ then -+ # Virtuozzo/OpenVZ -+ local _pid _ctid _pids -+ _pids=`ps -Af | grep "$DAEMON $PANDORA_PATH" | grep -v grep | awk '{ print $2 }'` -+ [ "$_pids" ] && for _pid in $_pids -+ do -+ _ctid=`/usr/sbin/vzpid $_pid | awk '$1 == '$_pid' { print $2 }'` -+ if [ "X$_ctid" = "X0" ] -+ then -+ PANDORA_PID=$_pid -+ break -+ fi -+ done -+ else -+ PANDORA_PID=`ps -Af | grep "$DAEMON $PANDORA_PATH" | grep -v grep | head -1 | awk '{ print $2 }'` - fi - - echo $PANDORA_PID -Index: pandora_agent -=================================================================== ---- pandora_agent (revision 10314) -+++ pandora_agent (working copy) -@@ -343,6 +343,8 @@ - init_module ($module); - } elsif ($line =~ /^\s*module_name\s+(.+)$/) { - $module->{'name'} = $1; -+ $module->{'name'} =~ s/\s+$//g; -+ $module->{'name'} =~ s/^\s+//g; - } elsif ($line =~ /^\s*module_description\s+(.+)$/) { - $module->{'description'} = $1; - } elsif ($line =~ /^\s*module_type\s+(\S+)\s*$/) { -@@ -1727,12 +1729,7 @@ - - # Data list - if ($#data > 0) { -- $Xml .= " <datalist>\n"; -- foreach my $data_item (@data) { -- chomp ($data_item); -- $Xml .= " <data><value><![CDATA[$data_item]]></value></data>\n"; -- } -- $Xml .= " </datalist>\n"; -+ $Xml .= " <data><![CDATA[" . join('', @data) . "]]></data>\n"; - # Single data - } else { - chomp ($data[0]); -Index: FreeBSD/pandora_agent -=================================================================== ---- FreeBSD/pandora_agent (revision 10314) -+++ FreeBSD/pandora_agent (working copy) -@@ -3,6 +3,7 @@ - # ********************************************************************** - # Pandora FMS Agent Daemon launcher for FreeBSD - # (c) 2010 Junichi Satoh <junichi@rworks.jp> -+# (c) 2014 Koichiro Kikuchi <koichiro@rworks.jp> - # - # ********************************************************************** - -@@ -18,7 +19,7 @@ - . "/etc/rc.subr" - - name="pandora_agent" --rcvar=`set_rcvar` -+rcvar=pandora_agent_enable - - # read configuration and set defaults - pandora_agent_enable=${pandora_agent_enable:-"NO"} -@@ -26,22 +27,15 @@ - - PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin - --command=/usr/local/bin/pandora_agent --command_args="/usr/local/etc/pandora &" -- - pidfile=/var/run/$name.pid - required_files="/usr/local/etc/pandora/pandora_agent.conf" --start_postcmd=start_postcmd - stop_postcmd=stop_postcmd - --procname="/usr/bin/perl" -+command=/usr/sbin/daemon -+command_interpreter=/usr/local/bin/perl -+procname=/usr/local/bin/pandora_agent - --start_postcmd() --{ -- sleep 1 -- PANDORA_PID=`pgrep -f -j none $name` -- echo $PANDORA_PID > $pidfile --} -+command_args="-cfp $pidfile $procname /usr/local/etc/pandora" - - stop_postcmd() - { diff --git a/net-mgmt/pandorafms_agent/pkg-plist b/net-mgmt/pandorafms_agent/pkg-plist index 5b00bd75acf6..03603d5a64a3 100644 --- a/net-mgmt/pandorafms_agent/pkg-plist +++ b/net-mgmt/pandorafms_agent/pkg-plist @@ -5,11 +5,7 @@ bin/pandora_revent %%TENTACLE_SERVER%%bin/tentacle_server bin/tentacle_client etc/rc.d/pandora_agent -@mode 400 -@owner pandora -@sample %%ETCDIR%%/pandora_agent.conf.sample -@owner -@mode +@sample(pandora,,400) %%ETCDIR%%/pandora_agent.conf.sample man/man1/tentacle_client.1.gz man/man1/pandora_agent.1.gz @mode 555 @@ -25,13 +21,7 @@ man/man1/pandora_agent.1.gz %%DATADIR%%/plugins/pandora_update %%DATADIR%%/plugins/top.sh %%DATADIR%%/plugins/who.sh -@owner pandora -@mode 700 -@dirrmtry %%DATADIR%%/collections -@dirrmtry %%DATADIR%%/plugins -@owner -@mode -@dirrmtry %%DATADIR%% +@dir(pandora,,700) %%DATADIR%%/collections +@dir(pandora,,700) %%DATADIR%%/plugins %%ETCDIR%%/plugins %%ETCDIR%%/collections -@dirrmtry %%ETCDIR%% diff --git a/net-mgmt/pandorafms_console/Makefile b/net-mgmt/pandorafms_console/Makefile index 20e41085622c..2a4cbe89c797 100644 --- a/net-mgmt/pandorafms_console/Makefile +++ b/net-mgmt/pandorafms_console/Makefile @@ -50,16 +50,17 @@ post-install: && ${RM} -rf pandora_console_install* *.spec \ extras/check_other_languages.sh.bak \ include/languages/extract_newlines.sh.bak \ - *.sql.bak COPYING ${PORTDOCS} DEBIAN/ + *.sql.bak COPYING ${PORTDOCS} DEBIAN/ \ + attachment/collections/.empty attachment/downloads/.gitignore @cd ${STAGEDIR}${WWWDIR} && ${MV} install.php install.done .if ${PORT_OPTIONS:MDOCS} @${MKDIR} ${STAGEDIR}${DOCSDIR} .for x in ${PORTDOCS} - @${INSTALL_DATA} ${WRKSRC}/${x} ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/${x} ${STAGEDIR}${DOCSDIR} .endfor .endif - @${MKDIR} -p ${STAGEDIR}${PREFIX}/${APACHEETCDIR}/Includes - @${INSTALL_DATA} ${WRKDIR}/pandora_console.conf \ + @${MKDIR} ${STAGEDIR}${PREFIX}/${APACHEETCDIR}/Includes + ${INSTALL_DATA} ${WRKDIR}/pandora_console.conf \ ${STAGEDIR}${PREFIX}/${APACHEETCDIR}/Includes/pandora_console.conf.sample @${LN} -sf ${_LICENSE_DIR}/${LICENSE} ${STAGEDIR}${WWWDIR}/COPYING diff --git a/net-mgmt/pandorafms_console/distinfo b/net-mgmt/pandorafms_console/distinfo index a69eb8f27832..d59de783bf50 100644 --- a/net-mgmt/pandorafms_console/distinfo +++ b/net-mgmt/pandorafms_console/distinfo @@ -1,2 +1,2 @@ -SHA256 (pandora/pandorafms_console-5.1.tar.gz) = 4f9624f4ddbe416929b3ce47a737073da2ff319f6121454b66140fb2a70c4638 -SIZE (pandora/pandorafms_console-5.1.tar.gz) = 28264905 +SHA256 (pandora/pandorafms_console-5.1SP1.tar.gz) = 5696fef415db22fd0eaffb3d8286eddfe3d123c86bae9a8a4044b7937efb8742 +SIZE (pandora/pandorafms_console-5.1SP1.tar.gz) = 27900949 diff --git a/net-mgmt/pandorafms_console/files/patch-WLB-2014110100 b/net-mgmt/pandorafms_console/files/patch-WLB-2014110100 new file mode 100644 index 000000000000..cbaeec44ddee --- /dev/null +++ b/net-mgmt/pandorafms_console/files/patch-WLB-2014110100 @@ -0,0 +1,29 @@ +diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php +index 9b02b2c..9c1524a 100644 +--- general/header.php ++++ general/header.php +@@ -375,15 +375,22 @@ config_check(); + + <?php + if ($_GET["refr"]) { ++ $_get_refr = strip_tags($_GET["refr"]); + ?> ++ refr_time = parseInt("<?php echo $_get_refr; ?>"); ++ if (isNaN(refr_time)) { ++ refr_time = 0; ++ } ++ + t = new Date(); +- t.setTime (t.getTime () + <?php echo $config["refr"] * 1000; ?>); ++ t.setTime (t.getTime () + ++ parseInt(<?php echo $config["refr"] * 1000; ?>)); + $("#refrcounter").countdown ({until: t, + layout: '%M%nn%M:%S%nn%S', + labels: ['', '', '', '', '', '', ''], + onExpiry: function () { + href = $("a.autorefresh").attr ("href"); +- href = href + <?php echo $_GET["refr"]; ?>; ++ href = href + refr_time; + $(document).attr ("location", href); + } + }); diff --git a/net-mgmt/pandorafms_console/files/patch-update b/net-mgmt/pandorafms_console/files/patch-update deleted file mode 100644 index 2d0fb9aee46d..000000000000 --- a/net-mgmt/pandorafms_console/files/patch-update +++ /dev/null @@ -1,9578 +0,0 @@ -Index: pandoradb_data.sql -=================================================================== ---- pandoradb_data.sql (revision 10314) -+++ pandoradb_data.sql (working copy) -@@ -283,7 +283,7 @@ - -- Dumping data for table `tnews` - -- - --INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (1,'admin','Welcome to Pandora FMS 5.0!','This is the new Pandora FMS Console. A lot of new features have been added since last version. Please read the documentation about it, and feel free to test any option.\r\n\r\nThe Pandora FMS Team.',NOW()); -+INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (1,'admin','Welcome to Pandora FMS!','This is the Pandora FMS Console. A lot of new features have been added since last version. Please read the documentation about it, and feel free to test any option.\r\n\r\nThe Pandora FMS Team.',NOW()); - INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (2,'admin','New Pandora FMS Agent Features','Feel free to test our new features for both Windows and Linux agents: Proxy and Broker modes.',NOW()); - - INSERT INTO tmodule VALUES (1,'Agent module'); -Index: include/functions_clippy.php -=================================================================== ---- include/functions_clippy.php (revision 0) -+++ include/functions_clippy.php (revision 10417) -@@ -0,0 +1,176 @@ -+<?php -+ -+// Pandora FMS - http://pandorafms.com -+// ================================================== -+// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas -+// Please see http://pandorafms.org for full contribution list -+ -+// This program is free software; you can redistribute it and/or -+// modify it under the terms of the GNU 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. -+ -+/** -+ * @package Include -+ * @subpackage Clippy -+ */ -+ -+function clippy_start($sec2) { -+ global $config; -+ -+ if ($sec2 === false) { -+ $sec2 = 'homepage'; -+ } -+ -+ $sec2 = str_replace('/', '_', $sec2); -+ -+ if ($sec2 != 'homepage') { -+ if (is_file("include/help/clippy/" . $sec2 . ".php")) { -+ require("include/help/clippy/" . $sec2 . ".php"); -+ -+ clippy_start_page(); -+ } -+ -+ //Add homepage for all pages for to show the "task sugestions" -+ require("include/help/clippy/homepage.php"); -+ clippy_start_page_homepage(); -+ } -+ else { -+ require("include/help/clippy/homepage.php"); -+ clippy_start_page_homepage(); -+ } -+} -+ -+function clippy_clean_help() { -+ set_cookie('clippy', null); -+} -+ -+function clippy_write_javascript_helps_steps($helps, -+ $force_first_step_by_default = true) { -+ -+ global $config; -+ -+ $clippy = get_cookie('clippy', false); -+ set_cookie('clippy', null); -+ -+ -+ //Get the help steps from a task -+ $steps = $helps[$clippy]['steps']; -+ if ($force_first_step_by_default) { -+ if (empty($steps)) { -+ //Get the first by default -+ $temp = reset($helps); -+ $steps = $temp['steps']; -+ } -+ } -+ -+ $conf = $helps[$clippy]['conf']; -+ if ($force_first_step_by_default) { -+ if (empty($conf)) { -+ //Get the first by default -+ $temp = reset($helps); -+ $conf = $temp['conf']; -+ } -+ } -+ -+ if (!empty($steps)) { -+ $name_obj_tour = 'intro'; -+ if (!empty($conf['name_obj_tour'])) { -+ $name_obj_tour = $conf['name_obj_tour']; -+ } -+ -+ $autostart = true; -+ if (!is_null($conf['autostart'])) { -+ $autostart = $conf['autostart']; -+ } -+ -+ $other_js = ''; -+ if (!empty($conf['other_js'])) { -+ $other_js = $conf['other_js']; -+ } -+ -+ ?> -+ <script type="text/javascript"> -+ var <?php echo $name_obj_tour; ?> = null; -+ -+ $(document).ready(function() { -+ <?php echo $name_obj_tour; ?> = introJs(); -+ -+ <?php echo $name_obj_tour; ?>.setOptions({ -+ steps: <?php echo json_encode($steps); ?>, -+ showBullets: <?php echo json_encode($conf['showBullets']); ?>, -+ showStepNumbers: <?php echo json_encode($conf['showStepNumbers']); ?>, -+ nextLabel: "<?php echo __('Next →'); ?>", -+ prevLabel: "<?php echo __('← Back'); ?>", -+ skipLabel: "<?php echo __('Skip'); ?>", -+ doneLabel: "<?php echo __('Done'); ?>", -+ exitOnOverlayClick: false, -+ exitOnEsc: true, //false, -+ }) -+ .onexit(function(value) { -+ exit = confirm("<?php echo __("Do you want to exit the help tour?"); ?>"); -+ return exit; -+ }); -+ -+ <?php -+ if (!empty($conf['next_help'])) { -+ ?> -+ clippy_set_help('<?php echo $conf['next_help']; ?>'); -+ <?php -+ } -+ ?> -+ -+ <?php -+ if ($autostart) { -+ ?> -+ <?php echo $name_obj_tour; ?>.start(); -+ <?php -+ } -+ ?> -+ }); -+ -+ <?php echo $other_js; ?> -+ </script> -+ <?php -+ } -+} -+ -+function clippy_context_help($help = null) { -+ $id = uniqid("id_"); -+ -+ $return = ''; -+ -+ require_once("include/help/clippy/" . $help . ".php"); -+ -+ ob_start(); -+ $function = "clippy_" . $help; -+ $function(); -+ $code = ob_get_clean(); -+ -+ $code = str_replace('{clippy}', '#' . $id, $code); html_debug_print($code, true); -+ $code = str_replace('{clippy_obj}', 'intro_' . $id, $code); html_debug_print($code, true); -+ -+ $return = $code . -+ '<div id="' . $id . '" style="display: inline;">' . -+ '<a onclick="intro_' . $id . '.start();" href="javascript: return false;" >' . -+ html_print_image( -+ "images/clippy_icon.png", -+ true) . -+ '</a>' . -+ '</div> -+ <script type="text/javascript"> -+ $(document).ready(function() { -+ $("#' . $id . ' img").pulsate (); -+ }); -+ </script> -+ '; -+ -+ -+ -+ return $return; -+} -+?> -\ No newline at end of file -Index: include/styles/menu.css -=================================================================== ---- include/styles/menu.css (revision 10314) -+++ include/styles/menu.css (working copy) -@@ -81,7 +81,6 @@ - .submenu { - font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif; - margin: 0px 10px 0px 0; -- width: 173px; - } - .submenu li a { - background-color: #222; -@@ -143,10 +142,6 @@ - background-position: 4px 8px; - } - --.menu { -- width: 173px; -- --} - /* Icons specified here */ - #icon_oper-networkconsole { - background-image: url(../../images/op_network.png); -@@ -234,7 +229,6 @@ - #menu_container { - z-index: 3; - position: absolute; -- left: -140px; -+ left: -80px; - background-color: #AAA; -- height: 100%; - } -Index: include/styles/pandora.css -=================================================================== ---- include/styles/pandora.css (revision 10314) -+++ include/styles/pandora.css (working copy) -@@ -278,7 +278,7 @@ - } - - div#menu { -- width: 165px; -+ width: 175px; - float: left; - } - -@@ -291,6 +291,14 @@ - background-color: #274C00; - } - -+.fixed_header { -+ z-index: 9999; -+ position: fixed; -+ left: 0; -+ top: 0; -+ width: 100%; -+} -+ - div#foot { - font-size: 6pt !important; - border-top: solid 2px #222; -@@ -298,7 +306,6 @@ - padding-bottom: 5px; - text-align: center; - background: #333333; -- width: 960px; - height: 38px; - clear: both; - width: auto; -@@ -901,17 +908,10 @@ - padding: 6px 0px; - height: 14px; - } --.titop { -- -moz-border-top-right-radius: 6px; -- -webkit-border-top-right-radius: 6px; -- border-top-right-radius: 6px; -- heigth: 100px; --} - .tit, .titb { - font-weight: bold; - color: #fff; - text-align: center; -- width: 173px; - } - - .suc * { -@@ -1863,12 +1863,10 @@ - div#main { - width: auto; - float: none; -- padding-right: 0px; -- padding-left: 0px; -- padding-top: 0px; -- padding-bottom: 20px; -- margin-left: 182px; -- margin-right: 20px; -+ margin-top: 10px; -+ margin-left: 185px; -+ margin-right: 10px; -+ padding-bottom: 10px; - background: #ECECEC; - min-width: 720px; - } -@@ -2669,7 +2667,7 @@ - margin: 0px !important; - bottom: 0px; - left: 0px; -- z-index: 1020; -+ z-index: 9001; - } - - #shortcut_bar { -@@ -2704,3 +2702,12 @@ - table#policy_modules td * { - display: inline; - } -+ -+ -+.context_help_title { -+ font-weight: bolder; -+ text-align: left; -+} -+.context_help_body { -+ text-align: left; -+} -\ No newline at end of file -Index: include/functions_update_manager.php -=================================================================== ---- include/functions_update_manager.php (revision 10314) -+++ include/functions_update_manager.php (working copy) -@@ -24,11 +24,17 @@ - global $build_version; - global $pandora_version; - -- $license = db_get_value('`value`', 'tupdate_settings', '`key`', -+ $license = db_get_value( -+ db_encapsule_fields_with_same_name_to_instructions('value'), -+ 'tupdate_settings', -+ db_encapsule_fields_with_same_name_to_instructions('key'), - 'customer_key'); - - if (enterprise_installed()) { -- $current_update = db_get_value('`value`', 'tupdate_settings', '`key`', -+ $current_update = db_get_value( -+ db_encapsule_fields_with_same_name_to_instructions('value'), -+ 'tupdate_settings', -+ db_encapsule_fields_with_same_name_to_instructions('key'), - 'current_package_enterprise'); - - $current_update = 0; -@@ -36,7 +42,10 @@ - $current_update = $config['current_package_enterprise']; - } - else { -- $current_update = db_get_value('`value`', 'tupdate_settings', '`key`', -+ $current_update = db_get_value( -+ db_encapsule_fields_with_same_name_to_instructions('value'), -+ 'tupdate_settings', -+ db_encapsule_fields_with_same_name_to_instructions('key'), - 'current_package'); - - $current_update = 0; -@@ -64,10 +73,12 @@ - function rrmdir($dir) { - if (is_dir($dir)) { - $objects = scandir($dir); -+ - foreach ($objects as $object) { - if ($object != "." && $object != "..") { -- if (filetype($dir."/".$object) == "dir") -- rrmdir($dir."/".$object); else unlink($dir."/".$object); -+ if (filetype($dir . "/" . $object) == "dir") -+ rrmdir($dir . "/" . $object); -+ else unlink($dir . "/" . $object); - } - } - reset($objects); -@@ -264,11 +275,13 @@ - return false; - } - else { -- if ($is_ajax) { -- return true; -+ $result = json_decode($result, true); -+ -+ if (empty($result)) { -+ return false; - } - else { -- return false; -+ return true; - } - } - } -@@ -362,8 +375,10 @@ - "/downloads/last_package.tgz"; - - try { -+ rrmdir($config['attachment_store'] . -+ "/downloads/temp_update/pandora_console"); -+ - $phar = new PharData($path_package); -- rrmdir($config['attachment_store'] . "/downloads/temp_update/pandora_console"); - $phar->extractTo($config['attachment_store'] . "/downloads/temp_update"); - } - catch (Exception $e) { -@@ -384,7 +399,14 @@ - array('value' => 50), - array('token' => 'progress_update')); - -- $full_path = $config['attachment_store'] . "/downloads/temp_update/pandora_console"; -+ $path_array = array('downloads', 'temp_update', 'pandora_console'); -+ $full_path = $config['attachment_store']; -+ foreach ($path_array as $directory) { -+ $full_path = $full_path . '/' . $directory; -+ if (!is_dir($full_path)) { -+ mkdir($full_path); -+ } -+ } - - $homedir = $config['homedir']; - -Index: include/functions_groups.php -=================================================================== ---- include/functions_groups.php (revision 10314) -+++ include/functions_groups.php (working copy) -@@ -236,7 +236,7 @@ - * @param integer $parent The id_group parent to search the childrens. - * @param array $groups The groups, its for optimize the querys to DB. - */ --function groups_get_childrens($parent, $groups = null) { -+function groups_get_childrens($parent, $groups = null, $onlyPropagate = false) { - if (empty($groups)) { - $groups = db_get_all_rows_in_table('tgrupo'); - } -@@ -248,7 +248,7 @@ - continue; - } - -- if ($group['propagate']) { -+ if ($group['propagate'] || $onlyPropagate) { - if ($group['parent'] == $parent) { - $return = $return + array($group['id_grupo'] => $group) + groups_get_childrens($group['id_grupo'], $groups); - } -@@ -1531,4 +1531,42 @@ - } - } - } -+ -+/** -+ * Return an array with the groups hierarchy (Recursive) -+ * -+ * @param array Groups array passed by reference -+ * @param mixed The id of the parent to search or false to begin the search from the first hierarchy level -+ * -+ * @return array The groups reordered by its hierarchy -+ */ -+function groups_get_tree(&$groups, $parent = false) { -+ $return = array(); -+ -+ foreach ($groups as $id => $group) { -+ if ($parent === false && (!isset($group['parent']) || $group['parent'] == 0)) { -+ $return[$id] = $group; -+ unset($groups[$id]); -+ $children = groups_get_tree($groups, $id); -+ -+ if (!empty($children)) { -+ $return[$id]['children'] = $children; -+ } -+ } -+ else if ($parent && isset($group['parent']) && $group['parent'] == $parent) { -+ $return[$id] = $group; -+ unset($groups[$id]); -+ $children = groups_get_tree($groups, $id); -+ -+ if (!empty($children)) { -+ $return[$id]['children'] = $children; -+ } -+ } -+ else { -+ continue; -+ } -+ } -+ -+ return $return; -+} - ?> -Index: include/functions_visual_map.php -=================================================================== ---- include/functions_visual_map.php (revision 10314) -+++ include/functions_visual_map.php (working copy) -@@ -114,9 +114,11 @@ - echo '<div id="' . $id . '" class="item static_graph" style="z-index: 1; text-align: center; color: ' . $color . '; position: absolute; display: inline-block; ' . $sizeStyle . ' top: ' . $top . 'px; left: ' . $left . 'px;">'; - if ($layoutData['image'] != null) { - if (($width != 0) && ($height != 0)) -- echo html_print_image($img, true, array("class" => "image", "id" => "image_" . $id, "width" => "$width", "height" => "$height", "style" => $borderStyle)); -+ echo html_print_image($img, true, -+ array("class" => "image", "id" => "image_" . $id, "width" => "$width", "height" => "$height", "style" => $borderStyle)); - else -- echo html_print_image($img, true, array("class" => "image", "id" => "image_" . $id, "style" => $borderStyle)); -+ echo html_print_image($img, true, -+ array("class" => "image", "id" => "image_" . $id, "style" => $borderStyle)); - echo '<br />'; - } - echo io_safe_output($text); -@@ -1299,8 +1301,28 @@ - } - - $img_style = array (); -+ - $img_style["title"] = strip_tags($layout_data["label"]); -+ if ($layout_data['type'] == STATIC_GRAPH) { -+ if ($layout_data['id_agente_modulo'] != 0) { -+ $unit_text = trim(io_safe_output( -+ modules_get_unit($layout_data['id_agente_modulo']))); -+ -+ $value = modules_get_last_value($layout_data['id_agente_modulo']); -+ -+ if (!is_string($value)) { -+ $value = format_for_graph($value, 2); -+ } -+ -+ if (!empty($unit_text)) -+ $value .= " " . $unit_text; -+ -+ $img_style["title"] .= " <br>" . __("Last value: ") . -+ $value; -+ } -+ } - -+ - if (!empty ($layout_data["width"])) { - $img_style["width"] = $layout_data["width"]; - } -Index: include/ajax/events.php -=================================================================== ---- include/ajax/events.php (revision 10314) -+++ include/ajax/events.php (working copy) -@@ -349,7 +349,13 @@ - } - - $details = events_page_details($event, $server); -- -+ -+ // Juanma (09/05/2014) Fix: Needs to reconnect to node, in previous funct node connection was lost -+ if ($meta) { -+ $server = metaconsole_get_connection_by_id ($server_id); -+ metaconsole_connect($server); -+ } -+ - $custom_fields = events_page_custom_fields($event); - - $custom_data = events_page_custom_data($event); -Index: include/ajax/module.php -=================================================================== ---- include/ajax/module.php (revision 10314) -+++ include/ajax/module.php (working copy) -@@ -23,6 +23,14 @@ - enterprise_include_once ('include/functions_metaconsole.php'); - - $get_plugin_macros = get_parameter('get_plugin_macros'); -+$search_modules = get_parameter('search_modules'); -+$get_module_detail = get_parameter ('get_module_detail', 0); -+$get_module_autocomplete_input = (bool) get_parameter('get_module_autocomplete_input'); -+$add_module_relation = (bool) get_parameter('add_module_relation'); -+$remove_module_relation = (bool) get_parameter('remove_module_relation'); -+$change_module_relation_updates = (bool) get_parameter('change_module_relation_updates'); -+$get_id_tag = (bool) get_parameter('get_id_tag', 0); -+ - if ($get_plugin_macros) { - $id_plugin = get_parameter('id_plugin', 0); - -@@ -37,7 +45,7 @@ - return; - } - --$search_modules = get_parameter('search_modules'); -+ - if ($search_modules) { - $id_agents = json_decode(io_safe_output(get_parameter('id_agents'))); - $filter = get_parameter('q', '') . '%'; -@@ -56,10 +64,9 @@ - return; - } - --$get_module_detail = get_parameter ('get_module_detail', 0); - - if ($get_module_detail) { -- -+ - ui_include_time_picker(); - - ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascript/i18n/"); -@@ -82,6 +89,9 @@ - $conexion = mysql_connect ($server['dbhost'], $server['dbuser'], $server['dbpass']); - $select_db = mysql_select_db ($server['dbname'], $conexion); - } -+ else { -+ $conexion = false; -+ } - - $selection_mode = get_parameter('selection_mode', 'fromnow'); - $date_from = (string) get_parameter ('date_from', date ('Y-m-j')); -@@ -131,15 +141,16 @@ - - html_print_table($formtable); - -- $moduletype_name = modules_get_moduletype_name (modules_get_agentmodule_type ($module_id)); -+ $moduletype_name = modules_get_moduletype_name( -+ modules_get_agentmodule_type($module_id)); - - $offset = (int) get_parameter("offset"); - $block_size = (int) $config["block_size"]; - - $columns = array (); - -- $datetime_from = strtotime ($date_from.' '.$time_from); -- $datetime_to = strtotime ($date_to.' '.$time_to); -+ $datetime_from = strtotime ($date_from . ' ' . $time_from); -+ $datetime_to = strtotime ($date_to . ' ' . $time_to); - - if ($moduletype_name == "log4x") { - $table->width = "100%"; -@@ -222,14 +233,30 @@ - ); - } - -+ - $sql_body = io_safe_output($sql_body); - // Clean all codification characters - - $sql = "SELECT * " . $sql_body; -- $sql_count = "SELECT count(*) " . $sql_body; - -+ switch ($config['dbtype']) { -+ case "mysql": -+ $sql_count = "SELECT count(*) " . $sql_body; -+ break; -+ case "postgresql": -+ $sql_body = str_replace("ORDER BY utimestamp DESC", -+ "GROUP BY utimestamp ORDER BY utimestamp DESC", -+ $sql_body); -+ $sql_count = "SELECT count(DISTINCT utimestamp) " . $sql_body; -+ break; -+ case "oracle": -+ $sql_count = "SELECT count(*) " . $sql_body; -+ break; -+ } -+ - $count = db_get_value_sql ($sql_count, $conexion); - -+ - switch ($config["dbtype"]) { - case "mysql": - $sql .= " LIMIT " . $offset . "," . $block_size; -@@ -337,10 +364,10 @@ - return; - } - --$get_module_autocomplete_input = (bool) get_parameter('get_module_autocomplete_input'); -+ - if ($get_module_autocomplete_input) { - $id_agent = (int) get_parameter("id_agent"); -- -+ - ob_clean(); - if ($id_agent > 0) { - html_print_autocomplete_modules( -@@ -350,7 +377,7 @@ - return; - } - --$add_module_relation = (bool) get_parameter('add_module_relation'); -+ - if ($add_module_relation) { - $result = false; - $id_module_a = (int) get_parameter("id_module_a"); -@@ -384,7 +411,7 @@ - return; - } - --$remove_module_relation = (bool) get_parameter('remove_module_relation'); -+ - if ($remove_module_relation) { - $id_relation = (int) get_parameter("id_relation"); - if ($id_relation > 0) { -@@ -395,23 +422,25 @@ - return; - } - --$change_module_relation_updates = (bool) get_parameter('change_module_relation_updates'); -+ - if ($change_module_relation_updates) { - $id_relation = (int) get_parameter("id_relation"); - if ($id_relation > 0) { - $result = (bool) modules_change_relation_lock($id_relation); - } -+ - echo json_encode($result); - return; - } - --$get_id_tag = (bool) get_parameter('get_id_tag', 0); -+ - if ($get_id_tag) { - $tag_name = get_parameter('tag_name'); -- -+ - if ($tag_name) { - $tag_id = db_get_value('id_tag', 'ttag', 'name', $tag_name); -- } else { -+ } -+ else { - $tag_id = 0; - } - -Index: include/functions_api.php -=================================================================== ---- include/functions_api.php (revision 10314) -+++ include/functions_api.php (working copy) -@@ -757,7 +757,7 @@ - $cascadeProtection = $other['data'][4]; - $intervalSeconds = $other['data'][5]; - $idOS = $other['data'][6]; -- $idServer = $other['data'][7]; -+ $nameServer = $other['data'][7]; - $customId = $other['data'][8]; - $learningMode = $other['data'][9]; - $disabled = $other['data'][10]; -@@ -806,7 +806,8 @@ - $cascadeProtection = $other['data'][4]; - $intervalSeconds = $other['data'][5]; - $idOS = $other['data'][6]; -- $idServer = $other['data'][7]; -+ //$idServer = $other['data'][7]; -+ $nameServer = $other['data'][7]; - $customId = $other['data'][8]; - $learningMode = $other['data'][9]; - $disabled = $other['data'][10]; -@@ -815,12 +816,12 @@ - switch ($config["dbtype"]) { - case "mysql": - $sql1 = 'SELECT name -- FROM tserver WHERE id_server =' . $idServer; -+ FROM tserver WHERE name LIKE "' . $nameServer . '"'; - break; - case "postgresql": - case "oracle": - $sql1 = 'SELECT name -- FROM tserver WHERE id_server =' . $idServer; -+ FROM tserver WHERE name LIKE \'' . $nameServer . '\''; - break; - } - -@@ -2476,7 +2477,7 @@ - if (!$module_values) { - returnError('error_get_module_value_all_agents', 'Error getting module values from all agents.'); - } -- else{ -+ else { - $data = array('type' => 'array', 'data' => $module_values); - - returnData('csv', $data, ';'); -@@ -4856,7 +4857,7 @@ - else { - $return = true; - } -- -+ - $data['type'] = 'string'; - if ($return === false) { - $data['data'] = 0; -@@ -4865,7 +4866,7 @@ - $data['data'] = $return; - } - returnData('string', $data); -- return; -+ return; - } - else { - returnError('error_parameter', 'Error in the parameters.'); -@@ -4900,20 +4901,20 @@ - <data><![CDATA[%s]]></data> - </module> - </agent_data>"; -- -+ - $xml = sprintf($xmlTemplate, io_safe_output(get_os_name($agent['id_os'])), - io_safe_output($agent['os_version']), $agent['intervalo'], - io_safe_output($agent['agent_version']), date('Y/m/d H:i:s', $time), - io_safe_output($agent['nombre']), $agent['timezone_offset'], - io_safe_output($agentModule['nombre']), io_safe_output($agentModule['descripcion']), modules_get_type_name($agentModule['id_tipo_modulo']), $data); -- -- -+ -+ - if (false === @file_put_contents($config['remote_config'] . '/' . io_safe_output($agent['nombre']) . '.' . $time . '.data', $xml)) { - returnError('error_file', 'Can save agent data xml.'); - } - else { - returnData('string', array('type' => 'string', 'data' => $xml)); -- return; -+ return; - } - } - } -@@ -6064,7 +6065,7 @@ - $id_agent = agents_get_agent_id($agent_name); - $id_agent_module = db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('id_agente' => $id_agent, 'nombre' => $module_name)); - -- $result = modules_change_disabled($id_agent_module, 1); -+ $result = modules_change_disabled($id_agent_module, 0); - - if ($result === NOERR) { - returnData('string', array('type' => 'string', 'data' => __('Correct module enable'))); -@@ -6665,7 +6666,8 @@ - 'module_lag' => $server["module_lag"], - 'threads' => $server["threads"], - 'queued_modules' => $server["queued_modules"], -- 'keepalive' => $server['keepalive'] -+ 'keepalive' => $server['keepalive'], -+ 'id_server' => $server['id_server'] - ); - - // servers_get_info() returns "<a http:....>servername</a>" for recon server's name. -Index: include/functions_ui.php -=================================================================== ---- include/functions_ui.php (revision 10314) -+++ include/functions_ui.php (working copy) -@@ -1245,7 +1245,13 @@ - } - $output .= "\n\t"; - -+ -+ -+ -+ -+ //////////////////////////////////////////////////////////////////// - //Load CSS -+ //////////////////////////////////////////////////////////////////// - if (empty ($config['css'])) { - $config['css'] = array (); - } -@@ -1270,7 +1276,8 @@ - } - } - -- //First, if user has assigned a skin then try to use css files of skin subdirectory -+ //First, if user has assigned a skin then try to use css files of -+ //skin subdirectory - $isFunctionSkins = enterprise_include_once ('include/functions_skins.php'); - if (!$login_ok) { - if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { -@@ -1278,6 +1285,7 @@ - } - } - -+ - $exists_css = false; - if ($login_ok and $isFunctionSkins !== ENTERPRISE_NOT_HOOK) { - //Checks if user's skin is available -@@ -1305,12 +1313,17 @@ - $config['css']); - } - -+ -+ - // Add the jquery UI styles CSS - $config['css']['jquery-UI'] = "include/styles/jquery-ui-1.10.0.custom.css"; -- - // Add the dialog styles CSS - $config['css']['dialog'] = "include/styles/dialog.css"; -+ // Add the dialog styles CSS -+ $config['css']['dialog'] = "include/javascript/introjs.css"; - -+ -+ - //We can't load empty and we loaded (conditionally) ie - $loaded = array ('', 'ie'); - -@@ -1333,25 +1346,34 @@ - $output .= '<link rel="stylesheet" href="' . $url_css . '" type="text/css" />'."\n\t"; - } - } -+ //////////////////////////////////////////////////////////////////// - //End load CSS -+ //////////////////////////////////////////////////////////////////// - -+ -+ -+ -+ //////////////////////////////////////////////////////////////////// - //Load JS -+ //////////////////////////////////////////////////////////////////// - if (empty ($config['js'])) { - $config['js'] = array (); //If it's empty, false or not init set array to empty just in case - } - -+ - //Pandora specific JavaScript should go first - $config['js'] = array_merge (array ("pandora" => "include/javascript/pandora.js"), $config['js']); -- - //Load base64 javascript library - $config['js']['base64'] = "include/javascript/encode_decode_base64.js"; -- - //Load webchat javascript library - $config['js']['webchat'] = "include/javascript/webchat.js"; -- - //Load qrcode library - $config['js']['qrcode'] = "include/javascript/qrcode.js"; -+ //Load intro.js library (for bubbles and clippy) -+ $config['js']['intro'] = "include/javascript/intro.js"; -+ $config['js']['clippy'] = "include/javascript/clippy.js"; - -+ - //Load other javascript - //We can't load empty - $loaded = array (''); -@@ -1370,9 +1392,15 @@ - $output .= '<script type="text/javascript" src="' . $url_js . '"></script>'."\n\t"; - } - } -+ //////////////////////////////////////////////////////////////////// - //End load JS -+ //////////////////////////////////////////////////////////////////// - -+ -+ -+ //////////////////////////////////////////////////////////////////// - //Load jQuery -+ //////////////////////////////////////////////////////////////////// - if (empty ($config['jquery'])) { - $config['jquery'] = array (); //If it's empty, false or not init set array to empty just in case - } -@@ -1422,8 +1450,13 @@ - $output .= '<script type="text/javascript" src="' . $url_js . '"></script>'."\n\t"; - } - } -+ //////////////////////////////////////////////////////////////////// -+ //End load JQuery -+ //////////////////////////////////////////////////////////////////// - - -+ -+ - if ($config['flash_charts']) { - //Include the javascript for the js charts library - include_once($config["homedir"] . '/include/graphs/functions_flot.php'); -@@ -1576,9 +1609,9 @@ - - // Show GOTO FIRST button - if ($other_class == '') { -- $output .= '<a class="pagination go_first" href="'.$url.'&'.$offset_name.'=0">'.html_print_image ("images/go_first.png", true, array ("class" => "bot")).'</a> '; -+ $output .= '<a class="pagination offset_0" href="'.$url.'&' .$offset_name.'=0">'.html_print_image ("images/go_first.png", true, array ("class" => "bot")).'</a> '; - } else { -- $output .= "<a class='pagination $other_class go_first' href='$url.&$offset_name=0'>".html_print_image ("images/go_first.png", true, array ("class" => "bot"))."</a> "; -+ $output .= "<a class='pagination $other_class offset_0' href='$url.&$offset_name=0'>".html_print_image ("images/go_first.png", true, array ("class" => "bot"))."</a> "; - } - - // Show PREVIOUS button -@@ -1588,9 +1621,9 @@ - $index_page_prev = 0; - - if ($other_class == '') { -- $output .= '<a class="pagination go_rewind" href="'.$url.'&'.$offset_name.'='.$index_page_prev.'">'.html_print_image ("images/go_previous.png", true, array ("class" => "bot")).'</a>'; -+ $output .= '<a class="pagination offset_' . $index_page_prev . '" href="'.$url.'&'.$offset_name.'='.$index_page_prev.'">'.html_print_image ("images/go_previous.png", true, array ("class" => "bot")).'</a>'; - } else { -- $output .= "<a class='pagination $other_class go_rewind' href='$url &$offset_name = $index_page_prev'>".html_print_image ("images/go_previous.png", true, array ("class" => "bot"))."</a>"; -+ $output .= "<a class='pagination $other_class offset_$index_page_prev' href='$url &$offset_name = $index_page_prev'>".html_print_image ("images/go_previous.png", true, array ("class" => "bot"))."</a>"; - } - } - -@@ -1629,13 +1662,12 @@ - // Index_counter stores max of blocks - if (($paginacion_maxima == 1) AND (($index_counter - $i) > 0)) { - $prox_bloque = ($i + ceil ($block_limit / 2)) * $pagination; -- if ($prox_bloque > $count) -- $prox_bloque = ($count -1) - $pagination; -- -+ if ($prox_bloque >= $count) -+ $prox_bloque = (int) (($count - 1) / $pagination) * $pagination; - if ($other_class == '') { -- $output .= '<a class="pagination go_fastforward" href="'.$url.'&'.$offset_name.'='.$prox_bloque.'">'.html_print_image ("images/go_next.png", true, array ("class" => "bot")).'</a>'; -+ $output .= '<a class="pagination offset_' . $prox_bloque . '" href="'.$url.'&'.$offset_name.'='.$prox_bloque.'">'.html_print_image ("images/go_next.png", true, array ("class" => "bot")).'</a>'; - } else { -- $output .= "<a class='pagination $other_class go_fastforward' href='$url&$offset_name=$prox_bloque'>".html_print_image ("images/go_next.png", true, array ("class" => "bot"))."</a>"; -+ $output .= "<a class='pagination $other_class offset_$prox_bloque' href='$url&$offset_name=$prox_bloque'>".html_print_image ("images/go_next.png", true, array ("class" => "bot"))."</a>"; - } - $i = $index_counter; - } -@@ -1647,9 +1679,9 @@ - $myoffset = floor (($count - 1) / $pagination) * $pagination; - - if ($other_class == '') { -- $output .= '<a class="pagination go_last" href="'.$url.'&'.$offset_name.'='.$myoffset.'">'.html_print_image ("images/go_last.png", true, array ("class" => "bot")).'</a>'; -+ $output .= '<a class="pagination offset_' . $myoffset . '" href="'.$url. '&'.$offset_name.'='.$myoffset.'">'.html_print_image ("images/go_last.png", true, array ("class" => "bot")).'</a>'; - } else { -- $output .= "<a class='pagination $other_class go_last' href='$url&$offset_name=$myoffset'>".html_print_image ("images/go_last.png", true, array ("class" => "bot"))."</a>"; -+ $output .= "<a class='pagination $other_class offset_$myoffset' href='$url&$offset_name=$myoffset'>".html_print_image ("images/go_last.png", true, array ("class" => "bot"))."</a>"; - } - } - -@@ -2268,7 +2300,8 @@ - $buffer .= '<span style="display: inline-block; vertical-align: top; margin-top: 2px;">' . - ui_print_truncate_text($title, 38); - if ($help != "") -- $buffer .= "<div class='head_help' style='float: right; margin-top: -3px !important; margin-left: 2px !important;'>" . ui_print_help_icon ($help, true, '', 'images/help_w.png') . "</div>"; -+ $buffer .= "<div class='head_help' style='float: right; margin-top: -3px !important; margin-left: 2px !important;'>" . -+ ui_print_help_icon ($help, true, '', 'images/help_w.png') . "</div>"; - $buffer .= '</span></li></ul></div>'; - - if (is_array($options)) { -Index: include/functions.php -=================================================================== ---- include/functions.php (revision 10314) -+++ include/functions.php (working copy) -@@ -768,6 +768,23 @@ - return get_parameter($name, 0); - } - -+function get_cookie($name, $default = '') { -+ if (isset($_COOKIE[$name])) { -+ return $_COOKIE[$name]; -+ } -+ else { -+ return $default; -+ } -+} -+ -+function set_cookie($name, $value) { -+ if (is_null($value)) { -+ unset($_COOKIE[$value]); -+ setcookie($value, null, -1, '/'); -+ } -+ setcookie($name, $value); -+} -+ - /** - * Get a parameter from a request. - * -@@ -1430,9 +1447,11 @@ - * - * @return array SNMP result. - */ --function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '', $snmp3_auth_user = '', -- $snmp3_security_level = '', $snmp3_auth_method = '', $snmp3_auth_pass = '', -- $snmp3_privacy_method = '', $snmp3_privacy_pass = '', $quick_print = 0, $base_oid = "", $snmp_port = '') { -+function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '', -+ $snmp3_auth_user = '', $snmp3_security_level = '', -+ $snmp3_auth_method = '', $snmp3_auth_pass = '', -+ $snmp3_privacy_method = '', $snmp3_privacy_pass = '', -+ $quick_print = 0, $base_oid = "", $snmp_port = '') { - - global $config; - -@@ -1464,7 +1483,7 @@ - else { - $snmpwalk_bin = $config['snmpwalk']; - } -- -+ - switch (PHP_OS) { - case "WIN32": - case "WINNT": -@@ -1480,16 +1499,54 @@ - $rc = 0; - switch ($snmp_version) { - case '3': -- exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' -x ' . escapeshellarg($snmp3_privacy_method) . ' -X ' . escapeshellarg($snmp3_privacy_pass) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2> ' . $error_redir_dir, $output, $rc); -+ switch ($snmp3_security_level) { -+ case "authNoPriv": -+ $command_str = $snmpwalk_bin . -+ ' -m ALL -v 3' . -+ ' -u ' . escapeshellarg($snmp3_auth_user) . -+ ' -A ' . escapeshellarg($snmp3_auth_pass) . -+ ' -l ' . escapeshellarg($snmp3_security_level) . -+ ' -a ' . escapeshellarg($snmp3_auth_method) . -+ ' ' . escapeshellarg($ip_target) . -+ ' ' . $base_oid . -+ ' 2> ' . $error_redir_dir; -+ break; -+ case "noAuthNoPriv": -+ $command_str = $snmpwalk_bin . -+ ' -m ALL -v 3' . -+ ' -u ' . escapeshellarg($snmp3_auth_user) . -+ ' -l ' . escapeshellarg($snmp3_security_level) . -+ ' ' . escapeshellarg($ip_target) . -+ ' ' . $base_oid . -+ ' 2> ' . $error_redir_dir; -+ break; -+ default: -+ $command_str = $snmpwalk_bin . -+ ' -m ALL -v 3' . -+ ' -u ' . escapeshellarg($snmp3_auth_user) . -+ ' -A ' . escapeshellarg($snmp3_auth_pass) . -+ ' -l ' . escapeshellarg($snmp3_security_level) . -+ ' -a ' . escapeshellarg($snmp3_auth_method) . -+ ' -x ' . escapeshellarg($snmp3_privacy_method) . -+ ' -X ' . escapeshellarg($snmp3_privacy_pass) . -+ ' ' . escapeshellarg($ip_target) . -+ ' ' . $base_oid . -+ ' 2> ' . $error_redir_dir; -+ break; -+ } - break; - case '2': - case '2c': - case '1': - default: -- exec ($snmpwalk_bin . ' -m ALL -v ' . escapeshellarg($snmp_version) . ' -c ' . escapeshellarg($snmp_community) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2> ' . $error_redir_dir, $output, $rc); -+ $command_str = $snmpwalk_bin . ' -m ALL -v ' . escapeshellarg($snmp_version) . ' -c ' . escapeshellarg($snmp_community) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2> ' . $error_redir_dir; - break; - } - -+ //html_debug_print($command_str); -+ -+ exec($command_str, $output, $rc); -+ - // Parse the output of snmpwalk - $snmpwalk = array(); - foreach ($output as $line) { -@@ -2134,4 +2191,29 @@ - return $news; - } - -+ -+/** -+ * Print audit data in CSV format. -+ * -+ * @param array Audit data. -+ * -+ */ -+function print_audit_csv ($data) { -+ global $config; -+ global $graphic_type; -+ -+ $config['ignore_callback'] = true; -+ while (@ob_end_clean ()); -+ -+ header("Content-type: application/octet-stream"); -+ header("Content-Disposition: attachment; filename=audit_log".date("Y-m-d_His").".csv"); -+ header("Pragma: no-cache"); -+ header("Expires: 0"); -+ -+ echo __('User') . ';' . __('Action') . ';' . __('Date') . ';' . __('Source ID') . ';'. __('Comments') ."\n"; -+ foreach ($data as $line) { -+ echo io_safe_output($line['id_usuario']) . ';' . io_safe_output($line['accion']) . ';' . $line['fecha'] . ';' . $line['ip_origen'] . ';'. io_safe_output($line['descripcion']). "\n"; -+ } -+} -+ - ?> -Index: include/functions_agents.php -=================================================================== ---- include/functions_agents.php (revision 10314) -+++ include/functions_agents.php (working copy) -@@ -360,6 +360,11 @@ - } - } - -+ //Fix for postgresql -+ if (empty($filter['id_agente'])) { -+ unset($filter['id_agente']); -+ } -+ - $where = db_format_array_where_clause_sql ($filter, 'AND', ''); - - $where_nogroup = db_format_array_where_clause_sql ($filter_nogroup, 'AND', ''); -@@ -412,6 +417,7 @@ - return $sql; - else - $agents = db_get_all_rows_sql($sql); -+ - break; - case "oracle": - $set = array(); -Index: include/functions_graph.php -=================================================================== ---- include/functions_graph.php (revision 10314) -+++ include/functions_graph.php (working copy) -@@ -102,13 +102,14 @@ - - foreach ($chart_array as $item) { - if ($series_suffix != '') { -- $item['sum'] = $item['sum'.$series_suffix]; -- $item['min'] = $item['min'.$series_suffix]; -- $item['max'] = $item['max'.$series_suffix]; -+ $item['sum'] = $item['sum' . $series_suffix]; -+ $item['min'] = $item['min' . $series_suffix]; -+ $item['max'] = $item['max' . $series_suffix]; - } - - //Get stats for normal graph - if (isset($item['sum']) && $item['sum']) { -+ - //Sum all values later divide by the number of elements - $stats['sum']['avg'] = $stats['sum']['avg'] + $item['sum']; - -@@ -245,6 +246,7 @@ - $is_unknown = $start_unknown; - - // Calculate chart data -+ $last_known = $previous_data; - for ($i = 0; $i < $resolution; $i++) { - $timestamp = $datelimit + ($interval * $i); - -@@ -270,6 +272,7 @@ - $interval_min = $data[$data_i]['datos']; - } - $total += $data[$data_i]['datos']; -+ $last_known = $data[$data_i]['datos']; - $count++; - $data_i++; - } -@@ -399,7 +402,6 @@ - $chart[$timestamp]['sum'.$series_suffix] = $total; - $chart[$timestamp]['min'.$series_suffix] = $interval_min; - } -- $previous_data = $total; - // Compressed data - } - else { -@@ -415,12 +417,12 @@ - } - else { - if ($avg_only) { -- $chart[$timestamp]['sum'.$series_suffix] = $previous_data; -+ $chart[$timestamp]['sum'.$series_suffix] = $last_known; - } - else { -- $chart[$timestamp]['max'.$series_suffix] = $previous_data; -- $chart[$timestamp]['sum'.$series_suffix] = $previous_data; -- $chart[$timestamp]['min'.$series_suffix] = $previous_data; -+ $chart[$timestamp]['max'.$series_suffix] = $last_known; -+ $chart[$timestamp]['sum'.$series_suffix] = $last_known; -+ $chart[$timestamp]['min'.$series_suffix] = $last_known; - } - } - } -@@ -580,7 +582,7 @@ - if (!$projection) { - return fs_error_image (); - } -- else{ -+ else { - return fs_error_image (); - } - } -@@ -1103,6 +1105,7 @@ - $countAvg = 0; - - // Calculate chart data -+ $last_known = $previous_data; - for ($l = 0; $l < $resolution; $l++) { - $countAvg ++; - -@@ -1117,8 +1120,8 @@ - $count = 0; - - // Read data that falls in the current interval -- $interval_min = $previous_data; -- $interval_max = $previous_data; -+ $interval_min = $last_known; -+ $interval_max = $last_known; - while (isset ($data[$j]) && $data[$j]['utimestamp'] >= $timestamp && $data[$j]['utimestamp'] < ($timestamp + $interval)) { - if ($data[$j]['datos'] > $interval_max) { - $interval_max = $data[$j]['datos']; -@@ -1127,6 +1130,7 @@ - $interval_min = $data[$j]['datos']; - } - $total += $data[$j]['datos']; -+ $last_known = $data[$j]['datos']; - $count++; - $j++; - } -@@ -1153,18 +1157,14 @@ - if ($count > 0) { - //$graph_values[$i][$timestamp] = $total * $weight_list[$i]; - $temp_graph_values[$timestamp_short] = $total * $weight_list[$i]; -- -- $previous_data = $total; - } - else { - // Compressed data - if ($uncompressed_module || ($timestamp > time ())) { -- //$graph_values[$i][$timestamp] = 0; - $temp_graph_values[$timestamp_short] = 0; - } - else { -- //$graph_values[$i][$timestamp] = $previous_data * $weight_list[$i]; -- $temp_graph_values[$timestamp_short] = $previous_data * $weight_list[$i]; -+ $temp_graph_values[$timestamp_short] = $last_known * $weight_list[$i]; - } - } - -@@ -1459,16 +1459,19 @@ - $filter['id_agente'] = $id_agent; - } - -- $fields = array('SUM(critical_count) Critical', -- 'SUM(warning_count) Warning', -- 'SUM(normal_count) Normal', -- 'SUM(unknown_count) Unknown'); -+ $fields = array('SUM(critical_count) AS Critical', -+ 'SUM(warning_count) AS Warning', -+ 'SUM(normal_count) AS Normal', -+ 'SUM(unknown_count) AS Unknown'); - - if ($show_not_init) { - $fields[] = 'SUM(notinit_count) "Not init"'; - } - - $data = db_get_row_filter('tagente', $filter, $fields); -+ if (empty($data)) { -+ $data = array(); -+ } - - array_walk($data, 'truncate_negatives'); - -@@ -1796,6 +1799,7 @@ - if ($modules === false) - $modules = array (); - -+ $data = array(); - foreach ($modules as $module) { - $agent_name = agents_get_name ($module['id_agente'], "none"); - -@@ -1816,7 +1820,8 @@ - $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("/images/logo_vertical_water.png")); - -- return hbar_graph($config['flash_charts'], $data, $width, $height, array(), -+ return hbar_graph($config['flash_charts'], -+ $data, $width, $height, array(), - array(), "", "", true, "", - $water_mark, - $config['fontpath'], $config['font_size'], false); -@@ -2670,6 +2675,7 @@ - $max_value = 0; - - // Calculate chart data -+ $last_known = $previous_data; - for ($i = 0; $i < $resolution; $i++) { - $timestamp = $datelimit + ($interval * $i); - -@@ -2689,6 +2695,7 @@ - $count++; - } - -+ $last_known = $data[$j]['datos']; - $j++; - } - -@@ -2796,43 +2803,20 @@ - //New code set 0 if there is a 0 - //Please check the incident #665 - //http://192.168.50.2/integria/index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id=665 -- -- - $chart[$timestamp]['sum'.$series_suffix] = 0; -- $previous_data = 0; -- -- //Old code that make a AVG -- -- //~ if ($avg_only) { -- //~ $chart[$timestamp]['sum'.$series_suffix] = $total; -- //~ } -- //~ else { -- //~ $chart[$timestamp]['sum'.$series_suffix] = $total; -- //~ $chart[$timestamp + 1] = array ('sum'.$series_suffix => 0, -- //~ //'count' => 0, -- //~ //'timestamp_bottom' => $timestamp, -- //~ //'timestamp_top' => $timestamp + $interval, -- //~ 'min'.$series_suffix => 0, -- //~ 'max'.$series_suffix => 0, -- //~ 'event'.$series_suffix => $event_value, -- //~ 'alert'.$series_suffix => $alert_value); -- //~ } -- //~ $previous_data = 0; - } - else if ($zero == 1) { // Just zeros - $chart[$timestamp]['sum'.$series_suffix] = 0; -- $previous_data = 0; - } - else if ($count > 0) { // No zeros - $chart[$timestamp]['sum'.$series_suffix] = $total; -- $previous_data = $total; - } - else { // Compressed data - if ($uncompressed_module || ($timestamp > time ()) || $is_unknown) { - $chart[$timestamp]['sum'.$series_suffix] = 0; - } - else { -- $chart[$timestamp]['sum'.$series_suffix] = $previous_data; -+ $chart[$timestamp]['sum'.$series_suffix] = $last_known; - } - } - -@@ -3279,7 +3263,7 @@ - * @param integer date date - */ - function grafico_modulo_string ($agent_module_id, $period, $show_events, -- $width, $height , $title, $unit_name, $show_alerts, $avg_only = 0, $pure=0, -+ $width, $height , $title, $unit_name, $show_alerts, $avg_only = 0, $pure = 0, - $date = 0, $only_image = false, $homeurl = '', $adapt_key = '', $ttl = 1, $menu = true) { - global $config; - global $graphic_type; -@@ -3381,6 +3365,7 @@ - } - - // Calculate chart data -+ $last_known = $previous_data; - for ($i = 0; $i < $resolution; $i++) { - $timestamp = $datelimit + ($interval * $i); - -@@ -3388,6 +3373,7 @@ - $total = 0; - // Read data that falls in the current interval - while (isset($data[$j]) && isset ($data[$j]) !== null && $data[$j]['utimestamp'] >= $timestamp && $data[$j]['utimestamp'] <= ($timestamp + $interval)) { -+ $last_known = $data[$j]; - $count++; - $j++; - } -@@ -3437,7 +3423,7 @@ - //The order in chart array is very important!!!! - if ($show_events) { - $chart[$timestamp]['event'] = $event_value; -- } -+ } - - if ($show_alerts) { - $chart[$timestamp]['alert'] = $alert_value; -@@ -3449,11 +3435,10 @@ - - if ($count > 0) { - $chart[$timestamp]['sum'] = $count; -- $previous_data = $total; - } - else { - // Compressed data -- $chart[$timestamp]['sum'] = $previous_data; -+ $chart[$timestamp]['sum'] = $last_known; - } - - if (!$avg_only) { -@@ -4106,47 +4091,304 @@ - /** - * Print a solarburst graph with a representation of all the groups, agents, module groups and modules grouped - */ --function graph_monitor_wheel ($data, $unit, $width = 700, $height = 700) { -+function graph_monitor_wheel ($width = 500, $height = 600) { - global $config; - -- $data = array(); -- - include_once ($config['homedir'] . "/include/functions_users.php"); -- //include_once ($config['homedir'] . "/include/functions_groups.php"); -+ include_once ($config['homedir'] . "/include/functions_groups.php"); - include_once ($config['homedir'] . "/include/functions_agents.php"); -- //include_once ($config['homedir'] . "/include/functions_modules.php"); -+ include_once ($config['homedir'] . "/include/functions_modules.php"); - -+ $graph_data = array(); -+ - $groups = users_get_groups(false, "AR", false, true); - -+ $data_groups = array(); - if (!empty($groups)) { -+ $groups_aux = $groups; -+ $data_groups = groups_get_tree($groups_aux); -+ $groups_aux = $groups = null; -+ } -+ -+ if (!empty($data_groups)) { - $filter = array('id_grupo' => array_keys($groups)); - $fields = array('id_agente', 'id_parent', 'id_grupo', 'nombre'); - $agents = agents_get_agents($filter, $fields); - - if (!empty($agents)) { - $agents_id = array(); -+ $agents_aux = array(); - foreach ($agents as $key => $agent) { -- $agents_id[] = $agent['id_agente']; -+ $agents_aux[$agent['id_agente']] = $agent; - } -+ $agents = $agents_aux; -+ $agents_aux = null; - $fields = array('id_agente_modulo', 'id_agente', 'id_module_group', 'nombre'); - - $module_groups = modules_get_modulegroups(); -- $modules = agents_get_modules($agents_id, $fields); -+ $module_groups[0] = __('Not assigned'); -+ $modules = agents_get_modules(array_keys($agents), '*'); - -+ $data_agents = array(); - if (!empty($modules)) { -- -+ foreach ($modules as $key => $module) { -+ $module_id = (int) $module['id_agente_modulo']; -+ $agent_id = (int) $module['id_agente']; -+ $module_group_id = (int) $module['id_module_group']; -+ $module_name = $module['nombre']; -+ $module_status = modules_get_agentmodule_status($module_id); -+ -+ if (!isset($data_agents[$agent_id])) { -+ $data_agents[$agent_id] = array(); -+ $data_agents[$agent_id]['id'] = $agent_id; -+ $data_agents[$agent_id]['name'] = $agents[$agent_id]['nombre']; -+ $data_agents[$agent_id]['group'] = (int) $agents[$agent_id]['id_grupo']; -+ $data_agents[$agent_id]['type'] = 'agent'; -+ $data_agents[$agent_id]['size'] = 30; -+ $data_agents[$agent_id]['children'] = array(); -+ -+ $tooltip_content = __('Agent') . ": <b>" . $data_agents[$agent_id]['name'] . "</b>"; -+ $data_agents[$agent_id]['tooltip_content'] = $tooltip_content; -+ -+ $data_agents[$agent_id]['modules_critical'] = 0; -+ $data_agents[$agent_id]['modules_warning'] = 0; -+ $data_agents[$agent_id]['modules_normal'] = 0; -+ $data_agents[$agent_id]['modules_not_init'] = 0; -+ $data_agents[$agent_id]['modules_not_normal'] = 0; -+ $data_agents[$agent_id]['modules_unknown'] = 0; -+ -+ $data_agents[$agent_id]['color'] = COL_UNKNOWN; -+ -+ unset($agents[$agent_id]); -+ } -+ if (!isset($data_agents[$agent_id]['children'][$module_group_id])) { -+ $data_agents[$agent_id]['children'][$module_group_id] = array(); -+ $data_agents[$agent_id]['children'][$module_group_id]['id'] = $module_group_id; -+ $data_agents[$agent_id]['children'][$module_group_id]['name'] = $module_groups[$module_group_id]; -+ $data_agents[$agent_id]['children'][$module_group_id]['type'] = 'module_group'; -+ $data_agents[$agent_id]['children'][$module_group_id]['size'] = 10; -+ $data_agents[$agent_id]['children'][$module_group_id]['children'] = array(); -+ -+ $tooltip_content = __('Module group') . ": <b>" . $module_groups[$module_group_id] . "</b>"; -+ $data_agents[$agent_id]['children'][$module_group_id]['tooltip_content'] = $tooltip_content; -+ -+ $data_agents[$agent_id]['children'][$module_group_id]['modules_critical'] = 0; -+ $data_agents[$agent_id]['children'][$module_group_id]['modules_warning'] = 0; -+ $data_agents[$agent_id]['children'][$module_group_id]['modules_normal'] = 0; -+ $data_agents[$agent_id]['children'][$module_group_id]['modules_not_init'] = 0; -+ $data_agents[$agent_id]['children'][$module_group_id]['modules_not_normal'] = 0; -+ $data_agents[$agent_id]['children'][$module_group_id]['modules_unknown'] = 0; -+ -+ $data_agents[$agent_id]['children'][$module_group_id]['color'] = COL_UNKNOWN; -+ } -+ -+ switch ($module_status) { -+ case AGENT_MODULE_STATUS_CRITICAL_BAD: -+ case AGENT_MODULE_STATUS_CRITICAL_ALERT: -+ $data_agents[$agent_id]['modules_critical']++; -+ $data_agents[$agent_id]['children'][$module_group_id]['modules_critical']++; -+ break; -+ -+ case AGENT_MODULE_STATUS_WARNING: -+ case AGENT_MODULE_STATUS_WARNING_ALERT: -+ $data_agents[$agent_id]['modules_warning']++; -+ $data_agents[$agent_id]['children'][$module_group_id]['modules_warning']++; -+ break; -+ -+ case AGENT_MODULE_STATUS_NORMAL: -+ case AGENT_MODULE_STATUS_NORMAL_ALERT: -+ $data_agents[$agent_id]['modules_normal']++; -+ $data_agents[$agent_id]['children'][$module_group_id]['modules_normal']++; -+ break; -+ -+ case AGENT_MODULE_STATUS_NOT_INIT: -+ $data_agents[$agent_id]['modules_not_init']++; -+ $data_agents[$agent_id]['children'][$module_group_id]['modules_not_init']++; -+ break; -+ -+ case AGENT_MODULE_STATUS_NOT_NORMAL: -+ $data_agents[$agent_id]['modules_not_normal']++; -+ $data_agents[$agent_id]['children'][$module_group_id]['modules_not_normal']++; -+ break; -+ -+ case AGENT_MODULE_STATUS_NO_DATA: -+ case AGENT_MODULE_STATUS_UNKNOWN: -+ $data_agents[$agent_id]['modules_unknown']++; -+ $data_agents[$agent_id]['children'][$module_group_id]['modules_unknown']++; -+ break; -+ } -+ -+ if ($data_agents[$agent_id]['modules_critical'] > 0) { -+ $data_agents[$agent_id]['color'] = COL_CRITICAL; -+ } -+ else if ($data_agents[$agent_id]['modules_warning'] > 0) { -+ $data_agents[$agent_id]['color'] = COL_WARNING; -+ } -+ else if ($data_agents[$agent_id]['modules_not_normal'] > 0) { -+ $data_agents[$agent_id]['color'] = COL_WARNING; -+ } -+ else if ($data_agents[$agent_id]['modules_unknown'] > 0) { -+ $data_agents[$agent_id]['color'] = COL_UNKNOWN; -+ } -+ else if ($data_agents[$agent_id]['modules_normal'] > 0) { -+ $data_agents[$agent_id]['color'] = COL_NORMAL; -+ } -+ else { -+ $data_agents[$agent_id]['color'] = COL_NOTINIT; -+ } -+ -+ if ($data_agents[$agent_id]['children'][$module_group_id]['modules_critical'] > 0) { -+ $data_agents[$agent_id]['children'][$module_group_id]['color'] = COL_CRITICAL; -+ } -+ else if ($data_agents[$agent_id]['children'][$module_group_id]['modules_warning'] > 0) { -+ $data_agents[$agent_id]['children'][$module_group_id]['color'] = COL_WARNING; -+ } -+ else if ($data_agents[$agent_id]['children'][$module_group_id]['modules_not_normal'] > 0) { -+ $data_agents[$agent_id]['children'][$module_group_id]['color'] = COL_WARNING; -+ } -+ else if ($data_agents[$agent_id]['children'][$module_group_id]['modules_unknown'] > 0) { -+ $data_agents[$agent_id]['children'][$module_group_id]['color'] = COL_UNKNOWN; -+ } -+ else if ($data_agents[$agent_id]['children'][$module_group_id]['modules_normal'] > 0) { -+ $data_agents[$agent_id]['children'][$module_group_id]['color'] = COL_NORMAL; -+ } -+ else { -+ $data_agents[$agent_id]['children'][$module_group_id]['color'] = COL_NOTINIT; -+ } -+ -+ $data_module = array(); -+ $data_module['id'] = $module_id; -+ $data_module['name'] = $module_name; -+ $data_module['type'] = 'module'; -+ $data_module['size'] = 10; -+ -+ $tooltip_content = __('Module') . ": <b>" . $module_name . "</b>"; -+ $data_module['tooltip_content'] = $tooltip_content; -+ -+ switch ($module_status) { -+ case AGENT_MODULE_STATUS_CRITICAL_BAD: -+ case AGENT_MODULE_STATUS_CRITICAL_ALERT: -+ $data_module['color'] = COL_CRITICAL; -+ break; -+ -+ case AGENT_MODULE_STATUS_WARNING: -+ case AGENT_MODULE_STATUS_WARNING_ALERT: -+ $data_module['color'] = COL_WARNING; -+ break; -+ -+ case AGENT_MODULE_STATUS_NORMAL: -+ case AGENT_MODULE_STATUS_NORMAL_ALERT: -+ $data_module['color'] = COL_NORMAL; -+ break; -+ -+ case AGENT_MODULE_STATUS_NOT_INIT: -+ $data_module['color'] = COL_NOTINIT; -+ break; -+ -+ case AGENT_MODULE_STATUS_NOT_NORMAL: -+ $data_module['color'] = COL_WARNING; -+ break; -+ -+ case AGENT_MODULE_STATUS_NO_DATA: -+ case AGENT_MODULE_STATUS_UNKNOWN: -+ default: -+ $data_module['color'] = COL_UNKNOWN; -+ break; -+ } -+ -+ $data_agents[$agent_id]['children'][$module_group_id]['children'][] = $data_module; -+ -+ unset($modules[$module_id]); -+ } - } -+ foreach ($agents as $id => $agent) { -+ if (!isset($data_agents[$id])) { -+ $data_agents[$id] = array(); -+ $data_agents[$id]['id'] = (int) $id; -+ $data_agents[$id]['name'] = $agent['nombre']; -+ $data_agents[$id]['type'] = 'agent'; -+ $data_agents[$id]['color'] = COL_NOTINIT; -+ } -+ } -+ $agents = null; - } - } - -+ function iterate_group_array ($groups, &$data_agents) { -+ -+ $data = array(); - -- if (empty ($data)) { -- return fs_error_image (); -+ foreach ($groups as $id => $group) { -+ -+ $group_aux = array(); -+ $group_aux['id'] = (int) $id; -+ $group_aux['name'] = $group['nombre']; -+ $group_aux['parent'] = (int) $group['parent']; -+ $group_aux['type'] = 'group'; -+ $group_aux['size'] = 100; -+ $group_aux['status'] = groups_get_status($id); -+ -+ switch ($group_aux['status']) { -+ case AGENT_STATUS_CRITICAL: -+ $group_aux['color'] = COL_CRITICAL; -+ break; -+ -+ case AGENT_STATUS_WARNING: -+ case AGENT_STATUS_ALERT_FIRED: -+ $group_aux['color'] = COL_WARNING; -+ break; -+ -+ case AGENT_STATUS_NORMAL: -+ $group_aux['color'] = COL_NORMAL; -+ break; -+ -+ case AGENT_STATUS_UNKNOWN: -+ default: -+ $group_aux['color'] = COL_UNKNOWN; -+ break; -+ } -+ -+ $tooltip_content = html_print_image("images/groups_small/" . $group['icon'] . ".png", true) . " " . __('Group') . ": <b>" . $group_aux['name'] . "</b>"; -+ $group_aux['tooltip_content'] = $tooltip_content; -+ -+ if (!isset($group['children'])) -+ $group_aux['children'] = array(); -+ if (!empty($group['children'])) -+ $group_aux['children'] = iterate_group_array($group['children']); -+ -+ $agents = extract_agents_with_group_id($data_agents, (int) $id); -+ -+ if (!empty($agents)) -+ $group_aux['children'] = array_merge($group_aux['children'], $agents); -+ -+ $data[] = $group_aux; -+ } -+ -+ return $data; - } - -+ function extract_agents_with_group_id (&$agents, $group_id) { -+ $valid_agents = array(); -+ foreach ($agents as $id => $agent) { -+ if (isset($agent['group']) && $agent['group'] == $group_id) { -+ $valid_agents[$id] = $agent; -+ unset($agents[$id]); -+ } -+ } -+ if (!empty($valid_agents)) -+ return $valid_agents; -+ else -+ return false; -+ } -+ -+ $graph_data = array('name' => __('Main node'), 'children' => iterate_group_array($data_groups, $data_agents)); -+ -+ if (empty($graph_data['children'])) -+ return fs_error_image(); -+ - include_once($config['homedir'] . "/include/graphs/functions_d3.php"); - -- return d3_tree_map_graph ($data, $width, $height, true); -+ return d3_sunburst_graph ($graph_data, $width, $height, true); - } - - ?> -Index: include/functions_events.php -=================================================================== ---- include/functions_events.php (revision 10314) -+++ include/functions_events.php (working copy) -@@ -162,7 +162,16 @@ - (SELECT ack_utimestamp FROM $table WHERE id_evento = MAX(te.id_evento)) AS ack_utimestamp - FROM $table te - WHERE 1=1 " . $sql_post . " -- GROUP BY estado, evento, id_agentmodule, id_evento, id_agente, id_usuario, id_grupo, estado, timestamp, utimestamp, event_type, id_alert_am, criticity, user_comment, tags, source, id_extra" . $groupby_extra . " -+ GROUP BY estado, evento, id_agentmodule, id_evento, -+ id_agente, id_usuario, id_grupo, estado, -+ timestamp, utimestamp, event_type, id_alert_am, -+ criticity, user_comment, tags, source, id_extra, -+ te.critical_instructions, -+ te.warning_instructions, -+ te.unknown_instructions, -+ te.owner_user, -+ te.ack_utimestamp, -+ te.custom_data " . $groupby_extra . " - ORDER BY timestamp_rep DESC LIMIT " . $pagination . " OFFSET " . $offset; - } - break; -@@ -582,7 +591,7 @@ - - $event_comments_array[] = $comment_for_json; - -- $event_comments = json_encode($event_comments_array); -+ $event_comments = io_json_mb_encode($event_comments_array); - - // Update comment - $ret = db_process_sql_update($event_table, array('user_comment' => $event_comments), array('id_evento' => implode(',', $id_event))); -@@ -2244,6 +2253,7 @@ - $table_comments->class = "alternate rounded_cells"; - - $event_comments = io_safe_output($event["user_comment"]); -+ $event_comments = str_replace("\n", "<br>", $event_comments); - - // If comments are not stored in json, the format is old - $event_comments_array = json_decode($event_comments, true); -Index: include/graphs/functions_flot.php -=================================================================== ---- include/graphs/functions_flot.php (revision 10314) -+++ include/graphs/functions_flot.php (working copy) -@@ -442,6 +442,7 @@ - - $max = 0; - $i = count($graph_data); -+ $data = array(); - foreach ($graph_data as $label => $values) { - $labels[] = io_safe_output($label); - $i--; -Index: include/graphs/pandora.d3.js -=================================================================== ---- include/graphs/pandora.d3.js (revision 10314) -+++ include/graphs/pandora.d3.js (working copy) -@@ -715,8 +715,11 @@ - .data(partition.nodes(data)) - .enter().append("path") - .attr("d", arc) -- .style("fill", function(d) { return color((d.children ? d : d.parent).name); }) -- .on("click", click); -+ .style("fill", function(d) { return d.color ? d3.rgb(d.color) : color((d.children ? d : d.parent).name); }) -+ .on("click", click) -+ .on("mouseover", over_user) -+ .on("mouseout", out_user) -+ .on("mousemove", move_tooltip); - - function click(d) { - path.transition() -@@ -737,4 +740,68 @@ - : function(t) { x.domain(xd(t)); y.domain(yd(t)).range(yr(t)); return arc(d); }; - }; - } -+ -+ function move_tooltip(d) { -+ var x = d3.event.pageX + 10; -+ var y = d3.event.pageY + 10; -+ -+ $("#tooltip").css('left', x + 'px'); -+ $("#tooltip").css('top', y + 'px'); -+ } -+ -+ function over_user(d) { -+ id = d.id; -+ -+ $("#" + id).css('border', '1px solid black'); -+ $("#" + id).css('z-index', '1'); -+ -+ show_tooltip(d); -+ } -+ -+ function out_user(d) { -+ id = d.id; -+ -+ $("#" + id).css('border', ''); -+ $("#" + id).css('z-index', ''); -+ -+ hide_tooltip(); -+ } -+ -+ function create_tooltip(d, x, y) { -+ var tooltip = (typeof d.tooltip_content != 'undefined') ? d.tooltip_content : d.name; -+ -+ if ($("#tooltip").length == 0) { -+ $(recipient) -+ .append($("<div></div>") -+ .attr('id', 'tooltip') -+ .html(tooltip)); -+ } -+ else { -+ $("#tooltip").html(tooltip); -+ } -+ -+ $("#tooltip").attr('style', 'background: #fff;' + -+ 'position: absolute;' + -+ 'display: block;' + -+ 'width: 200px;' + -+ 'text-align: left;' + -+ 'padding: 10px 10px 10px 10px;' + -+ 'z-index: 2;' + -+ "-webkit-box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.75);" + -+ "-moz-box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.75);" + -+ "box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.75);" + -+ 'left: ' + x + 'px;' + -+ 'top: ' + y + 'px;'); -+ } -+ -+ function show_tooltip(d) { -+ var x = d3.event.pageX + 10; -+ var y = d3.event.pageY + 10; -+ -+ create_tooltip(d, x, y); -+ } -+ -+ function hide_tooltip() { -+ $("#tooltip").hide(); -+ } - } -\ No newline at end of file -Index: include/graphs/fgraph.php -=================================================================== ---- include/graphs/fgraph.php (revision 10314) -+++ include/graphs/fgraph.php (working copy) -@@ -398,11 +398,13 @@ - setup_watermark($water_mark, $water_mark_file, $water_mark_url); - - if ($flash_chart) { -- if ($return){ -- return flot_hcolumn_chart ($chart_data, $width, $height, $water_mark_url); -+ if ($return) { -+ return flot_hcolumn_chart( -+ $chart_data, $width, $height, $water_mark_url); - } -- else{ -- echo flot_hcolumn_chart ($chart_data, $width, $height, $water_mark_url); -+ else { -+ echo flot_hcolumn_chart( -+ $chart_data, $width, $height, $water_mark_url); - } - } - else { -@@ -422,7 +424,7 @@ - - $id_graph = serialize_in_temp($graph, null, $ttl); - -- return "<img src='".$homedir."include/graphs/functions_pchart.php?static_graph=1&graph_type=hbar&ttl=".$ttl."&id_graph=".$id_graph."'>"; -+ return "<img src='" . $homedir . "include/graphs/functions_pchart.php?static_graph=1&graph_type=hbar&ttl=".$ttl."&id_graph=".$id_graph."'>"; - } - } - -Index: include/db/postgresql.php -=================================================================== ---- include/db/postgresql.php (revision 10314) -+++ include/db/postgresql.php (working copy) -@@ -332,6 +332,9 @@ - else if (is_float ($value) || is_double ($value)) { - $values_str .= sprintf("%f", $value); - } -+ elseif (is_string($value) && (strtoupper($value) === 'NULL')) { -+ $values_str .= "NULL"; -+ } - else { - $values_str .= sprintf("'%s'", $value); - } -@@ -346,6 +349,8 @@ - - $query .= ' VALUES (' . $values_str . ')'; - -+ //html_debug_print($query); -+ - return db_process_sql($query, 'insert_id'); - } - -@@ -362,6 +367,18 @@ - return $str; - } - -+function postgresql_encapsule_fields_with_same_name_to_instructions($field) { -+ $return = $field; -+ -+ if (is_string($return)) { -+ if ($return[0] !== '"') { -+ $return = '"' . $return . '"'; -+ } -+ } -+ -+ return $return; -+} -+ - /** - * Get the first value of the first row of a table in the database from an - * array with filter conditions. -Index: include/db/mysql.php -=================================================================== ---- include/db/mysql.php (revision 10314) -+++ include/db/mysql.php (working copy) -@@ -346,6 +346,18 @@ - return $str; - } - -+function mysql_encapsule_fields_with_same_name_to_instructions($field) { -+ $return = $field; -+ -+ if (is_string($return)) { -+ if ($return[0] !== '`') { -+ $return = '`' . $return . '`'; -+ } -+ } -+ -+ return $return; -+} -+ - /** - * Get the first value of the first row of a table in the database from an - * array with filter conditions. -Index: include/db/oracle.php -=================================================================== ---- include/db/oracle.php (revision 10314) -+++ include/db/oracle.php (working copy) -@@ -254,7 +254,7 @@ - else if ($type[0] == '/INSERT'){ - $query = oci_parse($config['dbconnection'], substr($sql,1)); - } -- else{ -+ else { - $query = oci_parse($config['dbconnection'], $sql); - } - } -@@ -448,6 +448,18 @@ - return str_replace(array('"', "'", '\\'), array('\\"', '\\\'', '\\\\'), $string); - } - -+function oracle_encapsule_fields_with_same_name_to_instructions($field) { -+ $return = $field; -+ -+ if (is_string($return)) { -+ if ($return[0] !== '"') { -+ $return = '"' . $return . '"'; -+ } -+ } -+ -+ return $return; -+} -+ - /** - * Get the first value of the first row of a table in the database from an - * array with filter conditions. -@@ -649,7 +661,7 @@ - else if ($value[0] == '%') { - $query .= sprintf ("%s LIKE '%s'", $field, $value); - } -- else{ -+ else { - $query .= sprintf ("%s = '%s'", $field, $value); - } - } -@@ -997,16 +1009,16 @@ - global $config; - - $type = explode(' ',strtoupper(trim($sql))); -- if ($type[0] == 'SELECT'){ -+ if ($type[0] == 'SELECT') { - $sql = "SELECT count(*) as NUM FROM (" . $sql . ")"; - } - $query = oci_parse($config['dbconnection'], $sql); - oci_execute($query); -- if ($type[0] == 'SELECT'){ -+ if ($type[0] == 'SELECT') { - $row = oci_fetch_assoc($query); - $rows = $row['NUM']; - } -- else{ -+ else { - $rows = oci_num_rows($query); - } - -@@ -1027,13 +1039,19 @@ - */ - function oracle_db_get_all_rows_field_filter ($table, $field, $condition, $order_field = "") { - if (is_int ($condition) || is_bool ($condition)) { -- $sql = sprintf ("SELECT * FROM %s WHERE %s = %d", $table, $field, $condition); -+ $sql = sprintf ("SELECT * -+ FROM %s -+ WHERE %s = %d", $table, $field, $condition); - } - else if (is_float ($condition) || is_double ($condition)) { -- $sql = sprintf ("SELECT * FROM %s WHERE %s = %f", $table, $field, $condition); -+ $sql = sprintf ("SELECT * -+ FROM %s -+ WHERE %s = %f", $table, $field, $condition); - } - else { -- $sql = sprintf ("SELECT * FROM %s WHERE %s = '%s'", $table, $field, $condition); -+ $sql = sprintf ("SELECT * -+ FROM %s -+ WHERE %s = '%s'", $table, $field, $condition); - } - - if ($order_field != "") -Index: include/functions_modules.php -=================================================================== ---- include/functions_modules.php (revision 10314) -+++ include/functions_modules.php (working copy) -@@ -1663,15 +1663,15 @@ - $status = STATUS_AGENT_DOWN; - $last_status = modules_get_agentmodule_last_status($id_agent_module); - switch($last_status) { -- case 0: -+ case AGENT_STATUS_NORMAL: - $title = __('UNKNOWN') . " - " . __('Last status') . - " " . __('NORMAL'); - break; -- case 1: -+ case AGENT_STATUS_CRITICAL: - $title = __('UNKNOWN') . " - " . __('Last status') . - " " . __('CRITICAL'); - break; -- case 2: -+ case AGENT_STATUS_WARNING: - $title = __('UNKNOWN') . " - " . __('Last status') . - " " . __('WARNING'); - break; -Index: include/functions_reporting.php -=================================================================== ---- include/functions_reporting.php (revision 10314) -+++ include/functions_reporting.php (working copy) -@@ -907,6 +907,8 @@ - } - - function reporting_get_stats_servers($tiny = true) { -+ global $config; -+ - $server_performance = servers_get_performance(); - - // Alerts table -@@ -959,7 +961,9 @@ - $tdata[0] = html_print_image('images/network.png', true, array('title' => __('Network modules'), 'width' => '25px')); - $tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_network_modules"]) . '</span>'; - -- $tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["network_modules_rate"], 2) . '</span>'; -+ $tdata[2] = '<span class="med_data">' . -+ format_numeric($server_performance ["network_modules_rate"], 2) . -+ '</span>'; - $tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec </span>'; - - $table_srv->rowclass[] = ''; -@@ -1020,8 +1024,23 @@ - $table_srv->rowclass[] = ''; - $table_srv->data[] = $tdata; - -- $system_events = db_get_value_sql('SELECT SQL_NO_CACHE COUNT(id_evento) FROM tevento'); -- -+ -+ switch ($config["dbtype"]) { -+ case "mysql": -+ $system_events = db_get_value_sql( -+ 'SELECT SQL_NO_CACHE COUNT(id_evento) -+ FROM tevento'); -+ break; -+ case "postgresql": -+ case "oracle": -+ $system_events = db_get_value_sql( -+ 'SELECT COUNT(id_evento) -+ FROM tevento'); -+ break; -+ } -+ -+ -+ - $tdata = array(); - $tdata[0] = html_print_image('images/lightning_go.png', true, array('title' => __('Total events'), 'width' => '25px')); - $tdata[1] = '<span class="big_data">' . format_numeric($system_events) . '</span>'; -@@ -1109,16 +1128,21 @@ - $tdata = array(); - $table_mbs->colspan[count($table_mbs->data)][0] = 4; - $table_mbs->cellstyle[count($table_mbs->data)][0] = 'text-align: center;'; -- $tdata[0] = '<div id="outter_status_pie" style="height: ' . $graph_height . 'px"><div id="status_pie" style="margin: auto; width: ' . $graph_width . 'px;">' . graph_agent_status (false, $graph_width, $graph_height, true, true) . '</div></div>'; -+ $tdata[0] = '<div id="outter_status_pie" style="height: ' . $graph_height . 'px">' . -+ '<div id="status_pie" style="margin: auto; width: ' . $graph_width . 'px;">' . -+ graph_agent_status(false, $graph_width, $graph_height, true, true) . -+ '</div></div>'; - $table_mbs->rowclass[] = ''; - $table_mbs->data[] = $tdata; - } - -- $output = '<fieldset class="databox tactical_set"> -- <legend>' . -- __('Monitors by status') . -- '</legend>' . -- html_print_table($table_mbs, true) . '</fieldset>'; -+ $output = ' -+ <fieldset class="databox tactical_set"> -+ <legend>' . -+ __('Monitors by status') . -+ '</legend>' . -+ html_print_table($table_mbs, true) . -+ '</fieldset>'; - - return $output; - } -@@ -3123,9 +3147,29 @@ - } - else { - -- $data[0] = grafico_modulo_sparse($content['id_agent_module'], $content['period'], -- false, $sizgraph_w, $sizgraph_h, '', '', false, true, true, -- $report["datetime"], '', 0, 0, true, true, ui_get_full_url(false) . '/'); -+ $data[0] = grafico_modulo_sparse( -+ $content['id_agent_module'], -+ $content['period'], -+ false, -+ $sizgraph_w, -+ $sizgraph_h, -+ '', -+ '', -+ false, -+ true, -+ true, -+ $report["datetime"], -+ '', -+ 0, -+ 0, -+ true, -+ true, -+ ui_get_full_url(false) . '/', -+ 1, -+ false, -+ '', -+ false, -+ true); - } - - array_push ($table->data, $data); -Index: include/auth/ldap.php -=================================================================== ---- include/auth/ldap.php (revision 10314) -+++ include/auth/ldap.php (working copy) -@@ -65,8 +65,11 @@ - $config["admin_can_make_admin"] = false; - - //Required and optional keys for this function to work --$req_keys = array ("ldap_server", "ldap_base_dn", "ldap_login_attr", "ldap_admin_group_name", "ldap_admin_group_attr", "ldap_admin_group_type", "ldap_user_filter", "ldap_user_attr"); --$opt_keys = array ("ldap_port", "ldap_start_tls", "ldap_version", "ldap_admin_dn", "ldap_admin_pwd"); -+$req_keys = array("ldap_server", "ldap_base_dn", "ldap_login_attr", -+ "ldap_admin_group_name", "ldap_admin_group_attr", -+ "ldap_admin_group_type", "ldap_user_filter", "ldap_user_attr"); -+$opt_keys = array("ldap_port", "ldap_start_tls", "ldap_version", -+ "ldap_admin_dn", "ldap_admin_pwd"); - - global $ldap_cache; //Needs to be globalized because config_process_config () function calls this file first and the variable would be local and subsequently lost - $ldap_cache = array (); -@@ -76,13 +79,15 @@ - //Put each required key in a variable. - foreach ($req_keys as $key) { - if (!isset ($config["auth"][$key])) { -- user_error ("Required key ".$key." not set", E_USER_ERROR); -+ user_error("Required key " . $key . " not set", E_USER_ERROR); - } - } - - // Convert group name to lower case to prevent problems --$config["auth"]["ldap_admin_group_attr"] = strtolower ($config["auth"]["ldap_admin_group_attr"]); --$config["auth"]["ldap_admin_group_type"] = strtolower ($config["auth"]["ldap_admin_group_type"]); -+$config["auth"]["ldap_admin_group_attr"] = -+ strtolower ($config["auth"]["ldap_admin_group_attr"]); -+$config["auth"]["ldap_admin_group_type"] = -+ strtolower ($config["auth"]["ldap_admin_group_type"]); - - foreach ($opt_keys as $key) { - if (!isset ($config["auth"][$key])) { -@@ -122,7 +127,7 @@ - return false; - } - global $config; -- -+ - $profile = db_get_value ("id_usuario", "tusuario_perfil", "id_usuario", $login); - - if ($profile === false && empty ($config["auth"]["create_user_undefined"])) { -@@ -311,7 +316,8 @@ - - $nick = false; - if (ldap_connect_bind ()) { -- $sr = @ldap_search ($ldap_cache["ds"], $config["auth"]["ldap_base_dn"], "(&(".$config["auth"]["ldap_login_attr"]."=".$login.")".$config["auth"]["ldap_user_filter"].")", array_values ($config["auth"]["ldap_user_attr"])); -+ $sr = @ldap_search ($ldap_cache["ds"], -+ io_safe_output($config["auth"]["ldap_base_dn"]), "(&(".io_safe_output($config["auth"]["ldap_login_attr"])."=".$login.")".io_safe_output($config["auth"]["ldap_user_filter"]).")", array_values ($config["auth"]["ldap_user_attr"])); - - if (!$sr) { - $ldap_cache["error"] .= 'Error searching LDAP server: ' . ldap_error ($ldap_cache["ds"]); -@@ -364,7 +370,7 @@ - return $ret; - } - -- $r = @ldap_bind ($ds, $config["auth"]["ldap_login_attr"]."=".$login.",".$config["auth"]["ldap_base_dn"], $password); -+ $r = @ldap_bind ($ds, io_safe_output($config["auth"]["ldap_login_attr"])."=".$login.",".io_safe_output($config["auth"]["ldap_base_dn"]), $password); - if (!$r) { - $ldap_cache["error"] .= 'Invalid login'; - } -@@ -393,7 +399,8 @@ - $time = get_system_time (); - if (ldap_connect_bind ()) { - -- $sr = ldap_search ($ldap_cache["ds"], $config["auth"]["ldap_base_dn"], "(&(".$config["auth"]["ldap_login_attr"]."=".$login.")".$config["auth"]["ldap_user_filter"].")", array_values ($config["auth"]["ldap_user_attr"])); -+ $sr = ldap_search ($ldap_cache["ds"], -+ io_safe_output($config["auth"]["ldap_base_dn"]), "(&(".io_safe_output($config["auth"]["ldap_login_attr"])."=".$login.")".io_safe_output($config["auth"]["ldap_user_filter"]).")", array_values ($config["auth"]["ldap_user_attr"])); - - if (!$sr) { - $ldap_cache["error"] .= 'Error searching LDAP server (load_user): ' . ldap_error( $ldap_cache["ds"] ); -@@ -497,7 +504,7 @@ - $time = get_system_time (); - - if (ldap_connect_bind ()) { -- $sr = @ldap_search ($ldap_cache["ds"], $config["auth"]["ldap_base_dn"], $config["auth"]["ldap_user_filter"], array_values ($config["auth"]["ldap_user_attr"])); -+ $sr = @ldap_search ($ldap_cache["ds"], io_safe_output($config["auth"]["ldap_base_dn"]), io_safe_output($config["auth"]["ldap_user_filter"]), array_values ($config["auth"]["ldap_user_attr"])); - if (!$sr) { - $ldap_cache["error"] .= 'Error searching LDAP server (get_users): ' . ldap_error( $ldap_cache["ds"] ); - } -Index: include/auth/mysql.php -=================================================================== ---- include/auth/mysql.php (revision 10314) -+++ include/auth/mysql.php (working copy) -@@ -512,7 +512,11 @@ - } - } - -- if (strlen($password) == 0 || !@ldap_bind ($ds, $config["ldap_login_attr"]."=".$login.",".$config["ldap_base_dn"], $password)) { -+ if (strlen($password) == 0 || -+ !@ldap_bind($ds, -+ io_safe_output($config["ldap_login_attr"]) . "=" . $login . "," . io_safe_output($config["ldap_base_dn"]), -+ $password)) { -+ - $config["auth_error"] = 'User not found in database or incorrect password'; - @ldap_close ($ds); - -Index: include/functions_networkmap.php -=================================================================== ---- include/functions_networkmap.php (revision 10314) -+++ include/functions_networkmap.php (working copy) -@@ -233,7 +233,8 @@ - $simple = 0, $font_size = 12, $layout = 'radial', $nooverlap = 0, - $zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0, - $id_networkmap = 0, $show_snmp_modules = 0, $cut_names = true, -- $relative = false, $text_filter = '', $l2_network = false, $ip_mask = null) { -+ $relative = false, $text_filter = '', $l2_network = false, $ip_mask = null, -+ $dont_show_subgroups = false) { - - global $config; - -@@ -262,7 +263,20 @@ - } - - if ($group >= 1) { -- $filter['id_grupo'] = $group; -+ if ($dont_show_subgroups) -+ $filter['id_grupo'] = $group; -+ else { -+ $childrens = groups_get_childrens($group, null, true); -+ if (!empty($childrens)) { -+ $childrens = array_keys($childrens); -+ -+ $filter['id_grupo'] = $childrens; -+ $filter['id_grupo'][] = $group; -+ } -+ else { -+ $filter['id_grupo'] = $group; -+ } -+ } - - //Order by id_parent ascendant for to avoid the bugs - //because the first agents to process in the next -@@ -589,7 +603,13 @@ - } - - // Generate a dot graph definition for graphviz with groups --function networkmap_generate_dot_groups ($pandora_name, $group = 0, $simple = 0, $font_size = 12, $layout = 'radial', $nooverlap = 0, $zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0, $modwithalerts = 0, $module_group = 0, $hidepolicymodules = 0, $depth = 'all', $id_networkmap = 0, $dont_show_subgroups = 0, $text_filter = '') { -+function networkmap_generate_dot_groups ($pandora_name, $group = 0, -+ $simple = 0, $font_size = 12, $layout = 'radial', $nooverlap = 0, -+ $zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0, -+ $modwithalerts = 0, $module_group = 0, $hidepolicymodules = 0, -+ $depth = 'all', $id_networkmap = 0, $dont_show_subgroups = 0, -+ $text_filter = '') { -+ - global $config; - - $parents = array(); -@@ -682,7 +702,8 @@ - // Get agents data - $agents = agents_get_agents ($filter, - array ('id_grupo, nombre, id_os, id_agente, -- normal_count, warning_count, critical_count, unknown_count, total_count, notinit_count')); -+ normal_count, warning_count, critical_count, -+ unknown_count, total_count, notinit_count')); - - if ($agents === false) - $agents = array(); -@@ -1427,7 +1448,9 @@ - $values['show_groups'] = $show_groups; - $values['show_modules'] = $show_modules; - -- return @db_process_sql_insert ('tnetwork_map', $values); -+ $values['server_name'] = ""; -+ -+ return @db_process_sql_insert('tnetwork_map', $values); - } - - /** -Index: include/javascript/introjs.css -=================================================================== ---- include/javascript/introjs.css (revision 0) -+++ include/javascript/introjs.css (revision 10417) -@@ -0,0 +1,276 @@ -+.introjs-overlay { -+ position: absolute; -+ z-index: 999999; -+ background-color: #000; -+ opacity: 0; -+ background: -moz-radial-gradient(center,ellipse cover,rgba(0,0,0,0.4) 0,rgba(0,0,0,0.9) 100%); -+ background: -webkit-gradient(radial,center center,0px,center center,100%,color-stop(0%,rgba(0,0,0,0.4)),color-stop(100%,rgba(0,0,0,0.9))); -+ background: -webkit-radial-gradient(center,ellipse cover,rgba(0,0,0,0.4) 0,rgba(0,0,0,0.9) 100%); -+ background: -o-radial-gradient(center,ellipse cover,rgba(0,0,0,0.4) 0,rgba(0,0,0,0.9) 100%); -+ background: -ms-radial-gradient(center,ellipse cover,rgba(0,0,0,0.4) 0,rgba(0,0,0,0.9) 100%); -+ background: radial-gradient(center,ellipse cover,rgba(0,0,0,0.4) 0,rgba(0,0,0,0.9) 100%); -+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#66000000',endColorstr='#e6000000',GradientType=1); -+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; -+ filter: alpha(opacity=50); -+ -webkit-transition: all 0.3s ease-out; -+ -moz-transition: all 0.3s ease-out; -+ -ms-transition: all 0.3s ease-out; -+ -o-transition: all 0.3s ease-out; -+ transition: all 0.3s ease-out; -+} -+ -+.introjs-fixParent { -+ z-index: auto !important; -+ opacity: 1.0 !important; -+} -+ -+.introjs-showElement, -+tr.introjs-showElement > td, -+tr.introjs-showElement > th { -+ z-index: 9999999 !important; -+} -+ -+.introjs-relativePosition, -+tr.introjs-showElement > td, -+tr.introjs-showElement > th { -+ position: relative; -+} -+ -+.introjs-helperLayer { -+ position: absolute; -+ z-index: 9999998; -+ background-color: #FFF; -+ background-color: rgba(255,255,255,.9); -+ border: 1px solid #777; -+ border: 1px solid rgba(0,0,0,.5); -+ border-radius: 4px; -+ box-shadow: 0 2px 15px rgba(0,0,0,.4); -+ -webkit-transition: all 0.3s ease-out; -+ -moz-transition: all 0.3s ease-out; -+ -ms-transition: all 0.3s ease-out; -+ -o-transition: all 0.3s ease-out; -+ transition: all 0.3s ease-out; -+} -+ -+.introjs-helperNumberLayer { -+ position: absolute; -+ top: -16px; -+ left: -16px; -+ z-index: 9999999999 !important; -+ padding: 2px; -+ font-family: Arial, verdana, tahoma; -+ font-size: 13px; -+ font-weight: bold; -+ color: white; -+ text-align: center; -+ text-shadow: 1px 1px 1px rgba(0,0,0,.3); -+ background: #ff3019; /* Old browsers */ -+ background: -webkit-linear-gradient(top, #ff3019 0%, #cf0404 100%); /* Chrome10+,Safari5.1+ */ -+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ff3019), color-stop(100%, #cf0404)); /* Chrome,Safari4+ */ -+ background: -moz-linear-gradient(top, #ff3019 0%, #cf0404 100%); /* FF3.6+ */ -+ background: -ms-linear-gradient(top, #ff3019 0%, #cf0404 100%); /* IE10+ */ -+ background: -o-linear-gradient(top, #ff3019 0%, #cf0404 100%); /* Opera 11.10+ */ -+ background: linear-gradient(to bottom, #ff3019 0%, #cf0404 100%); /* W3C */ -+ width: 20px; -+ height:20px; -+ line-height: 20px; -+ border: 3px solid white; -+ border-radius: 50%; -+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3019', endColorstr='#cf0404', GradientType=0); /* IE6-9 */ -+ filter: progid:DXImageTransform.Microsoft.Shadow(direction=135, strength=2, color=ff0000); /* IE10 text shadows */ -+ box-shadow: 0 2px 5px rgba(0,0,0,.4); -+} -+ -+.introjs-arrow { -+ border: 5px solid white; -+ content:''; -+ position: absolute; -+} -+.introjs-arrow.top { -+ top: -10px; -+ border-top-color:transparent; -+ border-right-color:transparent; -+ border-bottom-color:white; -+ border-left-color:transparent; -+} -+.introjs-arrow.top-right { -+ top: -10px; -+ right: 10px; -+ border-top-color:transparent; -+ border-right-color:transparent; -+ border-bottom-color:white; -+ border-left-color:transparent; -+} -+.introjs-arrow.top-middle { -+ top: -10px; -+ left: 50%; -+ margin-left: -5px; -+ border-top-color:transparent; -+ border-right-color:transparent; -+ border-bottom-color:white; -+ border-left-color:transparent; -+} -+.introjs-arrow.right { -+ right: -10px; -+ top: 10px; -+ border-top-color:transparent; -+ border-right-color:transparent; -+ border-bottom-color:transparent; -+ border-left-color:white; -+} -+.introjs-arrow.bottom { -+ bottom: -10px; -+ border-top-color:white; -+ border-right-color:transparent; -+ border-bottom-color:transparent; -+ border-left-color:transparent; -+} -+.introjs-arrow.left { -+ left: -10px; -+ top: 10px; -+ border-top-color:transparent; -+ border-right-color:white; -+ border-bottom-color:transparent; -+ border-left-color:transparent; -+} -+ -+.introjs-tooltip { -+ position: absolute; -+ padding: 10px; -+ background-color: white; -+ min-width: 200px; -+ max-width: 300px; -+ border-radius: 3px; -+ box-shadow: 0 1px 10px rgba(0,0,0,.4); -+ -webkit-transition: opacity 0.1s ease-out; -+ -moz-transition: opacity 0.1s ease-out; -+ -ms-transition: opacity 0.1s ease-out; -+ -o-transition: opacity 0.1s ease-out; -+ transition: opacity 0.1s ease-out; -+} -+ -+.introjs-tooltipbuttons { -+ text-align: right; -+} -+ -+/* -+ Buttons style by http://nicolasgallagher.com/lab/css3-github-buttons/ -+ Changed by Afshin Mehrabani -+*/ -+.introjs-button { -+ position: relative; -+ overflow: visible; -+ display: inline-block; -+ padding: 0.3em 0.8em; -+ border: 1px solid #d4d4d4; -+ margin: 0; -+ text-decoration: none; -+ text-shadow: 1px 1px 0 #fff; -+ font: 11px/normal sans-serif; -+ color: #333; -+ white-space: nowrap; -+ cursor: pointer; -+ outline: none; -+ background-color: #ececec; -+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f4f4f4), to(#ececec)); -+ background-image: -moz-linear-gradient(#f4f4f4, #ececec); -+ background-image: -o-linear-gradient(#f4f4f4, #ececec); -+ background-image: linear-gradient(#f4f4f4, #ececec); -+ -webkit-background-clip: padding; -+ -moz-background-clip: padding; -+ -o-background-clip: padding-box; -+ /*background-clip: padding-box;*/ /* commented out due to Opera 11.10 bug */ -+ -webkit-border-radius: 0.2em; -+ -moz-border-radius: 0.2em; -+ border-radius: 0.2em; -+ /* IE hacks */ -+ zoom: 1; -+ *display: inline; -+ margin-top: 10px; -+} -+ -+.introjs-button:hover { -+ border-color: #bcbcbc; -+ text-decoration: none; -+ box-shadow: 0px 1px 1px #e3e3e3; -+} -+ -+.introjs-button:focus, -+.introjs-button:active { -+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ececec), to(#f4f4f4)); -+ background-image: -moz-linear-gradient(#ececec, #f4f4f4); -+ background-image: -o-linear-gradient(#ececec, #f4f4f4); -+ background-image: linear-gradient(#ececec, #f4f4f4); -+} -+ -+/* overrides extra padding on button elements in Firefox */ -+.introjs-button::-moz-focus-inner { -+ padding: 0; -+ border: 0; -+} -+ -+.introjs-skipbutton { -+ margin-right: 5px; -+ color: #7a7a7a; -+} -+ -+.introjs-prevbutton { -+ -webkit-border-radius: 0.2em 0 0 0.2em; -+ -moz-border-radius: 0.2em 0 0 0.2em; -+ border-radius: 0.2em 0 0 0.2em; -+ border-right: none; -+} -+ -+.introjs-nextbutton { -+ -webkit-border-radius: 0 0.2em 0.2em 0; -+ -moz-border-radius: 0 0.2em 0.2em 0; -+ border-radius: 0 0.2em 0.2em 0; -+} -+ -+.introjs-disabled, .introjs-disabled:hover, .introjs-disabled:focus { -+ color: #9a9a9a; -+ border-color: #d4d4d4; -+ box-shadow: none; -+ cursor: default; -+ background-color: #f4f4f4; -+ background-image: none; -+ text-decoration: none; -+} -+ -+.introjs-bullets { -+ text-align: center; -+} -+.introjs-bullets ul { -+ clear: both; -+ margin: 15px auto 0; -+ padding: 0; -+ display: inline-block; -+} -+.introjs-bullets ul li { -+ list-style: none; -+ float: left; -+ margin: 0 2px; -+} -+.introjs-bullets ul li a { -+ display: block; -+ width: 6px; -+ height: 6px; -+ background: #ccc; -+ border-radius: 10px; -+ -moz-border-radius: 10px; -+ -webkit-border-radius: 10px; -+ text-decoration: none; -+} -+.introjs-bullets ul li a:hover { -+ background: #999; -+} -+.introjs-bullets ul li a.active { -+ background: #999; -+} -+.introjsFloatingElement { -+ position: absolute; -+ height: 0; -+ width: 0; -+ left: 50%; -+ top: 50%; -+} -Index: include/javascript/intro.js -=================================================================== ---- include/javascript/intro.js (revision 0) -+++ include/javascript/intro.js (revision 10417) -@@ -0,0 +1,1049 @@ -+/** -+ * Intro.js v0.9.0 -+ * https://github.com/usablica/intro.js -+ * MIT licensed -+ * -+ * Copyright (C) 2013 usabli.ca - A weekend project by Afshin Mehrabani (@afshinmeh) -+ */ -+ -+(function (root, factory) { -+ if (typeof exports === 'object') { -+ // CommonJS -+ factory(exports); -+ } else if (typeof define === 'function' && define.amd) { -+ // AMD. Register as an anonymous module. -+ define(['exports'], factory); -+ } else { -+ // Browser globals -+ factory(root); -+ } -+} (this, function (exports) { -+ //Default config/variables -+ var VERSION = '0.9.0'; -+ -+ /** -+ * IntroJs main class -+ * -+ * @class IntroJs -+ */ -+ function IntroJs(obj) { -+ this._targetElement = obj; -+ -+ this._options = { -+ /* Next button label in tooltip box */ -+ nextLabel: 'Next →', -+ /* Previous button label in tooltip box */ -+ prevLabel: '← Back', -+ /* Skip button label in tooltip box */ -+ skipLabel: 'Skip', -+ /* Done button label in tooltip box */ -+ doneLabel: 'Done', -+ /* Default tooltip box position */ -+ tooltipPosition: 'bottom', -+ /* Next CSS class for tooltip boxes */ -+ tooltipClass: '', -+ /* Close introduction when pressing Escape button? */ -+ exitOnEsc: true, -+ /* Close introduction when clicking on overlay layer? */ -+ exitOnOverlayClick: true, -+ /* Show step numbers in introduction? */ -+ showStepNumbers: true, -+ /* Let user use keyboard to navigate the tour? */ -+ keyboardNavigation: true, -+ /* Show tour control buttons? */ -+ showButtons: true, -+ /* Show tour bullets? */ -+ showBullets: true, -+ /* Scroll to highlighted element? */ -+ scrollToElement: true, -+ /* Set the overlay opacity */ -+ overlayOpacity: 0.8 -+ }; -+ } -+ -+ /** -+ * Initiate a new introduction/guide from an element in the page -+ * -+ * @api private -+ * @method _introForElement -+ * @param {Object} targetElm -+ * @returns {Boolean} Success or not? -+ */ -+ function _introForElement(targetElm) { -+ var introItems = [], -+ self = this; -+ -+ if (this._options.steps) { -+ //use steps passed programmatically -+ var allIntroSteps = []; -+ -+ for (var i = 0, stepsLength = this._options.steps.length; i < stepsLength; i++) { -+ var currentItem = _cloneObject(this._options.steps[i]); -+ //set the step -+ currentItem.step = introItems.length + 1; -+ //use querySelector function only when developer used CSS selector -+ if (typeof(currentItem.element) === 'string') { -+ //grab the element with given selector from the page -+ currentItem.element = document.querySelector(currentItem.element); -+ } -+ -+ //intro without element -+ if (typeof(currentItem.element) === 'undefined' || currentItem.element == null) { -+ var floatingElementQuery = document.querySelector(".introjsFloatingElement"); -+ -+ if (floatingElementQuery == null) { -+ floatingElementQuery = document.createElement('div'); -+ floatingElementQuery.className = 'introjsFloatingElement'; -+ -+ document.body.appendChild(floatingElementQuery); -+ } -+ -+ currentItem.element = floatingElementQuery; -+ currentItem.position = 'floating'; -+ } -+ -+ if (currentItem.element != null) { -+ introItems.push(currentItem); -+ } -+ } -+ -+ } else { -+ //use steps from data-* annotations -+ var allIntroSteps = targetElm.querySelectorAll('*[data-intro]'); -+ //if there's no element to intro -+ if (allIntroSteps.length < 1) { -+ return false; -+ } -+ -+ //first add intro items with data-step -+ for (var i = 0, elmsLength = allIntroSteps.length; i < elmsLength; i++) { -+ var currentElement = allIntroSteps[i]; -+ var step = parseInt(currentElement.getAttribute('data-step'), 10); -+ -+ if (step > 0) { -+ introItems[step - 1] = { -+ element: currentElement, -+ intro: currentElement.getAttribute('data-intro'), -+ step: parseInt(currentElement.getAttribute('data-step'), 10), -+ tooltipClass: currentElement.getAttribute('data-tooltipClass'), -+ position: currentElement.getAttribute('data-position') || this._options.tooltipPosition -+ }; -+ } -+ } -+ -+ //next add intro items without data-step -+ //todo: we need a cleanup here, two loops are redundant -+ var nextStep = 0; -+ for (var i = 0, elmsLength = allIntroSteps.length; i < elmsLength; i++) { -+ var currentElement = allIntroSteps[i]; -+ -+ if (currentElement.getAttribute('data-step') == null) { -+ -+ while (true) { -+ if (typeof introItems[nextStep] == 'undefined') { -+ break; -+ } else { -+ nextStep++; -+ } -+ } -+ -+ introItems[nextStep] = { -+ element: currentElement, -+ intro: currentElement.getAttribute('data-intro'), -+ step: nextStep + 1, -+ tooltipClass: currentElement.getAttribute('data-tooltipClass'), -+ position: currentElement.getAttribute('data-position') || this._options.tooltipPosition -+ }; -+ } -+ } -+ } -+ -+ //removing undefined/null elements -+ var tempIntroItems = []; -+ for (var z = 0; z < introItems.length; z++) { -+ introItems[z] && tempIntroItems.push(introItems[z]); // copy non-empty values to the end of the array -+ } -+ -+ introItems = tempIntroItems; -+ -+ //Ok, sort all items with given steps -+ introItems.sort(function (a, b) { -+ return a.step - b.step; -+ }); -+ -+ //set it to the introJs object -+ self._introItems = introItems; -+ -+ //add overlay layer to the page -+ if(_addOverlayLayer.call(self, targetElm)) { -+ //then, start the show -+ _nextStep.call(self); -+ -+ var skipButton = targetElm.querySelector('.introjs-skipbutton'), -+ nextStepButton = targetElm.querySelector('.introjs-nextbutton'); -+ -+ self._onKeyDown = function(e) { -+ if (e.keyCode === 27 && self._options.exitOnEsc == true) { -+ propagate_exit = true; -+ -+ //check if any callback is defined -+ if (self._introExitCallback != undefined) { -+ propagate_exit = self._introExitCallback.call(self); -+ if (typeof(propagate_exit) == "undefined") -+ propagate_exit = true; -+ } -+ -+ //escape key pressed, exit the intro -+ if (propagate_exit) -+ _exitIntro.call(self, targetElm); -+ -+ } else if(e.keyCode === 37) { -+ //left arrow -+ _previousStep.call(self); -+ } else if (e.keyCode === 39 || e.keyCode === 13) { -+ //right arrow or enter -+ _nextStep.call(self); -+ //prevent default behaviour on hitting Enter, to prevent steps being skipped in some browsers -+ if(e.preventDefault) { -+ e.preventDefault(); -+ } else { -+ e.returnValue = false; -+ } -+ } -+ }; -+ -+ self._onResize = function(e) { -+ _setHelperLayerPosition.call(self, document.querySelector('.introjs-helperLayer')); -+ }; -+ -+ if (window.addEventListener) { -+ if (this._options.keyboardNavigation) { -+ window.addEventListener('keydown', self._onKeyDown, true); -+ } -+ //for window resize -+ window.addEventListener("resize", self._onResize, true); -+ } else if (document.attachEvent) { //IE -+ if (this._options.keyboardNavigation) { -+ document.attachEvent('onkeydown', self._onKeyDown); -+ } -+ //for window resize -+ document.attachEvent("onresize", self._onResize); -+ } -+ } -+ return false; -+ } -+ -+ /* -+ * makes a copy of the object -+ * @api private -+ * @method _cloneObject -+ */ -+ function _cloneObject(object) { -+ if (object == null || typeof (object) != 'object' || typeof (object.nodeType) != 'undefined') { -+ return object; -+ } -+ var temp = {}; -+ for (var key in object) { -+ temp[key] = _cloneObject(object[key]); -+ } -+ return temp; -+ } -+ /** -+ * Go to specific step of introduction -+ * -+ * @api private -+ * @method _goToStep -+ */ -+ function _goToStep(step) { -+ //because steps starts with zero -+ this._currentStep = step - 2; -+ if (typeof (this._introItems) !== 'undefined') { -+ _nextStep.call(this); -+ } -+ } -+ -+ /** -+ * Go to next step on intro -+ * -+ * @api private -+ * @method _nextStep -+ */ -+ function _nextStep() { -+ this._direction = 'forward'; -+ -+ if (typeof (this._currentStep) === 'undefined') { -+ this._currentStep = 0; -+ } else { -+ ++this._currentStep; -+ } -+ -+ if ((this._introItems.length) <= this._currentStep) { -+ //end of the intro -+ //check if any callback is defined -+ if (typeof (this._introCompleteCallback) === 'function') { -+ this._introCompleteCallback.call(this); -+ } -+ _exitIntro.call(this, this._targetElement); -+ return; -+ } -+ -+ var nextStep = this._introItems[this._currentStep]; -+ if (typeof (this._introBeforeChangeCallback) !== 'undefined') { -+ this._introBeforeChangeCallback.call(this, nextStep.element); -+ } -+ -+ _showElement.call(this, nextStep); -+ } -+ -+ /** -+ * Go to previous step on intro -+ * -+ * @api private -+ * @method _nextStep -+ */ -+ function _previousStep() { -+ this._direction = 'backward'; -+ -+ if (this._currentStep === 0) { -+ return false; -+ } -+ -+ var nextStep = this._introItems[--this._currentStep]; -+ if (typeof (this._introBeforeChangeCallback) !== 'undefined') { -+ this._introBeforeChangeCallback.call(this, nextStep.element); -+ } -+ -+ _showElement.call(this, nextStep); -+ } -+ -+ /** -+ * Exit from intro -+ * -+ * @api private -+ * @method _exitIntro -+ * @param {Object} targetElement -+ */ -+ function _exitIntro(targetElement) { -+ //remove overlay layer from the page -+ var overlayLayer = targetElement.querySelector('.introjs-overlay'); -+ -+ //return if intro already completed or skipped -+ if (overlayLayer == null) { -+ return; -+ } -+ -+ //for fade-out animation -+ overlayLayer.style.opacity = 0; -+ setTimeout(function () { -+ if (overlayLayer.parentNode) { -+ overlayLayer.parentNode.removeChild(overlayLayer); -+ } -+ }, 500); -+ -+ //remove all helper layers -+ var helperLayer = targetElement.querySelector('.introjs-helperLayer'); -+ if (helperLayer) { -+ helperLayer.parentNode.removeChild(helperLayer); -+ } -+ -+ //remove intro floating element -+ var floatingElement = document.querySelector('.introjsFloatingElement'); -+ if (floatingElement) { -+ floatingElement.parentNode.removeChild(floatingElement); -+ } -+ -+ //remove `introjs-showElement` class from the element -+ var showElement = document.querySelector('.introjs-showElement'); -+ if (showElement) { -+ showElement.className = showElement.className.replace(/introjs-[a-zA-Z]+/g, '').replace(/^\s+|\s+$/g, ''); // This is a manual trim. -+ } -+ -+ //remove `introjs-fixParent` class from the elements -+ var fixParents = document.querySelectorAll('.introjs-fixParent'); -+ if (fixParents && fixParents.length > 0) { -+ for (var i = fixParents.length - 1; i >= 0; i--) { -+ fixParents[i].className = fixParents[i].className.replace(/introjs-fixParent/g, '').replace(/^\s+|\s+$/g, ''); -+ }; -+ } -+ -+ //clean listeners -+ if (window.removeEventListener) { -+ window.removeEventListener('keydown', this._onKeyDown, true); -+ } else if (document.detachEvent) { //IE -+ document.detachEvent('onkeydown', this._onKeyDown); -+ } -+ -+ //set the step to zero -+ this._currentStep = undefined; -+ } -+ -+ /** -+ * Render tooltip box in the page -+ * -+ * @api private -+ * @method _placeTooltip -+ * @param {Object} targetElement -+ * @param {Object} tooltipLayer -+ * @param {Object} arrowLayer -+ */ -+ function _placeTooltip(targetElement, tooltipLayer, arrowLayer, helperNumberLayer) { -+ var tooltipCssClass = '', -+ currentStepObj, -+ tooltipOffset, -+ targetElementOffset; -+ -+ //reset the old style -+ tooltipLayer.style.top = null; -+ tooltipLayer.style.right = null; -+ tooltipLayer.style.bottom = null; -+ tooltipLayer.style.left = null; -+ tooltipLayer.style.marginLeft = null; -+ tooltipLayer.style.marginTop = null; -+ -+ arrowLayer.style.display = 'inherit'; -+ -+ if (typeof(helperNumberLayer) != 'undefined' && helperNumberLayer != null) { -+ helperNumberLayer.style.top = null; -+ helperNumberLayer.style.left = null; -+ } -+ -+ //prevent error when `this._currentStep` is undefined -+ if (!this._introItems[this._currentStep]) return; -+ -+ //if we have a custom css class for each step -+ currentStepObj = this._introItems[this._currentStep]; -+ if (typeof (currentStepObj.tooltipClass) === 'string') { -+ tooltipCssClass = currentStepObj.tooltipClass; -+ } else { -+ tooltipCssClass = this._options.tooltipClass; -+ } -+ -+ tooltipLayer.className = ('introjs-tooltip ' + tooltipCssClass).replace(/^\s+|\s+$/g, ''); -+ -+ //custom css class for tooltip boxes -+ var tooltipCssClass = this._options.tooltipClass; -+ -+ currentTooltipPosition = this._introItems[this._currentStep].position; -+ switch (currentTooltipPosition) { -+ case 'top': -+ tooltipLayer.style.left = '15px'; -+ tooltipLayer.style.top = '-' + (_getOffset(tooltipLayer).height + 10) + 'px'; -+ arrowLayer.className = 'introjs-arrow bottom'; -+ break; -+ case 'right': -+ tooltipLayer.style.left = (_getOffset(targetElement).width + 20) + 'px'; -+ arrowLayer.className = 'introjs-arrow left'; -+ break; -+ case 'left': -+ if (this._options.showStepNumbers == true) { -+ tooltipLayer.style.top = '15px'; -+ } -+ tooltipLayer.style.right = (_getOffset(targetElement).width + 20) + 'px'; -+ arrowLayer.className = 'introjs-arrow right'; -+ break; -+ case 'floating': -+ arrowLayer.style.display = 'none'; -+ -+ //we have to adjust the top and left of layer manually for intro items without element -+ tooltipOffset = _getOffset(tooltipLayer); -+ -+ tooltipLayer.style.left = '50%'; -+ tooltipLayer.style.top = '50%'; -+ tooltipLayer.style.marginLeft = '-' + (tooltipOffset.width / 2) + 'px'; -+ tooltipLayer.style.marginTop = '-' + (tooltipOffset.height / 2) + 'px'; -+ -+ if (typeof(helperNumberLayer) != 'undefined' && helperNumberLayer != null) { -+ helperNumberLayer.style.left = '-' + ((tooltipOffset.width / 2) + 18) + 'px'; -+ helperNumberLayer.style.top = '-' + ((tooltipOffset.height / 2) + 18) + 'px'; -+ } -+ -+ break; -+ case 'bottom-right-aligned': -+ arrowLayer.className = 'introjs-arrow top-right'; -+ tooltipLayer.style.right = '0px'; -+ tooltipLayer.style.bottom = '-' + (_getOffset(tooltipLayer).height + 10) + 'px'; -+ break; -+ case 'bottom-middle-aligned': -+ targetElementOffset = _getOffset(targetElement); -+ tooltipOffset = _getOffset(tooltipLayer); -+ -+ arrowLayer.className = 'introjs-arrow top-middle'; -+ tooltipLayer.style.left = (targetElementOffset.width / 2 - tooltipOffset.width / 2) + 'px'; -+ tooltipLayer.style.bottom = '-' + (tooltipOffset.height + 10) + 'px'; -+ break; -+ case 'bottom-left-aligned': -+ // Bottom-left-aligned is the same as the default bottom -+ case 'bottom': -+ // Bottom going to follow the default behavior -+ default: -+ tooltipLayer.style.bottom = '-' + (_getOffset(tooltipLayer).height + 10) + 'px'; -+ arrowLayer.className = 'introjs-arrow top'; -+ break; -+ } -+ } -+ -+ /** -+ * Update the position of the helper layer on the screen -+ * -+ * @api private -+ * @method _setHelperLayerPosition -+ * @param {Object} helperLayer -+ */ -+ function _setHelperLayerPosition(helperLayer) { -+ if (helperLayer) { -+ //prevent error when `this._currentStep` in undefined -+ if (!this._introItems[this._currentStep]) return; -+ -+ var currentElement = this._introItems[this._currentStep], -+ elementPosition = _getOffset(currentElement.element), -+ widthHeightPadding = 10; -+ -+ if (currentElement.position == 'floating') { -+ widthHeightPadding = 0; -+ } -+ -+ //set new position to helper layer -+ helperLayer.setAttribute('style', 'width: ' + (elementPosition.width + widthHeightPadding) + 'px; ' + -+ 'height:' + (elementPosition.height + widthHeightPadding) + 'px; ' + -+ 'top:' + (elementPosition.top - 5) + 'px;' + -+ 'left: ' + (elementPosition.left - 5) + 'px;'); -+ } -+ } -+ -+ /** -+ * Show an element on the page -+ * -+ * @api private -+ * @method _showElement -+ * @param {Object} targetElement -+ */ -+ function _showElement(targetElement) { -+ -+ if (typeof (this._introChangeCallback) !== 'undefined') { -+ this._introChangeCallback.call(this, targetElement.element); -+ } -+ -+ var self = this, -+ oldHelperLayer = document.querySelector('.introjs-helperLayer'), -+ elementPosition = _getOffset(targetElement.element); -+ -+ if (oldHelperLayer != null) { -+ var oldHelperNumberLayer = oldHelperLayer.querySelector('.introjs-helperNumberLayer'), -+ oldtooltipLayer = oldHelperLayer.querySelector('.introjs-tooltiptext'), -+ oldArrowLayer = oldHelperLayer.querySelector('.introjs-arrow'), -+ oldtooltipContainer = oldHelperLayer.querySelector('.introjs-tooltip'), -+ skipTooltipButton = oldHelperLayer.querySelector('.introjs-skipbutton'), -+ prevTooltipButton = oldHelperLayer.querySelector('.introjs-prevbutton'), -+ nextTooltipButton = oldHelperLayer.querySelector('.introjs-nextbutton'); -+ -+ //hide the tooltip -+ oldtooltipContainer.style.opacity = 0; -+ -+ if (oldHelperNumberLayer != null) { -+ var lastIntroItem = this._introItems[(targetElement.step - 2 >= 0 ? targetElement.step - 2 : 0)]; -+ -+ if (lastIntroItem != null && (this._direction == 'forward' && lastIntroItem.position == 'floating') || (this._direction == 'backward' && targetElement.position == 'floating')) { -+ oldHelperNumberLayer.style.opacity = 0; -+ } -+ } -+ -+ //set new position to helper layer -+ _setHelperLayerPosition.call(self, oldHelperLayer); -+ -+ //remove `introjs-fixParent` class from the elements -+ var fixParents = document.querySelectorAll('.introjs-fixParent'); -+ if (fixParents && fixParents.length > 0) { -+ for (var i = fixParents.length - 1; i >= 0; i--) { -+ fixParents[i].className = fixParents[i].className.replace(/introjs-fixParent/g, '').replace(/^\s+|\s+$/g, ''); -+ }; -+ } -+ -+ //remove old classes -+ var oldShowElement = document.querySelector('.introjs-showElement'); -+ oldShowElement.className = oldShowElement.className.replace(/introjs-[a-zA-Z]+/g, '').replace(/^\s+|\s+$/g, ''); -+ //we should wait until the CSS3 transition is competed (it's 0.3 sec) to prevent incorrect `height` and `width` calculation -+ if (self._lastShowElementTimer) { -+ clearTimeout(self._lastShowElementTimer); -+ } -+ self._lastShowElementTimer = setTimeout(function() { -+ //set current step to the label -+ if (oldHelperNumberLayer != null) { -+ oldHelperNumberLayer.innerHTML = targetElement.step; -+ } -+ //set current tooltip text -+ oldtooltipLayer.innerHTML = targetElement.intro; -+ //set the tooltip position -+ _placeTooltip.call(self, targetElement.element, oldtooltipContainer, oldArrowLayer, oldHelperNumberLayer); -+ -+ //change active bullet -+ oldHelperLayer.querySelector('.introjs-bullets li > a.active').className = ''; -+ oldHelperLayer.querySelector('.introjs-bullets li > a[data-stepnumber="' + targetElement.step + '"]').className = 'active'; -+ -+ //show the tooltip -+ oldtooltipContainer.style.opacity = 1; -+ if (oldHelperNumberLayer) oldHelperNumberLayer.style.opacity = 1; -+ }, 350); -+ -+ } else { -+ var helperLayer = document.createElement('div'), -+ arrowLayer = document.createElement('div'), -+ tooltipLayer = document.createElement('div'), -+ tooltipTextLayer = document.createElement('div'), -+ bulletsLayer = document.createElement('div'), -+ buttonsLayer = document.createElement('div'); -+ -+ helperLayer.className = 'introjs-helperLayer'; -+ -+ //set new position to helper layer -+ _setHelperLayerPosition.call(self, helperLayer); -+ -+ //add helper layer to target element -+ this._targetElement.appendChild(helperLayer); -+ -+ arrowLayer.className = 'introjs-arrow'; -+ -+ tooltipTextLayer.className = 'introjs-tooltiptext'; -+ tooltipTextLayer.innerHTML = targetElement.intro; -+ -+ bulletsLayer.className = 'introjs-bullets'; -+ -+ if (this._options.showBullets === false) { -+ bulletsLayer.style.display = 'none'; -+ } -+ -+ var ulContainer = document.createElement('ul'); -+ -+ for (var i = 0, stepsLength = this._introItems.length; i < stepsLength; i++) { -+ var innerLi = document.createElement('li'); -+ var anchorLink = document.createElement('a'); -+ -+ anchorLink.onclick = function() { -+ self.goToStep(this.getAttribute('data-stepnumber')); -+ }; -+ -+ if (i === (targetElement.step-1)) anchorLink.className = "active"; -+ -+ anchorLink.href = 'javascript:void(0);'; -+ anchorLink.innerHTML = " "; -+ anchorLink.setAttribute('data-stepnumber', this._introItems[i].step); -+ -+ innerLi.appendChild(anchorLink); -+ ulContainer.appendChild(innerLi); -+ } -+ -+ bulletsLayer.appendChild(ulContainer); -+ -+ buttonsLayer.className = 'introjs-tooltipbuttons'; -+ if (this._options.showButtons === false) { -+ buttonsLayer.style.display = 'none'; -+ } -+ -+ tooltipLayer.className = 'introjs-tooltip'; -+ tooltipLayer.appendChild(tooltipTextLayer); -+ tooltipLayer.appendChild(bulletsLayer); -+ -+ //add helper layer number -+ if (this._options.showStepNumbers == true) { -+ var helperNumberLayer = document.createElement('span'); -+ helperNumberLayer.className = 'introjs-helperNumberLayer'; -+ helperNumberLayer.innerHTML = targetElement.step; -+ helperLayer.appendChild(helperNumberLayer); -+ } -+ tooltipLayer.appendChild(arrowLayer); -+ helperLayer.appendChild(tooltipLayer); -+ -+ //next button -+ var nextTooltipButton = document.createElement('a'); -+ -+ nextTooltipButton.onclick = function() { -+ if (self._introItems.length - 1 != self._currentStep) { -+ _nextStep.call(self); -+ } -+ }; -+ -+ nextTooltipButton.href = 'javascript:void(0);'; -+ nextTooltipButton.innerHTML = this._options.nextLabel; -+ -+ //previous button -+ var prevTooltipButton = document.createElement('a'); -+ -+ prevTooltipButton.onclick = function() { -+ if (self._currentStep != 0) { -+ _previousStep.call(self); -+ } -+ }; -+ -+ prevTooltipButton.href = 'javascript:void(0);'; -+ prevTooltipButton.innerHTML = this._options.prevLabel; -+ -+ //skip button -+ var skipTooltipButton = document.createElement('a'); -+ skipTooltipButton.className = 'introjs-button introjs-skipbutton'; -+ skipTooltipButton.href = 'javascript:void(0);'; -+ skipTooltipButton.innerHTML = this._options.skipLabel; -+ -+ skipTooltipButton.onclick = function() { -+ propagate_exit = true; -+ -+ if (self._introItems.length - 1 == self._currentStep && typeof (self._introCompleteCallback) === 'function') { -+ propagate_exit = self._introCompleteCallback.call(self); -+ if (typeof(propagate_exit) == "undefined") -+ propagate_exit = true; -+ } -+ -+ if (self._introItems.length - 1 != self._currentStep && typeof (self._introExitCallback) === 'function') { -+ propagate_exit = self._introExitCallback.call(self); -+ if (typeof(propagate_exit) == "undefined") -+ propagate_exit = true; -+ } -+ -+ if (propagate_exit) -+ _exitIntro.call(self, self._targetElement); -+ }; -+ -+ buttonsLayer.appendChild(skipTooltipButton); -+ -+ //in order to prevent displaying next/previous button always -+ if (this._introItems.length > 1) { -+ buttonsLayer.appendChild(prevTooltipButton); -+ buttonsLayer.appendChild(nextTooltipButton); -+ } -+ -+ tooltipLayer.appendChild(buttonsLayer); -+ -+ //set proper position -+ _placeTooltip.call(self, targetElement.element, tooltipLayer, arrowLayer, helperNumberLayer); -+ } -+ -+ if (this._currentStep == 0 && this._introItems.length > 1) { -+ prevTooltipButton.className = 'introjs-button introjs-prevbutton introjs-disabled'; -+ nextTooltipButton.className = 'introjs-button introjs-nextbutton'; -+ skipTooltipButton.innerHTML = this._options.skipLabel; -+ } else if (this._introItems.length - 1 == this._currentStep || this._introItems.length == 1) { -+ skipTooltipButton.innerHTML = this._options.doneLabel; -+ prevTooltipButton.className = 'introjs-button introjs-prevbutton'; -+ nextTooltipButton.className = 'introjs-button introjs-nextbutton introjs-disabled'; -+ } else { -+ prevTooltipButton.className = 'introjs-button introjs-prevbutton'; -+ nextTooltipButton.className = 'introjs-button introjs-nextbutton'; -+ skipTooltipButton.innerHTML = this._options.skipLabel; -+ } -+ -+ //Set focus on "next" button, so that hitting Enter always moves you onto the next step -+ nextTooltipButton.focus(); -+ -+ //add target element position style -+ targetElement.element.className += ' introjs-showElement'; -+ -+ var currentElementPosition = _getPropValue(targetElement.element, 'position'); -+ if (currentElementPosition !== 'absolute' && -+ currentElementPosition !== 'relative') { -+ //change to new intro item -+ targetElement.element.className += ' introjs-relativePosition'; -+ } -+ -+ var parentElm = targetElement.element.parentNode; -+ while (parentElm != null) { -+ if (parentElm.tagName.toLowerCase() === 'body') break; -+ -+ //fix The Stacking Contenxt problem. -+ //More detail: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context -+ var zIndex = _getPropValue(parentElm, 'z-index'); -+ var opacity = parseFloat(_getPropValue(parentElm, 'opacity')); -+ var transform = _getPropValue(parentElm, 'transform') || _getPropValue(parentElm, '-webkit-transform') || _getPropValue(parentElm, '-moz-transform') || _getPropValue(parentElm, '-ms-transform') || _getPropValue(parentElm, '-o-transform'); -+ if (/[0-9]+/.test(zIndex) || opacity < 1 || transform !== 'none') { -+ parentElm.className += ' introjs-fixParent'; -+ } -+ -+ parentElm = parentElm.parentNode; -+ } -+ -+ if (!_elementInViewport(targetElement.element) && this._options.scrollToElement === true) { -+ var rect = targetElement.element.getBoundingClientRect(), -+ winHeight=_getWinSize().height, -+ top = rect.bottom - (rect.bottom - rect.top), -+ bottom = rect.bottom - winHeight; -+ -+ //Scroll up -+ if (top < 0 || targetElement.element.clientHeight > winHeight) { -+ window.scrollBy(0, top - 30); // 30px padding from edge to look nice -+ -+ //Scroll down -+ } else { -+ window.scrollBy(0, bottom + 100); // 70px + 30px padding from edge to look nice -+ } -+ } -+ -+ if (typeof (this._introAfterChangeCallback) !== 'undefined') { -+ this._introAfterChangeCallback.call(this, targetElement.element); -+ } -+ } -+ -+ /** -+ * Get an element CSS property on the page -+ * Thanks to JavaScript Kit: http://www.javascriptkit.com/dhtmltutors/dhtmlcascade4.shtml -+ * -+ * @api private -+ * @method _getPropValue -+ * @param {Object} element -+ * @param {String} propName -+ * @returns Element's property value -+ */ -+ function _getPropValue (element, propName) { -+ var propValue = ''; -+ if (element.currentStyle) { //IE -+ propValue = element.currentStyle[propName]; -+ } else if (document.defaultView && document.defaultView.getComputedStyle) { //Others -+ propValue = document.defaultView.getComputedStyle(element, null).getPropertyValue(propName); -+ } -+ -+ //Prevent exception in IE -+ if (propValue && propValue.toLowerCase) { -+ return propValue.toLowerCase(); -+ } else { -+ return propValue; -+ } -+ } -+ -+ /** -+ * Provides a cross-browser way to get the screen dimensions -+ * via: http://stackoverflow.com/questions/5864467/internet-explorer-innerheight -+ * -+ * @api private -+ * @method _getWinSize -+ * @returns {Object} width and height attributes -+ */ -+ function _getWinSize() { -+ if (window.innerWidth != undefined) { -+ return { width: window.innerWidth, height: window.innerHeight }; -+ } else { -+ var D = document.documentElement; -+ return { width: D.clientWidth, height: D.clientHeight }; -+ } -+ } -+ -+ /** -+ * Add overlay layer to the page -+ * http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport -+ * -+ * @api private -+ * @method _elementInViewport -+ * @param {Object} el -+ */ -+ function _elementInViewport(el) { -+ var rect = el.getBoundingClientRect(); -+ -+ return ( -+ rect.top >= 0 && -+ rect.left >= 0 && -+ (rect.bottom+80) <= window.innerHeight && // add 80 to get the text right -+ rect.right <= window.innerWidth -+ ); -+ } -+ -+ /** -+ * Add overlay layer to the page -+ * -+ * @api private -+ * @method _addOverlayLayer -+ * @param {Object} targetElm -+ */ -+ function _addOverlayLayer(targetElm) { -+ var overlayLayer = document.createElement('div'), -+ styleText = '', -+ self = this; -+ -+ //set css class name -+ overlayLayer.className = 'introjs-overlay'; -+ -+ //check if the target element is body, we should calculate the size of overlay layer in a better way -+ if (targetElm.tagName.toLowerCase() === 'body') { -+ styleText += 'top: 0;bottom: 0; left: 0;right: 0;position: fixed;'; -+ overlayLayer.setAttribute('style', styleText); -+ } else { -+ //set overlay layer position -+ var elementPosition = _getOffset(targetElm); -+ if (elementPosition) { -+ styleText += 'width: ' + elementPosition.width + 'px; height:' + elementPosition.height + 'px; top:' + elementPosition.top + 'px;left: ' + elementPosition.left + 'px;'; -+ overlayLayer.setAttribute('style', styleText); -+ } -+ } -+ -+ targetElm.appendChild(overlayLayer); -+ -+ overlayLayer.onclick = function() { -+ if (self._options.exitOnOverlayClick == true) { -+ _exitIntro.call(self, targetElm); -+ -+ //check if any callback is defined -+ if (self._introExitCallback != undefined) { -+ self._introExitCallback.call(self); -+ } -+ } -+ }; -+ -+ setTimeout(function() { -+ styleText += 'opacity: ' + self._options.overlayOpacity.toString() + ';'; -+ overlayLayer.setAttribute('style', styleText); -+ }, 10); -+ -+ return true; -+ } -+ -+ /** -+ * Get an element position on the page -+ * Thanks to `meouw`: http://stackoverflow.com/a/442474/375966 -+ * -+ * @api private -+ * @method _getOffset -+ * @param {Object} element -+ * @returns Element's position info -+ */ -+ function _getOffset(element) { -+ var elementPosition = {}; -+ -+ //set width -+ elementPosition.width = element.offsetWidth; -+ -+ //set height -+ elementPosition.height = element.offsetHeight; -+ -+ //calculate element top and left -+ var _x = 0; -+ var _y = 0; -+ while (element && !isNaN(element.offsetLeft) && !isNaN(element.offsetTop)) { -+ _x += element.offsetLeft; -+ _y += element.offsetTop; -+ element = element.offsetParent; -+ } -+ //set top -+ elementPosition.top = _y; -+ //set left -+ elementPosition.left = _x; -+ -+ return elementPosition; -+ } -+ -+ /** -+ * Overwrites obj1's values with obj2's and adds obj2's if non existent in obj1 -+ * via: http://stackoverflow.com/questions/171251/how-can-i-merge-properties-of-two-javascript-objects-dynamically -+ * -+ * @param obj1 -+ * @param obj2 -+ * @returns obj3 a new object based on obj1 and obj2 -+ */ -+ function _mergeOptions(obj1,obj2) { -+ var obj3 = {}; -+ for (var attrname in obj1) { obj3[attrname] = obj1[attrname]; } -+ for (var attrname in obj2) { obj3[attrname] = obj2[attrname]; } -+ return obj3; -+ } -+ -+ var introJs = function (targetElm) { -+ if (typeof (targetElm) === 'object') { -+ //Ok, create a new instance -+ return new IntroJs(targetElm); -+ -+ } else if (typeof (targetElm) === 'string') { -+ //select the target element with query selector -+ var targetElement = document.querySelector(targetElm); -+ -+ if (targetElement) { -+ return new IntroJs(targetElement); -+ } else { -+ throw new Error('There is no element with given selector.'); -+ } -+ } else { -+ return new IntroJs(document.body); -+ } -+ }; -+ -+ /** -+ * Current IntroJs version -+ * -+ * @property version -+ * @type String -+ */ -+ introJs.version = VERSION; -+ -+ //Prototype -+ introJs.fn = IntroJs.prototype = { -+ clone: function () { -+ return new IntroJs(this); -+ }, -+ setOption: function(option, value) { -+ this._options[option] = value; -+ return this; -+ }, -+ setOptions: function(options) { -+ this._options = _mergeOptions(this._options, options); -+ return this; -+ }, -+ start: function () { -+ _introForElement.call(this, this._targetElement); -+ return this; -+ }, -+ goToStep: function(step) { -+ _goToStep.call(this, step); -+ return this; -+ }, -+ nextStep: function() { -+ _nextStep.call(this); -+ return this; -+ }, -+ previousStep: function() { -+ _previousStep.call(this); -+ return this; -+ }, -+ exit: function() { -+ _exitIntro.call(this, this._targetElement); -+ }, -+ refresh: function() { -+ _setHelperLayerPosition.call(this, document.querySelector('.introjs-helperLayer')); -+ return this; -+ }, -+ onbeforechange: function(providedCallback) { -+ if (typeof (providedCallback) === 'function') { -+ this._introBeforeChangeCallback = providedCallback; -+ } else { -+ throw new Error('Provided callback for onbeforechange was not a function'); -+ } -+ return this; -+ }, -+ onchange: function(providedCallback) { -+ if (typeof (providedCallback) === 'function') { -+ this._introChangeCallback = providedCallback; -+ } else { -+ throw new Error('Provided callback for onchange was not a function.'); -+ } -+ return this; -+ }, -+ onafterchange: function(providedCallback) { -+ if (typeof (providedCallback) === 'function') { -+ this._introAfterChangeCallback = providedCallback; -+ } else { -+ throw new Error('Provided callback for onafterchange was not a function'); -+ } -+ return this; -+ }, -+ oncomplete: function(providedCallback) { -+ if (typeof (providedCallback) === 'function') { -+ this._introCompleteCallback = providedCallback; -+ } else { -+ throw new Error('Provided callback for oncomplete was not a function.'); -+ } -+ return this; -+ }, -+ onexit: function(providedCallback) { -+ if (typeof (providedCallback) === 'function') { -+ this._introExitCallback = providedCallback; -+ } else { -+ throw new Error('Provided callback for onexit was not a function.'); -+ } -+ return this; -+ } -+ }; -+ -+ exports.introJs = introJs; -+ return introJs; -+})); -Index: include/javascript/clippy.js -=================================================================== ---- include/javascript/clippy.js (revision 0) -+++ include/javascript/clippy.js (revision 10417) -@@ -0,0 +1,8 @@ -+function clippy_set_help(help_section) { -+ document.cookie = 'clippy=' + help_section; -+} -+ -+function clippy_go_link_show_help(link, help_section) { -+ document.cookie = 'clippy=' + help_section; -+ window.location.href = link; -+} -\ No newline at end of file -Index: include/functions_servers.php -=================================================================== ---- include/functions_servers.php (revision 10314) -+++ include/functions_servers.php (working copy) -@@ -79,7 +79,9 @@ - $data["avg_interval_remote_modules"] = array(); - $data["avg_interval_local_modules"] = 0; - $data["local_modules_rate"] = 0; -+ $data["network_modules_rate"] = 0; - -+ - if ($config["realtimestats"] == 1) { - $counts = db_get_all_rows_sql ("SELECT tagente_modulo.id_modulo, COUNT(tagente_modulo.id_agente_modulo) modules - FROM tagente_modulo, tagente_estado, tagente -@@ -195,6 +197,8 @@ - $interval_avgs_agents = array(); - } - -+ $interval_avgs = array(); -+ - // Merge with the previous calculated array - foreach($interval_avgs_agents as $iaagents) { - if(!isset($interval_avgs[$iaagents['id_modulo']]['modules'])) { -Index: include/functions_treeview.php -=================================================================== ---- include/functions_treeview.php (revision 10314) -+++ include/functions_treeview.php (working copy) -@@ -468,11 +468,19 @@ - echo '<table class="databox" style="width:98%">'; - echo '<tr><td style="width:50%" valign="top">'; - -+ -+ - if (! defined ('METACONSOLE')) { -+ - $list = treeview_getData ($type); -+ - } - else { -- $servers = db_get_all_rows_sql ("SELECT * FROM tmetaconsole_setup WHERE disabled = 0"); -+ $servers = db_get_all_rows_sql (" -+ SELECT * -+ FROM tmetaconsole_setup -+ WHERE disabled = 0"); -+ - if ($servers === false) { - $servers = array(); - } -@@ -502,6 +510,8 @@ - metaconsole_restore_db(); - } - -+ -+ - if ($list === false) { - ui_print_error_message(__('There aren\'t agents in this agrupation')); - echo '</td></tr>'; -@@ -543,19 +553,25 @@ - else { - $id = $item['_id_']; - } -- -+ - echo "<a onfocus='JavaScript: this.blur()' href='javascript: loadSubTree(\"" . $type . "\",\"" . $id . "\", " . $lessBranchs . ", \"\", \"\")'>"; - - echo $img . $item['_iconImg_'] ." " . __($item['_name_']) . ' ('; - -- $counts_info = array('total_count' => $item['_num_ok_'] + $item['_num_critical_'] + $item['_num_warning_'] + $item['_num_unknown_'], -- 'normal_count' => $item['_num_ok_'], -- 'critical_count' => $item['_num_critical_'], -- 'warning_count' => $item['_num_warning_'], -- 'unknown_count' => $item['_num_unknown_']); -- -+ $counts_info = array( -+ 'total_count' => $item['_num_ok_'] + -+ $item['_num_critical_'] + -+ $item['_num_warning_'] + -+ $item['_num_unknown_'], -+ 'normal_count' => $item['_num_ok_'], -+ 'critical_count' => $item['_num_critical_'], -+ 'warning_count' => $item['_num_warning_'], -+ 'unknown_count' => $item['_num_unknown_']); -+ -+ - reporting_tiny_stats($counts_info, false, $type); - -+ - echo ') '. "</a>"; - - echo "<div hiddenDiv='1' loadDiv='0' style='margin: 0px; padding: 0px;' class='tree_view' id='tree_div_" . $type . "_" . $id . "'></div>"; -@@ -581,7 +597,11 @@ - $avariableGroups = users_get_groups (); - - //Get all groups with agents -- $full_groups = db_get_all_rows_sql("SELECT DISTINCT id_grupo FROM tagente WHERE total_count > 0"); -+ $full_groups = db_get_all_rows_sql(" -+ SELECT DISTINCT id_grupo -+ FROM tagente -+ WHERE total_count > 0"); -+ - if ($full_groups === false) { - return array (); - } -@@ -607,9 +627,12 @@ - switch ($select_status) { - case NORMAL: - foreach ($avariableGroups as $group_name) { -- $id_group = db_get_value_sql('SELECT id_grupo FROM tgrupo where nombre ="' . $group_name . '"'); -+ $id_group = db_get_value_sql(' -+ SELECT id_grupo -+ FROM tgrupo -+ WHERE nombre ="' . $group_name . '"'); - -- $num_ok = groups_agent_ok($id_group); -+ $num_ok = groups_agent_ok($id_group); - - if ($num_ok <= 0) - unset($avariableGroups[$id_group]); -@@ -619,7 +642,10 @@ - break; - case WARNING: - foreach ($avariableGroups as $group_name) { -- $id_group = db_get_value_sql('SELECT id_grupo FROM tgrupo where nombre ="' . $group_name . '"'); -+ $id_group = db_get_value_sql(' -+ SELECT id_grupo -+ FROM tgrupo -+ WHERE nombre ="' . $group_name . '"'); - - $num_warning = groups_agent_warning($id_group); - -@@ -629,7 +655,10 @@ - break; - case CRITICAL: - foreach ($avariableGroups as $group_name) { -- $id_group = db_get_value_sql('SELECT id_grupo FROM tgrupo where nombre ="' . $group_name . '"'); -+ $id_group = db_get_value_sql(' -+ SELECT id_grupo -+ FROM tgrupo -+ WHERE nombre ="' . $group_name . '"'); - - $num_critical = groups_agent_critical($id_group); - -@@ -639,7 +668,10 @@ - break; - case UNKNOWN: - foreach ($avariableGroups as $group_name) { -- $id_group = db_get_value_sql('SELECT id_grupo FROM tgrupo where nombre ="' . $group_name . '"'); -+ $id_group = db_get_value_sql(' -+ SELECT id_grupo -+ FROM tgrupo -+ WHERE nombre ="' . $group_name . '"'); - - $num_unknown = groups_agent_unknown($id_group); - -@@ -656,17 +688,42 @@ - } - - if ($search_free != '') { -- $sql_search = " AND id_grupo IN (SELECT id_grupo FROM tagente -- WHERE tagente.nombre COLLATE utf8_general_ci LIKE '%$search_free%')"; -+ switch ($config['dbtype']) { -+ case "mysql": -+ $sql_search = " AND id_grupo IN ( -+ SELECT id_grupo -+ FROM tagente -+ WHERE tagente.nombre COLLATE utf8_general_ci LIKE '%$search_free%')"; -+ break; -+ case "postgresql": -+ $sql_search = " AND id_grupo IN ( -+ SELECT id_grupo -+ FROM tagente -+ WHERE tagente.nombre LIKE '%$search_free%')"; -+ break; -+ case "oracle": -+ $sql_search = " AND id_grupo IN ( -+ SELECT id_grupo -+ FROM tagente -+ WHERE tagente.nombre COLLATE utf8_general_ci LIKE '%$search_free%')"; -+ break; -+ } - } - else { - $sql_search =''; - } - -+ $order_collate = ""; -+ switch ($config['dbtype']) { -+ case "mysql": -+ $order_collate = "COLLATE utf8_general_ci"; -+ break; -+ } -+ - switch ($type) { -- case 'os': -+ case 'os': - $sql = agents_get_agents(array ( -- 'order' => 'nombre COLLATE utf8_general_ci ASC', -+ 'order' => 'nombre ' . $order_collate . ' ASC', - 'disabled' => 0, - 'status' => $select_status, - 'search' => $sql_search), -@@ -676,7 +733,9 @@ - false, - true); - -- $sql_os = sprintf("SELECT * FROM tconfig_os WHERE id_os IN (%s)", $sql); -+ $sql_os = sprintf("SELECT * -+ FROM tconfig_os -+ WHERE id_os IN (%s)", $sql); - - $list = db_get_all_rows_sql($sql_os); - -@@ -692,17 +751,31 @@ - - switch ($config["dbtype"]) { - case "mysql": -+ $list = db_get_all_rows_sql(" -+ SELECT * -+ FROM tgrupo -+ WHERE nombre IN (" . $stringAvariableGroups . ") $sql_search -+ ORDER BY nombre COLLATE utf8_general_ci ASC"); -+ break; - case "postgresql": -- $list = db_get_all_rows_sql("SELECT * FROM tgrupo WHERE nombre IN (" . $stringAvariableGroups . ") $sql_search ORDER BY nombre COLLATE utf8_general_ci ASC"); -+ $list = db_get_all_rows_sql(" -+ SELECT * -+ FROM tgrupo -+ WHERE nombre IN (" . $stringAvariableGroups . ") $sql_search -+ ORDER BY nombre ASC"); - break; - case "oracle": -- $list = db_get_all_rows_sql("SELECT * FROM tgrupo WHERE dbms_lob.substr(nombre,4000,1) IN (" . $stringAvariableGroups . ") ORDER BY nombre COLLATE utf8_general_ci ASC"); -+ $list = db_get_all_rows_sql(" -+ SELECT * -+ FROM tgrupo -+ WHERE dbms_lob.substr(nombre,4000,1) IN (" . $stringAvariableGroups . ") -+ ORDER BY nombre COLLATE utf8_general_ci ASC"); - break; - } - break; - case 'module_group': - $sql = agents_get_agents(array ( -- 'order' => 'nombre COLLATE utf8_general_ci ASC', -+ 'order' => 'nombre ' . $order_collate . ' ASC', - 'disabled' => 0, - 'status' => $select_status, - 'search' => $sql_search), -@@ -714,8 +787,13 @@ - // Skip agents without modules - $sql .= ' AND tagente.total_count>0'; - -- $sql_module_groups = sprintf("SELECT * FROM tmodule_group -- WHERE id_mg IN (SELECT id_module_group FROM tagente_modulo WHERE id_agente IN (%s))", $sql); -+ $sql_module_groups = sprintf(" -+ SELECT * -+ FROM tmodule_group -+ WHERE id_mg IN ( -+ SELECT id_module_group -+ FROM tagente_modulo -+ WHERE id_agente IN (%s))", $sql); - - - $list = db_get_all_rows_sql($sql_module_groups); -@@ -734,7 +812,8 @@ - $groups = implode(',',$groups_id); - - if ($search_free != '') { -- $sql = "SELECT DISTINCT tpolicies.id, tpolicies.name -+ $sql = " -+ SELECT DISTINCT tpolicies.id, tpolicies.name - FROM tpolicies, tpolicy_modules, - tagente_estado, tagente, tagente_modulo - WHERE -@@ -749,7 +828,7 @@ - tagente.nombre LIKE '%$search_free%' AND - tagente.disabled = 0 AND - tagente_modulo.disabled = 0 -- ORDER BY tpolicies.name COLLATE utf8_general_ci ASC"; -+ ORDER BY tpolicies.name COLLATE utf8_general_ci ASC"; - - $list = db_get_all_rows_sql($sql); - -@@ -825,7 +904,7 @@ - tagente.id_grupo IN ($groups) AND - tagente.disabled = 0 AND - tagente_modulo.disabled = 0 -- ORDER BY tpolicies.name COLLATE utf8_general_ci ASC"); -+ ORDER BY tpolicies.name ' . $order_collate . ' ASC"); - - $element = 0; - switch ($select_status) { -@@ -889,8 +968,28 @@ - } - - if ($search_free != '') { -- $sql_search = " AND t1.id_agente IN (SELECT id_agente FROM tagente -- WHERE nombre COLLATE utf8_general_ci LIKE '%$search_free%')"; -+ switch ($config['dbtype']) { -+ case "mysql": -+ $sql_search = " AND t1.id_agente IN ( -+ SELECT id_agente -+ FROM tagente -+ WHERE nombre COLLATE utf8_general_ci LIKE '%$search_free%')"; -+ break; -+ case "postgresql": -+ $sql_search = " AND t1.id_agente IN ( -+ SELECT id_agente -+ FROM tagente -+ WHERE nombre LIKE '%$search_free%')"; -+ break; -+ case "oracle": -+ $sql_search = " AND t1.id_agente IN ( -+ SELECT id_agente -+ FROM tagente -+ WHERE nombre COLLATE utf8_general_ci LIKE '%$search_free%')"; -+ break; -+ } -+ -+ - } - else { - $sql_search = ''; -@@ -899,7 +998,8 @@ - if ($select_status != -1) - $sql_search .= " AND estado = " . $select_status . " "; - -- $sql_search .= tags_get_acl_tags($config['id_user'], 0, 'AR', 'module_condition', 'AND', 't1'); -+ $sql_search .= tags_get_acl_tags( -+ $config['id_user'], 0, 'AR', 'module_condition', 'AND', 't1'); - - switch ($config["dbtype"]) { - case "mysql": -@@ -915,7 +1015,7 @@ - $sql_search.' - GROUP BY t1.nombre ORDER BY t1.nombre'); - break; -- case "oracle": -+ case "oracle": - $list = db_get_all_rows_sql(' - SELECT dbms_lob.substr(t1.nombre,4000,1) as nombre - FROM tagente_modulo t1, tagente t2, -@@ -950,15 +1050,16 @@ - $search_sql = sprintf(" AND tagente.nombre COLLATE utf8_general_ci LIKE '%%%s%%'", $search_free); - } - -- $sql = "SELECT DISTINCT ttag.name -- FROM ttag, ttag_module, tagente, tagente_modulo -- WHERE ttag.id_tag = ttag_module.id_tag -+ $sql = " -+ SELECT DISTINCT ttag.name -+ FROM ttag, ttag_module, tagente, tagente_modulo -+ WHERE ttag.id_tag = ttag_module.id_tag - AND tagente.id_agente = tagente_modulo.id_agente - AND tagente.disabled = 0 - AND ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo" . - $search_sql . -- $user_tags_sql . -- " ORDER BY ttag.name COLLATE utf8_general_ci ASC"; -+ $user_tags_sql . " -+ ORDER BY ttag.name ' . $order_collate . ' ASC"; - - $list = db_get_all_rows_sql($sql); - break; -@@ -1054,6 +1155,13 @@ - return false; - } - -+ $order_collate = ""; -+ switch ($config['dbtype']) { -+ case "mysql": -+ $order_collate = "COLLATE utf8_general_ci"; -+ break; -+ } -+ - //TODO CHANGE POLICY ACL FOR TAG ACL - $extra_sql = ''; - if ($extra_sql != '') { -@@ -1062,7 +1170,18 @@ - $groups_sql = implode(', ', $avariableGroupsIds); - - if ($search_free != '') { -- $search_sql = " AND tagente.nombre COLLATE utf8_general_ci LIKE '%$search_free%'"; -+ switch ($config['dbtype']) { -+ case "mysql": -+ $search_sql = " AND tagente.nombre COLLATE utf8_general_ci LIKE '%$search_free%'"; -+ break; -+ case "postgresql": -+ $search_sql = " AND tagente.nombre LIKE '%$search_free%'"; -+ break; -+ case "oracle": -+ $search_sql = " AND tagente.nombre COLLATE utf8_general_ci LIKE '%$search_free%'"; -+ break; -+ } -+ - } - else { - $search_sql = ''; -@@ -1078,14 +1197,14 @@ - } - } - -- $sql = agents_get_agents(array ( -+ $sql = agents_get_agents(array ( - 'id_grupo' => $id, - 'disabled' => 0, - 'status' => $statusSel, - 'search' => $search_sql), - array ('*'), - 'AR', -- array('field' => 'nombre COLLATE utf8_general_ci', 'order' => ' ASC'), -+ array('field' => 'nombre ' . $order_collate, 'order' => ' ASC'), - true); - break; - case 'os': -@@ -1097,7 +1216,7 @@ - 'search' => $search_sql), - array ('*'), - 'AR', -- array('field' => 'nombre COLLATE utf8_general_ci', 'order' => ' ASC'), -+ array('field' => 'nombre ' . $order_collate, 'order' => ' ASC'), - true); - break; - case 'module_group': -@@ -1117,7 +1236,7 @@ - FROM tagente_modulo - WHERE id_module_group = ' . $id . ')'; - -- $sql .= 'ORDER BY nombre COLLATE utf8_general_ci ASC'; -+ $sql .= 'ORDER BY nombre ' . $order_collate . ' ASC'; - - break; - case 'policies': -@@ -1144,7 +1263,7 @@ - AND tagente_estado.utimestamp != 0 - AND tagente_modulo.id_policy_module != 0 - AND tpolicy_modules.id_policy = ' . $id . ' -- group by tagente.id_agente -+ GROUP BY tagente.id_agente - having COUNT(*) > 0)'; - } - else if ($statusSel == 0) { -@@ -1152,11 +1271,12 @@ - // If status filter is NORMAL add void agents - $sql .= " UNION SELECT * FROM tagente - WHERE tagente.disabled = 0 -- AND tagente.id_agente NOT IN (SELECT tagente_estado.id_agente -+ AND tagente.id_agente NOT IN ( -+ SELECT tagente_estado.id_agente - FROM tagente_estado)"; - } - -- $sql .= 'ORDER BY nombre COLLATE utf8_general_ci ASC'; -+ $sql .= 'ORDER BY nombre ' . $order_collate . ' ASC'; - - break; - case 'module': -@@ -1188,7 +1308,7 @@ - ) - ', $name); - -- $sql .= 'ORDER BY nombre COLLATE utf8_general_ci ASC'; -+ $sql .= 'ORDER BY nombre ' . $order_collate . ' ASC'; - - break; - case 'tag': -@@ -1219,7 +1339,8 @@ - - $sql .= ' AND tagente.disabled = 0'. $search_sql; - -- $sql .= ' GROUP BY tagente.id_agente ORDER BY tagente.nombre COLLATE utf8_general_ci ASC'; -+ $sql .= ' GROUP BY tagente.id_agente -+ ORDER BY tagente.nombre ' . $order_collate . ' ASC'; - - break; - } -@@ -1234,25 +1355,36 @@ - // Get SQL for the second tree branch - function treeview_getSecondBranchSQL ($fatherType, $id, $id_father) { - global $config; -+ -+ $order_collate = ""; -+ switch ($config['dbtype']) { -+ case "mysql": -+ $order_collate = "COLLATE utf8_general_ci"; -+ break; -+ } -+ - switch ($fatherType) { - case 'group': - $sql = 'SELECT * - FROM tagente_modulo AS t1 -- INNER JOIN tagente_estado AS t2 ON t1.id_agente_modulo = t2.id_agente_modulo -+ INNER JOIN tagente_estado AS t2 -+ ON t1.id_agente_modulo = t2.id_agente_modulo - WHERE t1.id_agente = ' . $id; - $sql .= tags_get_acl_tags($config['id_user'], 0, 'AR', 'module_condition', 'AND', 't1'); - break; - case 'os': - $sql = 'SELECT * - FROM tagente_modulo AS t1 -- INNER JOIN tagente_estado AS t2 ON t1.id_agente_modulo = t2.id_agente_modulo -+ INNER JOIN tagente_estado AS t2 -+ ON t1.id_agente_modulo = t2.id_agente_modulo - WHERE t1.id_agente = ' . $id; - $sql .= tags_get_acl_tags($config['id_user'], 0, 'AR', 'module_condition', 'AND', 't1'); - break; - case 'module_group': - $sql = 'SELECT * - FROM tagente_modulo AS t1 -- INNER JOIN tagente_estado AS t2 ON t1.id_agente_modulo = t2.id_agente_modulo -+ INNER JOIN tagente_estado AS t2 -+ ON t1.id_agente_modulo = t2.id_agente_modulo - WHERE t1.id_agente = ' . $id . ' AND id_module_group = ' . $id_father; - $sql .= tags_get_acl_tags($config['id_user'], 0, 'AR', 'module_condition', 'AND', 't1'); - break; -@@ -1275,8 +1407,10 @@ - $symbols = ' !"#$%&\'()*+,./:;<=>?@[\\]^{|}~'; - $name = $id_father; - for ($i = 0; $i < strlen($symbols); $i++) { -- $name = str_replace('_articapandora_'.ord(substr($symbols, $i, 1)).'_pandoraartica_', substr($symbols, $i, 1), $name); -- } -+ $name = str_replace('_articapandora_' . -+ ord(substr($symbols, $i, 1)) .'_pandoraartica_', -+ substr($symbols, $i, 1), $name); -+ } - switch ($config["dbtype"]) { - case "mysql": - $sql = 'SELECT * -@@ -1315,8 +1449,9 @@ - break; - } - -- // This line checks for initializated modules or (non-initialized) asyncronous modules -- $sql .= ' AND disabled = 0 AND (utimestamp > 0 OR id_tipo_modulo IN (21,22,23)) ORDER BY nombre COLLATE utf8_general_ci ASC'; -+ // This line checks for initializated modules or (non-initialized) asyncronous modules -+ $sql .= ' AND disabled = 0 AND (utimestamp > 0 OR id_tipo_modulo IN (21,22,23)) -+ ORDER BY nombre ' . $order_collate . ' ASC'; - return $sql; - } - ?> -Index: include/functions_config.php -=================================================================== ---- include/functions_config.php (revision 10314) -+++ include/functions_config.php (working copy) -@@ -182,6 +182,8 @@ - $error_update[] = __('Command Snapshot'); - if (!config_update_value ('server_log_dir', get_parameter('server_log_dir'))) - $error_update[] = __('Server logs directory'); -+ if (!config_update_value ('tutorial_mode', get_parameter('tutorial_mode'))) -+ $error_update[] = __('Tutorial mode'); - break; - case 'enterprise': - if (isset($config['enterprise_installed']) && $config['enterprise_installed'] == 1) { -@@ -433,6 +435,10 @@ - $error_update[] = __('Default icon in GIS'); - if (!config_update_value ('autohidden_menu', get_parameter('autohidden_menu'))) - $error_update[] = __('Autohidden menu'); -+ if (!config_update_value ('fixed_header', get_parameter('fixed_header'))) -+ $error_update[] = __('Fixed header'); -+ if (!config_update_value ('fixed_menu', get_parameter('fixed_menu'))) -+ $error_update[] = __('Fixed menu'); - if (!config_update_value ('paginate_module', get_parameter('paginate_module'))) - $error_update[] = __('Paginate module'); - if (!config_update_value ('graphviz_bin_dir', get_parameter('graphviz_bin_dir'))) -@@ -781,17 +787,31 @@ - // config_update_value ('autoupdate', true); - // } - -- require_once ($config["homedir"]."/include/auth/mysql.php"); -+ require_once ($config["homedir"] . "/include/auth/mysql.php"); - -- // Next is the directory where "/attachment" directory is placed, to upload files stores. -- // This MUST be writtable by http server user, and should be in pandora root. -- // By default, Pandora adds /attachment to this, so by default is the pandora console home dir -+ -+ // Next is the directory where "/attachment" directory is placed, -+ // to upload files stores. This MUST be writtable by http server -+ // user, and should be in pandora root. By default, Pandora adds -+ // /attachment to this, so by default is the pandora console home -+ // dir. - if (!isset ($config['attachment_store'])) { -- config_update_value ( 'attachment_store', $config['homedir'].'/attachment'); -+ config_update_value('attachment_store', -+ $config['homedir'] . '/attachment'); - } -+ else { -+ //Fixed when the user moves the pandora console to another dir -+ //after the first uses. -+ if (!is_dir($config['attachment_store'])) { -+ config_update_value('attachment_store', -+ $config['homedir'] . '/attachment'); -+ } -+ } - -+ - if (!isset ($config['fontpath'])) { -- config_update_value ( 'fontpath', $config['homedir'].'/include/fonts/smallfont.ttf'); -+ config_update_value('fontpath', -+ $config['homedir'] . '/include/fonts/smallfont.ttf'); - } - - if (!isset ($config['style'])) { -@@ -869,7 +889,7 @@ - if (!isset ($config['netflow_nfexpire'])) { - config_update_value ( 'netflow_nfexpire', '/usr/bin/nfexpire'); - } -- -+ - if (!isset ($config['netflow_max_resolution'])) { - config_update_value ( 'netflow_max_resolution', '50'); - } -@@ -877,7 +897,7 @@ - if (!isset ($config['netflow_disable_custom_lvfilters'])) { - config_update_value ( 'netflow_disable_custom_lvfilters', 0); - } -- -+ - if (!isset ($config['netflow_max_lifetime'])) { - config_update_value ( 'netflow_max_lifetime', '5'); - } -@@ -919,13 +939,14 @@ - } - - if (!isset ($config['ldap_base_dn'])) { -- config_update_value ( 'ldap_base_dn', 'ou=People,dc=edu,dc=example,dc=org'); -+ config_update_value('ldap_base_dn', -+ 'ou=People,dc=edu,dc=example,dc=org'); - } - - if (!isset ($config['ldap_login_attr'])) { - config_update_value ( 'ldap_login_attr', 'uid'); - } -- -+ - if (!isset ($config['fallback_local_auth'])) { - config_update_value ( 'fallback_local_auth', '0'); - } -@@ -1030,11 +1051,11 @@ - config_update_value( 'api_password', ''); - } - -- if(defined('METACONSOLE')) { -+ if (defined('METACONSOLE')) { - // Customizable sections (Metaconsole) - enterprise_include_once ('include/functions_enterprise.php'); - $customizable_sections = enterprise_hook('enterprise_get_customizable_sections'); -- -+ - if($customizable_sections != ENTERPRISE_NOT_HOOK) { - foreach($customizable_sections as $k => $v) { - if (!isset ($config[$k])) { -@@ -1050,7 +1071,7 @@ - - if (!isset ($config['relative_path']) && (isset ($_POST['nick']) - || isset ($config['id_user'])) && isset($config['enterprise_installed'])) { -- -+ - $isFunctionSkins = enterprise_include_once ('include/functions_skins.php'); - if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { - -@@ -1153,7 +1174,8 @@ - } - - if (!isset($config['custom_report_front_logo'])) { -- config_update_value ('custom_report_front_logo', 'images/pandora_logo_white.jpg'); -+ config_update_value ('custom_report_front_logo', -+ 'images/pandora_logo_white.jpg'); - } - - if (!isset($config['custom_report_front_header'])) { -@@ -1161,7 +1183,8 @@ - } - - if (!isset($config['custom_report_front_firstpage'])) { -- config_update_value ('custom_report_front_firstpage', "<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;"><img src="" . ui_get_full_url(false, false, false, false) . "/images/pandora_report_logo.png" alt="" width="800" /></p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;"><span style="font-size: xx-large;">(_REPORT_NAME_)</span></p>
<p style="text-align: center;"><span style="font-size: large;">(_DATETIME_)</span></p>"); -+ config_update_value ('custom_report_front_firstpage', -+ "<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;"><img src="" . ui_get_full_url(false, false, false, false) . "/images/pandora_report_logo.png" alt="" width="800" /></p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;"><span style="font-size: xx-large;">(_REPORT_NAME_)</span></p>
<p style="text-align: center;"><span style="font-size: large;">(_DATETIME_)</span></p>"); - } - - if (!isset($config['custom_report_front_footer'])) { -@@ -1176,6 +1199,10 @@ - config_update_value ('networkmap_max_width', 900); - } - -+ if (!isset($config['tutorial_mode'])) { -+ config_update_value ('tutorial_mode', 'full'); -+ } -+ - /* Finally, check if any value was overwritten in a form */ - config_update_config(); - } -@@ -1312,7 +1339,7 @@ - $config["alert_cnt"]++; - $_SESSION["alert_msg"] .= ui_print_info_message( - array('title' => __("New update of Pandora Console"), -- 'message' => __('There is a new update please go to menu Administration and into extensions <a style="font-weight:bold;" href="index.php?sec=gsetup&sec2=godmode/update_manager_xxx/update_manager_xxx&tab=online">go to Update Manager</a> for more details.'), -+ 'message' => __('There is a new update please go to menu Administration and into extensions <a style="font-weight:bold;" href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online">go to Update Manager</a> for more details.'), - 'no_close' => true, 'force_style' => 'color: #000000 !important'), '', true); - } - } -Index: include/help/clippy/godmode_agentes_modificar_agente.php -=================================================================== ---- include/help/clippy/godmode_agentes_modificar_agente.php (revision 0) -+++ include/help/clippy/godmode_agentes_modificar_agente.php (revision 10417) -@@ -0,0 +1,71 @@ -+<?php -+ -+// Pandora FMS - http://pandorafms.com -+// ================================================== -+// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas -+// Please see http://pandorafms.org for full contribution list -+ -+// This program is free software; you can redistribute it and/or -+// modify it under the terms of the GNU 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. -+ -+/** -+ * @package Include -+ * @subpackage Clippy -+ */ -+ -+function clippy_start_page() { -+ -+ $helps = array(); -+ -+ //================================================================== -+ //Help tour about the monitoring with a ping (step 1) -+ //------------------------------------------------------------------ -+ $helps['monitoring_server_step_1'] = array(); -+ $helps['monitoring_server_step_1']['steps'] = array(); -+ $helps['monitoring_server_step_1']['steps'][] = array( -+ 'element'=> '#clippy', -+ 'intro' => __('I show how to monitoring a server.') -+ ); -+ $helps['monitoring_server_step_1']['steps'][] = array( -+ 'element'=> 'input[name="search"]', -+ 'intro' => __('Please type a agent to save the modules for monitoring a server.') -+ ); -+ $helps['monitoring_server_step_1']['steps'][] = array( -+ 'element'=> 'input[name="srcbutton"]', -+ 'intro' => __('Maybe if you typped correctly the name, you can see the agent.') -+ ); -+ $helps['monitoring_server_step_1']['conf'] = array(); -+ $helps['monitoring_server_step_1']['conf']['showBullets'] = 0; -+ $helps['monitoring_server_step_1']['conf']['showStepNumbers'] = 1; -+ $helps['monitoring_server_step_1']['conf']['next_help'] = 'monitoring_server_step_2'; -+ //================================================================== -+ -+ -+ //================================================================== -+ //Help tour about the monitoring with a ping (step 2) -+ //------------------------------------------------------------------ -+ $helps['monitoring_server_step_2'] = array(); -+ $helps['monitoring_server_step_2']['steps'] = array(); -+ $helps['monitoring_server_step_2']['steps'][] = array( -+ 'element'=> '#clippy', -+ 'intro' => __('Please choose the agent that you have searched.') -+ ); -+ $helps['monitoring_server_step_2']['steps'][] = array( -+ 'element'=> '#agent_list', -+ 'intro' => __('Choose the agent, please click in the name.') -+ ); -+ $helps['monitoring_server_step_2']['conf'] = array(); -+ $helps['monitoring_server_step_2']['conf']['showBullets'] = 0; -+ $helps['monitoring_server_step_2']['conf']['showStepNumbers'] = 0; -+ $helps['monitoring_server_step_2']['conf']['next_help'] = 'monitoring_server_step_3'; -+ //================================================================== -+ -+ clippy_write_javascript_helps_steps($helps, false); -+} -+?> -\ No newline at end of file -Index: include/help/clippy/homepage.php -=================================================================== ---- include/help/clippy/homepage.php (revision 0) -+++ include/help/clippy/homepage.php (revision 10417) -@@ -0,0 +1,105 @@ -+<?php -+ -+// Pandora FMS - http://pandorafms.com -+// ================================================== -+// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas -+// Please see http://pandorafms.org for full contribution list -+ -+// This program is free software; you can redistribute it and/or -+// modify it under the terms of the GNU 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. -+ -+/** -+ * @package Include -+ * @subpackage Clippy -+ */ -+ -+function clippy_start_page_homepage() { -+ global $config; -+ -+ $clippy_is_annoying = (int)get_cookie('clippy_is_annoying', 0); -+ -+ clippy_clean_help(); -+ -+ $helps = array(); -+ -+ //================================================================== -+ //Help tour with the some task for to help the user. -+ //------------------------------------------------------------------ -+ $helps['homepage'] = array(); -+ $helps['homepage']['steps'] = array(); -+ $helps['homepage']['steps'][] = array( -+ 'element'=> '#clippy', -+ 'intro' => __('Could I help you?<br/><br/>I am Pandorin, the annoying clippy for Pandora. You could follow my advices for to make common and basic tasks in Pandora.') . -+ '<div style="position:relative;"> -+ <div id="pandorin" style="display: block; position: absolute; left: -100px; top: 20px;">' . -+ html_print_image('images/pandorin.png', true) . -+ '</div> -+ </div>' -+ ); -+ $helps['homepage']['steps'][] = array( -+ 'element'=> '#clippy', -+ 'intro' => __('What task do you want to do?') . '<br/><br/>' . -+ '<ul style="text-align: left; margin-left: 3px; list-style-type: disc;">' . -+ '<li>' . -+ "<a href='javascript: clippy_go_link_show_help(\"index.php?sec=gagente&sec2=godmode/agentes/modificar_agente\", \"monitoring_server_step_1\");'>" . -+ //'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&clippy=monitoring_server">' . -+ __('Monitoring a server Linux/Windows with a pandora agent') . -+ '</a>' . -+ '</li>' . -+ '<li>' . __('Monitoring a switch with remote SNMP') . '</li>' . -+ '<li>' . __('Monitoring a Windows server with remote WMI ') . '</li>' . -+ '</ul>' . -+ '<div style="text-align: left;">'. -+ html_print_checkbox_extended -+ ('clippy_is_annoying', 1, $clippy_is_annoying, false, -+ 'set_clippy_annoying()', '', true) . -+ __('Please the clippy is annoying, I don\'t want see.') . -+ '</div>' -+ ); -+ $helps['homepage']['conf'] = array(); -+ $helps['homepage']['conf']['showBullets'] = 0; -+ $helps['homepage']['conf']['showStepNumbers'] = 0; -+ $helps['homepage']['conf']['name_obj_tour'] = 'intro_homepage'; -+ $helps['homepage']['conf']['other_js'] = " -+ function show_clippy() { -+ intro_homepage.start(); -+ } -+ -+ function set_clippy_annoying() { -+ checked = $('input[name=\'clippy_is_annoying\']').is(':checked'); -+ intro_homepage.exit(); -+ -+ if (checked) { -+ document.cookie = 'clippy_is_annoying=1'; -+ } -+ else { -+ document.cookie = 'clippy_is_annoying=0'; -+ } -+ } -+ "; -+ if ($config['logged']) { -+ $helps['homepage']['conf']['autostart'] = true; -+ } -+ else { -+ $helps['homepage']['conf']['autostart'] = false; -+ } -+ -+ if ($config["tutorial_mode"] == 'on_demand') { -+ $helps['homepage']['conf']['autostart'] = false; -+ } -+ -+ if ($clippy_is_annoying === 1) { -+ $helps['homepage']['conf']['autostart'] = false; -+ } -+ -+ //================================================================== -+ -+ clippy_write_javascript_helps_steps($helps); -+} -+?> -\ No newline at end of file -Index: include/help/clippy/godmode_agentes_configurar_agente.php -=================================================================== ---- include/help/clippy/godmode_agentes_configurar_agente.php (revision 0) -+++ include/help/clippy/godmode_agentes_configurar_agente.php (revision 10417) -@@ -0,0 +1,126 @@ -+<?php -+ -+// Pandora FMS - http://pandorafms.com -+// ================================================== -+// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas -+// Please see http://pandorafms.org for full contribution list -+ -+// This program is free software; you can redistribute it and/or -+// modify it under the terms of the GNU 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. -+ -+/** -+ * @package Include -+ * @subpackage Clippy -+ */ -+ -+function clippy_start_page() { -+ $helps = array(); -+ -+ //================================================================== -+ //Help tour about the monitoring with a ping (step 3) -+ //------------------------------------------------------------------ -+ $helps['monitoring_server_step_3'] = array(); -+ $helps['monitoring_server_step_3']['steps'] = array(); -+ $helps['monitoring_server_step_3']['steps'][] = array( -+ 'element'=> '#clippy', -+ 'intro' => __('Now you must go to modules, don\'t worry I teach you.') -+ ); -+ $helps['monitoring_server_step_3']['steps'][] = array( -+ 'element'=> "img[alt='Modules']", -+ 'intro' => __('Please click in this tab.') -+ ); -+ $helps['monitoring_server_step_3']['conf'] = array(); -+ $helps['monitoring_server_step_3']['conf']['showBullets'] = 0; -+ $helps['monitoring_server_step_3']['conf']['showStepNumbers'] = 0; -+ $helps['monitoring_server_step_3']['conf']['next_help'] = 'monitoring_server_step_4'; -+ //================================================================== -+ -+ -+ //================================================================== -+ //Help tour about the monitoring with a ping (step 4) -+ //------------------------------------------------------------------ -+ $helps['monitoring_server_step_4'] = array(); -+ $helps['monitoring_server_step_4']['steps'] = array(); -+ $helps['monitoring_server_step_4']['steps'][] = array( -+ 'element'=> '#clippy', -+ 'intro' => __('Now you must create the module, don\'t worry I teach you.') -+ ); -+ $helps['monitoring_server_step_4']['steps'][] = array( -+ 'element'=> "#moduletype", -+ 'intro' => __('Choose the network server module.') -+ ); -+ $helps['monitoring_server_step_4']['steps'][] = array( -+ 'element'=> "input[name='updbutton']", -+ 'intro' => __('And click in this button.') -+ ); -+ $helps['monitoring_server_step_4']['conf'] = array(); -+ $helps['monitoring_server_step_4']['conf']['showBullets'] = 0; -+ $helps['monitoring_server_step_4']['conf']['showStepNumbers'] = 0; -+ $helps['monitoring_server_step_4']['conf']['next_help'] = 'monitoring_server_step_5'; -+ //================================================================== -+ -+ -+ //================================================================== -+ //Help tour about the monitoring with a ping (step 5) -+ //------------------------------------------------------------------ -+ $helps['monitoring_server_step_5'] = array(); -+ $helps['monitoring_server_step_5']['steps'] = array(); -+ $helps['monitoring_server_step_5']['steps'][] = array( -+ 'element'=> '#clippy', -+ 'intro' => __('Now you must create the module, don\'t worry I teach you.') -+ ); -+ $helps['monitoring_server_step_5']['steps'][] = array( -+ 'element'=> '#clippy', -+ 'intro' => __('We are going to fill the form.') -+ ); -+ $helps['monitoring_server_step_5']['steps'][] = array( -+ 'element'=> "#network_component_group", -+ 'intro' => __('Please choose the Network Management.') -+ ); -+ $helps['monitoring_server_step_5']['steps'][] = array( -+ 'element'=> "#network_component", -+ 'intro' => __('And choose the component with the name "Host Alive".') -+ ); -+ $helps['monitoring_server_step_5']['steps'][] = array( -+ 'element'=> "input[name='name']", -+ 'intro' => __('You can change the name.') -+ ); -+ $helps['monitoring_server_step_5']['steps'][] = array( -+ 'element'=> "input[name='ip_target']", -+ 'intro' => __('Check if this IP is the address of your machine.') -+ ); -+ $helps['monitoring_server_step_5']['steps'][] = array( -+ 'element'=> "input[name='crtbutton']", -+ 'intro' => __('And only to finish it is clicking this button.') -+ ); -+ $helps['monitoring_server_step_5']['conf'] = array(); -+ $helps['monitoring_server_step_5']['conf']['showBullets'] = 0; -+ $helps['monitoring_server_step_5']['conf']['showStepNumbers'] = 0; -+ $helps['monitoring_server_step_5']['conf']['next_help'] = 'monitoring_server_step_6'; -+ //================================================================== -+ -+ -+ //================================================================== -+ //Help tour about the monitoring with a ping (step 6) -+ //------------------------------------------------------------------ -+ $helps['monitoring_server_step_6'] = array(); -+ $helps['monitoring_server_step_6']['steps'] = array(); -+ $helps['monitoring_server_step_6']['steps'][] = array( -+ 'element'=> '#clippy', -+ 'intro' => __('Now, your module is just created.<br/> And the status color is <b>blue</b>.<br/>This meaning of blue status is the module is not executed for first time.<br/>In the next seconds if there is not a problem, the status color will change to red or green.') -+ ); -+ $helps['monitoring_server_step_6']['conf'] = array(); -+ $helps['monitoring_server_step_6']['conf']['showBullets'] = 0; -+ $helps['monitoring_server_step_6']['conf']['showStepNumbers'] = 0; -+ //================================================================== -+ -+ -+ clippy_write_javascript_helps_steps($helps, false); -+} -+?> -\ No newline at end of file -Index: include/help/clippy/module_unknow.php -=================================================================== ---- include/help/clippy/module_unknow.php (revision 0) -+++ include/help/clippy/module_unknow.php (revision 10417) -@@ -0,0 +1,55 @@ -+<?php -+ -+// Pandora FMS - http://pandorafms.com -+// ================================================== -+// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas -+// Please see http://pandorafms.org for full contribution list -+ -+// This program is free software; you can redistribute it and/or -+// modify it under the terms of the GNU 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. -+ -+/** -+ * @package Include -+ * @subpackage Clippy -+ */ -+ -+function clippy_module_unknow() { -+ $helps = array(); -+ -+ //================================================================== -+ //Help tour about the monitoring with a ping (step 3) -+ //------------------------------------------------------------------ -+ $helps['module_unknow'] = array(); -+ $helps['module_unknow']['steps'] = array(); -+ $helps['module_unknow']['steps'][] = array( -+ 'element'=> '{clippy}', //The template to replace with the autogenerate id -+ 'intro' => '<table>' . -+ '<tr>' . -+ '<td class="context_help_title">' . -+ __('You have unknown modules in this agent.') . -+ '</td>' . -+ '</tr>' . -+ '<tr>' . -+ '<td class="context_help_body">' . -+ __('Unknown modules are modules which receive data normally at least in one occassion, but at this time are not receving data. Please check our troubleshoot help page to help you determine why you have unknown modules.') . -+ ui_print_help_icon ('context_module_unknow', true, '', 'images/help_w.png') . -+ '</td>' . -+ '</tr>' . -+ '</table>' -+ ); -+ $helps['module_unknow']['conf'] = array(); -+ $helps['module_unknow']['conf']['autostart'] = false; -+ $helps['module_unknow']['conf']['showBullets'] = 0; -+ $helps['module_unknow']['conf']['showStepNumbers'] = 0; -+ $helps['module_unknow']['conf']['name_obj_tour'] = '{clippy_obj}'; -+ //================================================================== -+ -+ clippy_write_javascript_helps_steps($helps, true); -+} -+?> -\ No newline at end of file -Index: include/help/en/help_context_module_unknow.php -=================================================================== ---- include/help/en/help_context_module_unknow.php (revision 0) -+++ include/help/en/help_context_module_unknow.php (revision 10417) -@@ -0,0 +1,24 @@ -+<?php -+/** -+ * @package Include/help/en -+ */ -+?> -+<h1>Unknown modules in Pandora</h1> -+<p> -+You may have unknown modules for many reasons. Unknown module is a special status for a module/monitor which means “I dont have recent data for this monitor and I should have data”. A monitor goes to unknown status when doesnt receive nothing in at least its interval (for example, 300 seconds) multiplied by two, in this case, if you doesn't receive nothing in ten minutes, monitor goes to unknown. -+</p> -+<p> -+These are a few cases where you can get unknown modules: -+</p> -+<ul style="list-style-type: disc; margin-left: 30px;"> -+ <li>Your pandora server is down. Restart it, dont forget to check /var/log/pandora/pandora_server.log to see why was down.</li> -+ <li>Your tentacle server is down, and cannot get data from your Pandora FMS agents installed in your remote servers.</li> -+ <li>You have a network problem between your agents and your server.</li> -+ <li>Your pandora fms agent is stopped and is not sending information to your server.</li> -+ <li>Your network is down, or the remote device you are trying to ask is down or changed it's IP address (for example for numerical SNMP remote queries).</li> -+ <li>Your agent is reporting a badly synchronized date. Means reports a timedate in the past and that messup everything.</li> -+ <li>The script / module before works now doesn't, that can be because something is happing in the agent, check it out.</li> -+</ul> -+<p> -+Sometimes UNKNOWN status can be useful to monitor, so you can setup alerts on UNKNOWN status to warn you about that. -+</p> -\ No newline at end of file -Index: include/help/en/help_snmp_alert_field1.php -=================================================================== ---- include/help/en/help_snmp_alert_field1.php (revision 10314) -+++ include/help/en/help_snmp_alert_field1.php (working copy) -@@ -14,10 +14,10 @@ - <br><br> - You can use these macros in FieldX (1-10) of any alert - <br><br> --<b>_DATA_</b>: Full trap<br> --<b>_AGENT_</b>: Agent name<br> --<b>_IP_</b>: IP Address<br> --<b>_TIMESTAMP_</b>: Trap date<br> --<b>_SNMP_OID_</b>: Trap OID<br> --<b>_SNMP_VALUE_</b>: Trap OID value<br> -+<b>_data_</b>: Full trap<br> -+<b>_agent_</b>: Agent name<br> -+<b>_address_</b>: IP Address<br> -+<b>_timestamp_</b>: Trap date<br> -+<b>_snmp_oid_</b>: Trap OID<br> -+<b>_snmp_value_</b>: Trap OID value<br> - </p> -Index: include/help/es/help_snmp_alert_field1.php -=================================================================== ---- include/help/es/help_snmp_alert_field1.php (revision 10314) -+++ include/help/es/help_snmp_alert_field1.php (working copy) -@@ -14,10 +14,10 @@ - <br><br> - Puede usar esas macros en los campos FieldX (1-10) de cualquier alerta. - <br><br> --<b>_DATA_</b>: Trap entero <br> --<b>_AGENT_</b>: Nombre del Agente <br> --<b>_IP_</b>: Dirección IP<br> --<b>_TIMESTAMP_</b>: Fecha trap<br> --<b>_SNMP_OID_</b>: OID del trap<br> --<b>_SNMP_VALUE_</b>: Valor del OID del trap<br> -+<b>_data_</b>: Trap entero <br> -+<b>_agent_</b>: Nombre del Agente <br> -+<b>_address_</b>: Dirección IP<br> -+<b>_timestamp_</b>: Fecha trap<br> -+<b>_snmp_oid_</b>: OID del trap<br> -+<b>_snmp_value_</b>: Valor del OID del trap<br> - </p> -Index: include/help/ja/help_snmp_alert_field1.php -=================================================================== ---- include/help/ja/help_snmp_alert_field1.php (revision 10314) -+++ include/help/ja/help_snmp_alert_field1.php (working copy) -@@ -7,10 +7,17 @@ - <p> - - データフィールドがある場合、アラートでそれを利用する必要があります。この目的のために、特別な _snmp_fX_ というマクロを利用できます。これらのマクロは、SNMP トラップアラート以外では無効です。 -- -+<br><br> - メッセージを生成するには、フィールド1に次のような設定をします。 -- --Chassis Alert: _snmp_f2_ in device _snmp_f1_ -- --これらのマクロは、任意のアラートのフィールドX (1 から 10) で利用できます。 -+<br><br> -+ Chassis Alert: _snmp_f2_ in device _snmp_f1_ -+<br><br> -+任意のアラートのフィールドX (1 から 10) で以下のマクロを利用できます。 -+<br><br> -+<b>_data_</b>: トラップ全体<br> -+<b>_agent_</b>: エージェント名<br> -+<b>_address_</b>: IP アドレス<br> -+<b>_timestamp_</b>: トラップのタイムスタンプ<br> -+<b>_snmp_oid_</b>: トラップの OID<br> -+<b>_snmp_value_</b>: トラップ OID の値<br> - </p> -Index: include/config_process.php -=================================================================== ---- include/config_process.php (revision 10314) -+++ include/config_process.php (working copy) -@@ -247,4 +247,30 @@ - // cases (reverse proxy, others ports...). - //====================================================================== - $config["homeurl"] = ui_get_full_url(false); -+ -+ -+//====================================================================== -+// Get the version of DB manager -+//====================================================================== -+switch ($config["dbtype"]) { -+ case "mysql": -+ if (!isset($config['quote_string'])) { -+ $config['db_quote_string'] = "\""; -+ } -+ break; -+ case "postgresql": -+ if (!isset($config['dbversion'])) { -+ $result = db_get_sql("select version();"); -+ $result_chunks = explode(" ", $result); -+ -+ $config['dbversion'] = $result_chunks[1]; -+ } -+ if (!isset($config['quote_string'])) { -+ $config['db_quote_string'] = "'"; -+ } -+ break; -+ case "oracle": -+ break; -+} -+//====================================================================== - ?> -Index: include/functions_db.php -=================================================================== ---- include/functions_db.php (revision 10314) -+++ include/functions_db.php (working copy) -@@ -65,7 +65,8 @@ - if ($return === false) { - if ($critical) { - $login_screen = 'error_authconfig'; -- require($config['homeurl'] . '/general/error_screen.php'); -+ -+ require($config['homedir'] . '/general/error_screen.php'); - exit; - } - else if ($error == 0) { -@@ -108,6 +109,22 @@ - } - } - -+function db_encapsule_fields_with_same_name_to_instructions($field) { -+ global $config; -+ -+ switch ($config["dbtype"]) { -+ case "mysql": -+ return mysql_encapsule_fields_with_same_name_to_instructions($field); -+ break; -+ case "postgresql": -+ return postgresql_encapsule_fields_with_same_name_to_instructions($field); -+ break; -+ case "oracle": -+ return oracle_encapsule_fields_with_same_name_to_instructions($field); -+ break; -+ } -+} -+ - /** - * Adds an audit log entry (new function in 3.0) - * -Index: include/functions_extensions.php -=================================================================== ---- include/functions_extensions.php (revision 10314) -+++ include/functions_extensions.php (working copy) -@@ -99,11 +99,11 @@ - $dir = ENTERPRISE_DIR.'/'.EXTENSIONS_DIR; - - if (file_exists ($dir)) -- $handle = @opendir ($dir); -+ $handle = @opendir ($dir); - - if (empty ($handle)) - return; -- -+ - $file = readdir ($handle); - $extensions = array (); - $ignores = array ('.', '..'); -@@ -117,6 +117,10 @@ - $file = readdir ($handle); - continue; - } -+ -+ if ($file == "update_manager.php") -+ continue; -+ - $extension['file'] = $file; - $extension['operation_menu'] = ''; - $extension['godmode_menu'] = ''; -Index: ChangeLog -=================================================================== ---- ChangeLog (revision 10314) -+++ ChangeLog (working copy) -@@ -1,3 +1,425 @@ -+2014-08-14 Koichiro Kikuchi <koichiro@rworks.jp> -+ -+ * pandora_console_install: Refactored code and added "fakeroot" -+ installation support. -+ -+2014-08-13 Junichi Satoh <junichi@rworks.jp> -+ -+ * pandoradb.sql: Fixed sql error with MySQL 5.6 when NO_ZERO_DATE -+ SQL mode is enabled. -+ -+2014-08-13 Junichi Satoh <junichi@rworks.jp> -+ -+ * mobile/operation/events.php: Improved to show event comment. -+ -+2014-08-12 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * index.php, operation/agentes/ver_agente.php, -+ operation/agentes/estado_monitores.php, general/header.php, -+ include/functions_clippy.php, include/functions_ui.php, -+ include/help/en/help_context_module_unknow.php, -+ include/help/clippy/module_unknow.php, include/styles/pandora.css, -+ include/javascript/intro.js: added first version of context help -+ interactive. -+ -+2014-08-12 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/functions_modules.php: killed some unicorns and magic -+ numbers into the function "modules_get_status". -+ -+2014-08-12 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * images/clippy_icon.png, images/pandorin.png, -+ include/help/clippy/homepage.php, general/header.php: yes there is -+ a octopus another time in Pandora. -+ -+2014-08-12 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/functions_clippy.php, -+ include/help/clippy/godmode_agentes_modificar_agente.php, -+ include/help/clippy/godmode_agentes_configurar_agente.php: fixed the -+ execution of help tour when never it started. Sorry the clippy is -+ less annoying. -+ -+2014-08-12 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/functions_clippy.php: changed to modal version. -+ -+ * include/javascript/intro.js: added feature to avoid the exit, and -+ the pull request to original repository is solicited too -+ (https://github.com/usablica/intro.js/pull/311). -+ -+2014-08-12 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * general/header.php, godmode/setup/setup_general.php, -+ include/functions_clippy.php, include/functions_config.php, -+ include/help/clippy/homepage.php: wip in the clippy. -+ -+2014-08-12 Sancho Lerena <slerena@artica.es> -+ -+ * pandoradb_data.sql: No more "welcome to Pandora FMS 5.0" -+ removed version code to allow the same text for next releases -+ :-) -+ -+2014-08-11 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/help/clippy/godmode_agentes_modificar_agente.php, -+ include/help/clippy/homepage.php, -+ include/help/clippy/godmode_agentes_configurar_agente.php, -+ include/functions_clippy.php: wip in the clippy. -+ -+2014-08-11 Vanessa Gil <vanessa.gil@artica.es> -+ -+ * godmode/agentes/agent_template.php: Fixed bug in FF -+ threshold to apply a template module. Ticket #871. -+ -+2014-08-11 Vanessa Gil <vanessa.gil@artica.es> -+ -+ * godmode/agentes/agent_conf_gis.php: Altitude coordinate by -+ default. Fixed bug #766. -+ -+2014-08-08 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/functions.php, -+ include/help/clippy/godmode_agentes_modificar_agente.php, -+ include/help/clippy/homepage.php, -+ include/help/clippy/godmode_agentes_configurar_agente.php, -+ include/javascript/intro.js, -+ include/javascript/introjs.css, -+ include/javascript/clippy.js, -+ include/functions_ui.php, -+ include/functions_clippy.php, -+ index.php, -+ general/header.php: first version of the new feature a annoying -+ clippy such as the lovely micro$oft mascot. -+ -+2014-08-07 Alejandro Gallardo <alejandro.gallardo@artica.es> -+ -+ * pandoradb.sql, -+ extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql, -+ extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql, -+ extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql: -+ Modified the decimal precision of the column "post_process" -+ for the table 'tagente_modulo' (Ticket #1124). -+ -+2014-08-06 Sancho Lerena <slerena@artica.es> -+ -+ * extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql, -+ pandoradb.sql: Fixed bug introduced in commit 9604 -+ altering tagente_modulo.post_process double precission -+ making conversion from bytes to megabytes impossible -+ (0,00000095367432). Pending to fix also the interface for -+ module creation/edition which also fails. This is critical -+ for SP1 release :( -+ -+2014-08-05 Alejandro Gallardo <alejandro.gallardo@artica.es> -+ -+ * general/main_menu.php: Improved the submenus state -+ persistence functionality. -+ -+2014-08-05 Alejandro Gallardo <alejandro.gallardo@artica.es> -+ -+ * general/main_menu.php: Fixed the menu position when -+ it's fixed and the header's not. -+ -+ * include/functions_graph.php, -+ include/graphs/pandora.d3.js: Added colors to the elements -+ depending on their status on the functions 'sunburst' and -+ 'graph_monitor_wheel'. -+ -+ * include/styles/pandora.css: Fixed the z-index of the -+ shortcut bar. -+ -+2014-08-04 Alejandro Gallardo <alejandro.gallardo@artica.es> -+ -+ * general/header.php: Now the header can be configured -+ to be fixed at the top. -+ -+ * general/main_menu.php: Now the menu can be configured -+ to be fixed at the left. -+ -+ * godmode/setup/setup_visuals.php, -+ include/functions_config.php: Added new options to -+ enable the fixed header and menu. -+ -+ * include/styles/menu.css, -+ include/styles/pandora.css: Changes on the menu styles. -+ -+ -+2014-08-04 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/functions_config.php, -+ include/functions_update_manager.php: some fixes into the update -+ manager. -+ -+2014-08-04 Alejandro Gallardo <alejandro.gallardo@artica.es> -+ -+ * general/main_menu.php: Now the submenus opened by the -+ user remain opened when navigating through Pandora FMS. -+ -+2014-08-04 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/config_process.php: added global config var for the -+ quote strings (for example, PostgreSQL). -+ -+2014-08-03 Junichi Satoh <junichi@rworks.jp> -+ -+ * include/functions_ui.php: Fixed that the fast forward and the going -+ to the last of pagination doesn't work in the modal window for module -+ data display. -+ And fixed incorrect offset calculation for the fast forward. -+ -+2014-08-02 Junichi Satoh <junichi@rworks.jp> -+ -+ * operation/agentes/estado_monitores.php: Fixed that module data -+ display does not work correctly when time range mode is selected -+ and paginated. -+ -+2014-08-02 Junichi Satoh <junichi@rworks.jp> -+ -+ * operation/agentes/estado_agente.php: Fixed sql error. -+ -+2014-08-01 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * godmode/agentes/planned_downtime.editor.php: fixed the acl. -+ -+ MERGED FROM THE BRANCH 5.0 -+ -+2014-07-31 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/functions_networkmap.php, include/functions_graph.php, -+ include/db/postgresql.php, include/db/oracle.php, -+ include/functions_api.php, extensions/agents_alerts.php, -+ operation/search_main.php, operation/search_agents.getdata.php, -+ operation/agentes/status_monitor.php, -+ operation/agentes/networkmap.topology.php, -+ operation/agentes/ver_agente.php, -+ operation/search_modules.getdata.php, operation/search_results.php, -+ operation/events/events_list.php, -+ godmode/alerts/alert_list.builder.php, -+ godmode/alerts/configure_alert_template.php, -+ godmode/modules/manage_network_components_form.php, -+ godmode/reporting/reporting_builder.php, -+ godmode/reporting/map_builder.php: tiny fixes for the improve the -+ support of postgreSQL databases. -+ -+2014-07-30 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/ajax/module.php: tiny fixes for the improve the support of -+ postgreSQL databases. -+ -+2014-07-30 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * godmode/servers/manage_recontask.php, -+ godmode/servers/manage_recontask_form.php, -+ include/functions_treeview.php, include/ajax/module.php, -+ include/functions_reporting.php, include/db/postgresql.php, -+ include/functions_servers.php, operation/agentes/estado_agente.php, -+ operation/tree.php: tiny fixes for the improve -+ the support of postgreSQL databases. -+ -+2014-07-29 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/functions_graph.php, include/functions_reporting.php, -+ operation/agentes/estado_monitores.php: tiny fixes for the improve -+ the support of postgreSQL databases. -+ -+2014-07-29 Junichi Satoh <junichi@rworks.jp> -+ -+ * include/functions_events.php: Fixed a bug that event's comment -+ is not shown when it includes newline. -+ -+2014-07-28 Junichi Satoh <junichi@rworks.jp> -+ -+ * operation/agentes/estado_agente.php: Fixed sql error. -+ -+2014-07-24 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * operation/snmpconsole/snmp_view.php, -+ operation/events/events_list.php, operation/incidents/incident.php, -+ extensions/files_repo.php, -+ extensions/files_repo/sql/files_repo.postgreSQL.sql, -+ extensions/files_repo/functions_files_repo.php, -+ extensions/files_repo/files_repo_list.php, -+ godmode/agentes/modificar_agente.php, -+ godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php, -+ include/functions_graph.php, include/functions_db.php, -+ include/db/postgresql.php, include/db/oracle.php, -+ include/db/mysql.php, include/functions_update_manager.php, -+ include/functions_events.php, include/graphs/functions_flot.php, -+ include/graphs/fgraph.php: tiny fixes for the improve the support of -+ postgreSQL databases. -+ -+2014-07-23 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * extensions/module_groups.php, extensions/agents_alerts.php, -+ include/functions_agents.php, operation/agentes/exportdata.php: tiny -+ fixes for the improve the support of postgreSQL databases. -+ -+ * include/functions_db.php: fix blank screen when the connection -+ fail, now it shows the error message again. -+ -+2014-07-23 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/config_process.php, operation/agentes/status_monitor.php, -+ operation/agentes/estado_generalagente.php, -+ operation/agentes/estado_agente.php: tiny fixes for the improve the -+ support of postgreSQL databases. -+ -+2014-07-23 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/functions_servers.php, include/functions_reporting.php: -+ tiny fixes for the improve the support of postgreSQL databases. -+ -+2014-07-23 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * operation/agentes/estado_generalagente.php: fixed the show the -+ agent access box when the agent is new without data. -+ -+ INCIDENT: #1078 -+ -+2014-07-23 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * godmode/agentes/agent_wizard.snmp_explorer.php, -+ godmode/agentes/module_manager_editor_plugin.php: some fixes for -+ the snmp version 3. -+ -+2014-07-22 Juan Manuel Ramon <juanmanuel.ramon@artica.es> -+ -+ * include/ajax/events.php: Fixed custom fields view in -+ metaconsole event extended view. -+ -+ This is my last commit for Pandora guys! Bye ;-) -+ -+2014-07-22 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * godmode/agentes/agent_wizard.snmp_explorer.php, -+ include/functions.php: some fixes for the snmp v3. -+ -+2014-07-22 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * godmode/agentes/agent_manager.php: fixed to show the QR code image -+ in the creation of a new agent. -+ -+2014-07-21 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * pandoradb.postgreSQL.sql: fixed the SQL. -+ -+2014-07-18 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/functions_graph.php, include/functions_reporting.php: -+ fixed to show the unknown graph in simple graph. -+ -+ INCIDENT: #1035 -+ -+2014-07-17 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/auth/ldap.php, include/auth/mysql.php: fixed the -+ parameters with white spaces. -+ -+ INCIDENT: #1063 -+ -+2014-07-17 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/functions_groups.php: added parameter to avoid the check -+ the propagation in the function "groups_get_childrens". -+ -+ * include/functions_networkmap.php, -+ operation/agentes/networkmap.php, -+ operation/agentes/networkmap.topology.php: added feature to show the -+ agents in subgroups (or not). -+ -+ INCIDENT: #1018 -+ -+2014-07-14 Vanessa Gil <vanessa.gil@artica.es> -+ -+ * godmode/admin_access_log.php -+ include/functions.php: Added export to csv. -+ -+ * godmode/audit_log_csv.php: Added file. -+ -+2014-07-10 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/functions_api.php: fixed the call "set_update_agent" -+ because before the call get the id_server but this data never -+ was translated to name_server. And added id_server into the call -+ "get_pandora_servers" in the last position. -+ -+2014-07-10 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/functions_api.php: restored the parameter name server in -+ the api call "set_new_agent", thanks KOSAKA. -+ -+2014-07-10 Junichi Satoh <junichi@rworks.jp> -+ -+ * include/help/ja/help_snmp_alert_field1.php: Updated help. -+ -+2014-07-09 Mario Pulido <mario.pulido@artica.es> -+ -+ * include/help/ja/help_snmp_alert_field1.php: Added macros snmp alert help -+ -+2014-07-09 Junichi Satoh <junichi@rworks.jp> -+ -+ * include/help/ja/help_snmp_alert_field1.php: Updated help. -+ -+2014-07-09 Junichi Satoh <junichi@rworks.jp> -+ -+ * include/functions_events.php, operation/events/events.php, -+ operation/events/events_list.php: Replaced json_encode() -+ with io_json_mb_encode() to avoid invalid encoding with multi-byte -+ characters. -+ -+2014-07-08 Mario Pulido <mario.pulido@artica.es> -+ -+ * include/help/en/help_snmp_alert_field1.php, -+ include/help/es/help_snmp_alert_field1.php: Change macros snmp alert help -+ -+2014-07-08 Hirofumi Kosaka <kosaka@rworks.jp> -+ -+ * include/functions_api.php: Fixed that 'set enable_module' -+ had not worked. -+ -+ MERGED FROM BRANCH 5.0 -+ -+2014-07-07 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/functions_visual_map.php: show in the tooltip of -+ "static graph" the last value of module. -+ -+ INCIDENT: #1014 -+ -+2014-07-07 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * godmode/setup/license.php: fixed the white screen. -+ -+ INCIDENT: #996 -+ -+2014-07-07 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * operation/agentes/alerts_status.php: fixed the pagination with -+ the column sorted. -+ -+ INCIDENT: #977 -+ -+2014-07-04 Alejandro Gallardo <alejandro.gallardo@artica.es> -+ -+ * index.php: Now the shortcut bar isn't loaded while -+ the pandora console is in fullscreen mode. -+ -+2014-07-04 Ramon Novoa <rnovoa@artica.es> -+ -+ * include/functions_graph.php: When drawing charts, propagate the last value -+ in the database instead of the value of the last interval (which is the -+ average value for that interval). -+ -+ * operation/agentes/estado_monitores.php: Show events for boolean modules by default. -+ -+2014-07-04 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * include/functions_config.php, include/functions_extensions.php: -+ fixed the show old update manager and set the correct link in the -+ header warning message to update manager. -+ - 2014-06-30 Koichiro KIKUCHI <koichiro@rworks.jp> - - * operation/agentes/estado_monitores.php, -Index: pandoradb.sql -=================================================================== ---- pandoradb.sql (revision 10314) -+++ pandoradb.sql (working copy) -@@ -203,7 +203,7 @@ - `plugin_pass` text, - `plugin_parameter` text, - `id_plugin` int(10) default '0', -- `post_process` double default NULL, -+ `post_process` double(18,15) default 0, - `prediction_module` bigint(14) default '0', - `max_timeout` int(4) unsigned default '0', - `max_retries` int(4) unsigned default '0', -@@ -490,7 +490,7 @@ - CREATE TABLE IF NOT EXISTS `talert_special_days` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `id_group` INT(10) NOT NULL DEFAULT 0, -- `date` date NOT NULL DEFAULT '0000-00-00', -+ `date` date NOT NULL DEFAULT '1970-01-01', - `same_day` enum('monday','tuesday','wednesday','thursday','friday','saturday','sunday') NOT NULL DEFAULT 'sunday', - `description` text, - PRIMARY KEY (`id`) -Index: pandoradb.postgreSQL.sql -=================================================================== ---- pandoradb.postgreSQL.sql (revision 10314) -+++ pandoradb.postgreSQL.sql (working copy) -@@ -26,7 +26,8 @@ - - --\c "pandora" - --CREATE OR REPLACE LANGUAGE plpgsql; -+-- For previous PostgreSQL version 9.0 -+CREATE LANGUAGE plpgsql; - - CREATE OR REPLACE FUNCTION unix_timestamp(TIMESTAMP without time zone = CURRENT_TIMESTAMP) RETURNS double precision AS 'SELECT ceil(date_part(''epoch'', $1)); ' LANGUAGE SQL; - -@@ -240,10 +241,10 @@ - "disabled_types_event" TEXT default '', - "module_macros" TEXT default '', - "min_ff_event_normal" INTEGER default 0, -- "min_ff_event_warning" INTEGER default 0, -- "min_ff_event_critical" INTEGER default 0, -- "each_ff" SMALLINT default 0, -- "ff_timeout" INTEGER unsigned default 0 -+ "min_ff_event_warning" INTEGER default 0, -+ "min_ff_event_critical" INTEGER default 0, -+ "each_ff" SMALLINT default 0, -+ "ff_timeout" INTEGER default 0 - ); - CREATE INDEX "tagente_modulo_id_agente_idx" ON "tagente_modulo"("id_agente"); - CREATE INDEX "tagente_modulo_id_tipo_modulo_idx" ON "tagente_modulo"("id_tipo_modulo"); -@@ -1595,7 +1596,7 @@ - -- ----------------------------------------------------- - -- Table `tevent_response` - -- ----------------------------------------------------- --CREATE TABLE IF NOT EXISTS "tevent_response" ( -+CREATE TABLE "tevent_response" ( - "id" SERIAL NOT NULL PRIMARY KEY, - "name" varchar(600) NOT NULL default '', - "description" TEXT, -@@ -1611,7 +1612,7 @@ - -- --------------------------------------------------------------------- - -- Table "tcategory" - -- --------------------------------------------------------------------- --CREATE TABLE IF NOT EXISTS "tcategory" ( -+CREATE TABLE "tcategory" ( - "id" SERIAL NOT NULL PRIMARY KEY, - "name" varchar(600) NOT NULL default '' - ); -Index: pandora_console_install -=================================================================== ---- pandora_console_install (revision 10314) -+++ pandora_console_install (working copy) -@@ -11,92 +11,103 @@ - - PI_VERSION=4.0 - FORCE=0 -+DESTDIR="" - LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"` - MODE=$1 - -+# -+# set_global_vars -+# Check platform and set DISTRO, OS_VERSION, WWWUSER, WWWGROUP, WWWROOT, -+# PANDORA_HOME and PANDORA_HOME_GROUP. -+# -+set_global_vars () { -+ DISTRO="GENERIC" - --get_distro () { -- -- OS_NAME=`uname -s` -- -- # Get Linux Distro type and version -- if [ -f "/etc/SuSE-release" ] -- then -- OS_VERSION=`cat /etc/SuSE-release | grep VERSION | cut -f 3 -d " "` -- LINUX_DISTRO=SUSE -- else -- if [ -f "/etc/lsb-release" ] && [ ! -f "/etc/redhat-release" ] -+ case `uname -s` in -+ Linux) -+ # Get Linux Distro type and version -+ if [ -f "/etc/SuSE-release" ] - then -+ OS_VERSION=`cat /etc/SuSE-release | grep VERSION | cut -f 3 -d " "` -+ DISTRO=SUSE -+ elif [ -f "/etc/lsb-release" ] && [ ! -f "/etc/redhat-release" ] -+ then - OS_VERSION=`cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -f 2 -d "="` -- LINUX_DISTRO=UBUNTU -+ DISTRO=UBUNTU - OS_VERSION="UBUNTU $OS_VERSION" -- else -- if [ -f "/etc/debian_version" ] -- then -- OS_VERSION=`cat /etc/debian_version` -- OS_VERSION="DEBIAN $OS_VERSION" -- LINUX_DISTRO=DEBIAN -- else -- if [ -f "/etc/fedora-release" ] -- then -- OS_VERSION=`cat /etc/fedora-release | cut -f 4 -d " "` -- OS_VERSION="FEDORA $OS_VERSION" -- LINUX_DISTRO=FEDORA -- else -- if [ -f "/etc/redhat-release" ] -- then -- LINUX_DISTRO=RHEL_CENTOS -- else -- if [ "$OS_NAME" = "FreeBSD" ] -- then -- LINUX_DISTRO=FreeBSD -- else -- if [ "$OS_NAME" = "NetBSD" ] -- then -- LINUX_DISTRO=NetBSD -- else -- LINUX_DISTRO=GENERIC -- fi -- fi -- OS_VERSION=`uname -r` -- fi -- fi -- fi -+ elif [ -f "/etc/debian_version" ] -+ then -+ OS_VERSION=`cat /etc/debian_version` -+ OS_VERSION="DEBIAN $OS_VERSION" -+ DISTRO=DEBIAN -+ elif [ -f "/etc/fedora-release" ] -+ then -+ OS_VERSION=`cat /etc/fedora-release | cut -f 4 -d " "` -+ OS_VERSION="FEDORA $OS_VERSION" -+ DISTRO=FEDORA -+ elif [ -f "/etc/redhat-release" ] -+ then -+ DISTRO=RHEL_CENTOS - fi -+ case $DISTRO in -+ SUSE) -+ WWWUSER=wwwrun -+ WWWGROUP=www -+ PANDORA_HOME_GROUP=root -+ WWWROOT=/srv/www/htdocs -+ ;; -+ UBUNTU|DEBIAN) -+ WWWUSER=www-data -+ WWWGROUP=www-data -+ WWWROOT=/var/www -+ ;; -+ FEDORA|RHEL_CENTOS) -+ WWWUSER=apache -+ WWWGROUP=apache -+ WWWROOT=/var/www/html -+ ;; -+ esac -+ ;; -+ FreeBSD) -+ DISTRO=FreeBSD -+ WWWUSER=www -+ WWWGROUP=www -+ WWWROOT=/usr/local/www -+ -+ local apache -+ for apache in apache24 apache22 -+ do -+ [ ! -d $WWWROOT/$apache ] && continue -+ WWWROOT=$WWWROOT/$apache/data -+ break -+ done -+ ;; -+ NetBSD) -+ DISTRO=NetBSD -+ WWWUSER=www -+ WWWGROUP=www -+ WWWROOT=/usr/pkg/share/httpd/htdocs -+ ;; -+ esac -+ -+ # backward compatible defaults (Assuming SUSE) -+ if [ "$DISTRO" = GENERIC ] -+ then -+ WWWUSER=wwwrun -+ WWWGROUP=www -+ WWWROOT=/srv/www/htdocs -+ PANDORA_HOME_GROUP=root - fi -- echo $LINUX_DISTRO -+ # Use WWWGROUP as default for PANDORA_HOME_GROUP -+ : ${PANDORA_HOME_GROUP:=$WWWGROUP} -+ -+ OS_VERSION=`uname -r` -+ PANDORA_HOME="$WWWROOT/pandora_console" - } - - uninstall () { -- DISTRO=`get_distro` -+ set_global_vars - -- if [ "$DISTRO" = "UBUNTU" ] -- then -- PANDORA_HOME=/var/www/pandora_console -- else -- if [ "$DISTRO" = "RHEL_CENTOS" ] -- then -- PANDORA_HOME=/var/www/html/pandora_console -- else -- if [ "$DISTRO" = "FEDORA" ] -- then -- PANDORA_HOME=/var/www/html/pandora_console -- else -- if [ "$DISTRO" = "FreeBSD" ] -- then -- PANDORA_HOME="/usr/local/www/data/pandora_console /usr/local/www/apache24/data/pandora_console /usr/local/www/apache22/data/pandora_console" -- else -- if [ "$DISTRO" = "NetBSD" ] -- then -- PANDORA_HOME="/usr/pkg/share/httpd/htdocs/pandora_console" -- else -- PANDORA_HOME=/srv/www/htdocs/pandora_console -- fi -- fi -- fi -- fi -- fi -- - echo "Removing Pandora FMS Console" - rm -Rf $PANDORA_HOME - echo "You need to drop manually pandora database from your Database server" -@@ -104,81 +115,43 @@ - } - - install () { -+ set_global_vars - -- DISTRO=`get_distro` - OLDFILENAMETMP=`date +"%Y-%m-%d"` -- -- if [ "$DISTRO" = "UBUNTU" ] -- then -- PANDORA_HOME=/var/www/pandora_console -- PANDORA_CONF=$PANDORA_HOME/include/config.php -- else -- if [ "$DISTRO" = "RHEL_CENTOS" ] -- then -- PANDORA_HOME=/var/www/html/pandora_console -- PANDORA_CONF=$PANDORA_HOME/include/config.php -- else -- if [ "$DISTRO" = "FEDORA" ] -- then -- PANDORA_HOME=/var/www/html/pandora_console -- PANDORA_CONF=$PANDORA_HOME/include/config.php -- else -- if [ "$DISTRO" = "FreeBSD" ] -- then -- if [ -d /usr/local/www/apache24 ] -- then -- PANDORA_HOME=/usr/local/www/apache24/data/pandora_console -- else -- if [ -d /usr/local/www/apache22 ] -- then -- PANDORA_HOME=/usr/local/www/apache22/data/pandora_console -- else -- PANDORA_HOME=/usr/local/www/data/pandora_console -- fi -- fi -- PANDORA_CONF=$PANDORA_HOME/include/config.php -- else -- if [ "$DISTRO" = "NetBSD" ] -- then -- PANDORA_HOME=/usr/pkg/share/httpd/htdocs/pandora_console -- PANDORA_CONF=$PANDORA_HOME/include/config.php -- else -- PANDORA_HOME=/srv/www/htdocs/pandora_console -- PANDORA_CONF=$PANDORA_HOME/include/config.php -- fi -- fi -- fi -- fi -- fi -+ PANDORA_CONF=$PANDORA_HOME/include/config.php - - echo "Detecting operating system: $DISTRO" - -- if [ -f $PANDORA_HOME ] && [ "$FORCE" = "0" ] -+ if [ -f $DESTDIR$PANDORA_HOME ] && [ "$FORCE" = "0" ] - then - echo "Seems that default dir already exists. Please use --force to" -- echo "force installer to install on $PANDORA_HOME" -+ echo "force installer to install on $DESTDIR$PANDORA_HOME" - exit - else -- echo "Checking default dir $PANDORA_HOME..." -+ echo "Checking default dir $DESTDIR$PANDORA_HOME..." - fi - -- # Create directories -- echo "Creating Pandora FMS Console home directory at $PANDORA_HOME ..." -- mkdir -p $PANDORA_HOME 2> /dev/null -- -- # Copying Pandora FMS console -- echo "Copying Pandora FMS Console to $PANDORA_HOME.." -- cp -R * $PANDORA_HOME -- chmod -R u+rwX,g+rX,g-w,o-rwx $PANDORA_HOME -- -- -- # Creating 'pandora' user -+ # Check and create 'pandora' user if needed - id pandora 2> /dev/null - if [ $? -eq 0 ]; then - echo " " - echo "User pandora does exist, skipping this step" -+ elif [ "$DESTDIR" ] -+ then -+ # don't create user with "fakeroot" installation -+ echo "User 'pandora' does not exist. All chown operations may fail." -+ echo "You should manualy set proper ownership to $DESTDIR$PANDORA_HOME and $DESTDIR$PANDORA_SPOOL if it's required." -+ echo - else -- echo "Creating 'pandora' user" -+ echo "Are you sure we can create a standard 'pandora' user locally? [y/N]" -+ read AREYOUSURE -+ if [ "$AREYOUSURE" != "y" ] -+ then -+ echo "Please create the 'pandora' user manually according to your authentication scheme, then start again the installation" -+ echo "Aborting..." -+ exit 1 -+ fi -+ # creating user - if [ "$DISTRO" = "FreeBSD" ] - then - echo "pandora:41121:::::Pandora FMS:/home/pandora:/usr/sbin/nologin:" | adduser -f - -w no 2> /dev/null -@@ -190,46 +163,31 @@ - fi - fi - -- if [ ! -d /var/spool/pandora ] -- then -- mkdir -p /var/spool/pandora -- fi -+ # Create directories -+ echo "Creating Pandora FMS Console home directory at $DESTDIR$PANDORA_HOME ..." -+ mkdir -p $DESTDIR$PANDORA_HOME 2> /dev/null - -+ # Copying Pandora FMS console -+ echo "Copying Pandora FMS Console to $DESTDIR$PANDORA_HOME.." -+ cp -R * $DESTDIR$PANDORA_HOME -+ chmod -R u+rwX,g+rX,g-w,o-rwx $DESTDIR$PANDORA_HOME -+ -+ # prepare /var/spool/pandora/data_in and sub directories -+ for subdir in collections conf md5 netflow -+ do -+ [ ! -d $DESTDIR/var/spool/pandora/data_in/$subdir ] && mkdir -p $DESTDIR/var/spool/pandora/data_in/$subdir -+ done -+ - #Ownership -- if [ "$DISTRO" = "UBUNTU" ] -- then -- chown -R www-data:root $PANDORA_HOME -- chown -R pandora:www-data /var/spool/pandora/ -- else -- if [ "$DISTRO" = "RHEL_CENTOS" ] -- then -- chown -R apache:apache $PANDORA_HOME -- chown -R pandora:apache /var/spool/pandora/ -- else -- if [ "$DISTRO" = "FEDORA" ] -- then -- chown -R apache:apache $PANDORA_HOME -- chown -R pandora:apache /var/spool/pandora/ -- else -- if [ "$DISTRO" = "FreeBSD" -o "$DISTRO" = "NetBSD" ] -- then -- chown -R www:www $PANDORA_HOME -- chown -R pandora:www /var/spool/pandora/ -- else -- # Assuming SUSE -- chown -R wwwrun:root $PANDORA_HOME -- chown -R pandora:www /var/spool/pandora/ -- fi -- fi -- fi -- fi -+ chown -R $WWWUSER:$PANDORA_HOME_GROUP $DESTDIR$PANDORA_HOME 2> /dev/null -+ chown -R pandora:$WWWGROUP $DESTDIR/var/spool/pandora/ 2> /dev/null - - echo "Setting secure permissions for Pandora FMS spool dir..." -- chmod -R u+rwX,g+rwX,o-rwx /var/spool/pandora/ -+ chmod -R u+rwX,g+rwX,o-rwx $DESTDIR/var/spool/pandora/ - - echo "Done." - echo " " -- echo "You have your Pandora FMS console installed on $PANDORA_HOME." -+ echo "You have your Pandora FMS console installed on $DESTDIR$PANDORA_HOME." - echo " " - echo "Now you can setup your Pandora FMS console and install" - echo "database using a browser and point to: " -@@ -240,17 +198,40 @@ - } - - help () { -+ echo "Syntax": -+ echo -+ echo " ./pandora_console_install < --mode > [ --option ]" -+ echo " " -+ echo "Modes:" -+ echo - echo " --force-install To force installation if already installed on this system" - echo " --install To install Pandora FMS Console on this system" -- echo " " -+ echo " --uninstall To uninstall/remove Pandora FMS Console on this System" -+ echo -+ echo "Option:" -+ echo -+ echo " --destdir DIR Specify root directory for \"fakeroot\" installation" -+ echo - } - - # Script banner at start - echo " " --echo "Pandora FMS Console Installer $PI_VERSION (c) 2008-2011 ArticaST" -+echo "Pandora FMS Console Installer $PI_VERSION (c) 2008-2014 ArticaST" - echo "This program is licensed under GPL2 Terms. http://pandorafms.com" - echo " " - -+# parse option -+if [ "$2" = "--destdir" ] -+then -+ if [ -z "$3" ] -+ then -+ echo '"--datadir" option requires an argument' -+ help -+ exit 1 -+ fi -+ DESTDIR="$3" -+fi -+ - case "$MODE" in - - '--force-install') -Index: index.php -=================================================================== ---- index.php (revision 10314) -+++ index.php (working copy) -@@ -355,6 +355,7 @@ - * Load here, because if not, some extensions not load well, I don't why. - */ - -+$config['logged'] = false; - extensions_load_extensions ($config['extensions']); - if ($process_login) { - /* Call all extensions login function */ -@@ -376,6 +377,8 @@ - - //Set the initial global counter for chat. - users_get_last_global_counter('session'); -+ -+ $config['logged'] = true; - } - - //Get old parameters before navigation. -@@ -562,7 +565,9 @@ - require("general/logon_ok.php"); - } - } -- require("general/shortcut_bar.php"); -+ if ($config["pure"] == 0) { -+ require("general/shortcut_bar.php"); -+ } - } - - if ($config["pure"] == 0) { -@@ -583,6 +588,11 @@ - require ("general/footer.php"); - echo '</div>'; - } -+ -+/// Clippy function -+require_once('include/functions_clippy.php'); -+clippy_start($sec2); -+ - while (@ob_end_flush ()); - - db_print_database_debug (); -Index: extensions/agents_alerts.php -=================================================================== ---- extensions/agents_alerts.php (revision 10314) -+++ extensions/agents_alerts.php (working copy) -@@ -172,13 +172,18 @@ - echo "<th width='20px' style='vertical-align:top; padding-top: 35px;' rowspan='".($nagents+1)."'><a href='index.php?sec=extensions&sec2=extensions/agents_alerts&refr=0&hor_offset=".$new_hor_offset."&offset=".$offset."&group_id=".$group_id."'>".html_print_image("images/darrowleft.png",true, array('title' => __('Previous templates')))."</a> </th>"; - } - -+ $templates_raw = array(); - if (!empty($templates)) { - $sql = sprintf('SELECT id, name -- FROM talert_templates WHERE id IN (%s)',implode(',',array_keys($templates))); -+ FROM talert_templates -+ WHERE id IN (%s)',implode(',',array_keys($templates))); - - $templates_raw = db_get_all_rows_sql($sql); - } - -+ if (empty($templates_raw)) -+ $templates_raw = array(); -+ - $alerts = array(); - $ntemplates = 0; - foreach ($templates_raw as $temp) { -@@ -225,7 +230,7 @@ - if($anyfired) { - $cellstyle = 'background:'.COL_ALERTFIRED.';'; - } -- -+ - echo '<td style="text-align:center;'.$cellstyle.'"> '; - - $uniqid = uniqid(); -@@ -266,9 +271,12 @@ - $data[0] = modules_get_agentmodule_name ($alert['id_agent_module']); - - $actions = alerts_get_alert_agent_module_actions ($alert['id']); -- -- $actionDefault = db_get_value_sql("SELECT id_alert_action FROM talert_templates WHERE id = " . $alert['id_alert_template']); - -+ $actionDefault = db_get_value_sql(" -+ SELECT id_alert_action -+ FROM talert_templates -+ WHERE id = " . $alert['id_alert_template']); -+ - $actionText = ''; - - if (!empty($actions)) { -@@ -284,10 +292,13 @@ - } - else { - if (!empty($actionDefault)) { -- $actionText = db_get_sql ("SELECT name FROM talert_actions WHERE id = $actionDefault"). " <i>(".__("Default") . ")</i>"; -+ $actionText = db_get_sql ("SELECT name -+ FROM talert_actions -+ WHERE id = $actionDefault") . -+ " <i>(" . __("Default") . ")</i>"; - } - } -- -+ - $data[1] = $actionText; - $data[2] = ui_print_timestamp ($alert["last_fired"], true); - -Index: extensions/files_repo/sql/files_repo.postgreSQL.sql -=================================================================== ---- extensions/files_repo/sql/files_repo.postgreSQL.sql (revision 10314) -+++ extensions/files_repo/sql/files_repo.postgreSQL.sql (working copy) -@@ -1,2 +1,2 @@ --CREATE TABLE IF NOT EXISTS "tfiles_repo" ("id" SERIAL NOT NULL PRIMARY KEY, "name" VARCHAR(255) NOT NULL, "description" VARCHAR(500) NULL default '', "hash" VARCHAR(8) NULL default ''); --CREATE TABLE IF NOT EXISTS "tfiles_repo_group" ("id" SERIAL NOT NULL PRIMARY KEY, "id_file" INTEGER NOT NULL REFERENCES tfiles_repo("id") ON DELETE CASCADE, "id_group" INTEGER NOT NULL); -+CREATE TABLE "tfiles_repo" ("id" SERIAL NOT NULL PRIMARY KEY, "name" VARCHAR(255) NOT NULL, "description" VARCHAR(500) NULL default '', "hash" VARCHAR(8) NULL default ''); -+CREATE TABLE "tfiles_repo_group" ("id" SERIAL NOT NULL PRIMARY KEY, "id_file" INTEGER NOT NULL REFERENCES tfiles_repo("id") ON DELETE CASCADE, "id_group" INTEGER NOT NULL); -Index: extensions/files_repo/functions_files_repo.php -=================================================================== ---- extensions/files_repo/functions_files_repo.php (revision 10314) -+++ extensions/files_repo/functions_files_repo.php (working copy) -@@ -125,31 +125,33 @@ - - function files_repo_get_files ($filter = false, $count = false) { - global $config; -- -+ - // Don't use the realpath for the download links! - $files_repo_path = io_safe_output($config['attachment_store'])."/files_repo"; -- -- $sql = "SELECT * FROM tfiles_repo " . db_format_array_where_clause_sql($filter, "AND", "WHERE"); -+ -+ $sql = "SELECT * -+ FROM tfiles_repo -+ " . db_format_array_where_clause_sql($filter, "AND", "WHERE"); - $files = db_get_all_rows_sql($sql); -- -+ - if ($files === false) - $files = array(); -- -+ - $user_groups = files_repo_get_user_groups($config['id_user']); -- -+ - $files_data = array(); - foreach ($files as $file) { -- -+ - $file_groups = files_repo_get_file_groups($file['id']); - $permission = files_repo_check_file_acl ($file['id'], $config['id_user'], $file_groups, $user_groups); - if (!$permission) { - continue; - } -- -+ - $data = array(); - $data['name'] = $file['name']; - $data['description'] = $file['description']; -- $data['location'] = $files_repo_path."/".$file['id']."_".$data['name']; -+ $data['location'] = $files_repo_path . "/" . $file['id']."_".$data['name']; - // Size in bytes - $data['size'] = filesize($data['location']); - // Last modification time in unix timestamp -@@ -158,7 +160,7 @@ - $data['hash'] = $file['hash']; - $files_data[$file['id']] = $data; - } -- -+ - if ($count) { - $files_data = count($files_data); - } -Index: extensions/files_repo/files_repo_list.php -=================================================================== ---- extensions/files_repo/files_repo_list.php (revision 10314) -+++ extensions/files_repo/files_repo_list.php (working copy) -@@ -17,16 +17,19 @@ - - global $config; - --$full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/"; --require_once ($full_extensions_dir."files_repo/functions_files_repo.php"); -+$full_extensions_dir = $config['homedir'] . "/" . EXTENSIONS_DIR . "/"; -+require_once ($full_extensions_dir . -+ "files_repo/functions_files_repo.php"); - - $offset = (int) get_parameter('offset'); - $filter = array(); - $filter['limit'] = $config['block_size']; - $filter['offset'] = $offset; - $filter['order'] = array('field' => 'id', 'order' => 'DESC'); -+ - $files = files_repo_get_files($filter); - -+ - if (!empty($files)) { - - echo "<br>"; -Index: extensions/module_groups.php -=================================================================== ---- extensions/module_groups.php (revision 10314) -+++ extensions/module_groups.php (working copy) -@@ -141,7 +141,8 @@ - GROUP BY estado"; - break; - case "postgresql": -- $sql = "SELECT COUNT(id_agente) AS count, case utimestamp when 0 then 5 else estado end as estado -+ $sql = "SELECT COUNT(id_agente) AS count, -+ case utimestamp when 0 then 5 else estado end as estado - FROM tagente_estado - WHERE id_agente IN - (SELECT id_agente FROM tagente WHERE id_grupo = %d AND disabled = 0) -@@ -149,7 +150,7 @@ - (SELECT id_agente_modulo - FROM tagente_modulo - WHERE id_module_group = %d AND disabled = 0 AND delete_pending = 0) -- GROUP BY estado"; -+ GROUP BY estado, utimestamp"; - break; - case "oracle": - $sql = "SELECT COUNT(id_agente) AS count, case when utimestamp = 0 then 5 else estado end estado -@@ -185,7 +186,8 @@ - //Metaobject use in html_print_table - $table = null; - $table->align[0] = 'right'; //Align to right the first column. -- $table->style[0] = 'color: #ffffff; background-color: #778866; font-weight: bolder;'; -+ $table->style[0] = 'color: #ffffff; '. -+ 'background-color: #778866; font-weight: bolder;'; - $table->head = $head; - $table->width = '98%'; - -@@ -201,7 +203,7 @@ - - foreach ($modelGroups as $idModelGroup => $modelGroup) { - $fired = false; -- $query = sprintf($sql,$idAgentGroup, $idModelGroup); -+ $query = sprintf($sql, $idAgentGroup, $idModelGroup); - - $rowsDB = db_get_all_rows_sql ($query); - -Index: extensions/files_repo.php -=================================================================== ---- extensions/files_repo.php (revision 10314) -+++ extensions/files_repo.php (working copy) -@@ -18,12 +18,14 @@ - function pandora_files_repo_install () { - global $config; - -+ - if (isset($config['files_repo_installed'])) { - if ($config['files_repo_installed'] == 1) { - return; - } - } -- -+ -+ - $full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/"; - $full_sql_dir = $full_extensions_dir."files_repo/sql/"; - -@@ -40,6 +42,7 @@ - break; - } - -+ - foreach ($sentences as $sentence) { - if (trim ($sentence) == "") - continue; -@@ -61,22 +64,22 @@ - - switch ($config["dbtype"]) { - case "mysql": -- db_process_sql ('DROP TABLE `tfiles_repo_group`'); -- db_process_sql ('DROP TABLE `tfiles_repo`'); -- db_process_sql ('DELETE FROM `tconfig` -- WHERE `token` LIKE "files_repo_%"'); -+ db_process_sql('DROP TABLE `tfiles_repo_group`'); -+ db_process_sql('DROP TABLE `tfiles_repo`'); -+ db_process_sql('DELETE FROM `tconfig` -+ WHERE `token` LIKE "files_repo_%"'); - break; - case "postgresql": -- db_process_sql ('DROP TABLE `tfiles_repo_group`'); -- db_process_sql ('DROP TABLE `tfiles_repo`'); -- db_process_sql ('DELETE FROM "tconfig" -- WHERE "token" LIKE \'files_repo_%\''); -+ db_process_sql('DROP TABLE "tfiles_repo_group"'); -+ db_process_sql('DROP TABLE "tfiles_repo"'); -+ db_process_sql('DELETE FROM "tconfig" -+ WHERE "token" LIKE \'files_repo_%\''); - break; - case "oracle": -- db_process_sql ('DROP TABLE `tfiles_repo_group`'); -- db_process_sql ('DROP TABLE `tfiles_repo`'); -- db_process_sql ('DELETE FROM tconfig -- WHERE token LIKE \'files_repo_%\''); -+ db_process_sql('DROP TABLE "tfiles_repo_group"'); -+ db_process_sql('DROP TABLE "tfiles_repo"'); -+ db_process_sql('DELETE FROM tconfig -+ WHERE token LIKE \'files_repo_%\''); - break; - } - -@@ -86,11 +89,11 @@ - - function pandora_files_repo_godmode () { - global $config; -- -+ - if (!isset($config['files_repo_installed']) || !$config['files_repo_installed']) { - ui_print_error_message(__('Extension not installed')); - } -- -+ - // ACL Check - check_login (); - if (! check_acl ($config['id_user'], 0, "PM")) { -@@ -98,37 +101,41 @@ - require ("general/noaccess.php"); - return; - } -- -+ - // Header tabs - $godmode['text'] = '<a href="index.php?sec=gextensions&sec2=extensions/files_repo">' - . html_print_image ("images/setup.png", true, array ("title" => __('Administration view'))) - . "</a>"; - $godmode['godmode'] = 1; - $godmode['active'] = 1; -- -+ - $operation['text'] = '<a href="index.php?sec=extensions&sec2=extensions/files_repo">' - . html_print_image ("images/operation.png", true, array ("title" => __('Operation view'))) - . "</a>"; - $operation['operation'] = 1; -- -+ - $onheader = array('godmode' => $godmode, 'operation' => $operation); - // Header - ui_print_page_header (__("Files repository manager"), "images/extensions.png", false, "", true, $onheader); -- -+ - $full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/"; -- require_once ($full_extensions_dir."files_repo/functions_files_repo.php"); -- -+ require_once ($full_extensions_dir . "files_repo/functions_files_repo.php"); -+ - // Directory files_repo check - if (!files_repo_check_directory(true)) { - return; - } -- -+ -+ $server_content_length = 0; -+ if (isset($_SERVER['CONTENT_LENGTH'])) -+ $server_content_length = $_SERVER['CONTENT_LENGTH']; -+ - // Check for an anoying error that causes the $_POST and $_FILES arrays - // were empty if the file is larger than the post_max_size -- if (intval($_SERVER['CONTENT_LENGTH']) > 0 && empty($_POST)) { -+ if (intval($server_content_length) > 0 && empty($_POST)) { - ui_print_error_message(__('The file exceeds the maximum size')); - } -- -+ - // GET and POST parameters - $file_id = (int) get_parameter ("file_id"); - $add_file = (bool) get_parameter ("add_file"); -@@ -144,7 +151,7 @@ - $description = mb_substr($description, 0, 200, "UTF-8"); - } - $description = io_safe_input($description); -- -+ - if ($add_file) { - $result = files_repo_add_file("upfile", $description, $groups, $public); - } elseif ($update_file) { -@@ -163,7 +170,7 @@ - } - $file_id = 0; - } -- -+ - // FORM - require ($full_extensions_dir."files_repo/files_repo_form.php"); - if (!$file_id) { -@@ -175,7 +182,7 @@ - - function pandora_files_repo_operation () { - global $config; -- -+ - // Header tabs - $onheader = array(); - if (check_acl($config['id_user'], 0, "PM")) { -@@ -194,18 +201,19 @@ - } - // Header - ui_print_page_header (__("Files repository"), "images/extensions.png", false, "", false, $onheader); -- -+ - $full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/"; - require_once ($full_extensions_dir."files_repo/functions_files_repo.php"); -- -+ - // Directory files_repo check - if (!files_repo_check_directory(true)) { - return; - } -- -+ - // LIST - $full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/"; -- require ($full_extensions_dir."files_repo/files_repo_list.php"); -+ -+ require ($full_extensions_dir . "files_repo/files_repo_list.php"); - } - - extensions_add_operation_menu_option(__('Files repository'), null, null, "v1r1"); -Index: operation/incidents/incident.php -=================================================================== ---- operation/incidents/incident.php (revision 10314) -+++ operation/incidents/incident.php (working copy) -@@ -25,7 +25,8 @@ - } - - // Header --ui_print_page_header (__('Incident management'), "images/book_edit.png", false, "", false, ""); -+ui_print_page_header (__('Incident management'), -+ "images/book_edit.png", false, "", false, ""); - - // Take input parameters - -@@ -197,7 +198,7 @@ - ORDER BY actualizacion DESC OFFSET ".$offset." LIMIT ".$config["block_size"]; - $count_sql = "SELECT count(*) FROM tincidencia WHERE - id_grupo IN (".implode (",",array_keys ($groups)).")".$filter; -- breka; -+ break; - } - - $result = db_get_all_rows_sql ($sql); -@@ -250,11 +251,14 @@ - $agents_incidents = array(); - } - --foreach ($agents_incidents as $agent_incident){ -+$result_agent_incidents = array(); -+foreach ($agents_incidents as $agent_incident) { - $result_agent_incidents[$agent_incident['id_agente']] = $agent_incident['nombre']; - } - --html_print_select ($result_agent_incidents, "agent_search", $agent_search, 'javascript:this.form.submit();', __('All agents'), "", false, false, false, "w155"); -+html_print_select ($result_agent_incidents, "agent_search", -+ $agent_search, 'javascript:this.form.submit();', __('All agents'), -+ "", false, false, false, "w155"); - - echo '</td></tr><tr><td colspan=3>'; - -Index: operation/tree.php -=================================================================== ---- operation/tree.php (revision 10314) -+++ operation/tree.php (working copy) -@@ -72,7 +72,7 @@ - } - if ($printAlertsTable) { - $id_module = get_parameter('id_module'); -- -+ - if (defined ('METACONSOLE')) { - $server = metaconsole_get_connection ($server_name); - metaconsole_connect($server); -@@ -86,7 +86,7 @@ - } - if ($printModuleTable) { - $id_module = get_parameter('id_module'); -- -+ - if (defined ('METACONSOLE')) { - $server = metaconsole_get_connection ($server_name); - metaconsole_connect($server); -@@ -139,7 +139,8 @@ - } - $avariableGroups = users_get_groups(); - $avariableGroupsIds = array_keys($avariableGroups); -- $sql = treeview_getFirstBranchSQL ($type, $id, $avariableGroupsIds, $statusSel, $search_free); -+ $sql = treeview_getFirstBranchSQL ($type, $id, -+ $avariableGroupsIds, $statusSel, $search_free); - if ($sql === false) { - $server_rows = array (); - } -@@ -437,7 +438,7 @@ - "id=" . $row["id_agente_modulo"]; - } - echo "<a href='javascript: show_module_detail_dialog(" . $row["id_agente_modulo"] . ", ". $row['id_agente'].", \"" . $server_name . "\", 0, 86400)'>". html_print_image ("images/binary.png", true, array ("style" => 'vertical-align: middle;', "border" => "0" )) . "</a>"; -- -+ - echo " "; - - $nmodule_alerts = db_get_value_sql(sprintf("SELECT count(*) FROM talert_template_modules WHERE id_agent_module = %s", $row["id_agente_modulo"])); -@@ -525,35 +526,44 @@ - } - - $module_tab = array('text' => "<a href='index.php?extension_in_menu=estado&sec=estado&sec2=operation/tree&refr=0&sort_by=module'>" -- . html_print_image ("images/brick.png", true, array ("title" => __('Modules'))) . "</a>", 'active' => $activeTab == "module"); -+ . html_print_image("images/brick.png", -+ true, -+ array("title" => __('Modules'))) . "</a>", -+ 'active' => $activeTab == "module"); - - $tags_tab = array('text' => "<a href='index.php?&sec=monitoring&sec2=operation/tree&refr=0&sort_by=tag&pure=$pure'>" -- . html_print_image ("images/tag.png", true, array ("title" => __('Tags'))) . "</a>", 'active' => $activeTab == "tag"); -- -+ . html_print_image("images/tag.png", -+ true, -+ array("title" => __('Tags'))) . "</a>", -+ 'active' => $activeTab == "tag"); -+ - switch ($activeTab) { - case 'group': -- $order = __('groups'); -+ $order = __('groups'); - break; - case 'module_group': -- $order = __('module groups'); -+ $order = __('module groups'); - break; - case 'policies': -- $order = __('policies'); -+ $order = __('policies'); - break; - case 'module': -- $order = __('modules'); -+ $order = __('modules'); - break; - case 'os': -- $order = __('OS'); -+ $order = __('OS'); - break; - case 'tag': -- $order = __('tags'); -+ $order = __('tags'); - break; - } - - if (! defined ('METACONSOLE')) { - $onheader = array('tag' => $tags_tab, 'os' => $os_tab, 'group' => $group_tab, 'module_group' => $module_group_tab, 'policies' => $policies_tab, 'module' => $module_tab); -- ui_print_page_header (__('Tree view')." - ".__('Sort the agents by ') .$order, "images/extensions.png", false, "", false, $onheader); -+ ui_print_page_header( -+ __('Tree view') . " - " . __('Sort the agents by ') . $order, -+ "images/extensions.png", -+ false, "", false, $onheader); - } - else { - -@@ -569,7 +579,7 @@ - if ($config['enable_tags_tree']) { - $allowed_tabs[] = 'tag'; - } -- -+ - if (!in_array($activeTab, $allowed_tabs)) { - db_pandora_audit("HACK Attempt", - "Trying to access to not allowed tab on tree view"); -@@ -577,17 +587,19 @@ - exit; - } - // End of tab check -- -+ - $group_tab = array('text' => "<a href='index.php?sec=monitoring&sec2=operation/tree&refr=0&tab=group&pure=$pure'>" - . html_print_image ("images/group.png", true, array ("title" => __('Groups'))) . "</a>", - 'active' => $activeTab == "group"); - - $subsections['group'] = $group_tab; -- -- if($config['enable_tags_tree']) { -- $tags_tab = array('text' => "<a href='index.php?&sec=monitoring&sec2=operation/tree&refr=0&tab=tag&pure=$pure'>" -- . html_print_image ("images/tag.png", true, array ("title" => __('Tags'))) . "</a>", 'active' => $activeTab == "tag"); - -+ if ($config['enable_tags_tree']) { -+ $tags_tab = array( -+ 'text' => "<a href='index.php?&sec=monitoring&sec2=operation/tree&refr=0&tab=tag&pure=$pure'>" . -+ html_print_image ("images/tag.png", true, array ("title" => __('Tags'))) . "</a>", -+ 'active' => $activeTab == "tag"); -+ - $subsections['tag'] = $tags_tab; - } - -@@ -649,6 +661,7 @@ - - treeview_printTree($activeTab); - -+ - enterprise_hook('close_meta_frame'); - - ui_include_time_picker(); -@@ -672,10 +685,14 @@ - * id_father int use in js and ajax php, its useful when you have a two subtrees with same agent for diferent each one - */ - function loadSubTree(type, div_id, less_branchs, id_father, server_name) { -- hiddenDiv = $('#tree_div'+id_father+'_'+type+'_'+div_id).attr('hiddenDiv'); -- loadDiv = $('#tree_div'+id_father+'_'+type+'_'+div_id).attr('loadDiv'); -- pos = parseInt($('#tree_image'+id_father+'_'+type+'_'+div_id).attr('pos_tree')); -+ hiddenDiv = $('#tree_div' + id_father + '_' + type + '_' + div_id) -+ .attr('hiddenDiv'); -+ loadDiv = $('#tree_div' + id_father + '_' + type + '_' + div_id) -+ .attr('loadDiv'); - -+ pos = parseInt($('#tree_image' + id_father + '_' + type + '_' + div_id) -+ .attr('pos_tree')); -+ - //If has yet ajax request running - if (loadDiv == 2) - return; -@@ -683,8 +700,10 @@ - if (loadDiv == 0) { - - //Put an spinner to simulate loading process -- $('#tree_div'+id_father+'_'+type+'_'+div_id).html("<img style='padding-top:10px;padding-bottom:10px;padding-left:20px;' src=images/spinner.gif>"); -- $('#tree_div'+id_father+'_'+type+'_'+div_id).show('normal'); -+ $('#tree_div' + id_father + '_' + type + '_' + div_id) -+ .html("<img style='padding-top:10px;padding-bottom:10px;padding-left:20px;' src=images/spinner.gif>"); -+ $('#tree_div' + id_father + '_' + type + '_' + div_id) -+ .show('normal'); - - $('#tree_div'+id_father+'_'+type+'_'+div_id).attr('loadDiv', 2); - $.ajax({ -Index: operation/search_modules.getdata.php -=================================================================== ---- operation/search_modules.getdata.php (revision 10314) -+++ operation/search_modules.getdata.php (working copy) -@@ -108,7 +108,7 @@ - ) - ) - ) AND -- t1.nombre COLLATE utf8_general_ci LIKE \'%' . $stringSearchSQL . '%\' OR -+ t1.nombre LIKE \'%' . $stringSearchSQL . '%\' OR - t3.nombre LIKE \'%' . $stringSearchSQL . '%\''; - break; - case "oracle": -Index: operation/search_main.php -=================================================================== ---- operation/search_main.php (revision 10314) -+++ operation/search_main.php (working copy) -@@ -44,6 +44,7 @@ - $table->style[9] = 'font-weight: bold; text-align: center;'; - $table->style[10] = 'font-weight: bold; text-align: center;'; - $table->style[11] = 'font-weight: bold; text-align: center;'; -+$table->style[13] = 'font-weight: bold; text-align: center;'; - - $table->data[0][0] = html_print_image ("images/agent.png", true, array ("title" => __('Agents found'))); - $table->data[0][1] = "<a href='index.php?search_category=agents&keywords=".$keyword."&head_search_keywords=Search'>" . -Index: operation/events/events_list.php -=================================================================== ---- operation/events/events_list.php (revision 10314) -+++ operation/events/events_list.php (working copy) -@@ -52,7 +52,7 @@ - $event_filter['tag_with'] = base64_encode(io_safe_output($event_filter['tag_with'])); - $event_filter['tag_without'] = base64_encode(io_safe_output($event_filter['tag_without'])); - -- echo json_encode($event_filter); -+ echo io_json_mb_encode($event_filter); - } - - // Saves an event filter -@@ -69,8 +69,8 @@ - $values['event_view_hr'] = get_parameter('event_view_hr'); - $values['id_user_ack'] = get_parameter('id_user_ack'); - $values['group_rep'] = get_parameter('group_rep'); -- $values['tag_with'] = get_parameter('tag_with', json_encode(array())); -- $values['tag_without'] = get_parameter('tag_without', json_encode(array())); -+ $values['tag_with'] = get_parameter('tag_with', io_json_mb_encode(array())); -+ $values['tag_without'] = get_parameter('tag_without', io_json_mb_encode(array())); - $values['filter_only_alert'] = get_parameter('filter_only_alert'); - $values['id_group_filter'] = get_parameter('id_group_filter'); - -@@ -97,8 +97,8 @@ - $values['event_view_hr'] = get_parameter('event_view_hr'); - $values['id_user_ack'] = get_parameter('id_user_ack'); - $values['group_rep'] = get_parameter('group_rep'); -- $values['tag_with'] = get_parameter('tag_with', json_encode(array())); -- $values['tag_without'] = get_parameter('tag_without', json_encode(array())); -+ $values['tag_with'] = get_parameter('tag_with', io_json_mb_encode(array())); -+ $values['tag_without'] = get_parameter('tag_without', io_json_mb_encode(array())); - $values['filter_only_alert'] = get_parameter('filter_only_alert'); - $values['id_group_filter'] = get_parameter('id_group_filter'); - -@@ -116,7 +116,7 @@ - if ($get_event_filters) { - $event_filter = events_get_event_filter_select(); - -- echo json_encode($event_filter); -+ echo io_json_mb_encode($event_filter); - } - - return; -@@ -195,14 +195,14 @@ - $table->class = 'databox'; - $table->styleTable = 'font-weight: bold; color: #555; text-align:left;'; - $table->style[0] = 'width: 50%; width:50%;'; -- -+ - $data = array(); - $table->rowid[0] = 'update_save_selector'; - $data[0] = html_print_radio_button('filter_mode', 'new', '', true, true) . __('New filter') . '<br><br>'; - $data[1] = html_print_radio_button('filter_mode', 'update', '', false, true) . __('Update filter') . '<br><br>'; - $table->data[] = $data; - $table->rowclass[] = ''; -- -+ - $data = array(); - $table->rowid[1] = 'save_filter_row1'; - $data[0] = __('Filter name') . '<br>'; -@@ -212,7 +212,7 @@ - $data[1] .= html_print_select_groups($config["id_user"], "ER", users_can_manage_group_all(), 'id_group', $id_group, '', '', 0, true, false, false, 'w130'); - $table->data[] = $data; - $table->rowclass[] = ''; -- -+ - $data = array(); - $table->rowid[2] = 'save_filter_row2'; - $data[0] = html_print_submit_button (__('Save filter'), 'save_filter', false, 'class="sub upd"', true); -@@ -220,18 +220,18 @@ - $table->cellstyle[2][0] = 'text-align:right;'; - $table->data[] = $data; - $table->rowclass[] = ''; -- -+ - $data = array(); - $table->rowid[3] = 'update_filter_row1'; - $data[0] = __("Overwrite filter") . '<br>'; - # Fix : Only admin user can see filters of group ALL for update - $_filters_update = events_get_event_filter_select(false); -- -+ - $data[0] .= html_print_select ($_filters_update, "overwrite_filter", '', '', '', 0, true); - $data[1] = html_print_submit_button (__('Update filter'), 'update_filter', false, 'class="sub upd"', true); - $table->data[] = $data; - $table->rowclass[] = ''; -- -+ - html_print_table($table); - unset($table); - echo '</div>'; -@@ -340,7 +340,7 @@ - if ($open_filter) { - $events_filter .= html_print_input_hidden('open_filter', 'true', true); - } --else{ -+else { - $events_filter .= html_print_input_hidden('open_filter', 'false', true); - } - -@@ -414,8 +414,18 @@ - $table_advanced->rowclass[] = ''; - - $data = array(); --$data[0] = '<fieldset class="databox" style="width: 310px;"><legend>' . __('Events with following tags') . '</legend>' . html_print_table($tabletags_with, true) . '</fieldset>'; --$data[1] = '<fieldset class="databox" style="width: 310px;"><legend>' . __('Events without following tags') . '</legend>' . html_print_table($tabletags_without, true) . '</fieldset>'; -+$data[0] = '<fieldset class="databox" style="width: 310px;">' . -+ '<legend>' . -+ __('Events with following tags') . -+ '</legend>' . -+ html_print_table($tabletags_with, true) . -+ '</fieldset>'; -+$data[1] = '<fieldset class="databox" style="width: 310px;">' . -+ '<legend>' . -+ __('Events without following tags') . -+ '</legend>' . -+ html_print_table($tabletags_without, true) . -+ '</fieldset>'; - $table_advanced->data[] = $data; - $table_advanced->rowclass[] = ''; - -@@ -536,9 +546,15 @@ - - //Extract the events by filter (or not) from db - $result = db_get_all_rows_sql ($sql); -+ - } - else { -- $result = events_get_events_grouped($sql_post, $offset, $pagination, $meta, $history); -+ $result = events_get_events_grouped( -+ $sql_post, -+ $offset, -+ $pagination, -+ $meta, -+ $history); - } - - if (!empty($result)) { -Index: operation/events/events.php -=================================================================== ---- operation/events/events.php (revision 10314) -+++ operation/events/events.php (working copy) -@@ -172,7 +172,7 @@ - $return = array('fired' => 0); - } - -- echo json_encode($return); -+ echo io_json_mb_encode($return); - } - - return; -Index: operation/search_agents.getdata.php -=================================================================== ---- operation/search_agents.getdata.php (revision 10314) -+++ operation/search_agents.getdata.php (working copy) -@@ -173,7 +173,7 @@ - AND ( - t1.nombre LIKE '%%" . $stringSearchSQL . "%%' OR - t2.nombre LIKE '%%" . $stringSearchSQL . "%%' OR -- t1.direction LIKE '%%" . $stringSearchSQL . "%%' -+ t1.direccion LIKE '%%" . $stringSearchSQL . "%%' - ) - "; - break; -Index: operation/search_results.php -=================================================================== ---- operation/search_results.php (revision 10314) -+++ operation/search_results.php (working copy) -@@ -58,7 +58,9 @@ - - if ($searchMain) { - $main_tab = array('text' => "<a href='index.php?search_category=main&keywords=".$config['search_keywords']."&head_search_keywords=Search'>" -- . html_print_image ("images/zoom_mc.png", true, array ("title" => __('Global search'))) . "</a>", 'active' => $searchTab == "main"); -+ . html_print_image ("images/zoom_mc.png", true, -+ array ("title" => __('Global search'))) . "</a>", -+ 'active' => $searchTab == "main"); - } - else { - $main_tab = ''; -@@ -66,7 +68,9 @@ - - if ($searchAgents) { - $agents_tab = array('text' => "<a href='index.php?search_category=agents&keywords=".$config['search_keywords']."&head_search_keywords=Search'>" -- . html_print_image ("images/op_monitoring.png", true, array ("title" => __('Agents'))) . "</a>", 'active' => $searchTab == "agents"); -+ . html_print_image ("images/op_monitoring.png", true, -+ array ("title" => __('Agents'))) . "</a>", -+ 'active' => $searchTab == "agents"); - } - else { - $agents_tab = ''; -@@ -74,7 +78,9 @@ - - if ($searchUsers) { - $users_tab = array('text' => "<a href='index.php?search_category=users&keywords=".$config['search_keywords']."&head_search_keywords=Search'>" -- . html_print_image ("images/op_workspace.png", true, array ("title" => __('Users'))) . "</a>", 'active' => $searchTab == "users"); -+ . html_print_image ("images/op_workspace.png", true, -+ array ("title" => __('Users'))) . "</a>", -+ 'active' => $searchTab == "users"); - } - else { - $users_tab = ''; -@@ -82,7 +88,9 @@ - - if ($searchAlerts) { - $alerts_tab = array('text' => "<a href='index.php?search_category=alerts&keywords=".$config['search_keywords']."&head_search_keywords=Search'>" -- . html_print_image ("images/op_alerts.png", true, array ("title" => __('Alerts'))) . "</a>", 'active' => $searchTab == "alerts"); -+ . html_print_image ("images/op_alerts.png", true, -+ array ("title" => __('Alerts'))) . "</a>", -+ 'active' => $searchTab == "alerts"); - } - else { - $alerts_tab = ''; -@@ -90,7 +98,9 @@ - - if ($searchGraphs) { - $graphs_tab = array('text' => "<a href='index.php?search_category=graphs&keywords=".$config['search_keywords']."&head_search_keywords=Search'>" -- . html_print_image ("images/chart.png", true, array ("title" => __('Graphs'))) . "</a>", 'active' => $searchTab == "graphs"); -+ . html_print_image ("images/chart.png", true, -+ array ("title" => __('Graphs'))) . "</a>", -+ 'active' => $searchTab == "graphs"); - } - else { - $graphs_tab = ''; -@@ -98,7 +108,9 @@ - - if ($searchReports) { - $reports_tab = array('text' => "<a href='index.php?search_category=reports&keywords=".$config['search_keywords']."&head_search_keywords=Search'>" -- . html_print_image ("images/op_reporting.png", true, array ("title" => __('Reports'))) . "</a>", 'active' => $searchTab == "reports"); -+ . html_print_image ("images/op_reporting.png", true, -+ array ("title" => __('Reports'))) . "</a>", -+ 'active' => $searchTab == "reports"); - } - else { - $reports_tab = ''; -@@ -106,7 +118,9 @@ - - if ($searchMaps) { - $maps_tab = array('text' => "<a href='index.php?search_category=maps&keywords=".$config['search_keywords']."&head_search_keywords=Search'>" -- . html_print_image ("images/visual_console.png", true, array ("title" => __('Maps'))) . "</a>", 'active' => $searchTab == "maps"); -+ . html_print_image ("images/visual_console.png", true, -+ array ("title" => __('Maps'))) . "</a>", -+ 'active' => $searchTab == "maps"); - } - else { - $maps_tab = ''; -@@ -114,7 +128,9 @@ - - if ($searchModules) { - $modules_tab = array('text' => "<a href='index.php?search_category=modules&keywords=".$config['search_keywords']."&head_search_keywords=Search'>" -- . html_print_image ("images/brick.png", true, array ("title" => __('Modules'))) . "</a>", 'active' => $searchTab == "modules"); -+ . html_print_image ("images/brick.png", true, -+ array ("title" => __('Modules'))) . "</a>", -+ 'active' => $searchTab == "modules"); - } - else { - $modules_tab = ''; -@@ -135,6 +151,7 @@ - switch ($searchTab) { - case 'main': - $only_count = true; -+ - require_once('search_agents.getdata.php'); - require_once('search_agents.php'); - require_once('search_users.getdata.php'); -Index: operation/agentes/status_monitor.php -=================================================================== ---- operation/agentes/status_monitor.php (revision 10314) -+++ operation/agentes/status_monitor.php (working copy) -@@ -14,8 +14,6 @@ - // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - // GNU General Public License for more details. - -- -- - // Load global vars - global $config; - -@@ -45,6 +43,8 @@ - ui_meta_print_header(__("Monitor view")); - } - -+ -+ - $ag_freestring = get_parameter ('ag_freestring'); - $ag_modulename = (string) get_parameter ('ag_modulename'); - if (!defined('METACONSOLE')) { -@@ -101,9 +101,13 @@ - - $sql_conditions = " AND tagente_modulo.disabled = 0 AND tagente.disabled = 0"; - -+if (is_numeric($ag_group)) { -+ $id_ag_group = 0; -+} -+else { -+ $id_ag_group = db_get_value('id_grupo', 'tgrupo', 'nombre', $ag_group); -+} - --$id_ag_group = db_get_value('id_grupo', 'tgrupo', 'nombre', $ag_group); -- - // Agent group selector - if (!defined('METACONSOLE')) { - if ($ag_group > 0 && check_acl ($config["id_user"], $ag_group, "AR")) { -@@ -123,6 +127,7 @@ - $sql_conditions_group = " AND tagente.id_grupo IN (".$user_groups.")"; - } - } -+ - // Module group - if (defined('METACONSOLE')) { - if ($modulegroup != '-1') -@@ -198,7 +203,7 @@ - WHERE ttag_module.id_tag IN (SELECT id_tag FROM ttag where name LIKE '%" . $tag_filter . "%') - )"; - } -- else{ -+ else { - $sql_conditions .= " AND tagente_modulo.id_agente_modulo IN ( - SELECT ttag_module.id_agente_modulo - FROM ttag_module -@@ -310,7 +315,9 @@ - if (defined('METACONSOLE')) { - - // For each server defined and not disabled: -- $servers = db_get_all_rows_sql ("SELECT * FROM tmetaconsole_setup WHERE disabled = 0"); -+ $servers = db_get_all_rows_sql ("SELECT * -+ FROM tmetaconsole_setup -+ WHERE disabled = 0"); - - if ($servers === false) - $servers = array(); -@@ -727,8 +734,15 @@ - LIMIT ".$offset.",".$limit_sql; - break; - case "postgresql": -+ if (strstr($config['dbversion'], "8.4") !== false) { -+ $string_agg = "array_to_string(array_agg(ttag.name), ',')"; -+ } -+ else { -+ $string_agg = "STRING_AGG(ttag.name, ',')"; -+ } -+ - $sql = "SELECT -- (SELECT STRING_AGG(ttag.name, ',') -+ (SELECT " . $string_agg . " - FROM ttag - WHERE ttag.id_tag IN ( - SELECT ttag_module.id_tag -@@ -760,7 +774,10 @@ - tagente_modulo.critical_instructions, - tagente_modulo.warning_instructions, - tagente_modulo.unknown_instructions, -- tagente_estado.utimestamp AS utimestamp".$sql_form . $sql_conditions_all." LIMIT " . $limit_sql . " OFFSET " . $offset; -+ tagente_estado.utimestamp AS utimestamp" . -+ $sql_from . -+ $sql_conditions_all . -+ " LIMIT " . $limit_sql . " OFFSET " . $offset; - break; - case "oracle": - $set = array(); -@@ -799,7 +816,9 @@ - tagente_modulo.critical_instructions, - tagente_modulo.warning_instructions, - tagente_modulo.unknown_instructions, -- tagente_estado.utimestamp AS utimestamp" . $sql_form . $sql_conditions_all; -+ tagente_estado.utimestamp AS utimestamp" . -+ $sql_from . -+ $sql_conditions_all; - $sql = oracle_recode_query ($sql, $set); - break; - } -Index: operation/agentes/alerts_status.php -=================================================================== ---- operation/agentes/alerts_status.php (revision 10314) -+++ operation/agentes/alerts_status.php (working copy) -@@ -258,7 +258,8 @@ - - - $alerts = array(); --$options_simple = array('offset' => $offset_simple, 'limit' => $config['block_size'], 'order' => $order); -+$options_simple = array('offset' => $offset_simple, -+ 'limit' => $config['block_size'], 'order' => $order); - - $filter_alert = array(); - if($filter_standby == 'standby_on') { -@@ -322,11 +323,11 @@ - } - - if ($tab != null) { -- $url = $url.'&tab='.$tab; -+ $url = $url.'&tab=' . $tab; - } - - if ($pure) { -- $url .= '&pure='.$pure; -+ $url .= '&pure=' . $pure; - } - - // Filter form -@@ -345,13 +346,17 @@ - if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { - if ($print_agent) { - if (!defined('METACONSOLE')) { -- $table->head[0] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>"; -+ $table->head[0] = "<span title='" . __('Policy') . "'>" . -+ __('P.') . "</span>"; - } - -- $table->head[1] = "<span title='" . __('Standby') . "'>" . __('S.') . "</span>"; -+ $table->head[1] = "<span title='" . __('Standby') . "'>" . -+ __('S.') . "</span>"; - - if (!defined('METACONSOLE')) { -- $table->head[2] = "<span title='" . __('Force execution') . "'>" . __('F.') . "</span>"; -+ $table->head[2] = -+ "<span title='" . __('Force execution') . "'>" . -+ __('F.') . "</span>"; - } - - $table->head[3] = __('Agent'); -@@ -481,6 +486,12 @@ - } - } - -+ -+if ($sortField) { -+ $url .= '&sort_field=' . $sortField; -+ $url .= '&sort=' . $sort; -+} -+ - $table->data = array (); - - $rowPair = true; -@@ -496,9 +507,10 @@ - } - - if (!empty ($table->data)) { -- echo '<form method="post" action="'.$url.'">'; -+ echo '<form method="post" action="' . $url . '">'; - -- ui_pagination ($countAlertsSimple, $url, $offset_simple, 0, false, 'offset_simple'); -+ ui_pagination ($countAlertsSimple, $url, $offset_simple, 0, false, -+ 'offset_simple'); - html_print_table ($table); - - if (!defined('METACONSOLE')) { -Index: operation/agentes/estado_generalagente.php -=================================================================== ---- operation/agentes/estado_generalagente.php (revision 10314) -+++ operation/agentes/estado_generalagente.php (working copy) -@@ -255,7 +255,7 @@ - else { - $data[1] = __('Enabled'); - } -- -+ - $table_data->data[] = $data; - } - -@@ -323,7 +323,7 @@ - WHERE estado IN (0,1) - AND id_agent=$id_agente - ORDER BY actualizacion DESC"); -- -+ - if ($last_incident != false) { - - $table_incident->id = 'agent_incident_main'; -@@ -333,10 +333,10 @@ - $table_incident->class = 'databox'; - $table_incident->style[0] = 'width: 30%;'; - $table_incident->style[1] = 'width: 70%;'; -- -+ - $table_incident->head[0] = ' <span>' . '<a href="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id='.$last_incident["id_incidencia"].'">' .__('Active incident on this agent') .'</a>'. '</span>'; - $table_incident->head_colspan[0] = 2; -- -+ - $data = array(); - $data[0] = '<b>' . __('Author') . '</b>'; - $data[1] = $last_incident["id_creator"]; -@@ -391,20 +391,20 @@ - $table_interface->head_colspan = array(); - $table_interface->head_colspan[0] = 4; - $table_interface->data = array(); -- -+ - foreach ($modules as $key => $module) { -- -+ - // Trying to get the interface name from the module name - if (preg_match ("/_(.+)$/", (string)$module['nombre'], $matches)) { - if ($matches[1]) { - $interface_name = $matches[1]; -- -+ - $module_id = $module['id_agente_modulo']; - $db_status = modules_get_agentmodule_status($module_id); - $module_value = modules_get_last_value ($module_id); - modules_get_status($module_id, $db_status, $module_value, $status, $title); - $status = ui_print_status_image($status, $title, true); -- -+ - $ip_target = "--"; - // Trying to get something like an IP from the description - if (preg_match ("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", (string)$module['descripcion'], $matches) || -@@ -421,7 +421,7 @@ - $description = $matches[0]; - } - } -- -+ - $data = array(); - $data[0] = "<strong>" . $interface_name . "</strong>"; - $data[1] = $status; -@@ -432,7 +432,7 @@ - } - } - unset($modules); -- -+ - // This javascript piece of code is used to make expandible the body of the table - ?> - <script type="text/javascript"> -@@ -477,7 +477,11 @@ - '</fieldset>'; - - // ACCESS RATE GRAPH --if ($config["agentaccess"]) { -+$access_agent = db_get_value_sql("SELECT COUNT(id_agent) -+ FROM tagent_access -+ WHERE id_agent = " . $id_agente); -+ -+if ($config["agentaccess"] && $access_agent > 0) { - $data[0] .= '<fieldset class="databox" style="position: static;"> - <legend style="text-align:left; color: #666;">' . - __('Agent access rate (24h)') . -Index: operation/agentes/networkmap.topology.php -=================================================================== ---- operation/agentes/networkmap.topology.php (revision 10314) -+++ operation/agentes/networkmap.topology.php (working copy) -@@ -39,7 +39,7 @@ - $graph = networkmap_generate_dot(__('Pandora FMS'), $group, $simple, - $font_size, $layout, $nooverlap, $zoom, $ranksep, $center, $regen, - $pure, $id_networkmap, $show_snmp_modules, true, true, -- $text_filter, $l2_network); -+ $text_filter, $l2_network, null, $dont_show_subgroups); - - if ($graph === false) { - ui_print_error_message (__('Map could not be generated')); -@@ -79,9 +79,18 @@ - } - else { - fwrite ($fh, $graph); -- $graphviz_path = ($config['graphviz_bin_dir']) ? io_safe_output($config['graphviz_bin_dir']."/") : ""; -- $cmd = escapeshellarg($graphviz_path.$filter) . " -Tcmapx " . escapeshellarg("-o$filename_map") . " -Tpng ". escapeshellarg("-o$filename_img") . " " . escapeshellarg($filename_dot); -+ -+ $graphviz_path = (isset($config['graphviz_bin_dir'])) ? -+ io_safe_output($config['graphviz_bin_dir'] . "/") -+ : -+ ""; -+ -+ $cmd = escapeshellarg($graphviz_path . $filter) . -+ " -Tcmapx " . escapeshellarg("-o$filename_map") . -+ " -Tpng ". escapeshellarg("-o$filename_img") . -+ " " . escapeshellarg($filename_dot); - $result = system ($cmd); -+ - fclose ($fh); - unlink ($filename_dot); - //~ html_debug_print($cmd); -Index: operation/agentes/estado_agente.php -=================================================================== ---- operation/agentes/estado_agente.php (revision 10314) -+++ operation/agentes/estado_agente.php (working copy) -@@ -223,18 +223,31 @@ - $selectLastContactDown = ''; - $order = null; - -+ -+$order_collation = ""; -+switch ($config["dbtype"]) { -+ case "mysql": -+ $order_collation = " COLLATE utf8_general_ci"; -+ break; -+ case "postgresql": -+ case "oracle": -+ $order_collation = ""; -+ break; -+} -+ -+ - switch ($sortField) { - case 'name': - switch ($sort) { - case 'up': - $selectNameUp = $selected; -- $order = array('field' => 'nombre COLLATE utf8_general_ci', -- 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC'); -+ $order = array('field' => 'nombre' . $order_collation, -+ 'field2' => 'nombre' . $order_collation, 'order' => 'ASC'); - break; - case 'down': - $selectNameDown = $selected; -- $order = array('field' => 'nombre COLLATE utf8_general_ci', -- 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC'); -+ $order = array('field' => 'nombre' . $order_collation, -+ 'field2' => 'nombre' . $order_collation, 'order' => 'DESC'); - break; - } - break; -@@ -243,12 +256,12 @@ - case 'up': - $selectOsUp = $selected; - $order = array('field' => 'id_os', -- 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC'); -+ 'field2' => 'nombre' . $order_collation, 'order' => 'ASC'); - break; - case 'down': - $selectOsDown = $selected; - $order = array('field' => 'id_os', -- 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC'); -+ 'field2' => 'nombre' . $order_collation, 'order' => 'DESC'); - break; - } - break; -@@ -257,12 +270,12 @@ - case 'up': - $selectIntervalUp = $selected; - $order = array('field' => 'intervalo', -- 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC'); -+ 'field2' => 'nombre' . $order_collation, 'order' => 'ASC'); - break; - case 'down': - $selectIntervalDown = $selected; - $order = array('field' => 'intervalo', -- 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC'); -+ 'field2' => 'nombre' . $order_collation, 'order' => 'DESC'); - break; - } - break; -@@ -271,12 +284,12 @@ - case 'up': - $selectGroupUp = $selected; - $order = array('field' => 'id_grupo', -- 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC'); -+ 'field2' => 'nombre' . $order_collation, 'order' => 'ASC'); - break; - case 'down': - $selectGroupDown = $selected; - $order = array('field' => 'id_grupo', -- 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC'); -+ 'field2' => 'nombre' . $order_collation, 'order' => 'DESC'); - break; - } - break; -@@ -285,12 +298,12 @@ - case 'up': - $selectLastContactUp = $selected; - $order = array('field' => 'ultimo_contacto', -- 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC'); -+ 'field2' => 'nombre' . $order_collation, 'order' => 'DESC'); - break; - case 'down': - $selectLastContactDown = $selected; - $order = array('field' => 'ultimo_contacto', -- 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC'); -+ 'field2' => 'nombre' . $order_collation, 'order' => 'ASC'); - break; - } - break; -@@ -305,15 +318,15 @@ - $selectGroupDown = ''; - $selectLastContactUp = ''; - $selectLastContactDown = ''; -- $order = array('field' => 'nombre COLLATE utf8_general_ci', -- 'field2' => 'nombre COLLATE utf8_general_ci', -+ $order = array('field' => 'nombre' . $order_collation, -+ 'field2' => 'nombre' . $order_collation, - 'order' => 'ASC'); - break; - } - - $search_sql = ''; - if ($search != "") { -- $search_sql = " AND ( nombre COLLATE utf8_general_ci LIKE '%$search%' OR direccion LIKE '%$search%' OR comentarios LIKE '%$search%') "; -+ $search_sql = " AND ( nombre " . $order_collation . " LIKE '%$search%' OR direccion LIKE '%$search%' OR comentarios LIKE '%$search%') "; - } - - // Show only selected groups -@@ -340,8 +353,9 @@ - array ('COUNT(*) as total'), 'AR', false); - $total_agents = isset ($total_agents[0]['total']) ? $total_agents[0]['total'] : 0; - -+ - $agents = agents_get_agents(array ( -- 'order' => 'nombre COLLATE utf8_general_ci ASC', -+ 'order' => 'nombre ' . $order_collation . ' ASC', - 'id_grupo' => $groups, - 'disabled' => 0, - 'status' => $status, -@@ -354,7 +368,7 @@ - 'id_os', - 'ultimo_contacto', - 'intervalo', -- 'comentarios description', -+ 'comentarios description', - 'quiet', - 'normal_count', - 'warning_count', -Index: operation/agentes/exportdata.php -=================================================================== ---- operation/agentes/exportdata.php (revision 10314) -+++ operation/agentes/exportdata.php (working copy) -@@ -40,10 +40,13 @@ - - switch ($config["dbtype"]) { - case "mysql": -- case "postgresql": - $agents = agents_get_agents( - array('nombre LIKE "' . $agentName . '"'), array ('id_agente')); - break; -+ case "postgresql": -+ $agents = agents_get_agents( -+ array('nombre LIKE \'' . $agentName . '\''), array ('id_agente')); -+ break; - case "oracle": - $agents = agents_get_agents( - array('nombre LIKE \'%' . $agentName . '%\''), array ('id_agente')); -@@ -198,7 +201,7 @@ - $table->data[0][0] = '<b>'.__('Group').'</b>'; - - $groups = users_get_groups ($config['id_user'], "RR", users_can_manage_group_all()); -- -+ - $table->data[0][1] = html_print_select_groups($config['id_user'], - "RR", users_can_manage_group_all(), "group", $group, '', '', 0, true, false, true, - 'w130', false); -Index: operation/agentes/estado_monitores.php -=================================================================== ---- operation/agentes/estado_monitores.php (revision 10314) -+++ operation/agentes/estado_monitores.php (working copy) -@@ -102,6 +102,7 @@ - include_once($config['homedir'] . "/include/functions_modules.php"); - include_once($config['homedir'] . "/include/functions_servers.php"); - include_once($config['homedir'] . "/include/functions_tags.php"); -+include_once($config['homedir'] . "/include/functions_clippy.php"); - - $id_agent = get_parameter('id_agente'); - $url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agent; -@@ -232,7 +233,6 @@ - //Count monitors/modules - switch ($config["dbtype"]) { - case "mysql": -- case "postgresql": - $sql = sprintf(" - SELECT COUNT(*) - FROM tagente_estado, -@@ -246,8 +246,29 @@ - AND %s %s - AND tagente_estado.estado != %d - ORDER BY tagente_modulo.id_module_group , %s %s", -- $id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']); -+ $id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']); - break; -+ case "postgresql": -+ $sql = sprintf(" -+ SELECT COUNT(DISTINCT tagente_modulo.id_module_group) -+ FROM tagente_estado, -+ (SELECT * -+ FROM tagente_modulo -+ WHERE id_agente = %d AND nombre LIKE '%s' -+ AND delete_pending = 0 -+ AND disabled = 0) tagente_modulo -+ LEFT JOIN tmodule_group -+ ON tagente_modulo.id_module_group = tmodule_group.id_mg -+ WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo -+ AND %s %s -+ AND tagente_estado.estado != %d -+ GROUP BY tagente_modulo.id_module_group, -+ tagente_modulo.nombre -+ ORDER BY tagente_modulo.id_module_group , %s %s", -+ $id_agente, $status_text_monitor_sql, $status_filter_sql, -+ $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], -+ $order['order']); -+ break; - case "oracle": - $sql = sprintf (" - SELECT COUNT(*)" . -@@ -265,15 +286,18 @@ - ", $id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']); - break; - } --$count_modules = db_get_all_rows_sql ($sql); --$count_modules = reset($count_modules[0]); - -+$count_modules = db_get_all_rows_sql($sql); -+if (isset($count_modules[0])) -+ $count_modules = reset($count_modules[0]); -+else -+ $count_modules = 0; - -+ - //Get monitors/modules - // Get all module from agent - switch ($config["dbtype"]) { - case "mysql": -- case "postgresql": - $sql = sprintf(" - SELECT * - FROM tagente_estado, -@@ -287,8 +311,24 @@ - AND %s %s - AND tagente_estado.estado != %d - ORDER BY tagente_modulo.id_module_group , %s %s", -- $id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']); -+ $id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']); - break; -+ case "postgresql": -+ $sql = sprintf(" -+ SELECT * -+ FROM tagente_estado, -+ (SELECT * -+ FROM tagente_modulo -+ WHERE id_agente = %d AND nombre LIKE '%s' AND delete_pending = 0 -+ AND disabled = 0) tagente_modulo -+ LEFT JOIN tmodule_group -+ ON tagente_modulo.id_module_group = tmodule_group.id_mg -+ WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo -+ AND %s %s -+ AND tagente_estado.estado != %d -+ ORDER BY tagente_modulo.id_module_group , %s %s", -+ $id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']); -+ break; - // If Dbms is Oracle then field_list in sql statement has to be recoded. See oracle_list_all_field_table() - case "oracle": - $fields_tagente_estado = oracle_list_all_field_table('tagente_estado', 'string'); -@@ -374,6 +414,8 @@ - $id_type_web_content_string = db_get_value('id_tipo', 'ttipo_modulo', - 'nombre', 'web_content_string'); - -+$show_context_help_first_time = false; -+ - foreach ($modules as $module) { - //The code add the row of 1 cell with title of group for to be more organice the list. - -@@ -509,7 +551,15 @@ - modules_get_status($module['id_agente_modulo'], $module['estado'], - $module_value, $status, $title); - -+ - $data[5] = ui_print_status_image($status, $title, true); -+ if (!$show_context_help_first_time) { -+ $show_context_help_first_time = true; -+ -+ if ($module['estado'] == AGENT_MODULE_STATUS_UNKNOWN) { -+ $data[5] .= clippy_context_help("module_unknow"); -+ } -+ } - - - if ($module["id_tipo_modulo"] == 24) { -@@ -633,7 +683,13 @@ - $url = 'include/procesos.php?agente='.$module["id_agente_modulo"]; - $win_handle=dechex(crc32($module["id_agente_modulo"].$module["nombre"])); - -- $link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$module["id_agente_modulo"]."&label=".rawurlencode(urlencode(base64_encode($module["nombre"])))."&refresh=600','day_".$win_handle."')"; -+ # Show events for boolean modules by default. -+ if ($graph_type == 'boolean') { -+ $draw_events = 1; -+ } else { -+ $draw_events = 0; -+ } -+ $link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$module["id_agente_modulo"]."&label=".rawurlencode(urlencode(base64_encode($module["nombre"])))."&refresh=600&draw_events=$draw_events','day_".$win_handle."')"; - - $data[8] .= '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a> '; - $server_name = ''; -@@ -736,7 +792,7 @@ - - var server_name = ''; - var extra_parameters = ''; -- if (period == -1) { -+ if ($('input[name=selection_mode]:checked').val()) { - - period = $('#period').val(); - -Index: operation/agentes/ver_agente.php -=================================================================== ---- operation/agentes/ver_agente.php (revision 10314) -+++ operation/agentes/ver_agente.php (working copy) -@@ -48,7 +48,7 @@ - $recursion = (int) get_parameter ('recursion', 0); - $custom_condition = get_parameter('custom_condition', ''); - $privilege = (string) get_parameter ('privilege', "AR"); -- -+ - // Is is possible add keys prefix to avoid auto sorting in js object conversion - $keys_prefix = (string) get_parameter ('keys_prefix', ''); - $status_agents = (int)get_parameter('status_agents', AGENT_STATUS_ALL); -@@ -142,7 +142,7 @@ - - $groups = users_get_groups ($config["id_user"], "AW", false); - $group_id_list = ($groups ? join(",",array_keys($groups)):"0"); -- -+ - $sql = 'SELECT DISTINCT(t1.nombre) as name - FROM tagente t1, tagente_modulo t2 - WHERE t1.id_agente = t2.id_agente -@@ -156,7 +156,7 @@ - WHERE t3.id_agente = t4.id_agente AND t1.nombre = t3.nombre - AND t4.nombre IN (\'' . implode('\',\'', $nameModules) . '\')) = '.count($nameModules); - } -- -+ - $sql .= ' ORDER BY t1.nombre'; - - $nameAgents = db_get_all_rows_sql($sql); -@@ -468,17 +468,17 @@ - - echo '<strong>'.__('Last contact').':</strong> '.human_time_comparation($agent['ultimo_contacto']).'<br />'; - echo '<strong>'.__('Last remote contact').':</strong> '.human_time_comparation($agent['ultimo_contacto_remoto']).'<br />'; -- -+ - # Fix : Only show agents with module with tags of user profile - $_user_tags = tags_get_user_tags($config['id_user'], 'RR'); -- -+ - $_sql_post = ''; - if ($_user_tags !== false) { -- -+ - $_tags = implode(',', array_keys($_user_tags)); -- -+ - $_sql_post .= ' AND tagente_modulo.id_agente_modulo IN (SELECT a.id_agente_modulo FROM tagente_modulo a, ttag_module b WHERE a.id_agente_modulo=b.id_agente_modulo AND b.id_tag IN (' . $_tags . ')) '; -- -+ - } - - $sql = sprintf ('SELECT tagente_modulo.descripcion, -@@ -488,9 +488,9 @@ - AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo - AND tagente_modulo.disabled = 0 - AND tagente_estado.estado = 1', $id_agent); -- -+ - $sql .= $_sql_post; -- -+ - if ($metaconsole) { - if (metaconsole_connect($server) != NOERR) { - return; -@@ -624,7 +624,7 @@ - if ($modulegroup === false) { - echo __('None').'<br />'; - } -- else{ -+ else { - echo $modulegroup.'<br />'; - } - echo '<strong>'.__('Agent').':</strong> '; -Index: operation/agentes/networkmap.php -=================================================================== ---- operation/agentes/networkmap.php (revision 10314) -+++ operation/agentes/networkmap.php (working copy) -@@ -230,14 +230,14 @@ - $buttons['addmap'] = array('active' => $activeTab == false, - 'text' => '<a href="index.php?sec=network&sec2=operation/agentes/networkmap&add_networkmap=1&tab='.$activeTab.'&pure='.$pure.'">' . - html_print_image("images/add_mc.png", true, array ("title" => __('Add map'))) .'</a>'); -- -+ - if (!$nomaps && $id_networkmap != 0) { - $buttons['deletemap'] = array('active' => $activeTab == false, - 'text' => '<a href="index.php?sec=network&sec2=operation/agentes/networkmap&id_networkmap='.$id_networkmap.'&delete_networkmap=1&tab='.$activeTab.'&pure='.$pure.'">' . - html_print_image("images/delete_mc.png", true, array ("title" => __('Delete map'))) .'</a>'); -- -+ - $buttons['savemap'] = array('active' => $activeTab == false, -- 'text' => '<a href="index.php?sec=network&' . -+ 'text' => '<a href="index.php?sec=network&' . - 'sec2=operation/agentes/networkmap&' . - 'id_networkmap=' . $id_networkmap . '&' . - 'save_networkmap=1&' . -@@ -320,7 +320,7 @@ - - - unset($table); --$table->width = '95%'; -+$table->width = '98%'; - $table->class = 'databox'; - $table->data = array(); - $table->data[0][] = __('Name:') . ' ' . -@@ -329,7 +329,9 @@ - html_print_select_groups(false, 'AR', false, 'group', $group, '', 'All', 0, true); - if ($activeTab == 'groups' || $activeTab == 'policies') { - $table->data[0][] = __('Module group') . ' ' . -- html_print_select_from_sql ('SELECT id_mg, name FROM tmodule_group', 'module_group', $module_group, '', 'All', 0, true); -+ html_print_select_from_sql (' -+ SELECT id_mg, name -+ FROM tmodule_group', 'module_group', $module_group, '', 'All', 0, true); - } - - if ($activeTab == 'topology') { -@@ -411,7 +413,7 @@ - - $table->data[2][] = __('Free text for search (*):') . ' ' . - html_print_input_text('text_filter', $text_filter, '', 30, 100, true); --if ($activeTab == 'groups') { -+if (($activeTab == 'groups') || ($activeTab == 'topology')) { - $table->data[2][] = __('Don\'t show subgroups:') . - ui_print_help_tip(__('Only run with it is filter for any group'), true) . - ' ' . -Index: operation/snmpconsole/snmp_view.php -=================================================================== ---- operation/snmpconsole/snmp_view.php (revision 10314) -+++ operation/snmpconsole/snmp_view.php (working copy) -@@ -48,7 +48,8 @@ - foreach ($user_groups as $id=>$name) { - if ($i == 0) { - $str_user_groups .= $id; -- } else { -+ } -+ else { - $str_user_groups .= ','.$id; - } - $i++; -@@ -336,8 +337,11 @@ - $table->data[4][2] = html_print_select ($trap_types, 'trap_type', $trap_type, 'this.form.submit();', '', '', true, false, false); - - $table->data[3][3] = '<strong>'.__('Group by OID/IP').'</strong>'; --$table->data[3][4] .= __('Yes').' '.html_print_radio_button ('group_by', 1, '', $group_by, true).' '; --$table->data[3][4] .= __('No').' '.html_print_radio_button ('group_by', 0, '', $group_by, true); -+$table->data[3][4] = __('Yes') . ' '. -+ html_print_radio_button ('group_by', 1, '', $group_by, true) . -+ ' '; -+$table->data[3][4] .= __('No') . ' ' . -+ html_print_radio_button ('group_by', 0, '', $group_by, true); - - $filter = '<form method="POST" action="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&refr='.((int)get_parameter('refr', 0)).'&pure='.$config["pure"].'&tab='.$tab.'">'; - $filter .= html_print_table($table, true); -Index: images/pandorin.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: images/pandorin.png -=================================================================== ---- images/pandorin.png (revision 10314) -+++ images/pandorin.png (working copy) - -Property changes on: images/pandorin.png -___________________________________________________________________ -Added: svn:mime-type -## -0,0 +1 ## -+application/octet-stream -\ No newline at end of property -Index: images/clippy_icon.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: images/clippy_icon.png -=================================================================== ---- images/clippy_icon.png (revision 10314) -+++ images/clippy_icon.png (working copy) - -Property changes on: images/clippy_icon.png -___________________________________________________________________ -Added: svn:mime-type -## -0,0 +1 ## -+application/octet-stream -\ No newline at end of property -Index: extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql -=================================================================== ---- extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql (revision 10314) -+++ extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql (working copy) -@@ -190,3 +190,9 @@ - -- Table trecon_script - -- --------------------------------------------------------------------- - DELETE FROM "trecon_script" WHERE "id_recon_script"=1; -+ -+/* 2014/08/07 */ -+-- --------------------------------------------------------------------- -+-- Table `tagente_modulo` -+-- --------------------------------------------------------------------- -+ALTER TABLE "tagente_modulo" MODIFY COLUMN "post_process" NUMERIC(18,15) default 0; -\ No newline at end of file -Index: extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql -=================================================================== ---- extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql (revision 10314) -+++ extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql (working copy) -@@ -48,8 +48,6 @@ - -- --------------------------------------------------------------------- - -- Table `tagente_modulo` - -- --------------------------------------------------------------------- --ALTER TABLE `tagente_modulo` MODIFY COLUMN `post_process` DOUBLE DEFAULT NULL; --/* 2014/05/21 */ - ALTER TABLE `tagente_modulo` ADD COLUMN `min_ff_event_normal` int(4) unsigned default '0'; - ALTER TABLE `tagente_modulo` ADD COLUMN `min_ff_event_warning` int(4) unsigned default '0'; - ALTER TABLE `tagente_modulo` ADD COLUMN `min_ff_event_critical` int(4) unsigned default '0'; -@@ -230,3 +228,9 @@ - -- Table `trecon_script` - -- --------------------------------------------------------------------- - DELETE FROM `trecon_script` WHERE id_recon_script=1; -+ -+/* 2014/08/07 */ -+-- --------------------------------------------------------------------- -+-- Table `tagente_modulo` -+-- --------------------------------------------------------------------- -+ALTER TABLE tagente_modulo MODIFY COLUMN `post_process` double(18,15) default 0; -\ No newline at end of file -Index: extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql -=================================================================== ---- extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql (revision 10314) -+++ extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql (working copy) -@@ -216,3 +216,9 @@ - -- Table trecon_script - -- --------------------------------------------------------------------- - DELETE FROM trecon_script WHERE id_recon_script=1; -+ -+/* 2014/08/07 */ -+-- --------------------------------------------------------------------- -+-- Table `tagente_modulo` -+-- --------------------------------------------------------------------- -+ALTER TABLE tagente_modulo MODIFY COLUMN post_process NUMBER(18,15) default 0; -\ No newline at end of file -Index: mobile/operation/events.php -=================================================================== ---- mobile/operation/events.php (revision 10314) -+++ mobile/operation/events.php (working copy) -@@ -261,6 +261,25 @@ - if (empty($event["tags"])) { - $event["tags"] = '<i>'.__('N/A').'</i>'; - } -+ -+ $event_comments = db_get_value('user_comment', 'tevento', 'id_evento', $id_event); -+ $event_comments_array = array(); -+ $event_comments_array = json_decode($event_comments, true); -+ // Support for new format only. -+ if (empty($event_comments_array)) { -+ $comment = '<i>'.__('N/A').'</i>'; -+ } else { -+ $comment = ''; -+ $event_comments_array = array_reverse($event_comments_array); -+ foreach($event_comments_array as $c) { -+ $comment .= date ($system->getConfig("date_format"), $c['utimestamp']) . ' (' . $c['id_user'] . ')'; -+ $c['comment'] = io_safe_output($c['comment']); -+ $c['comment'] = str_replace("\n", "<br>", $c['comment']); -+ $comment .= '<br>' . $c['comment'] . '<br>'; -+ } -+ } -+ -+ $event["comments"] = $comment; - - echo json_encode(array('correct' => 1, 'event' => $event)); - } -@@ -486,6 +505,10 @@ - <th><?php echo __('Tags');?></th> - <td class="cell_event_tags"></td> - </tr> -+ <tr class="event_comments"> -+ <th><?php echo __('Comments');?></th> -+ <td class="cell_event_comments"></td> -+ </tr> - </tbody> - </table> - <?php -@@ -828,6 +851,9 @@ - .html(event[\"group\"]); - $(\"#detail_event_dialog .cell_event_tags\") - .html(event[\"tags\"]); -+ $(\"#detail_event_dialog .cell_event_comments\") -+ -+.html(event[\"comments\"]); - $(\"#detail_event_dialog .cell_agent\") - .html(event[\"agent\"]); - -Index: general/main_menu.php -=================================================================== ---- general/main_menu.php (revision 10314) -+++ general/main_menu.php (working copy) -@@ -62,74 +62,163 @@ - /* <![CDATA[ */ - - var autohidden_menu = <?php echo $autohidden_menu; ?>; -+var fixed_menu = <?php echo json_encode((bool)$config['fixed_menu']); ?>; -+var fixed_header = <?php echo json_encode((bool)$config['fixed_header']); ?>; -+var id_user = "<?php echo $config['id_user']; ?>"; -+var cookie_name = id_user + '-pandora_menu_state'; -+var cookie_name_encoded = btoa(cookie_name); - -+var menuState = $.cookie(cookie_name_encoded); -+if (!menuState) { -+ menuState = {}; -+} -+else { -+ menuState = JSON.parse(menuState); -+ open_submenus(); -+} -+ -+function open_submenus () { -+ $.each(menuState, function (index, value) { -+ if (value) -+ $('div.menu>ul>li#' + index + '>ul').show(); -+ }); -+ $('div.menu>ul>li.selected>ul').removeClass('invisible'); -+} -+ -+ -+function close_submenus () { -+ $.each(menuState, function (index, value) { -+ if (value) -+ $('div.menu>ul>li#' + index + '>ul').hide(); -+ }); -+ $('div.menu>ul>li.selected>ul').addClass('invisible'); -+} -+ - $(document).ready( function() { -- $("img.toggle").click (function () { -- $(this).siblings ("ul").toggle (); -+ -+ $("img.toggle").click (function (e) { - //In case the links gets activated, we don't want to follow link -- return false; -+ e.preventDefault(); -+ -+ var menuItem = $(this).parent(); -+ var submenu = menuItem.children("ul"); -+ -+ if (submenu.is(":visible")) { -+ submenu.slideUp(); -+ -+ if (typeof menuState[menuItem.attr('id')] != 'undefined') -+ delete menuState[menuItem.attr('id')]; -+ } -+ else { -+ submenu.slideDown(); -+ -+ menuState[menuItem.attr('id')] = 1; -+ } -+ -+ $.cookie(cookie_name_encoded, JSON.stringify(menuState), {expires: 7}); - }); - -- $('#menu_container').hover (handlerIn, handlerOut); -- var openTime = 0; -- var handsIn = 0; -- -- function handlerIn() { -- handsIn = 1; -- if(openTime == 0) { -- show_menu(); -- openTime = new Date().getTime(); -- -- // Close in 1 second if is not closed manually -- setTimeout(function() { -- if(openTime > 0 && handsIn == 0) { -- hide_menu(); -- openTime = 0; -+ if (fixed_menu) { -+ $('div#menu') -+ .css('position', 'fixed') -+ .css('z-index', '9000') -+ .css('left', '0') -+ .css('top', $('div#head').innerHeight() + 'px') -+ .css('height', '100%') -+ .css('overflow', 'hidden') -+ .hover(function (e) { -+ if (!autohidden_menu) { -+ $(this).css('overflow', 'auto').children('div').css('width', 'auto'); - } -- }, 1000); -+ }, function (e) { -+ if (!autohidden_menu) { -+ $(this).css('overflow', 'hidden').children('div').css('width', '100%'); -+ } -+ }) -+ .children('div') -+ .css('margin-bottom', $('div#head').innerHeight() + 'px'); -+ -+ if (!fixed_header) { -+ $(window).scroll(function () { -+ if ($(this).scrollTop() <= $('div#head').innerHeight()) { -+ $('div#menu').css('top', $('div#head').innerHeight() - $(this).scrollTop() + 'px' ); -+ } else { -+ $('div#menu').css('top', '0'); -+ } -+ }); - } - } -- -- function handlerOut() { -- handsIn = 0; -- var openedTime = new Date().getTime() - openTime; -+ -+ if (autohidden_menu) { -+ -+ $('#menu_container').hover (handlerIn, handlerOut); -+ var openTime = 0; -+ var handsIn = 0; -+ -+ $('#main').css('margin-left', '50px'); -+ hide_menu_pretty(); - -- if(openedTime > 1000) { -- hide_menu(); -- openTime = 0; -+ function handlerIn() { -+ handsIn = 1; -+ if (openTime == 0) { -+ show_menu(); -+ openTime = new Date().getTime(); -+ -+ // Close in 1 second if is not closed manually -+ setTimeout(function() { -+ if(openTime > 0 && handsIn == 0) { -+ hide_menu(); -+ openTime = 0; -+ } -+ }, 1000); -+ } - } -+ -+ function handlerOut() { -+ handsIn = 0; -+ var openedTime = new Date().getTime() - openTime; -+ -+ if (openedTime > 1000) { -+ hide_menu(); -+ openTime = 0; -+ } -+ } -+ -+ function show_menu () { -+ $('#menu_container').animate({"left": "+=80px"}, 200, function () { -+ if (fixed_menu) { -+ $('#menu_container').parent().css('overflow', 'auto'); -+ } -+ }); -+ show_menu_pretty(); -+ } -+ -+ function show_menu_pretty() { -+ open_submenus(); -+ $('div.menu ul li').css('background-position', ''); -+ $('ul.submenu li a, li.menu_icon a, li.links a, div.menu>ul>li>img.toggle').show(); -+ $('.titop').css('color', 'white'); -+ $('.bg3').css('color', 'white'); -+ $('.bg4').css('color', 'white'); -+ } -+ -+ function hide_menu () { -+ if (fixed_menu) { -+ $('#menu_container').parent().css('overflow', 'hidden'); -+ } -+ $('#menu_container').animate({"left": "-=80px"}, 100); -+ hide_menu_pretty(); -+ } -+ -+ function hide_menu_pretty() { -+ close_submenus(); -+ $('div.menu li').css('background-position', '85px 5px'); -+ $('ul.submenu li a, li.menu_icon a, li.links a, div.menu>ul>li>img.toggle').hide(); -+ $('.titop').css('color', $('.titop').css('background-color')); -+ $('.bg3').css('color', $('.bg3').css('background-color')); -+ $('.bg4').css('color', $('.bg4').css('background-color')); -+ } - } -- -- function show_menu () { -- $('#menu_container').animate({"left": "+=140px"}, 200); -- show_menu_pretty(); -- } -- -- function show_menu_pretty() { -- $('div.menu ul li').css('background-position', ''); -- $('ul.submenu li a, li.menu_icon a, li.links a').css('visibility', ''); -- $('.titop').css('color', 'white'); -- $('.bg3').css('color', 'white'); -- $('.bg4').css('color', 'white'); -- } -- -- function hide_menu () { -- $('#menu_container').animate({"left": "-=140px"}, 100); -- hide_menu_pretty(); -- } -- -- function hide_menu_pretty() { -- $('div.menu li').css('background-position', '140px 3px'); -- $('ul.submenu li a, li.menu_icon a, li.links a').css('visibility', 'hidden'); -- $('.titop').css('color', $('.titop').css('background-color')); -- $('.bg3').css('color', $('.bg3').css('background-color')); -- $('.bg4').css('color', $('.bg4').css('background-color')); -- } -- -- if (autohidden_menu) { -- $('#main').css('margin-left', '40px'); -- hide_menu_pretty(); -- } - }); - /* ]]> */ - </script> -Index: general/header.php -=================================================================== ---- general/header.php (revision 10314) -+++ general/header.php (working copy) -@@ -58,10 +58,16 @@ - $table->cellspacing = 0; - $table->head = array (); - $table->data = array (); -- $table->style[0] = $table->style[1] = $table->style[3] = -- $table->style[4] = $table->style[5] = -- $table->style[6] = $table->style[8] = -- $table->style[9] = $table->style['qr'] = -+ $table->style[0] = -+ $table->style['clippy'] = -+ $table->style[1] = -+ $table->style[3] = -+ $table->style[4] = -+ $table->style[5] = -+ $table->style[6] = -+ $table->style[8] = -+ $table->style[9] = -+ $table->style['qr'] = - 'width: 22px; text-align:center; height: 22px; padding-right: 9px;'; - $table->style[7] = 'width: 20px; padding-right: 9px;'; - $table->style['searchbar'] = 'width: 180px; min-width: 180px;'; -@@ -122,11 +128,26 @@ - </script> - <?php - -- $table->data[0][0] = $servers_link_open . $servers_check_img . $servers_link_close; -+ if ($config['tutorial_mode'] !== 'expert') { -+ $table->data[0]['clippy'] = -+ '<a href="javascript: show_clippy();">' . -+ html_print_image( -+ "images/clippy_icon.png", -+ true, -+ array("id" => 'clippy', -+ "class" => 'clippy', -+ "alt" => __('Clippy'), -+ 'title' => __('Clippy'))) . -+ '</a>'; -+ } - - -+ $table->data[0][0] = $servers_link_open . -+ $servers_check_img . $servers_link_close; - - -+ -+ - //======= Autorefresh code ============================= - $autorefresh_txt = ''; - $autorefresh_additional = ''; -@@ -303,8 +324,19 @@ - - <script type="text/javascript"> - /* <![CDATA[ */ -+ -+ var fixed_header = <?php echo json_encode((bool)$config['fixed_header']); ?>; -+ - var new_chat = <?php echo (int)$_SESSION['new_chat'];?>; - $(document).ready (function () { -+ -+ if (fixed_header) { -+ $('div#head').addClass('fixed_header'); -+ $('div#page') -+ .css('padding-top', $('div#head').innerHeight() + 'px') -+ .css('position', 'relative'); -+ } -+ - check_new_chats_icon('icon_new_messages_chat'); - - /* Temporal fix to hide graphics when ui_dialog are displayed */ -Index: godmode/audit_log_csv.php -=================================================================== ---- godmode/audit_log_csv.php (revision 0) -+++ godmode/audit_log_csv.php (revision 10417) -@@ -0,0 +1,137 @@ -+<?php -+// ______ __ _______ _______ _______ -+//| __ \.---.-.-----.--| |.-----.----.---.-. | ___| | | __| -+//| __/| _ | | _ || _ | _| _ | | ___| |__ | -+//|___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| -+// -+// ============================================================================ -+// Copyright (c) 2007-2010 Artica Soluciones Tecnologicas, http://www.artica.es -+// This code is NOT free software. This code is NOT licenced under GPL2 licence -+// You cannnot redistribute it without written permission of copyright holder. -+// ============================================================================ -+ -+if (file_exists("../../../include/config.php")) -+ require ("../../../include/config.php"); -+else { -+ //TODO FIX AND SET AS RELATIVE DIRECTORY -+ if (file_exists("/var/www/pandora_console/include/config.php")) -+ require ("/var/www/pandora_console/include/config.php"); -+ if (file_exists("/srv/www/htdocs/pandora_console/include/config.php")) -+ require ("/srv/www/htdocs/pandora_console/include/config.php"); -+} -+ -+global $config; -+ -+require_once ($config["homedir"]."/include/functions.php"); -+require_once ($config["homedir"]."/include/functions_db.php"); -+require_once ($config["homedir"]."/enterprise/include/functions_reporting_csv.php"); -+require_once ($config["homedir"]."/include/auth/mysql.php"); -+ -+error_reporting(E_ALL); -+ini_set("display_errors", 1); -+ -+if (! isset ($_SESSION["id_usuario"])) { -+ session_start (); -+ session_write_close (); -+} -+ -+ -+// Login check -+if (!isset($_SESSION["id_usuario"])) { -+ $config['id_user'] = null; -+} -+else { -+ $config['id_user'] = $_SESSION["id_usuario"]; -+} -+ -+if (!check_login()) { -+ db_pandora_audit("ACL Violation", "Trying to access graph builder"); -+ include ($config["homedir"]."/general/noaccess.php"); -+ return; -+} -+ -+if (! check_acl ($config['id_user'], 0, "PM")) { -+ db_pandora_audit( "ACL Violation", -+ "Trying to access event viewer"); -+ require ("general/noaccess.php"); -+ exit; -+} -+ -+$tipo_log = get_parameter ("tipo_log", 'all'); -+$user_filter = get_parameter('user_filter', 'all'); -+$filter_text = get_parameter('filter_text', ''); -+$filter_hours_old = get_parameter('filter_hours_old', 24); -+$filter_ip = get_parameter('filter_ip', ''); -+ -+$filter = 'WHERE 1 = 1'; -+ -+if ($tipo_log != 'all') { -+ $filter .= " AND accion = '$tipo_log'"; -+} -+switch ($config['dbtype']) { -+ case "mysql": -+ if ($user_filter != 'all') { -+ $filter .= sprintf(' AND id_usuario = "%s"', $user_filter); -+ } -+ -+ $filter .= ' AND (accion LIKE "%' . $filter_text . '%" OR descripcion LIKE "%' . $filter_text . '%")'; -+ -+ if ($filter_ip != '') { -+ $filter .= sprintf(' AND ip_origen LIKE "%s"', $filter_ip); -+ } -+ break; -+ case "postgresql": -+ case "oracle": -+ if ($user_filter != 'all') { -+ $filter .= sprintf(' AND id_usuario = \'%s\'', $user_filter); -+ } -+ -+ $filter .= ' AND (accion LIKE \'%' . $filter_text . '%\' OR descripcion LIKE \'%' . $filter_text . '%\')'; -+ -+ if ($filter_ip != '') { -+ $filter .= sprintf(' AND ip_origen LIKE \'%s\'', $filter_ip); -+ } -+ break; -+} -+ -+if ($filter_hours_old != 0) { -+ switch ($config["dbtype"]) { -+ case "mysql": -+ $filter .= ' AND fecha >= DATE_ADD(NOW(), INTERVAL -' . $filter_hours_old . ' HOUR)'; -+ break; -+ case "postgresql": -+ $filter .= ' AND fecha >= NOW() - INTERVAL \'' . $filter_hours_old . ' HOUR \''; -+ break; -+ case "oracle": -+ $filter .= ' AND fecha >= (SYSTIMESTAMP - INTERVAL \'' . $filter_hours_old . '\' HOUR)'; -+ break; -+ } -+} -+ -+switch ($config["dbtype"]) { -+ case "mysql": -+ $sql = sprintf ("SELECT * -+ FROM tsesion -+ %s -+ ORDER BY fecha DESC", $filter); -+ break; -+ case "postgresql": -+ $sql = sprintf ("SELECT * -+ FROM tsesion -+ %s -+ ORDER BY fecha DESC", $filter); -+ break; -+ case "oracle": -+ $sql = sprintf ("SELECT * -+ FROM tsesion -+ %s -+ ORDER BY fecha DESC", $filter); -+ $result = oracle_recode_query ($sql, $set); -+ break; -+} -+ -+$result = db_get_all_rows_sql ($sql); -+ -+print_audit_csv ($result); -+ -+?> -Index: godmode/admin_access_logs.php -=================================================================== ---- godmode/admin_access_logs.php (revision 10314) -+++ godmode/admin_access_logs.php (working copy) -@@ -295,6 +295,13 @@ - - html_print_table ($table); - -+echo '<div style="width: '.$table->width.'" class="action-buttons">'; -+echo '<a href="' . -+ ui_get_full_url(false, false, false, false) . 'godmode/audit_log_csv.php?tipo_log='.$tipo_log.'&user_filter='.$user_filter.'&filter_text='.$filter_text.'&filter_hours_old='.$filter_hours_old.'&filter_ip='.$filter_ip.'"'. -+ 'target="_new">' . -+ html_print_button (__('Export to CSV '), 'export_csv', false, '', 'class=sub next', true, false). '</a>'; -+echo '</div>'; -+ - if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { - enterprise_hook('enterpriseAuditFooter'); - } -Index: godmode/db/db_info.php -=================================================================== ---- godmode/db/db_info.php (revision 10314) -+++ godmode/db/db_info.php (working copy) -@@ -79,7 +79,7 @@ - - foreach ($count as $agent_id => $value) { - $data = array (); -- -+ - //First row is a link to the agent - $data[0] = '<strong><a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='.$agent_id.'">'.$agents[$agent_id].'</a></strong>'; - //Second row is a number of modules for the agent -Index: godmode/agentes/agent_template.php -=================================================================== ---- godmode/agentes/agent_template.php (revision 10314) -+++ godmode/agentes/agent_template.php (working copy) -@@ -96,7 +96,12 @@ - 'warning_instructions' => $row2['warning_instructions'], - 'unknown_instructions' => $row2['unknown_instructions'], - 'id_category' => $row2['id_category'], -- 'module_macros' => $row2['module_macros'] -+ 'module_macros' => $row2['module_macros'], -+ 'each_ff' => $row2['each_ff'], -+ 'min_ff_event' => $row2['min_ff_event'], -+ 'min_ff_event_normal' => $row2['min_ff_event_normal'], -+ 'min_ff_event_warning' => $row2['min_ff_event_warning'], -+ 'min_ff_event_critical' => $row2['min_ff_event_critical'] - ); - - $name = $row2["name"]; -Index: godmode/agentes/module_manager_editor_plugin.php -=================================================================== ---- godmode/agentes/module_manager_editor_plugin.php (revision 10314) -+++ godmode/agentes/module_manager_editor_plugin.php (working copy) -@@ -84,7 +84,12 @@ - if (!empty($m['help'])) { - $data[0] .= ui_print_help_tip ($m['help'], true); - } -- if($m['hide']) { -+ -+ $m_hide = false; -+ if (isset($m['hide'])) -+ $m_hide = $m['hide']; -+ -+ if ($m_hide) { - $data[1] = html_print_input_password($m['macro'], $m['value'], '', 100, 255, true); - } - else { -Index: godmode/agentes/agent_conf_gis.php -=================================================================== ---- godmode/agentes/agent_conf_gis.php (revision 10314) -+++ godmode/agentes/agent_conf_gis.php (working copy) -@@ -118,9 +118,7 @@ - //Validate altitude - if ((jQuery.trim(altitude).length == 0) || - isNaN(parseFloat(altitude))) { -- $('input[name=altitude]').css('background', '#cc0000'); -- -- valid = false; -+ $('input[name=altitude]').val(1); - } - - if (valid) return true; -Index: godmode/agentes/agent_wizard.snmp_explorer.php -=================================================================== ---- godmode/agentes/agent_wizard.snmp_explorer.php (revision 10314) -+++ godmode/agentes/agent_wizard.snmp_explorer.php (working copy) -@@ -50,65 +50,74 @@ - // Get the plugin - $plugin = db_get_row_sql('SELECT * FROM tplugin WHERE execute LIKE "%/snmp_remote.pl"'); - --if(empty($plugin)) { -+if (empty($plugin)) { - ui_print_info_message(array('message' => __('The SNMP remote plugin doesnt seem to be installed') . '. ' . __('It is necessary to use some features') . '.<br><br>' . __('Please, install the SNMP remote plugin (The name of the plugin must be snmp_remote.pl)'), 'no_close' => true)); - } - - // Define STATIC SNMP data - $static_snmp_descriptions = array( -- 'Load-1' => 'Load Average (Last minute)', -- 'Load-5' => 'Load Average (Last 5 minutes)', -- 'Load-15' => 'Load Average (Last 5 minutes)', -- 'memTotalSwap' => 'Total Swap Size configured for the host', -- 'memAvailSwap' => 'Available Swap Space on the host', -- 'memTotalReal' => 'Total Real/Physical Memory Size on the host', -- 'memAvailReal' => 'Available Real/Physical Memory Space on the host', -- 'memTotalFree' => 'Total Available Memory on the host', -- //'memShared' => 'Total Shared Memory', -- 'memCached' => 'Total Cached Memory', -- 'memBuffer' => 'Total Buffered Memory', -- 'ssSwapIn' => 'Amount of memory swapped in from disk (kB/s)', -- 'ssSwapOut' => 'Amount of memory swapped to disk (kB/s)', -- 'ssIORawSent' => 'Number of blocks sent to a block device', -- 'ssIORawReceived' => 'Number of blocks received from a block device', -- 'ssRawInterrupts' => 'Number of interrupts processed', -- 'ssRawContexts' => 'Number of context switches', -- 'ssCpuRawUser' => 'user CPU time', -- 'ssCpuRawSystem' => 'system CPU time', -- 'ssCpuRawIdle' => 'idle CPU time' -- ); -- -+ 'Load-1' => 'Load Average (Last minute)', -+ 'Load-5' => 'Load Average (Last 5 minutes)', -+ 'Load-15' => 'Load Average (Last 5 minutes)', -+ 'memTotalSwap' => 'Total Swap Size configured for the host', -+ 'memAvailSwap' => 'Available Swap Space on the host', -+ 'memTotalReal' => 'Total Real/Physical Memory Size on the host', -+ 'memAvailReal' => 'Available Real/Physical Memory Space on the host', -+ 'memTotalFree' => 'Total Available Memory on the host', -+ //'memShared' => 'Total Shared Memory', -+ 'memCached' => 'Total Cached Memory', -+ 'memBuffer' => 'Total Buffered Memory', -+ 'ssSwapIn' => 'Amount of memory swapped in from disk (kB/s)', -+ 'ssSwapOut' => 'Amount of memory swapped to disk (kB/s)', -+ 'ssIORawSent' => 'Number of blocks sent to a block device', -+ 'ssIORawReceived' => 'Number of blocks received from a block device', -+ 'ssRawInterrupts' => 'Number of interrupts processed', -+ 'ssRawContexts' => 'Number of context switches', -+ 'ssCpuRawUser' => 'user CPU time', -+ 'ssCpuRawSystem' => 'system CPU time', -+ 'ssCpuRawIdle' => 'idle CPU time' -+ ); -+ - $static_snmp_oids = array( -- 'Load-1' => '.1.3.6.1.4.1.2021.10.1.5.1', -- 'Load-5' => '.1.3.6.1.4.1.2021.10.1.5.2', -- 'Load-15' => '.1.3.6.1.4.1.2021.10.1.5.3', -- 'memTotalSwap' => '.1.3.6.1.4.1.2021.4.3.0', -- 'memAvailSwap' => '.1.3.6.1.4.1.2021.4.4.0', -- 'memTotalReal' => '.1.3.6.1.4.1.2021.4.5.0', -- 'memAvailReal' => '.1.3.6.1.4.1.2021.4.6.0', -- 'memTotalFree' => '.1.3.6.1.4.1.2021.4.11.0', -- //'memShared' => '.1.3.6.1.4.1.2021.4.13', -- 'memCached' => '.1.3.6.1.4.1.2021.4.15.0', -- 'memBuffer' => '.1.3.6.1.4.1.2021.4.14.0', -- 'ssSwapIn' => '.1.3.6.1.4.1.2021.11.3.0', -- 'ssSwapOut' => '.1.3.6.1.4.1.2021.11.4.0', -- 'ssIORawSent' => '.1.3.6.1.4.1.2021.11.57.0', -- 'ssIORawReceived' => '.1.3.6.1.4.1.2021.11.58.0', -- 'ssRawInterrupts' => '.1.3.6.1.4.1.2021.11.59.0', -- 'ssRawContexts' => '.1.3.6.1.4.1.2021.11.60.0', -- 'ssCpuRawUser' => '.1.3.6.1.4.1.2021.11.50.0', -- 'ssCpuRawSystem' => '.1.3.6.1.4.1.2021.11.52.0', -- 'ssCpuRawIdle' => '.1.3.6.1.4.1.2021.11.53.0' -- ); -+ 'Load-1' => '.1.3.6.1.4.1.2021.10.1.5.1', -+ 'Load-5' => '.1.3.6.1.4.1.2021.10.1.5.2', -+ 'Load-15' => '.1.3.6.1.4.1.2021.10.1.5.3', -+ 'memTotalSwap' => '.1.3.6.1.4.1.2021.4.3.0', -+ 'memAvailSwap' => '.1.3.6.1.4.1.2021.4.4.0', -+ 'memTotalReal' => '.1.3.6.1.4.1.2021.4.5.0', -+ 'memAvailReal' => '.1.3.6.1.4.1.2021.4.6.0', -+ 'memTotalFree' => '.1.3.6.1.4.1.2021.4.11.0', -+ //'memShared' => '.1.3.6.1.4.1.2021.4.13', -+ 'memCached' => '.1.3.6.1.4.1.2021.4.15.0', -+ 'memBuffer' => '.1.3.6.1.4.1.2021.4.14.0', -+ 'ssSwapIn' => '.1.3.6.1.4.1.2021.11.3.0', -+ 'ssSwapOut' => '.1.3.6.1.4.1.2021.11.4.0', -+ 'ssIORawSent' => '.1.3.6.1.4.1.2021.11.57.0', -+ 'ssIORawReceived' => '.1.3.6.1.4.1.2021.11.58.0', -+ 'ssRawInterrupts' => '.1.3.6.1.4.1.2021.11.59.0', -+ 'ssRawContexts' => '.1.3.6.1.4.1.2021.11.60.0', -+ 'ssCpuRawUser' => '.1.3.6.1.4.1.2021.11.50.0', -+ 'ssCpuRawSystem' => '.1.3.6.1.4.1.2021.11.52.0', -+ 'ssCpuRawIdle' => '.1.3.6.1.4.1.2021.11.53.0' -+ ); - - // Using plugin --if(!empty($plugin)) { -+if (!empty($plugin)) { - $static_snmp_descriptions['avgCpuLoad'] = 'Average of CPUs Load (%)'; - $static_snmp_descriptions['memoryUse'] = 'Memory use (%)'; - } - - $fail = false; - -+$devices = array(); -+$processes = array(); -+$disks = array(); -+$temperatures = array(); -+ -+$arrow = false; -+ -+$other_snmp_data = array(); -+ - if ($snmpwalk) { - // OID Used is for DISKS - $snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, -@@ -120,7 +129,6 @@ - $snmpis = array(); - } - else { -- $disks = array(); - // We get here only the interface part of the MIB, not full mib - foreach($snmpis as $key => $snmp) { - -@@ -136,14 +144,14 @@ - - if (array_key_exists(1,$data)) { - $disks[$data[1]] = $data[1]; -- -+ - } - else { - $disks[$data[0]] = $data[0]; -- -- } -+ -+ } - } -- -+ - // OID Used is for PROCESSES - $snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, - $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, -@@ -152,8 +160,8 @@ - if ($snmpis === false) { - $snmpis = array(); - } -- -- $processes = array(); -+ -+ - // We get here only the interface part of the MIB, not full mib - foreach($snmpis as $key => $snmp) { - -@@ -168,12 +176,12 @@ - - if (array_key_exists(1,$data)) { - $process_name = str_replace ( "\"" , "" , $data[1]); -- -+ - } - else { - $process_name = str_replace ( "\"" , "" , $data[0]); -- -- } -+ -+ } - - $processes[$process_name] = $process_name; - } -@@ -191,7 +199,7 @@ - $snmpis = array(); - } - -- $temperatures = array(); -+ - // We get here only the interface part of the MIB, not full mib - foreach($snmpis as $key => $snmp) { - -@@ -208,11 +216,11 @@ - if ($keydata2[0] == 'lmTempSensorsDevice') { - if (array_key_exists(1,$data)) { - $temperatures[$keydata2[1]] = $data[1]; -- -+ - } - else { - $temperatures[$keydata2[1]] = $data[0]; -- -+ - } - } - } -@@ -229,7 +237,7 @@ - $snmpis = array(); - } - -- $devices = array(); -+ - // We get here only the interface part of the MIB, not full mib - foreach($snmpis as $key => $snmp) { - -@@ -262,8 +270,15 @@ - - // Other SNMP Data - $arrow = true; -- foreach ($static_snmp_oids as $key=>$oid) { -- $result = snmpget($ip_target, $snmp_community, $oid); -+ -+ foreach ($static_snmp_oids as $key => $oid) { -+ if ($snmp_version == 3) { -+ $result = false; //It is statics oids. -+ } -+ else { -+ $result = snmpget($ip_target, $snmp_community, $oid); -+ } -+ - if ($result != false) { - $other_snmp_data[$key] = $static_snmp_descriptions[$key]; - } -@@ -318,7 +333,7 @@ - ui_print_error_message (__('No agent selected or the agent does not exist')); - } - else { -- -+ - // Common values - $common_values = array(); - -@@ -341,33 +356,33 @@ - - // DEVICES - $devices_prefix_oids = array( -- 'diskIONRead' => '.1.3.6.1.4.1.2021.13.15.1.1.3.', -- 'diskIONWritten' => '.1.3.6.1.4.1.2021.13.15.1.1.4.', -- 'diskIONReads' => '.1.3.6.1.4.1.2021.13.15.1.1.5.', -- 'diskIONWrites' => '.1.3.6.1.4.1.2021.13.15.1.1.6.' -- ); -- -+ 'diskIONRead' => '.1.3.6.1.4.1.2021.13.15.1.1.3.', -+ 'diskIONWritten' => '.1.3.6.1.4.1.2021.13.15.1.1.4.', -+ 'diskIONReads' => '.1.3.6.1.4.1.2021.13.15.1.1.5.', -+ 'diskIONWrites' => '.1.3.6.1.4.1.2021.13.15.1.1.6.' -+ ); -+ - $devices_prefix_descriptions = array( -- 'diskIONRead' => 'The number of bytes read from this device since boot', -- 'diskIONWritten' => 'The number of bytes written to this device since boot', -- 'diskIONReads' => 'The number of read accesses from this device since boot', -- 'diskIONWrites' => 'The number of write accesses from this device since boot' -- ); -- -+ 'diskIONRead' => 'The number of bytes read from this device since boot', -+ 'diskIONWritten' => 'The number of bytes written to this device since boot', -+ 'diskIONReads' => 'The number of read accesses from this device since boot', -+ 'diskIONWrites' => 'The number of write accesses from this device since boot' -+ ); -+ - $results = array(); - - foreach ($devices as $device) { - $module_values = $common_values; -- -+ - // Split module data to get type, name, etc - $device_exploded = explode($separator, $device); - $device_name = $device_exploded[0]; - - $name_exploded = explode('-', $device_name); - $name = ltrim(html_entity_decode($name_exploded[1])); -- -+ - $device_type = $device_exploded[1]; -- -+ - // Delete type from device id - unset($device_exploded[0]); - unset($device_exploded[1]); -@@ -376,10 +391,11 @@ - $device_id = implode($separator, $device_exploded); - - $module_values['descripcion'] = $devices_prefix_descriptions[$device_type]; -- -+ - if (($name == 'Bytes read') || ($name == 'Bytes written')) { - $module_values['id_tipo_modulo'] = modules_get_type_id('remote_snmp_inc'); -- } else { -+ } -+ else { - $module_values['id_tipo_modulo'] = modules_get_type_id('remote_snmp'); - } - -@@ -398,7 +414,7 @@ - - foreach ($temperatures as $temperature) { - $module_values = $common_values; -- -+ - // Split module data to get type, name, etc - $temperature_exploded = explode($separator, $temperature); - $temperature_name = $temperature_exploded[0]; -@@ -434,14 +450,14 @@ - - $module_values['descripcion'] = $static_snmp_descriptions[$snmpdata_name]; - $module_values['id_tipo_modulo'] = modules_get_type_id('remote_snmp'); -- -+ - //Average use of CPUs is a plugin module - switch ($snmpdata_name) { - case 'avgCpuLoad': - case 'memoryUse': - $module_values['id_modulo'] = MODULE_PLUGIN; - $module_values['id_plugin'] = $plugin['id']; -- -+ - $macros = json_decode($plugin['macros'], true); - - foreach($macros as $k => $macro) { -@@ -464,6 +480,33 @@ - $macros[$k]['value'] = '-m memuse'; - break; - } -+ -+ if ($snmp_version == '3') { -+ $macros[$k]['value'] .= " -v3 "; -+ switch ($snmp3_security_level) { -+ case "authNoPriv": -+ $macros[$k]['value'] .= -+ ' -u ' . $snmp3_auth_user . -+ ' -A ' . $snmp3_auth_pass . -+ ' -l ' . $snmp3_security_level . -+ ' -a ' . $snmp3_auth_method; -+ break; -+ case "noAuthNoPriv": -+ $macros[$k]['value'] .= -+ ' -u ' . $snmp3_auth_user . -+ ' -l ' . $snmp3_security_level; -+ break; -+ default: -+ $macros[$k]['value'] .= -+ ' -u ' . $snmp3_auth_user . -+ ' -A ' . $snmp3_auth_pass . -+ ' -l ' . $snmp3_security_level . -+ ' -a ' . $snmp3_auth_method . -+ ' -x ' . $snmp3_privacy_method . -+ ' -X ' . $snmp3_privacy_pass; -+ break; -+ } -+ } - break; - } - } -@@ -497,7 +540,7 @@ - - $macros = json_decode($plugin['macros'], true); - -- foreach($macros as $k => $macro) { -+ foreach ($macros as $k => $macro) { - switch($macro['macro']) { - case '_field1_': - // Field 1 is the IP Address -@@ -510,6 +553,33 @@ - case '_field3_': - // Field 3 is the plugin parameters - $macros[$k]['value'] = io_safe_input('-m process -p "' . $process . '"'); -+ -+ if ($snmp_version == '3') { -+ $macros[$k]['value'] .= " -v3 "; -+ switch ($snmp3_security_level) { -+ case "authNoPriv": -+ $macros[$k]['value'] .= -+ ' -u ' . $snmp3_auth_user . -+ ' -A ' . $snmp3_auth_pass . -+ ' -l ' . $snmp3_security_level . -+ ' -a ' . $snmp3_auth_method; -+ break; -+ case "noAuthNoPriv": -+ $macros[$k]['value'] .= -+ ' -u ' . $snmp3_auth_user . -+ ' -l ' . $snmp3_security_level; -+ break; -+ default: -+ $macros[$k]['value'] .= -+ ' -u ' . $snmp3_auth_user . -+ ' -A ' . $snmp3_auth_pass . -+ ' -l ' . $snmp3_security_level . -+ ' -a ' . $snmp3_auth_method . -+ ' -x ' . $snmp3_privacy_method . -+ ' -X ' . $snmp3_privacy_pass; -+ break; -+ } -+ } - break; - } - } -@@ -519,7 +589,7 @@ - unset($module_values['snmp_community']); //snmp_community - unset($module_values['ip_target']); //ip_target - unset($module_values['tcp_send']); //snmp_version -- -+ - $result = modules_create_agent_module ($id_agent, io_safe_input($process), $module_values); - - $results[$result][] = $process; -@@ -537,7 +607,7 @@ - - $macros = json_decode($plugin['macros'], true); - -- foreach($macros as $k => $macro) { -+ foreach ($macros as $k => $macro) { - switch($macro['macro']) { - case '_field1_': - // Field 1 is the IP Address -@@ -550,7 +620,33 @@ - case '_field3_': - // Field 3 is the plugin parameters - $macros[$k]['value'] = io_safe_input('-m diskuse -d "' . io_safe_output($disk) . '"'); -- break; -+ -+ if ($snmp_version == '3') { -+ $macros[$k]['value'] .= " -v3 "; -+ switch ($snmp3_security_level) { -+ case "authNoPriv": -+ $macros[$k]['value'] .= -+ ' -u ' . $snmp3_auth_user . -+ ' -A ' . $snmp3_auth_pass . -+ ' -l ' . $snmp3_security_level . -+ ' -a ' . $snmp3_auth_method; -+ break; -+ case "noAuthNoPriv": -+ $macros[$k]['value'] .= -+ ' -u ' . $snmp3_auth_user . -+ ' -l ' . $snmp3_security_level; -+ break; -+ default: -+ $macros[$k]['value'] .= -+ ' -u ' . $snmp3_auth_user . -+ ' -A ' . $snmp3_auth_pass . -+ ' -l ' . $snmp3_security_level . -+ ' -a ' . $snmp3_auth_method . -+ ' -x ' . $snmp3_privacy_method . -+ ' -X ' . $snmp3_privacy_pass; -+ break; -+ } -+ } - } - } - -@@ -559,34 +655,46 @@ - unset($module_values['snmp_community']); //snmp_community - unset($module_values['ip_target']); //ip_target - unset($module_values['tcp_send']); //snmp_version -- -- $result = modules_create_agent_module ($id_agent, io_safe_input($disk), $module_values); - -+ $result = modules_create_agent_module($id_agent, io_safe_input($disk), $module_values); -+ - $results[$result][] = $disk; - } -- -+ - $success_message = ''; - $error_message = ''; -- -- if (count($results[NOERR]) > 0) { -- $success_message .= sprintf(__('%s modules created succesfully'), count($results[NOERR])) . '<br>'; -+ -+ if (isset($results[NOERR])) { -+ if (count($results[NOERR]) > 0) { -+ $success_message .= sprintf(__('%s modules created succesfully'), count($results[NOERR])) . '<br>'; -+ } - } -- if (count($results[ERR_GENERIC]) > 0) { -- $error_message .= sprintf(__('Error creating %s modules') . ': <br> * ' . implode('<br> * ', $results[ERR_GENERIC]), count($results[ERR_GENERIC])) . '<br>'; -+ if (isset($results[ERR_GENERIC])) { -+ if (count($results[ERR_GENERIC]) > 0) { -+ $error_message .= sprintf(__('Error creating %s modules') . ': <br> * ' . implode('<br> * ', $results[ERR_GENERIC]), count($results[ERR_GENERIC])) . '<br>'; -+ } - } -- if (count($results[ERR_EXIST]) > 0) { -- $error_message .= sprintf(__('%s modules already exist') . ': <br> * ' . implode('<br> * ', $results[ERR_EXIST]), count($results[ERR_EXIST])) . '<br>'; -+ if (isset($results[ERR_DB])) { -+ if (count($results[ERR_DB]) > 0) { -+ $error_message .= sprintf(__('Error creating %s modules') . ': <br> * ' . implode('<br> * ', $results[ERR_DB]), count($results[ERR_DB])) . '<br>'; -+ } - } -+ if (isset($results[ERR_EXIST])) { -+ if (count($results[ERR_EXIST]) > 0) { -+ $error_message .= sprintf(__('%s modules already exist') . ': <br> * ' . implode('<br> * ', $results[ERR_EXIST]), count($results[ERR_EXIST])) . '<br>'; -+ } -+ } - - if (!empty($error_message)) { - ui_print_error_message($error_message); -- } else { -+ } -+ else { - if (empty($success_message)) { - $success_message .= sprintf(__('Modules created succesfully')) . '<br>'; - } - ui_print_success_message($success_message); - } -- } -+ } - } - - echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>'; -@@ -697,17 +805,17 @@ - $table->data[1][0] .= html_print_select ($modes, - 'snmp_wizard_modes', '', '', '', '', true, false, false); - $table->cellstyle[1][0] = 'vertical-align: middle;'; -- -+ - $table->colspan[1][0] = 2; - $table->data[1][2] = '<b>'.__('Modules').'</b>'; - $table->cellstyle[1][2] = 'vertical-align: middle;'; -- -+ - // Devices list -- $table->data[2][0] .= '<div class="wizard_mode_form wizard_mode_devices">'; -+ $table->data[2][0] = '<div class="wizard_mode_form wizard_mode_devices">'; - $table->data[2][0] .= html_print_select ($devices, 'devices', '', '', - '', '', true, true, true, '', false, 'width: 300px;'); - $table->data[2][0] .= '</div>'; -- -+ - // If SNMP remote plugin is not installed, show an advice - if(empty($plugin)) { - // Processes list -@@ -747,7 +855,7 @@ - $table->data[2][0] .= '</div>'; - - $table->cellstyle[2][0] = 'vertical-align: top; text-align: center;'; -- -+ - // Devices arrow - $table->data[2][1] = '<div class="wizard_mode_form wizard_mode_devices wizard_mode_devices_arrow clickable">' . html_print_image('images/darrowright.png', true, array('title' => __('Add to modules list'))) . '</div>'; - // Processes arrow -@@ -761,15 +869,15 @@ - $table->data[2][1] .= '<div class="wizard_mode_form wizard_mode_snmpdata wizard_mode_snmpdata_arrow clickable">' . html_print_image('images/darrowright.png', true, array('title' => __('Add to modules list'))) . '</div>'; - } - $table->data[2][1] .= '<br><br><div class="wizard_mode_delete_arrow clickable">' . html_print_image('images/cross.png', true, array('title' => __('Remove from modules list'))) . '</div>'; -- $table->cellstyle[2][1] .= 'vertical-align: middle; text-align: center;'; -- -+ $table->cellstyle[2][1] = 'vertical-align: middle; text-align: center;'; -+ - $table->data[2][2] = html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:300px; height: 100%;'); - $table->data[2][2] .= html_print_input_hidden('agent', $id_agent, true); - $table->cellstyle[2][2] = 'vertical-align: top; text-align: center;'; -- -+ - html_print_table($table); - -- echo "<div style='text-align:right; width:".$table->width."'>"; -+ echo "<div style='text-align:right; width:" . $table->width . "'>"; - html_print_submit_button(__('Create modules'), 'create_modules_btn', false, array('class' => 'sub add')); - echo "</div>"; - unset($table); -@@ -778,7 +886,7 @@ - echo "</form>"; - echo '</div>'; - } -- -+ - ui_require_jquery_file ('pandora.controls'); - ui_require_jquery_file ('ajaxqueue'); - ui_require_jquery_file ('bgiframe'); -Index: godmode/agentes/planned_downtime.editor.php -=================================================================== ---- godmode/agentes/planned_downtime.editor.php (revision 10314) -+++ godmode/agentes/planned_downtime.editor.php (working copy) -@@ -1,5 +1,4 @@ - <?php -- - // Pandora FMS - http://pandorafms.com - // ================================================== - // Copyright (c) 2005-2010 Artica Soluciones Tecnologicas -@@ -18,6 +17,7 @@ - - check_login(); - -+ - if (! check_acl ($config['id_user'], 0, "AW")) { - db_pandora_audit("ACL Violation", - "Trying to access downtime scheduler"); -@@ -25,6 +25,7 @@ - return; - } - -+ - require_once ('include/functions_users.php'); - - // Header -@@ -36,10 +37,7 @@ - true, - ""); - --// Load global vars --global $config; - --check_login(); - - //Initialize data - $id_agent = get_parameter ("id_agent"); -@@ -153,7 +151,7 @@ - $datetime_from = strtotime ($once_date_from . ' ' . $once_time_from); - $datetime_to = strtotime ($once_date_to . ' ' . $once_time_to); - $now = strtotime(date(DATE_FORMAT). ' ' . date(TIME_FORMAT)); -- -+ - if ($datetime_from < $now) { - ui_print_error_message(__('Not created. Error inserting data. Start time must be higher than the current time' )); - } -Index: godmode/agentes/modificar_agente.php -=================================================================== ---- godmode/agentes/modificar_agente.php (revision 10314) -+++ godmode/agentes/modificar_agente.php (working copy) -@@ -161,6 +161,17 @@ - echo "</div>"; - - -+$order_collation = ""; -+switch ($config["dbtype"]) { -+ case "mysql": -+ $order_collation = "COLLATE utf8_general_ci"; -+ break; -+ case "postgresql": -+ case "oracle": -+ $order_collation = ""; -+ break; -+} -+ - $selected = 'border: 1px solid black;'; - $selectNameUp = ''; - $selectNameDown = ''; -@@ -173,14 +184,14 @@ - switch ($sort) { - case 'up': - $selectNameUp = $selected; -- $order = array('field' => 'nombre COLLATE utf8_general_ci', -- 'field2' => 'nombre COLLATE utf8_general_ci', -+ $order = array('field' => 'nombre ' . $order_collation, -+ 'field2' => 'nombre ' . $order_collation, - 'order' => 'ASC'); - break; - case 'down': - $selectNameDown = $selected; -- $order = array('field' => 'nombre COLLATE utf8_general_ci', -- 'field2' => 'nombre COLLATE utf8_general_ci', -+ $order = array('field' => 'nombre ' . $order_collation, -+ 'field2' => 'nombre ' . $order_collation, - 'order' => 'DESC'); - break; - } -@@ -190,13 +201,13 @@ - case 'up': - $selectOsUp = $selected; - $order = array('field' => 'id_os', -- 'field2' => 'nombre COLLATE utf8_general_ci', -+ 'field2' => 'nombre ' . $order_collation, - 'order' => 'ASC'); - break; - case 'down': - $selectOsDown = $selected; - $order = array('field' => 'id_os', -- 'field2' => 'nombre COLLATE utf8_general_ci', -+ 'field2' => 'nombre ' . $order_collation, - 'order' => 'DESC'); - break; - } -@@ -206,13 +217,13 @@ - case 'up': - $selectGroupUp = $selected; - $order = array('field' => 'id_grupo', -- 'field2' => 'nombre COLLATE utf8_general_ci', -+ 'field2' => 'nombre ' . $order_collation, - 'order' => 'ASC'); - break; - case 'down': - $selectGroupDown = $selected; - $order = array('field' => 'id_grupo', -- 'field2' => 'nombre COLLATE utf8_general_ci', -+ 'field2' => 'nombre ' . $order_collation, - 'order' => 'DESC'); - break; - } -@@ -224,13 +235,16 @@ - $selectOsDown = ''; - $selectGroupUp = ''; - $selectGroupDown = ''; -- $order = array('field' => 'nombre COLLATE utf8_general_ci', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC'); -+ $order = array('field' => 'nombre ' . $order_collation, -+ 'field2' => 'nombre ' . $order_collation, -+ 'order' => 'ASC'); - break; - } - - $search_sql = ''; - if ($search != "") { -- $search_sql = " AND ( nombre COLLATE utf8_general_ci LIKE '%$search%' OR direccion LIKE '%$search%') "; -+ $search_sql = " AND ( nombre " . $order_collation . " -+ LIKE '%$search%' OR direccion LIKE '%$search%') "; - } - - // Show only selected groups -Index: godmode/agentes/agent_manager.php -=================================================================== ---- godmode/agentes/agent_manager.php (revision 10314) -+++ godmode/agentes/agent_manager.php (working copy) -@@ -159,7 +159,8 @@ - - $table->data[0][1] .= " <b>" . __("ID") . "</b> $id_agente "; - $table->data[0][1] .= ' <a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">'; -- $table->data[0][1] .= html_print_image ("images/zoom.png", true, array ("border" => 0, "title" => __('Agent detail'))); -+ $table->data[0][1] .= html_print_image ("images/zoom.png", -+ true, array ("border" => 0, "title" => __('Agent detail'))); - $table->data[0][1] .= '</a>'; - } - -@@ -215,9 +216,14 @@ - </style> - <?php - $table->rowspan[1][2] = 7; --$table->data[1][2] = -- "<a id='qr_code_agent_view' href='javascript: show_dialog_qrcode(null, \"" . -- ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agente) . "\" );'></a>"; -+if ($id_agente) { -+ $table->data[1][2] = -+ "<a id='qr_code_agent_view' href='javascript: show_dialog_qrcode(null, \"" . -+ ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agente) . "\" );'></a>"; -+} -+else { -+ $table->data[1][2] = __("Only it is show when<br />the agent is saved."); -+} - - $groups = users_get_groups ($config["id_user"], "AR",false); - $agents = agents_get_group_agents (array_keys ($groups)); -Index: godmode/servers/manage_recontask.php -=================================================================== ---- godmode/servers/manage_recontask.php (revision 10314) -+++ godmode/servers/manage_recontask.php (working copy) -@@ -204,6 +204,7 @@ - if (($id_recon_script == 'NULL') && preg_match("/[0-9]+.+[0-9]+.+[0-9]+.+[0-9]+\/+[0-9]/", $network)) - { - $result = db_process_sql_insert('trecon_task', $values); -+ - $reason = __("Network provided is not correct"); - } - elseif ($id_recon_script != 'NULL') { -@@ -215,9 +216,10 @@ - $result = false; - } - } -- else -+ else { - $result = false; -- -+ } -+ - if ($result !== false) { - ui_print_success_message(__('Successfully created recon task')); - } -Index: godmode/servers/manage_recontask_form.php -=================================================================== ---- godmode/servers/manage_recontask_form.php (revision 10314) -+++ godmode/servers/manage_recontask_form.php (working copy) -@@ -54,7 +54,7 @@ - echo io_json_mb_encode($macros); - return; - } -- -+ - return; - } - -@@ -261,7 +261,7 @@ - - - $explanation = db_get_value('description', 'trecon_script', 'id_recon_script', $id_recon_script); -- -+ - $table->data[12][0] = "<b>" . __('Explanation') . "</b>"; - $table->data[12][1] = "<span id='spinner_layour' style='display: none;'>" . html_print_image ("images/spinner.gif", true) . - "</span>" . html_print_textarea('explanation', 4, 60, $explanation, 'style="width: 388px;"', true); -Index: godmode/alerts/configure_alert_template.php -=================================================================== ---- godmode/alerts/configure_alert_template.php (revision 10314) -+++ godmode/alerts/configure_alert_template.php (working copy) -@@ -394,11 +394,15 @@ - } - if ($result) { - //db_pandora_audit("Command management", "Create alert command " . $result, false, false, json_encode($values)); -- db_pandora_audit("Template alert management", "Create alert template #" . $result, false, false, json_encode($values)); -+ db_pandora_audit("Template alert management", -+ "Create alert template #" . $result, false, false, -+ json_encode($values)); - } - else { - //db_pandora_audit("Command management", "Fail try to create alert command", false, false, json_encode($values)); -- db_pandora_audit("Template alert management", "Fail try to create alert template", false, false, json_encode($values)); -+ db_pandora_audit("Template alert management", -+ "Fail try to create alert template", false, false, -+ json_encode($values)); - } - - ui_print_result_message ($result, -@@ -455,7 +459,7 @@ - for ($i = 1; $i <= 10; $i++) { - $fields_recovery[$i] = $template['field'.$i.'_recovery']; - } -- -+ - $default_action = $template['id_alert_action']; - $priority = $template['priority']; - $id_group = $template['id_group']; -@@ -474,6 +478,10 @@ - $table->size[2] = '20%'; - - if ($step == 2) { -+ -+ if (!isset($show_matches)) -+ $show_matches = false; -+ - /* Firing conditions and events */ - $table->colspan = array (); - $table->colspan[4][1] = 3; -@@ -493,7 +501,7 @@ - $table->data[0][1] .= html_print_checkbox ('saturday', 1, $saturday, true); - $table->data[0][1] .= __('Sun'); - $table->data[0][1] .= html_print_checkbox ('sunday', 1, $sunday, true); -- -+ - $table->data[0][2] = __('Use special days list'); - $table->data[0][3] = html_print_checkbox ('special_day', 1, $special_day, true); - -@@ -512,11 +520,11 @@ - '', false, true); - - $table->data[3][0] = __('Min. number of alerts'); -- $table->data[3][1] = html_print_input_text ('min_alerts', $min_alerts, '', -- 5, 7, true); -+ $table->data[3][1] = html_print_input_text ('min_alerts', -+ $min_alerts, '', 5, 7, true); - $table->data[3][2] = __('Max. number of alerts'); -- $table->data[3][3] = html_print_input_text ('max_alerts', $max_alerts, '', -- 5, 7, true); -+ $table->data[3][3] = html_print_input_text ('max_alerts', -+ $max_alerts, '', 5, 7, true); - - $table->data[4][0] = __('Default action'); - $usr_groups = implode(',', array_keys(users_get_groups($config['id_user'], 'LM', true))); -@@ -529,7 +537,8 @@ - ORDER BY name', $usr_groups); - break; - case "oracle": -- $sql_query = sprintf('SELECT id, dbms_lob.substr(name,4000,1) as nombre -+ $sql_query = sprintf('SELECT id, -+ dbms_lob.substr(name,4000,1) AS nombre - FROM talert_actions - WHERE id_group IN (%s) - ORDER BY dbms_lob.substr(name,4000,1)', $usr_groups); -@@ -543,13 +552,15 @@ - $table->data[5][0] = __('Condition type'); - $table->data[5][1] = html_print_select (alerts_get_alert_templates_types (), 'type', - $type, '', __('Select'), 0, true, false, false); -- $table->data[5][1] .= '<span id="matches_value" '.($show_matches ? '' : 'style="display: none"').'>'; -+ $table->data[5][1] .= '<span id="matches_value" ' . -+ ($show_matches ? '' : 'style="display: none"').'>'; - $table->data[5][1] .= ' '.html_print_checkbox ('matches_value', 1, $matches, true); -- $table->data[5][1] .= html_print_label (__('Trigger when matches the value'), -+ $table->data[5][1] .= html_print_label( -+ __('Trigger when matches the value'), - 'checkbox-matches_value', true); - $table->data[5][1] .= '</span>'; - $table->colspan[5][1] = 3; -- -+ - $table->data['value'][0] = __('Value'); - $table->data['value'][1] = html_print_input_text ('value', $value, '', - 35, 255, true); -@@ -566,17 +577,20 @@ - 'width' => '20px')); - $table->data['value'][1] .= '</span>'; - $table->colspan['value'][1] = 3; -- -+ - //Min first, then max, that's more logical - $table->data['min'][0] = __('Min.'); -- $table->data['min'][1] = html_print_input_text ('min', $min, '', 5, 255, true); -+ $table->data['min'][1] = html_print_input_text ('min', $min, '', 5, -+ 255, true); - $table->colspan['min'][1] = 3; -- -+ - $table->data['max'][0] = __('Max.'); -- $table->data['max'][1] = html_print_input_text ('max', $max, '', 5, 255, true); -+ $table->data['max'][1] = html_print_input_text ('max', $max, '', 5, -+ 255, true); - $table->colspan['max'][1] = 3; -- -- $table->data['example'][1] = ui_print_alert_template_example ($id, true, false); -+ -+ $table->data['example'][1] = ui_print_alert_template_example($id, -+ true, false); - $table->colspan['example'][1] = 4; - } - else if ($step == 3) { -@@ -585,7 +599,7 @@ - $table->style[2] = 'font-weight: bold; vertical-align: top'; - $table->size = array (); - $table->size[0] = '20%'; -- -+ - /* Alert recover */ - if (! $recovery_notify) { - $table->cellstyle['label_fields'][2] = 'display:none;'; -@@ -610,7 +624,7 @@ - $table->data['label_fields'][0] = ''; - $table->data['label_fields'][1] = __('Firing fields'); - $table->data['label_fields'][2] = __('Recovery fields'); -- -+ - for ($i = 1; $i <= 10; $i++) { - if (isset($template[$name])) { - $value = $template[$name]; -@@ -621,8 +635,9 @@ - - //$table->rowclass['field'.$i] = 'row_field'; - -- $table->data['field'.$i][0] = sprintf(__('Field %s'), $i) . ui_print_help_icon ('alert_macros', true); -- $table->data['field'.$i][1] = html_print_textarea ('field'.$i, 1, 1, isset($fields[$i]) ? $fields[$i] : '', 'style="min-height:40px;" class="fields"', true); -+ $table->data['field'.$i][0] = sprintf(__('Field %s'), $i) . -+ ui_print_help_icon ('alert_macros', true); -+ $table->data['field'.$i][1] = html_print_textarea('field'.$i, 1, 1, isset($fields[$i]) ? $fields[$i] : '', 'style="min-height:40px;" class="fields"', true); - // Recovery - $table->data['field'.$i][2] = html_print_textarea ('field'.$i.'_recovery', 1, 1, isset($fields_recovery[$i]) ? $fields_recovery[$i] : '', 'style="min-height:40px" class="fields"', true); - } -Index: godmode/alerts/alert_list.builder.php -=================================================================== ---- godmode/alerts/alert_list.builder.php (revision 10314) -+++ godmode/alerts/alert_list.builder.php (working copy) -@@ -80,7 +80,7 @@ - $own_info = get_user_info ($config['id_user']); - if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) - $templates = alerts_get_alert_templates (false, array ('id', 'name')); --else{ -+else { - $usr_groups = users_get_groups($config['id_user'], 'LW', true); - $filter_groups = ''; - $filter_groups = implode(',', array_keys($usr_groups)); -@@ -107,13 +107,17 @@ - $actions = db_get_all_rows_sql($sql); - } - $table->data[2][1] = '<div class="actions_container">'; --$table->data[2][1] .= html_print_select(index_array ($actions, 'id', 'name'),'action_select','','',__('Default action'),'0',true, '', true, '', false, 'width: 250px;'); -+$table->data[2][1] .= html_print_select( -+ index_array($actions, 'id', 'name'), 'action_select', '', '', -+ __('Default action'), '0', true, '', true, '', false, -+ 'width: 250px;'); - $table->data[2][1] .= '<span id="advanced_action" class="advanced_actions invisible"><br>'; - $table->data[2][1] .= __('Number of alerts match from').' '; - $table->data[2][1] .= html_print_input_text ('fires_min', '', '', 4, 10, true); --$table->data[2][1] .= ' '.__('to').' '; -+$table->data[2][1] .= ' ' . __('to') . ' '; - $table->data[2][1] .= html_print_input_text ('fires_max', '', '', 4, 10, true); --$table->data[2][1] .= ui_print_help_icon ("alert-matches", true, ui_get_full_url(false, false, false, false)); -+$table->data[2][1] .= ui_print_help_icon ("alert-matches", true, -+ ui_get_full_url(false, false, false, false)); - $table->data[2][1] .= '</span>'; - $table->data[2][1] .= '</div>'; - if (check_acl ($config['id_user'], 0, "LM")) { -Index: godmode/snmpconsole/snmp_alert.php -=================================================================== ---- godmode/snmpconsole/snmp_alert.php (revision 10314) -+++ godmode/snmpconsole/snmp_alert.php (working copy) -@@ -476,10 +476,11 @@ - $user_groups = users_get_groups($config['id_user'],"AR", true); - $str_user_groups = ''; - $i = 0; --foreach ($user_groups as $id=>$name) { -+foreach ($user_groups as $id => $name) { - if ($i == 0) { - $str_user_groups .= $id; -- } else { -+ } -+ else { - $str_user_groups .= ','.$id; - } - $i++; -@@ -895,6 +896,7 @@ - $where_sql .= ' AND `priority` = ' . $priority_filter; - } - -+ $where_sql = ""; - if (!empty($free_search)) { - $where_sql .= " AND (`single_value` LIKE '%" . $free_search . "%' - OR `_snmp_f10_` LIKE '%" . $free_search . "%' -@@ -914,7 +916,8 @@ - } - - $count = db_get_value_sql("SELECT COUNT(*) -- FROM talert_snmp WHERE id_group IN ($str_user_groups) " . $where_sql); -+ FROM talert_snmp WHERE id_group IN ($str_user_groups) " . -+ $where_sql); - - $result = array(); - -Index: godmode/setup/setup_general.php -=================================================================== ---- godmode/setup/setup_general.php (revision 10314) -+++ godmode/setup/setup_general.php (working copy) -@@ -252,6 +252,17 @@ - $table->data[32][0] = __('Server logs directory') . ui_print_help_tip (__("Directory where the server logs are stored."), true); - $table->data[32][1] = html_print_input_text ('server_log_dir', $config["server_log_dir"], '', 50, 255, true); - -+$modes_tutorial = array( -+ 'full' => __('Full mode'), -+ 'on_demand' => __('On demand'), -+ 'expert' => __('Expert') -+ ); -+$table->data['tutorial_mode'][0] = __('Tutorial mode') . -+ ui_print_help_tip (__("Configuration of our clippy, 'full mode' show the icon in the header and the contextual helps and it is noise, 'on demand' it is equal to full but it is not noise and 'expert' the icons in the header and the context is not."), true); -+$table->data['tutorial_mode'][1] = -+ html_print_select($modes_tutorial, 'tutorial_mode', -+ $config["tutorial_mode"], '', '', 0, true); -+ - echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&section=general&pure='.$config['pure'].'">'; - - echo "<fieldset>"; -Index: godmode/setup/license.php -=================================================================== ---- godmode/setup/license.php (revision 10314) -+++ godmode/setup/license.php (working copy) -@@ -47,7 +47,8 @@ - } - - echo '<script type="text/javascript">'; --print_js_var_enteprise(); -+if (enterprise_installed()) -+ print_js_var_enteprise(); - echo '</script>'; - - echo '<form method="post">'; -@@ -71,11 +72,13 @@ - $table->data[4][1] = html_print_input_text('expires', $license['license_mode'], '', 10, 255, true, true); - - html_print_table ($table); --echo '<div class="action-buttons" style="width: '.$table->width.'">'; --html_print_input_hidden ('update_settings', 1); --html_print_submit_button (__('Validate'), 'update_button', false, 'class="sub upd"'); --html_print_button(__('Request new license'), '', false, 'generate_request_code()', 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub next"'); --echo '</div>'; -+if (enterprise_installed()) { -+ echo '<div class="action-buttons" style="width: '.$table->width.'">'; -+ html_print_input_hidden ('update_settings', 1); -+ html_print_submit_button (__('Validate'), 'update_button', false, 'class="sub upd"'); -+ html_print_button(__('Request new license'), '', false, 'generate_request_code()', 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub next"'); -+ echo '</div>'; -+} - echo '</form>'; - echo '<div id="code_license_dialog" style="display: none; text-align: left;" title="' . __('Request new license') . '">'; - echo '<div id="logo">'; -Index: godmode/setup/setup_visuals.php -=================================================================== ---- godmode/setup/setup_visuals.php (revision 10314) -+++ godmode/setup/setup_visuals.php (working copy) -@@ -399,6 +399,16 @@ - - $row++; - -+$table->data[$row][0] = __('Fixed header'); -+$table->data[$row][1] = html_print_checkbox('fixed_header', 1, $config['fixed_header'], true); -+ -+$row++; -+ -+$table->data[$row][0] = __('Fixed menu'); -+$table->data[$row][1] = html_print_checkbox('fixed_menu', 1, $config['fixed_menu'], true); -+ -+$row++; -+ - echo '<form id="form_setup" method="post">'; - html_print_input_hidden ('update_config', 1); - html_print_table ($table); -Index: godmode/modules/manage_network_components_form.php -=================================================================== ---- godmode/modules/manage_network_components_form.php (revision 10314) -+++ godmode/modules/manage_network_components_form.php (working copy) -@@ -489,7 +489,7 @@ - $("input[name=snmp_community]").css({backgroundColor: '#ddd'}); - $("input[name=snmp_community]").attr("disabled",true); - } -- else{ -+ else { - $("input[name=snmp3_auth_user]").val(""); - $("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd'}); - $("input[name=snmp3_auth_user]").attr("disabled", true); -Index: godmode/reporting/reporting_builder.php -=================================================================== ---- godmode/reporting/reporting_builder.php (revision 10314) -+++ godmode/reporting/reporting_builder.php (working copy) -@@ -66,12 +66,12 @@ - 'args' => serialize ($parameters), - 'scheduled' => $scheduled, - 'flag_delete' => 1); -- -+ - $result = db_process_sql_insert('tuser_task_scheduled', $values); - - ui_print_result_message ($result, -- __('Your report has been planned, and the system will email you a PDF with the report as soon as its finished'), -- __('An error has ocurred')); -+ __('Your report has been planned, and the system will email you a PDF with the report as soon as its finished'), -+ __('An error has ocurred')); - echo '<br>'; - } - -@@ -451,10 +451,13 @@ - $data[2] = '<a href="' . $config['homeurl'] . 'index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id='.$report['id_report'].'&pure='.$pure.'">' . - html_print_image("images/html.png", true, array('title' => __('HTML view'))) . '</a>'; - $data[3] = '<a href="'. ui_get_full_url(false, false, false, false) . 'ajax.php?page=' . $config['homedir'] . '/operation/reporting/reporting_xml&id='.$report['id_report'].'">' . html_print_image("images/xml.png", true, array('title' => __('Export to XML'))) . '</a>'; //I chose ajax.php because it's supposed to give XML anyway -- } else { -- $data[2] = html_print_image("images/html_disabled.png", true); -- $data[3] = html_print_image("images/xml_disabled.png", true); - } -+ else { -+ $data[2] = html_print_image( -+ "images/html_disabled.png", true); -+ $data[3] = html_print_image( -+ "images/xml_disabled.png", true); -+ } - - - //Calculate dinamically the number of the column -@@ -475,7 +478,8 @@ - $next++; - - -- $data[$next] = ui_print_group_icon($report['id_group'], true, "groups_small", '', !defined('METACONSOLE')); -+ $data[$next] = ui_print_group_icon( -+ $report['id_group'], true, "groups_small", '', !defined('METACONSOLE')); - $next++; - } - -@@ -801,7 +805,7 @@ - else - $values['id_agent_module'] = get_parameter('id_agent_module'); - -- $values['only_display_wrong'] = get_parameter('checkbox_only_display_wrong'); -+ $values['only_display_wrong'] = (int)get_parameter('checkbox_only_display_wrong', 0); - $values['monday'] = get_parameter('monday', 0); - $values['tuesday'] = get_parameter('tuesday', 0); - $values['wednesday'] = get_parameter('wednesday', 0); -@@ -814,7 +818,7 @@ - $values['group_by_agent'] = get_parameter ('checkbox_row_group_by_agent'); - $values['show_resume'] = get_parameter ('checkbox_show_resume'); - $values['order_uptodown'] = get_parameter ('radiobutton_order_uptodown'); -- $values['exception_condition'] = get_parameter('exception_condition'); -+ $values['exception_condition'] = (int)get_parameter('exception_condition', 0); - $values['exception_condition_value'] = get_parameter('exception_condition_value'); - $values['show_graph'] = get_parameter('combo_graph_options'); - $values['id_module_group'] = get_parameter('combo_modulegroup'); -@@ -916,7 +920,7 @@ - if ($good_format) { - $resultOperationDB = db_process_sql_update('treport_content', $values, array('id_rc' => $idItem)); - } -- else{ -+ else { - $resultOperationDB = false; - } - break; -@@ -926,6 +930,7 @@ - $values['type'] = get_parameter('type', null); - $values['name'] = (string) get_parameter('name'); - $values['description'] = get_parameter('description'); -+ - // Support for projection graph, prediction date and SLA reports - // 'top_n_value', 'top_n' and 'text' fields will be reused for these types of report - switch ($values['type']) { -@@ -1007,15 +1012,15 @@ - switch ($config['dbtype']) { - case "mysql": - case "postgresql": -- $values['only_display_wrong'] = get_parameter('checkbox_only_display_wrong'); -+ $values['only_display_wrong'] = (int)get_parameter('checkbox_only_display_wrong', 0); - break; - case "oracle": - $only_display_wrong_tmp = get_parameter('checkbox_only_display_wrong'); - if (empty($only_display_wrong_tmp)) { - $values['only_display_wrong'] = 0; - } -- else{ -- $values['only_display_wrong'] = $only_display_wrong_tmp; -+ else { -+ $values['only_display_wrong'] = $only_display_wrong_tmp; - } - break; - } -@@ -1040,7 +1045,7 @@ - $values['group_by_agent'] = get_parameter ('checkbox_row_group_by_agent',0); - $values['show_resume'] = get_parameter ('checkbox_show_resume',0); - $values['order_uptodown'] = get_parameter ('radiobutton_order_uptodown',0); -- $values['exception_condition'] = get_parameter('radiobutton_exception_condition'); -+ $values['exception_condition'] = (int)get_parameter('radiobutton_exception_condition', 0); - $values['exception_condition_value'] = get_parameter('exception_condition_value'); - $values['show_graph'] = get_parameter('combo_graph_options'); - $values['id_module_group'] = get_parameter('combo_modulegroup'); -@@ -1391,11 +1396,17 @@ - default: - switch ($config["dbtype"]) { - case "mysql": -- $oldOrder = db_get_value_sql('SELECT `order` FROM treport_content WHERE id_rc = ' . $idItem); -+ $oldOrder = db_get_value_sql(' -+ SELECT `order` -+ FROM treport_content -+ WHERE id_rc = ' . $idItem); - break; - case "postgresql": - case "oracle": -- $oldOrder = db_get_value_sql('SELECT "order" FROM treport_content WHERE id_rc = ' . $idItem); -+ $oldOrder = db_get_value_sql(' -+ SELECT "order" -+ FROM treport_content -+ WHERE id_rc = ' . $idItem); - break; - } - //db_get_value_filter('order', 'treport_content', array('id_rc' => $idItem)); -@@ -1413,17 +1424,20 @@ - case "mysql": - $resultOperationDB = db_process_sql_update('treport_content', - array('`order`' => $oldOrder), -- array('`order`' => $newOrder, 'id_report' => $idReport)); -+ array('`order`' => $newOrder, -+ 'id_report' => $idReport)); - break; - case "postgresql": - $resultOperationDB = db_process_sql_update('treport_content', - array('"order"' => $oldOrder), -- array('"order"' => $newOrder, 'id_report' => $idReport)); -+ array('"order"' => $newOrder, -+ 'id_report' => $idReport)); - break; - case "oracle": - $resultOperationDB = db_process_sql_update('treport_content', - array('"order"' => $oldOrder), -- array('"order"' => $newOrder, 'id_report' => $idReport), -+ array('"order"' => $newOrder, -+ 'id_report' => $idReport), - 'AND', false); - break; - } -@@ -1505,7 +1519,7 @@ - $resultOperationDB = $result; - } - } -- -+ - $buttons = array( - 'list_reports' => array('active' => false, - 'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure.'">' . -@@ -1545,15 +1559,21 @@ - // Page header for metaconsole - if ($enterpriseEnable and defined('METACONSOLE')) { - // Bread crumbs -- ui_meta_add_breadcrumb(array('link' => 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure, 'text' => __('Reporting'))); -+ ui_meta_add_breadcrumb( -+ array('link' => -+ 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure=' . $pure, -+ 'text' => __('Reporting'))); - - ui_meta_print_page_header($nav_bar); - - // Print header - ui_meta_print_header(__('Reporting'). $textReportName, "", $buttons); - } --else -- ui_print_page_header(__('Reporting') . $textReportName, "images/op_reporting.png", false, "reporting_" . $activeTab . "_tab", false, $buttons); -+else { -+ ui_print_page_header(__('Reporting') . $textReportName, -+ "images/op_reporting.png", false, -+ "reporting_" . $activeTab . "_tab", false, $buttons); -+} - - enterprise_hook('open_meta_frame'); - -@@ -1563,13 +1583,16 @@ - - switch ($activeTab) { - case 'main': -- require_once($config['homedir'] . '/godmode/reporting/reporting_builder.main.php'); -+ require_once($config['homedir'] . -+ '/godmode/reporting/reporting_builder.main.php'); - break; - case 'list_items': -- require_once($config['homedir'] . '/godmode/reporting/reporting_builder.list_items.php'); -+ require_once($config['homedir'] . -+ '/godmode/reporting/reporting_builder.list_items.php'); - break; - case 'item_editor': -- require_once($config['homedir'] . '/godmode/reporting/reporting_builder.item_editor.php'); -+ require_once($config['homedir'] . -+ '/godmode/reporting/reporting_builder.item_editor.php'); - break; - default: - reporting_enterprise_select_tab($activeTab); -Index: godmode/reporting/map_builder.php -=================================================================== ---- godmode/reporting/map_builder.php (revision 10314) -+++ godmode/reporting/map_builder.php (working copy) -@@ -125,7 +125,7 @@ - ui_print_error_message(__('Not copied. Error copying data')); - } - } -- else{ -+ else { - // If the array is empty the copy is completed - ui_print_success_message(__('Successfully copied')); - db_clean_cache(); diff --git a/net-mgmt/pandorafms_console/pkg-plist b/net-mgmt/pandorafms_console/pkg-plist index 97b7c8ca80e8..a04c3ebe1c91 100644 --- a/net-mgmt/pandorafms_console/pkg-plist +++ b/net-mgmt/pandorafms_console/pkg-plist @@ -4,6 +4,11 @@ @group www @mode %%WWWDIR%%/ajax.php +%%WWWDIR%%/attachment/index.html +%%WWWDIR%%/attachment/mibs/index.html +%%WWWDIR%%/attachment/plugin/index.html +@dir %%WWWDIR%%/attachment/collections +@dir %%WWWDIR%%/attachment/downloads %%WWWDIR%%/COPYING %%WWWDIR%%/extensions/agents_alerts.php %%WWWDIR%%/extensions/agents_modules.php @@ -95,6 +100,7 @@ %%WWWDIR%%/godmode/agentes/module_manager_editor_prediction.php %%WWWDIR%%/godmode/agentes/module_manager_editor_wmi.php %%WWWDIR%%/godmode/agentes/planned_downtime.editor.php +%%WWWDIR%%/godmode/agentes/planned_downtime.export_csv.php %%WWWDIR%%/godmode/agentes/planned_downtime.list.php %%WWWDIR%%/godmode/alerts/alert_actions.php %%WWWDIR%%/godmode/alerts/alert_commands.php @@ -117,7 +123,6 @@ %%WWWDIR%%/godmode/db/db_main.php %%WWWDIR%%/godmode/db/db_purge.php %%WWWDIR%%/godmode/db/db_refine.php -%%WWWDIR%%/godmode/db/db_sanity.php %%WWWDIR%%/godmode/events/custom_events.php %%WWWDIR%%/godmode/events/event_edit_filter.php %%WWWDIR%%/godmode/events/event_filter.php @@ -307,8 +312,16 @@ %%WWWDIR%%/images/chart_curve_threshold.png %%WWWDIR%%/images/check-cross.png %%WWWDIR%%/images/clean.png +%%WWWDIR%%/images/clippy/clippy.png +%%WWWDIR%%/images/clippy/easter_egg_00.png +%%WWWDIR%%/images/clippy/easter_egg_01.png +%%WWWDIR%%/images/clippy/easter_egg_02.png +%%WWWDIR%%/images/clippy/easter_egg_03.png +%%WWWDIR%%/images/clippy/easter_egg_04.png +%%WWWDIR%%/images/clippy_icon.png %%WWWDIR%%/images/clock.png %%WWWDIR%%/images/clock2.png +%%WWWDIR%%/images/close_button_dialog.png %%WWWDIR%%/images/cog.png %%WWWDIR%%/images/cog_db.png %%WWWDIR%%/images/cog_del.png @@ -1114,6 +1127,7 @@ %%WWWDIR%%/images/printer.png %%WWWDIR%%/images/profiles.png %%WWWDIR%%/images/qrcode_icon.jpg +%%WWWDIR%%/images/radial_dynamic_network_icon.png %%WWWDIR%%/images/recon.png %%WWWDIR%%/images/recon_icon.png %%WWWDIR%%/images/refresh.png @@ -1357,6 +1371,7 @@ %%WWWDIR%%/images/wand.png %%WWWDIR%%/images/wand_agent.png %%WWWDIR%%/images/wand_interfaces.png +%%WWWDIR%%/images/wand_services.png %%WWWDIR%%/images/wand_sla.png %%WWWDIR%%/images/wand_snmp.png %%WWWDIR%%/images/wand_wmi.png @@ -1378,6 +1393,7 @@ %%WWWDIR%%/include/ajax/agent.php %%WWWDIR%%/include/ajax/alert_list.ajax.php %%WWWDIR%%/include/ajax/events.php +%%WWWDIR%%/include/ajax/graph.ajax.php %%WWWDIR%%/include/ajax/menu.ajax.php %%WWWDIR%%/include/ajax/module.php %%WWWDIR%%/include/ajax/networkmap.ajax.php @@ -1439,6 +1455,7 @@ %%WWWDIR%%/include/functions_network_profiles.php %%WWWDIR%%/include/functions_networkmap.php %%WWWDIR%%/include/functions_os.php +%%WWWDIR%%/include/functions_planned_downtimes.php %%WWWDIR%%/include/functions_profile.php %%WWWDIR%%/include/functions_reporting.php %%WWWDIR%%/include/functions_reports.php @@ -1510,10 +1527,18 @@ %%WWWDIR%%/include/graphs/pChart/palettes/spring.color %%WWWDIR%%/include/graphs/pChart/palettes/summer.color %%WWWDIR%%/include/graphs/pandora.d3.js +%%WWWDIR%%/include/help/clippy/agent_out_of_limits.php +%%WWWDIR%%/include/help/clippy/extension_cron_send_email.php %%WWWDIR%%/include/help/clippy/godmode_agentes_configurar_agente.php %%WWWDIR%%/include/help/clippy/godmode_agentes_modificar_agente.php +%%WWWDIR%%/include/help/clippy/godmode_alerts_alert_actions.php +%%WWWDIR%%/include/help/clippy/godmode_alerts_configure_alert_action.php %%WWWDIR%%/include/help/clippy/homepage.php %%WWWDIR%%/include/help/clippy/module_unknow.php +%%WWWDIR%%/include/help/clippy/modules_not_init.php +%%WWWDIR%%/include/help/clippy/modules_not_learning_mode.php +%%WWWDIR%%/include/help/clippy/operation_agentes_status_monitor.php +%%WWWDIR%%/include/help/clippy/operation_agentes_ver_agente.php %%WWWDIR%%/include/help/en/help_action_threshold.php %%WWWDIR%%/include/help/en/help_agent_access.php %%WWWDIR%%/include/help/en/help_agent_server.php @@ -1542,6 +1567,7 @@ %%WWWDIR%%/include/help/en/help_conf_alert_template.php %%WWWDIR%%/include/help/en/help_configure_gis_map.php %%WWWDIR%%/include/help/en/help_context_module_unknow.php +%%WWWDIR%%/include/help/en/help_context_pandora_server_email.php %%WWWDIR%%/include/help/en/help_create_agent.php %%WWWDIR%%/include/help/en/help_critical_status.php %%WWWDIR%%/include/help/en/help_custom_logo.php @@ -1590,6 +1616,7 @@ %%WWWDIR%%/include/help/en/help_pcap_filter.php %%WWWDIR%%/include/help/en/help_performance.php %%WWWDIR%%/include/help/en/help_planned_downtime.php +%%WWWDIR%%/include/help/en/help_planned_downtime_time.php %%WWWDIR%%/include/help/en/help_plugin_definition.php %%WWWDIR%%/include/help/en/help_plugin_macros.php %%WWWDIR%%/include/help/en/help_plugin_parameters.php @@ -1601,6 +1628,7 @@ %%WWWDIR%%/include/help/en/help_prediction_source_module.php %%WWWDIR%%/include/help/en/help_profile.php %%WWWDIR%%/include/help/en/help_projection_graph.php +%%WWWDIR%%/include/help/en/help_propagate_acl.php %%WWWDIR%%/include/help/en/help_reconscript_definition.php %%WWWDIR%%/include/help/en/help_recontask.php %%WWWDIR%%/include/help/en/help_reporting_advanced_tab.php @@ -1722,6 +1750,7 @@ %%WWWDIR%%/include/help/es/help_pcap_filter.php %%WWWDIR%%/include/help/es/help_performance.php %%WWWDIR%%/include/help/es/help_planned_downtime.php +%%WWWDIR%%/include/help/es/help_planned_downtime_time.php %%WWWDIR%%/include/help/es/help_plugin_definition.php %%WWWDIR%%/include/help/es/help_plugin_macros.php %%WWWDIR%%/include/help/es/help_plugin_parameters.php @@ -1733,6 +1762,7 @@ %%WWWDIR%%/include/help/es/help_prediction_source_module.php %%WWWDIR%%/include/help/es/help_profile.php %%WWWDIR%%/include/help/es/help_projection_graph.php +%%WWWDIR%%/include/help/es/help_propagate_acl.php %%WWWDIR%%/include/help/es/help_reconscript_definition.php %%WWWDIR%%/include/help/es/help_recontask.php %%WWWDIR%%/include/help/es/help_reporting_advanced_tab.php @@ -1805,6 +1835,7 @@ %%WWWDIR%%/include/help/ja/help_component_groups.php %%WWWDIR%%/include/help/ja/help_conf_alert_template.php %%WWWDIR%%/include/help/ja/help_configure_gis_map.php +%%WWWDIR%%/include/help/ja/help_context_pandora_server_email.php %%WWWDIR%%/include/help/ja/help_create_agent.php %%WWWDIR%%/include/help/ja/help_critical_status.php %%WWWDIR%%/include/help/ja/help_custom_logo.php @@ -1863,6 +1894,7 @@ %%WWWDIR%%/include/help/ja/help_prediction_source_module.php %%WWWDIR%%/include/help/ja/help_profile.php %%WWWDIR%%/include/help/ja/help_projection_graph.php +%%WWWDIR%%/include/help/ja/help_propagate_acl.php %%WWWDIR%%/include/help/ja/help_reconscript_definition.php %%WWWDIR%%/include/help/ja/help_recontask.php %%WWWDIR%%/include/help/ja/help_reporting_advanced_tab.php @@ -2514,6 +2546,8 @@ %%WWWDIR%%/include/languages/util-update-po %%WWWDIR%%/include/languages/zh_CN.mo %%WWWDIR%%/include/languages/zh_CN.po +%%WWWDIR%%/include/languages/zh_TW.mo +%%WWWDIR%%/include/languages/zh_TW.po %%WWWDIR%%/include/php_to_js_values.php %%WWWDIR%%/include/sounds/Door_Alarm.wav %%WWWDIR%%/include/sounds/EAS_beep.wav @@ -2798,6 +2832,7 @@ %%WWWDIR%%/operation/agentes/gis_view.php %%WWWDIR%%/operation/agentes/graphs.php %%WWWDIR%%/operation/agentes/group_view.php +%%WWWDIR%%/operation/agentes/interface_traffic_graph_win.php %%WWWDIR%%/operation/agentes/networkmap.dinamic.php %%WWWDIR%%/operation/agentes/networkmap.groups.php %%WWWDIR%%/operation/agentes/networkmap.php @@ -2834,7 +2869,6 @@ %%WWWDIR%%/operation/integria_incidents/incident.php %%WWWDIR%%/operation/integria_incidents/incident.tracking.php %%WWWDIR%%/operation/integria_incidents/incident.workunits.php -%%WWWDIR%%/operation/integria_incidents/incident_detail.php %%WWWDIR%%/operation/integria_incidents/incident_statistics.php %%WWWDIR%%/operation/menu.php %%WWWDIR%%/operation/messages/message_edit.php @@ -2850,6 +2884,8 @@ %%WWWDIR%%/operation/search_alerts.php %%WWWDIR%%/operation/search_graphs.getdata.php %%WWWDIR%%/operation/search_graphs.php +%%WWWDIR%%/operation/search_helps.getdata.php +%%WWWDIR%%/operation/search_helps.php %%WWWDIR%%/operation/search_main.php %%WWWDIR%%/operation/search_maps.getdata.php %%WWWDIR%%/operation/search_maps.php @@ -2863,6 +2899,7 @@ %%WWWDIR%%/operation/servers/recon_view.php %%WWWDIR%%/operation/snmpconsole/snmp_browser.php %%WWWDIR%%/operation/snmpconsole/snmp_mib_uploader.php +%%WWWDIR%%/operation/snmpconsole/snmp_statistics.php %%WWWDIR%%/operation/snmpconsole/snmp_view.php %%WWWDIR%%/operation/system_alert.php %%WWWDIR%%/operation/tree.php @@ -2890,247 +2927,3 @@ %%WWWDIR%%/pandoradb.postgreSQL.sql %%WWWDIR%%/pandoradb.sql %%WWWDIR%%/pandoradb_data.sql -@dirrm %%WWWDIR%%/operation/visual_console -@dirrm %%WWWDIR%%/operation/users -@dirrm %%WWWDIR%%/operation/tree -@dirrm %%WWWDIR%%/operation/snmpconsole -@dirrm %%WWWDIR%%/operation/servers -@dirrm %%WWWDIR%%/operation/reporting -@dirrm %%WWWDIR%%/operation/netflow -@dirrm %%WWWDIR%%/operation/messages -@dirrm %%WWWDIR%%/operation/integria_incidents -@dirrm %%WWWDIR%%/operation/incidents -@dirrm %%WWWDIR%%/operation/gis_maps -@dirrm %%WWWDIR%%/operation/events -@dirrm %%WWWDIR%%/operation/agentes -@dirrm %%WWWDIR%%/operation -@dirrm %%WWWDIR%%/mobile/operation -@dirrm %%WWWDIR%%/mobile/include/style/images -@dirrm %%WWWDIR%%/mobile/include/style -@dirrm %%WWWDIR%%/mobile/include/javascript -@dirrm %%WWWDIR%%/mobile/include -@dirrm %%WWWDIR%%/mobile/images -@dirrm %%WWWDIR%%/mobile -@dirrm %%WWWDIR%%/include/swiftmailer/dependency_maps -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/Transport/Esmtp/Auth -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/Transport/Esmtp -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/Transport -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/StreamFilters -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/Plugins/Reporters -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/Plugins/Pop -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/Plugins/Loggers -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/Plugins/Decorator -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/Plugins -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/Mime/Headers -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/Mime/HeaderEncoder -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/Mime/ContentEncoder -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/Mime -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/Mailer -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/KeyCache -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/Events -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/Encoder -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/CharacterStream -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/CharacterReaderFactory -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/CharacterReader -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift/ByteStream -@dirrm %%WWWDIR%%/include/swiftmailer/classes/Swift -@dirrm %%WWWDIR%%/include/swiftmailer/classes -@dirrm %%WWWDIR%%/include/swiftmailer -@dirrm %%WWWDIR%%/include/styles/images -@dirrm %%WWWDIR%%/include/styles -@dirrm %%WWWDIR%%/include/sounds -@dirrm %%WWWDIR%%/include/languages/datepicker -@dirrm %%WWWDIR%%/include/languages -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/utils -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes/simple/skins/o2k7/img -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes/simple/skins/o2k7 -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes/simple/skins/default -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes/simple/skins -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes/simple/langs -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes/simple/img -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes/simple -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes/advanced/skins/o2k7/img -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes/advanced/skins/o2k7 -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes/advanced/skins/highcontrast -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes/advanced/skins/default/img -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes/advanced/skins/default -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes/advanced/skins -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes/advanced/langs -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes/advanced/js -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes/advanced/img -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes/advanced -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/themes -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/xhtmlxtras/langs -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/xhtmlxtras/js -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/xhtmlxtras/css -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/xhtmlxtras -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/wordcount -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/visualchars -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/visualblocks/css -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/visualblocks -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/template/langs -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/template/js -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/template/css -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/template -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/table/langs -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/table/js -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/table/css -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/table -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/tabfocus -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/style/langs -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/style/js -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/style/css -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/style -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/spellchecker/includes -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/spellchecker/img -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/spellchecker/css -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/spellchecker/classes/utils -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/spellchecker/classes -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/spellchecker -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/searchreplace/langs -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/searchreplace/js -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/searchreplace/css -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/searchreplace -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/save -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/print -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/preview/jscripts -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/preview -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/paste/langs -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/paste/js -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/paste -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/pagebreak -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/noneditable -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/nonbreaking -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/media/langs -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/media/js -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/media/css -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/media -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/lists -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/legacyoutput -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/layer -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/insertdatetime -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/inlinepopups/skins/clearlooks2 -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/inlinepopups/skins -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/inlinepopups -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/iespell -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/fullscreen -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/fullpage/langs -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/fullpage/js -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/fullpage/css -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/fullpage -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/example_dependency -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/example/langs -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/example/js -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/example/img -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/example -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/emotions/langs -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/emotions/js -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/emotions/img -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/emotions -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/directionality -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/contextmenu -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/bbcode -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/autosave -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/autoresize -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/autolink -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/advlist -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/advlink/langs -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/advlink/js -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/advlink/css -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/advlink -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/advimage/langs -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/advimage/js -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/advimage/img -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/advimage/css -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/advimage -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/advhr/langs -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/advhr/js -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/advhr/css -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins/advhr -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/plugins -@dirrm %%WWWDIR%%/include/javascript/tiny_mce/langs -@dirrm %%WWWDIR%%/include/javascript/tiny_mce -@dirrm %%WWWDIR%%/include/javascript/mergely -@dirrm %%WWWDIR%%/include/javascript/i18n -@dirrm %%WWWDIR%%/include/javascript/OpenLayers/theme/default/img -@dirrm %%WWWDIR%%/include/javascript/OpenLayers/theme/default -@dirrm %%WWWDIR%%/include/javascript/OpenLayers/theme -@dirrm %%WWWDIR%%/include/javascript/OpenLayers/img -@dirrm %%WWWDIR%%/include/javascript/OpenLayers -@dirrm %%WWWDIR%%/include/javascript -@dirrm %%WWWDIR%%/include/help/ja -@dirrm %%WWWDIR%%/include/help/es -@dirrm %%WWWDIR%%/include/help/en -@dirrm %%WWWDIR%%/include/help/clippy -@dirrm %%WWWDIR%%/include/help -@dirrm %%WWWDIR%%/include/graphs/pChart/palettes -@dirrm %%WWWDIR%%/include/graphs/pChart/fonts -@dirrm %%WWWDIR%%/include/graphs/pChart/data -@dirrm %%WWWDIR%%/include/graphs/pChart/cache -@dirrm %%WWWDIR%%/include/graphs/pChart -@dirrm %%WWWDIR%%/include/graphs/images_graphs -@dirrm %%WWWDIR%%/include/graphs/flot -@dirrm %%WWWDIR%%/include/graphs -@dirrm %%WWWDIR%%/include/fonts -@dirrm %%WWWDIR%%/include/db -@dirrm %%WWWDIR%%/include/auth -@dirrm %%WWWDIR%%/include/ajax -@dirrm %%WWWDIR%%/include/Image -@dirrmtry %%WWWDIR%%/include -@dirrmtry %%WWWDIR%%/images/status_sets/faces -@dirrmtry %%WWWDIR%%/images/status_sets/default -@dirrmtry %%WWWDIR%%/images/status_sets/color_text -@dirrmtry %%WWWDIR%%/images/status_sets -@dirrmtry %%WWWDIR%%/images/os_icons -@dirrmtry %%WWWDIR%%/images/networkmap -@dirrmtry %%WWWDIR%%/images/mimetypes -@dirrmtry %%WWWDIR%%/images/help -@dirrmtry %%WWWDIR%%/images/groups_small -@dirrmtry %%WWWDIR%%/images/gis_map/icons -@dirrmtry %%WWWDIR%%/images/gis_map -@dirrmtry %%WWWDIR%%/images/custom_logo -@dirrmtry %%WWWDIR%%/images/console/icons/old_icons -@dirrmtry %%WWWDIR%%/images/console/icons -@dirrmtry %%WWWDIR%%/images/console/background -@dirrmtry %%WWWDIR%%/images/console -@dirrmtry %%WWWDIR%%/images/backgrounds -@dirrmtry %%WWWDIR%%/images -@dirrm %%WWWDIR%%/godmode/users -@dirrm %%WWWDIR%%/godmode/update_manager -@dirrm %%WWWDIR%%/godmode/tag -@dirrm %%WWWDIR%%/godmode/snmpconsole -@dirrm %%WWWDIR%%/godmode/setup -@dirrm %%WWWDIR%%/godmode/servers -@dirrm %%WWWDIR%%/godmode/reporting -@dirrm %%WWWDIR%%/godmode/netflow -@dirrm %%WWWDIR%%/godmode/modules -@dirrm %%WWWDIR%%/godmode/massive -@dirrm %%WWWDIR%%/godmode/groups -@dirrm %%WWWDIR%%/godmode/gis_maps -@dirrm %%WWWDIR%%/godmode/events -@dirrm %%WWWDIR%%/godmode/db -@dirrm %%WWWDIR%%/godmode/category -@dirrm %%WWWDIR%%/godmode/alerts -@dirrm %%WWWDIR%%/godmode/agentes -@dirrm %%WWWDIR%%/godmode -@dirrm %%WWWDIR%%/general/ui -@dirrm %%WWWDIR%%/general/license -@dirrm %%WWWDIR%%/general -@dirrmtry %%WWWDIR%%/fonts -@dirrm %%WWWDIR%%/extras -@dirrm %%WWWDIR%%/extensions/users -@dirrm %%WWWDIR%%/extensions/ssh_gateway -@dirrm %%WWWDIR%%/extensions/realtime_graphs -@dirrm %%WWWDIR%%/extensions/net_tools -@dirrm %%WWWDIR%%/extensions/module_groups -@dirrm %%WWWDIR%%/extensions/matrix_events -@dirrm %%WWWDIR%%/extensions/files_repo/sql -@dirrm %%WWWDIR%%/extensions/files_repo -@dirrm %%WWWDIR%%/extensions/dbmanager -@dirrm %%WWWDIR%%/extensions/agents_modules -@dirrmtry %%WWWDIR%%/extensions -@dirrmtry %%WWWDIR%%/attachment/plugin -@dirrmtry %%WWWDIR%%/attachment/mibs -@dirrmtry %%WWWDIR%%/attachment -@dirrmtry %%WWWDIR%% diff --git a/net-mgmt/pandorafms_server/Makefile b/net-mgmt/pandorafms_server/Makefile index acbb47b9578a..d11faee0c623 100644 --- a/net-mgmt/pandorafms_server/Makefile +++ b/net-mgmt/pandorafms_server/Makefile @@ -2,8 +2,6 @@ # $FreeBSD$ PORTNAME= pandora_server -PORTREVISION= 2 - CATEGORIES= net-mgmt MAINTAINER= koichiro@rworks.jp @@ -21,14 +19,13 @@ PANDORA_DEPS= p5-DBI>=0:${PORTSDIR}/databases/p5-DBI \ p5-XML-Simple>=0:${PORTSDIR}/textproc/p5-XML-Simple \ p5-XML-Twig>=0:${PORTSDIR}/textproc/p5-XML-Twig \ p5-JSON>=0:${PORTSDIR}/converters/p5-JSON - BUILD_DEPENDS= ${PANDORA_DEPS} - RUN_DEPENDS= p5-libwww>=0:${PORTSDIR}/www/p5-libwww \ p5-DBD-mysql>=4:${PORTSDIR}/databases/p5-DBD-mysql \ ${LOCALBASE}/bin/wmic:${PORTSDIR}/net-mgmt/wmi-client \ ${LOCALBASE}/bin/nmap:${PORTSDIR}/security/nmap \ p5-Storable>=0:${PORTSDIR}/devel/p5-Storable \ + p5-Encode-Locale>=0:${PORTSDIR}/converters/p5-Encode-Locale \ ${PANDORA_DEPS} OPTIONS_DEFINE= DOCS TENTACLE XPROBE PGSQL ORACLE EXTRAS @@ -104,7 +101,7 @@ post-install: @${MV} ${STAGEDIR}${ETCDIR}/pandora_server.conf ${STAGEDIR}${ETCDIR}/pandora_server.conf.sample @${MKDIR} ${STAGEDIR}${DOCSDIR} .for x in ${PORTDOCS} - @${INSTALL_DATA} ${WRKSRC}/${x} ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/${x} ${STAGEDIR}${DOCSDIR} .endfor .include <bsd.port.post.mk> diff --git a/net-mgmt/pandorafms_server/bsd.pandora.mk b/net-mgmt/pandorafms_server/bsd.pandora.mk index 74beea439a12..2487f1aa1718 100644 --- a/net-mgmt/pandorafms_server/bsd.pandora.mk +++ b/net-mgmt/pandorafms_server/bsd.pandora.mk @@ -1,6 +1,6 @@ # $FreeBSD$ -PANDORA_VERSION= 5.1 +PANDORA_VERSION= 5.1SP1 PANDORA_LICENSE= GPLv2 PANDORA_LICENSE_FILE= ${WRKSRC}/COPYING @@ -12,9 +12,9 @@ PANDORA_HOMEDIR?= ${PANDORA_ETCDIR}/home PANDORA_INSTALLER= ${PORTNAME}_installer PANDORA_INSTALLER_ARGS= --install -PORTVERSION= ${PANDORA_VERSION:C/((SP[0-9]*)?)$/.0\1/} +PORTVERSION= ${PANDORA_VERSION:C/SP/./} -MASTER_SITES?= SF/pandora/Pandora%20FMS%20${PANDORA_VERSION}/Final/Tarball +MASTER_SITES?= SF/pandora/Pandora%20FMS%20${PANDORA_VERSION:C/(SP[0-9]*)/\/\1/}Final/Tarball .if ${PORTNAME} == "pandora_agent" DISTNAME= pandorafms_agent_unix-${PANDORA_VERSION} .else @@ -38,7 +38,7 @@ PLIST_SUB+= SPOOLDIR="${PANDORA_SPOOLDIR}" LOGDIR="${PANDORA_LOGDIR}" \ SUB_LIST+= PANDORA_VERSION="${PANDORA_VERSION}" PLIST= ${WRKDIR}/PLIST -PORTDOCS?= AUTHORS ChangeLog +PORTDOCS?= AUTHORS .if ${PORTNAME} == "pandora_server" USE_LOGDIR= "" diff --git a/net-mgmt/pandorafms_server/distinfo b/net-mgmt/pandorafms_server/distinfo index bae0c3a61aa8..5b1a04faa61c 100644 --- a/net-mgmt/pandorafms_server/distinfo +++ b/net-mgmt/pandorafms_server/distinfo @@ -1,2 +1,2 @@ -SHA256 (pandora/pandorafms_server-5.1.tar.gz) = 00b163f3fad5474380ba02afcbac2c4221ff03d4bd293957590310504a5a0b3e -SIZE (pandora/pandorafms_server-5.1.tar.gz) = 4064063 +SHA256 (pandora/pandorafms_server-5.1SP1.tar.gz) = c7b49da0b941315a59de9d3edebb10f0103eb4ee59956e961d3b6787f4449b27 +SIZE (pandora/pandorafms_server-5.1SP1.tar.gz) = 4011575 diff --git a/net-mgmt/pandorafms_server/files/patch-update b/net-mgmt/pandorafms_server/files/patch-update deleted file mode 100644 index 13de3c16a593..000000000000 --- a/net-mgmt/pandorafms_server/files/patch-update +++ /dev/null @@ -1,5592 +0,0 @@ -Index: NetBSD/pandora_server.conf.new -=================================================================== ---- NetBSD/pandora_server.conf.new (revision 0) -+++ NetBSD/pandora_server.conf.new (revision 10417) -@@ -0,0 +1,443 @@ -+############################################################################# -+# Pandora FMS Server Parameters -+# Pandora FMS, the Flexible Monitoring System. -+# Version 5.1BETA1 -+# Licensed under GPL license v2, -+# (c) 2003-2014 Artica Soluciones Tecnologicas -+# http://www.pandorafms.com -+# Please change it for your setup needs -+############################################################################# -+ -+# Servername: Name of this server -+# if not given, it takes hostname. It's preferable to setup one -+# because machine name could change by some reason. -+ -+#servername greystone -+ -+# incomingdir: Defines directory where incoming data packets are stored -+# You could set directory relative to base path or absolute, starting with / -+ -+incomingdir /var/spool/pandora/data_in -+ -+# log_file: Main logfile for pandora_server -+# You could set file relative to base path or absolute, starting with / -+ -+log_file /var/log/pandora/pandora_server.log -+ -+# Log file for Pandora FMS SNMP console. Its generated by NetSNMP Trap daemon -+ -+snmp_logfile /var/log/pandora/pandora_snmptrap.log -+ -+# Error logfile: aux logfile for pandora_server errors (in Daemon mode) -+# You could set file relative to base path or absolute, starting with / -+ -+errorlog_file /var/log/pandora/pandora_server.error -+ -+# daemon: Runs in daemon mode (background) if 1, if 0 runs in foreground -+# this could be also configured on commandline with -D option -+ -+# daemon 1 -+ -+# dbengine: mysql, postgresql or oracle (mysql by default) -+ -+dbengine mysql -+ -+# Database credentials. A VERY important configuration. -+# This must be the same credentials used by your Pandora FMS Console -+# but could be different if your console is not running in the same -+# host than the server. Check your console setup in /include/config.php -+ -+# dbname: Database name (pandora by default) -+ -+dbname pandora -+ -+# dbuser: Database user name (pandora by default) -+ -+dbuser pandora -+ -+# dbpass: Database password -+ -+dbpass pandora -+ -+# dbhost: Database hostname or IP address -+ -+dbhost 127.0.0.1 -+ -+# dbport: Database port number -+# Default value depends on the dbengine (mysql: 3306, postgresql: 5432, oracle: 1521) -+ -+#dbport 3306 -+ -+# By default, parent agent will not be updated -+ -+#update_parent 0 -+ -+# verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy) -+# -v in command line (verbose) or -d (debug). Set this to 10 when try to locate problems and -+# set to 0 or 1 on production enviroments. -+ -+verbosity 1 -+ -+# Master Server, 1 if master server (normal mode), 0 for slave mode (slave in multi-server setup) -+ -+master 1 -+ -+# Activate Pandora SNMP console (depending on snmptrapd) -+ -+snmpconsole 0 -+ -+# snmptrapd will ignore authenticationFailure traps if set to 1. -+ -+snmp_ignore_authfailure 1 -+ -+# snmptrapd will read the PDU source address instead of the agent-addr field is set to 1. -+ -+snmp_pdu_address 0 -+ -+# Activate (1) Pandora Network Server -+ -+networkserver 1 -+ -+# Activate (1) Pandora Data Server -+ -+dataserver 1 -+ -+# Activate (1) Pandora FMS Recon server -+ -+reconserver 1 -+ -+# pluginserver : 1 or 0. Set to 1 to activate plugin server with this setup -+ -+pluginserver 1 -+ -+# Pandora FMS Plugin exec tool filepath (by default at /usr/local/bin) -+ -+plugin_exec /usr/local/bin/gtimeout -+ -+# predictionserver : 1 or 0. Set to 1 to activate prediction server with this setup -+# DISABLED BY DEFAULT -+ -+predictionserver 0 -+ -+# wmiserver : 1 or 0. Set to 1 to activate WMI server with this setup -+# DISABLED BY DEFAULT -+ -+wmiserver 1 -+ -+# wmic: Needed by Pandora FMS wmi server. -+ -+wmi_client /usr/local/bin/wmic -+ -+# Network timeout (in seconds) for timeout in network connections for Network agents -+ -+network_timeout 4 -+ -+# Server keepalive (in seconds) -+ -+server_keepalive 45 -+ -+# Server Threshold: defines number of seconds of main loop (in sec) -+ -+server_threshold 5 -+ -+# Network threads: Do not set too high (~40). Each threads make a network module check. -+ -+network_threads 4 -+ -+# icmp_checks x : defines number of pings for each icmp_proc module type. at least one of -+# that ping should be 1 to report 1. Values of 1 have more performance, but are more feasible -+# to produce false positives. -+ -+icmp_checks 3 -+ -+# tcp specific options : -+# tcp_checks: number of tcp retries if first attempt fails. -+# tcp_timeout: specific timeout for tcp connections -+ -+tcp_checks 1 -+tcp_timeout 10 -+ -+# snmp specific options : -+# snmp_checks: number of snmp request retries if first attempt fails. -+# snmp_timeout: specific timeout for snmp request. -+ -+snmp_checks 1 -+snmp_timeout 4 -+ -+# snmp_proc_deadresponse 1 (default): Return DOWN if cannot contact -+# or receive NULL from a SNMP PROC module. -+ -+snmp_proc_deadresponse 1 -+ -+# plugin_threads: Specify number of plugin server threads for processing plugin calls -+ -+plugin_threads 1 -+ -+# plugin_timeout: Specify number of seconds calling plugin exec waiting for response -+# after this time, call is aborted and result is "unknown". -+ -+plugin_timeout 12 -+ -+# wmi_timeout : specific timeout for wmi request. -+ -+wmi_timeout 7 -+ -+# wmi_threads: Specify number of WMI server threads for processing WMI remote calls -+ -+wmi_threads 1 -+ -+# recon_threads. Each thread will scan a different scantask. -+ -+recon_threads 1 -+ -+# dataserver_threads: Number of threads for data server (XML processing threads) -+ -+dataserver_threads 1 -+ -+# mta_address: External Mailer (MTA) IP Address to be used by Pandora FMS internal email capabilities -+ -+mta_address localhost -+ -+# mta_port, this is the mail server port (default 25) -+ -+#mta_port 25 -+ -+# mta_user MTA User (if needed for auth, FQD or simple user, depending on your server) -+ -+#mta_user myuser@mydomain.com -+ -+# mta_pass MTA Pass (if needed for auth) -+ -+#mta_pass mypassword -+ -+# mta_auth MTA Auth system (if needed, it supports LOGIN, PLAIN, CRAM-MD5, DIGEST-MD) -+ -+#mta_auth LOGIN -+ -+# mta_from Email address that sends the mail, by default is pandora@localhost -+# probably you need to change it to avoid problems with your antispam -+ -+#mta_from Pandora FMS <pandora@mydomain.com> -+ -+# Set 1 if want eMail deliver alert in separate mail (default). -+# Set 0 if want eMail deliver shared mail by all destination. -+mail_in_separate 1 -+ -+ -+# xprobe2: Optional package to detect OS types using advanced TCP/IP -+# fingerprinting tecniques, much more accurates than stadard nmap. -+# If not provided, nmap is used insted xprobe2 -+ -+xprobe2 /usr/local/bin/xprobe2 -+ -+# nmap: If provided, is used to detect OS type with recon server using -+# advanded OS fingerprint technique. Xprobe2 gives more accurate results -+# Nmap is also used to do TCP port scanning in detected host. -+ -+nmap /usr/pkg/bin/nmap -+ -+# snmpget: Needed to do SNMP checks. By default is on /usr/local/bin/snmpget -+ -+snmpget /usr/pkg/bin/snmpget -+ -+# snmp_trapd: Needed by Pandora FMS SNMP console. -+ -+snmp_trapd /usr/pkg/sbin/snmptrapd -+ -+# Location of the braa binary needed by the Enterprise SNMP Server (/usr/local/bin/braa by default) (PANDORA FMS ENTERPRISE ONLY). -+ -+braa /usr/local/bin/braa -+ -+# Number of retries before braa hands a module over to the Network Server (PANDORA FMS ENTERPRISE ONLY). -+ -+braa_retries 3 -+ -+# Default group id for new agents created with Pandora FMS Data Server -+ -+autocreate_group 2 -+ -+# Set to 1 if want to autocreate agents with Pandora FMS Data Server, -+# set to 0 to disable (for security purposes, for example). -+ -+autocreate 1 -+ -+# max_log_size: Specify max size of Pandora FMS server log file (1MB by default). If -+# log file grows above this limit, is renamed to "pandora_server.log.old". -+ -+max_log_size 65536 -+ -+# max_queue_files (500 by default) -+# When server have more than max_queue_files in incoming directory, skips the read -+# the directory to avoid filesystem overhead. -+ -+max_queue_files 500 -+ -+# Use the XML file last modification time as timestamp. -+# use_xml_timestamp 1 -+ -+# Pandora FMS will autorestart itself each XXX seconds, use this if you experience problems with -+# shutting down threads, or other stability problems. -+ -+# auto_restart 86400 -+ -+# Pandora FMS will restart after restart_delay seconds on critical errors. -+ -+restart 1 -+restart_delay 60 -+ -+# More information about GIS Setup in /usr/share/pandora_server/util/gis.README -+# Flag to activate GIS (positional information for agents and maps) -+# by default it is desactivated -+ -+#activate_gis 0 -+ -+# Radius of error in meters to consider two gis locations as the same location. -+ -+#location_error 50 -+ -+# Recon reverse geolocation mode [disabled, sql, file] -+# disabled The recon task doesn't try to geolocate the ip discovered. -+# sql The recon task trys to query the SQL database to geolocate the -+# ip discovered -+# file The recon task trys to find the geolocation information of the -+# ip discovered in the file indicated in the -+# recon_reverse_geolocation_file parameter -+ -+# recon_reverse_geolocation_mode disabled -+ -+# Recon reverse geolocation file. This is the database with the reverse -+# geolocation information using MaxMind GPL GeoLiteCity.dat format). -+ -+#recon_reverse_geolocation_file /usr/local/share/GeoIP/GeoIPCity.dat -+ -+# Radius (in meters) of the circle in where the agents will be place randomly -+# when finded by a recon task. Center of the circle is guessed -+# by geolocating the IP. -+#recon_location_scatter_radius 1000 -+ -+# Pandora Server self-monitoring (embedded agent) (by default enabled) -+ -+self_monitoring 1 -+ -+# Update parent from the agent xml -+ -+#update_parent 1 -+# -+# -+# This enable realtime reverse geocoding using Google Maps public api. -+# This requires internet access, and could have performance penalties processing GIS -+# information due the connetion needed to resolve all GIS input. -+# NOTE: If you dont pay the service to google, they will ban your IP in a few days. -+ -+# google_maps_description 1 -+ -+# This enable realtime reverse geocoding using Openstreet Maps public api. -+# This requires internet access, and could have performance penalties processing GIS -+# information due the connetion needed to resolve all GIS input. -+# You can alter the code to use a local (your own) openstreet maps server. -+ -+# openstreetmaps_description 1 -+ -+# Enable (1) or disable (0) Pandora FMS Event Web Server (PANDORA FMS ENTERPRISE ONLY). -+ -+webserver 1 -+ -+# Number of threads for the Web Server (PANDORA FMS ENTERPRISE ONLY). -+ -+web_threads 1 -+ -+# Enable (1) or disable (0) Pandora FMS Inventory Server (PANDORA FMS ENTERPRISE ONLY). -+ -+inventoryserver 1 -+ -+# Number of threads for the Web Server (PANDORA FMS ENTERPRISE ONLY). -+ -+inventory_threads 1 -+ -+# Enable (1) or disable (0) Pandora FMS Export Server (PANDORA FMS ENTERPRISE ONLY). -+ -+exportserver 0 -+ -+# Number of threads for the Export Server (PANDORA FMS ENTERPRISE ONLY). -+ -+export_threads 1 -+ -+# Enable (1) or disable (0) Pandora FMS Event Server (PANDORA FMS ENTERPRISE ONLY). -+ -+eventserver 0 -+ -+# Event Server event window in seconds (3600 by default) (PANDORA FMS ENTERPRISE ONLY). -+ -+event_window 3600 -+ -+# Enable (1) or disable (0) Pandora FMS Enterprise ICMP Server (PANDORA FMS ENTERPRISE ONLY). -+# You need nmap 5.20 or higher in order to use this ! -+ -+icmpserver 1 -+ -+# Number of threads for the Enterprise ICMP Server (PANDORA FMS ENTERPRISE ONLY). -+ -+icmp_threads 1 -+ -+# Enable (1) or disable (0) Pandora FMS Enterprise SNMP Server (PANDORA FMS ENTERPRISE ONLY). -+# Check braa tool is running and operative. -+ -+snmpserver 1 -+ -+# Number of threads for the Enterprise SNMP Server (PANDORA FMS ENTERPRISE ONLY). -+ -+snmp_threads 1 -+ -+# Block size for block producer/consumer servers, that is, the number of modules -+# per block (20 by default) (PANDORA FMS ENTERPRISE ONLY). -+ -+block_size 20 -+ -+# Path to the netflow daemon nfcapd. -+ -+netflow_daemon /usr/pkg/bin/nfcapd -+ -+# If set to 1, process XML data files in a stack instead of a queue. 0 by default. -+# WARNING: Incremental modules will not work properly if dataserver_lifo is set to 1!!! -+ -+dataserver_lifo 0 -+ -+# If set to 1, the policy manager is enabled and the server is listening the policy queue. -+# 0 by default (PANDORA FMS ENTERPRISE ONLY) -+ -+policy_manager 1 -+ -+# If set to 1, the event replicate process is enabled. 0 by default. (PANDORA FMS ENTERPRISE ONLY) -+# WARNING: This process doesn't do anything if is not properly configured from the console setup -+ -+event_replication 0 -+ -+# If set to 1, new events validate older event for the same module. This will -+# affect the performance of the server. This was the "normal behaviour" on previous (4.x) versions. -+# disable only if you really know what you are doing !!. -+ -+event_auto_validation 1 -+ -+# If defined, events generated by Pandora FMS will be written to the specified text file. -+#event_file /var/log/pandora/pandora_events.txt -+ -+# Set the maximum number of traps that will be processed from a single source in a -+# configured time interval. -+snmp_storm_protection 25 -+ -+# Time interval for snmp_storm protection (in seconds). -+snmp_storm_timeout 10 -+ -+# Default texts for some events. The macros _module_ and _data_ are supported. -+#text_going_down_normal Module '_module_' is going to NORMAL (_data_) -+#text_going_up_critical Module '_module_' is going to CRITICAL (_data_) -+#text_going_up_warning Module '_module_' is going to WARNING (_data_) -+#text_going_down_warning Module '_module_' is going to WARNING (_data_) -+#text_going_unknown Module '_module_' is going to UNKNOWN -+ -+# Events older that the specified time (in seconds) will be auto-validated. Set to 0 to disable this feature. -+event_expiry_time 0 -+ -+# Only events more recent than the specified time window (in seconds) will be auto-validated. This value must -+# be greater than event_expiry_time. -+#event_expiry_window 86400 -Index: NetBSD/pandora_server.conf -=================================================================== ---- NetBSD/pandora_server.conf (revision 10314) -+++ NetBSD/pandora_server.conf (working copy) -@@ -1,442 +0,0 @@ --############################################################################# --# Pandora FMS Server Parameters --# Pandora FMS, the Flexible Monitoring System. --# Version 5.1BETA1 --# Licensed under GPL license v2, --# (c) 2003-2014 Artica Soluciones Tecnologicas --# http://www.pandorafms.com --# Please change it for your setup needs --############################################################################# -- --# Servername: Name of this server --# if not given, it takes hostname. It's preferable to setup one --# because machine name could change by some reason. -- --#servername greystone -- --# incomingdir: Defines directory where incoming data packets are stored --# You could set directory relative to base path or absolute, starting with / -- --incomingdir /var/spool/pandora/data_in -- --# log_file: Main logfile for pandora_server --# You could set file relative to base path or absolute, starting with / -- --log_file /var/log/pandora/pandora_server.log -- --# Log file for Pandora FMS SNMP console. Its generated by NetSNMP Trap daemon -- --snmp_logfile /var/log/pandora/pandora_snmptrap.log -- --# Error logfile: aux logfile for pandora_server errors (in Daemon mode) --# You could set file relative to base path or absolute, starting with / -- --errorlog_file /var/log/pandora/pandora_server.error -- --# daemon: Runs in daemon mode (background) if 1, if 0 runs in foreground --# this could be also configured on commandline with -D option -- --# daemon 1 -- --# dbengine: mysql, postgresql or oracle (mysql by default) -- --dbengine mysql -- --# Database credentials. A VERY important configuration. --# This must be the same credentials used by your Pandora FMS Console --# but could be different if your console is not running in the same --# host than the server. Check your console setup in /include/config.php -- --# dbname: Database name (pandora by default) -- --dbname pandora -- --# dbuser: Database user name (pandora by default) -- --dbuser pandora -- --# dbpass: Database password -- --dbpass pandora -- --# dbhost: Database hostname or IP address -- --dbhost 127.0.0.1 -- --# dbport: Database port number --# Default value depends on the dbengine (mysql: 3306, postgresql: 5432, oracle: 1521) -- --#dbport 3306 -- --# By default, parent agent will not be updated -- --#update_parent 0 -- --# verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy) --# -v in command line (verbose) or -d (debug). Set this to 10 when try to locate problems and --# set to 0 or 1 on production enviroments. -- --verbosity 1 -- --# Master Server, 1 if master server (normal mode), 0 for slave mode (slave in multi-server setup) -- --master 1 -- --# Activate Pandora SNMP console (depending on snmptrapd) -- --snmpconsole 0 -- --# snmptrapd will ignore authenticationFailure traps if set to 1. -- --snmp_ignore_authfailure 1 -- --# snmptrapd will read the PDU source address instead of the agent-addr field is set to 1. -- --snmp_pdu_address 0 -- --# Activate (1) Pandora Network Server -- --networkserver 1 -- --# Activate (1) Pandora Data Server -- --dataserver 1 -- --# Activate (1) Pandora FMS Recon server -- --reconserver 1 -- --# pluginserver : 1 or 0. Set to 1 to activate plugin server with this setup -- --pluginserver 1 -- --# Pandora FMS Plugin exec tool filepath (by default at /usr/local/bin) -- --plugin_exec /usr/local/bin/gtimeout -- --# predictionserver : 1 or 0. Set to 1 to activate prediction server with this setup --# DISABLED BY DEFAULT -- --predictionserver 0 -- --# wmiserver : 1 or 0. Set to 1 to activate WMI server with this setup --# DISABLED BY DEFAULT -- --wmiserver 1 -- --# wmic: Needed by Pandora FMS wmi server. -- --wmi_client /usr/local/bin/wmic -- --# Network timeout (in seconds) for timeout in network connections for Network agents -- --network_timeout 4 -- --# Server keepalive (in seconds) -- --server_keepalive 45 -- --# Server Threshold: defines number of seconds of main loop (in sec) -- --server_threshold 5 -- --# Network threads: Do not set too high (~40). Each threads make a network module check. -- --network_threads 4 -- --# icmp_checks x : defines number of pings for each icmp_proc module type. at least one of --# that ping should be 1 to report 1 -- --icmp_checks 1 -- --# tcp specific options : --# tcp_checks: number of tcp retries if first attempt fails. --# tcp_timeout: specific timeout for tcp connections -- --tcp_checks 1 --tcp_timeout 10 -- --# snmp specific options : --# snmp_checks: number of snmp request retries if first attempt fails. --# snmp_timeout: specific timeout for snmp request. -- --snmp_checks 1 --snmp_timeout 4 -- --# snmp_proc_deadresponse 1 (default): Return DOWN if cannot contact --# or receive NULL from a SNMP PROC module. -- --snmp_proc_deadresponse 1 -- --# plugin_threads: Specify number of plugin server threads for processing plugin calls -- --plugin_threads 1 -- --# plugin_timeout: Specify number of seconds calling plugin exec waiting for response --# after this time, call is aborted and result is "unknown". -- --plugin_timeout 12 -- --# wmi_timeout : specific timeout for wmi request. -- --wmi_timeout 7 -- --# wmi_threads: Specify number of WMI server threads for processing WMI remote calls -- --wmi_threads 1 -- --# recon_threads. Each thread will scan a different scantask. -- --recon_threads 1 -- --# dataserver_threads: Number of threads for data server (XML processing threads) -- --dataserver_threads 1 -- --# mta_address: External Mailer (MTA) IP Address to be used by Pandora FMS internal email capabilities -- --mta_address localhost -- --# mta_port, this is the mail server port (default 25) -- --#mta_port 25 -- --# mta_user MTA User (if needed for auth, FQD or simple user, depending on your server) -- --#mta_user myuser@mydomain.com -- --# mta_pass MTA Pass (if needed for auth) -- --#mta_pass mypassword -- --# mta_auth MTA Auth system (if needed, it supports LOGIN, PLAIN, CRAM-MD5, DIGEST-MD) -- --#mta_auth LOGIN -- --# mta_from Email address that sends the mail, by default is pandora@localhost --# probably you need to change it to avoid problems with your antispam -- --#mta_from Pandora FMS <pandora@mydomain.com> -- --# Set 1 if want eMail deliver alert in separate mail (default). --# Set 0 if want eMail deliver shared mail by all destination. --mail_in_separate 1 -- -- --# xprobe2: Optional package to detect OS types using advanced TCP/IP --# fingerprinting tecniques, much more accurates than stadard nmap. --# If not provided, nmap is used insted xprobe2 -- --xprobe2 /usr/local/bin/xprobe2 -- --# nmap: If provided, is used to detect OS type with recon server using --# advanded OS fingerprint technique. Xprobe2 gives more accurate results --# Nmap is also used to do TCP port scanning in detected host. -- --nmap /usr/pkg/bin/nmap -- --# snmpget: Needed to do SNMP checks. By default is on /usr/local/bin/snmpget -- --snmpget /usr/pkg/bin/snmpget -- --# snmp_trapd: Needed by Pandora FMS SNMP console. -- --snmp_trapd /usr/pkg/sbin/snmptrapd -- --# Location of the braa binary needed by the Enterprise SNMP Server (/usr/local/bin/braa by default) (PANDORA FMS ENTERPRISE ONLY). -- --braa /usr/local/bin/braa -- --# Number of retries before braa hands a module over to the Network Server (PANDORA FMS ENTERPRISE ONLY). -- --braa_retries 3 -- --# Default group id for new agents created with Pandora FMS Data Server -- --autocreate_group 2 -- --# Set to 1 if want to autocreate agents with Pandora FMS Data Server, --# set to 0 to disable (for security purposes, for example). -- --autocreate 1 -- --# max_log_size: Specify max size of Pandora FMS server log file (1MB by default). If --# log file grows above this limit, is renamed to "pandora_server.log.old". -- --max_log_size 65536 -- --# max_queue_files (500 by default) --# When server have more than max_queue_files in incoming directory, skips the read --# the directory to avoid filesystem overhead. -- --max_queue_files 500 -- --# Use the XML file last modification time as timestamp. --# use_xml_timestamp 1 -- --# Pandora FMS will autorestart itself each XXX seconds, use this if you experience problems with --# shutting down threads, or other stability problems. -- --# auto_restart 86400 -- --# Pandora FMS will restart after restart_delay seconds on critical errors. -- --restart 1 --restart_delay 60 -- --# More information about GIS Setup in /usr/share/pandora_server/util/gis.README --# Flag to activate GIS (positional information for agents and maps) --# by default it is desactivated -- --#activate_gis 0 -- --# Radius of error in meters to consider two gis locations as the same location. -- --#location_error 50 -- --# Recon reverse geolocation mode [disabled, sql, file] --# disabled The recon task doesn't try to geolocate the ip discovered. --# sql The recon task trys to query the SQL database to geolocate the --# ip discovered --# file The recon task trys to find the geolocation information of the --# ip discovered in the file indicated in the --# recon_reverse_geolocation_file parameter -- --# recon_reverse_geolocation_mode disabled -- --# Recon reverse geolocation file. This is the database with the reverse --# geolocation information using MaxMind GPL GeoLiteCity.dat format). -- --#recon_reverse_geolocation_file /usr/local/share/GeoIP/GeoIPCity.dat -- --# Radius (in meters) of the circle in where the agents will be place randomly --# when finded by a recon task. Center of the circle is guessed --# by geolocating the IP. --#recon_location_scatter_radius 1000 -- --# Pandora Server self-monitoring (embedded agent) (by default enabled) -- --self_monitoring 1 -- --# Update parent from the agent xml -- --#update_parent 1 --# --# --# This enable realtime reverse geocoding using Google Maps public api. --# This requires internet access, and could have performance penalties processing GIS --# information due the connetion needed to resolve all GIS input. --# NOTE: If you dont pay the service to google, they will ban your IP in a few days. -- --# google_maps_description 1 -- --# This enable realtime reverse geocoding using Openstreet Maps public api. --# This requires internet access, and could have performance penalties processing GIS --# information due the connetion needed to resolve all GIS input. --# You can alter the code to use a local (your own) openstreet maps server. -- --# openstreetmaps_description 1 -- --# Enable (1) or disable (0) Pandora FMS Event Web Server (PANDORA FMS ENTERPRISE ONLY). -- --webserver 1 -- --# Number of threads for the Web Server (PANDORA FMS ENTERPRISE ONLY). -- --web_threads 1 -- --# Enable (1) or disable (0) Pandora FMS Inventory Server (PANDORA FMS ENTERPRISE ONLY). -- --inventoryserver 1 -- --# Number of threads for the Web Server (PANDORA FMS ENTERPRISE ONLY). -- --inventory_threads 1 -- --# Enable (1) or disable (0) Pandora FMS Export Server (PANDORA FMS ENTERPRISE ONLY). -- --exportserver 0 -- --# Number of threads for the Export Server (PANDORA FMS ENTERPRISE ONLY). -- --export_threads 1 -- --# Enable (1) or disable (0) Pandora FMS Event Server (PANDORA FMS ENTERPRISE ONLY). -- --eventserver 0 -- --# Event Server event window in seconds (3600 by default) (PANDORA FMS ENTERPRISE ONLY). -- --event_window 3600 -- --# Enable (1) or disable (0) Pandora FMS Enterprise ICMP Server (PANDORA FMS ENTERPRISE ONLY). --# You need nmap 5.20 or higher in order to use this ! -- --icmpserver 1 -- --# Number of threads for the Enterprise ICMP Server (PANDORA FMS ENTERPRISE ONLY). -- --icmp_threads 1 -- --# Enable (1) or disable (0) Pandora FMS Enterprise SNMP Server (PANDORA FMS ENTERPRISE ONLY). --# Check braa tool is running and operative. -- --snmpserver 1 -- --# Number of threads for the Enterprise SNMP Server (PANDORA FMS ENTERPRISE ONLY). -- --snmp_threads 1 -- --# Block size for block producer/consumer servers, that is, the number of modules --# per block (20 by default) (PANDORA FMS ENTERPRISE ONLY). -- --block_size 20 -- --# Path to the netflow daemon nfcapd. -- --netflow_daemon /usr/pkg/bin/nfcapd -- --# If set to 1, process XML data files in a stack instead of a queue. 0 by default. --# WARNING: Incremental modules will not work properly if dataserver_lifo is set to 1!!! -- --dataserver_lifo 0 -- --# If set to 1, the policy manager is enabled and the server is listening the policy queue. --# 0 by default (PANDORA FMS ENTERPRISE ONLY) -- --policy_manager 1 -- --# If set to 1, the event replicate process is enabled. 0 by default. (PANDORA FMS ENTERPRISE ONLY) --# WARNING: This process doesn't do anything if is not properly configured from the console setup -- --event_replication 0 -- --# If set to 1, new events validate older event for the same module. This will --# affect the performance of the server. This was the "normal behaviour" on previous (4.x) versions. --# disable only if you really know what you are doing !!. -- --event_auto_validation 1 -- --# If defined, events generated by Pandora FMS will be written to the specified text file. --#event_file /var/log/pandora/pandora_events.txt -- --# Set the maximum number of traps that will be processed from a single source in a --# configured time interval. --snmp_storm_protection 25 -- --# Time interval for snmp_storm protection (in seconds). --snmp_storm_timeout 10 -- --# Default texts for some events. The macros _module_ and _data_ are supported. --#text_going_down_normal Module '_module_' is going to NORMAL (_data_) --#text_going_up_critical Module '_module_' is going to CRITICAL (_data_) --#text_going_up_warning Module '_module_' is going to WARNING (_data_) --#text_going_down_warning Module '_module_' is going to WARNING (_data_) --#text_going_unknown Module '_module_' is going to UNKNOWN -- --# Events older that the specified time (in seconds) will be auto-validated. Set to 0 to disable this feature. --event_expiry_time 0 -- --# Only events more recent than the specified time window (in seconds) will be auto-validated. This value must --# be greater than event_expiry_time. --#event_expiry_window 86400 -Index: conf/pandora_server.conf.new -=================================================================== ---- conf/pandora_server.conf.new (revision 10314) -+++ conf/pandora_server.conf.new (working copy) -@@ -86,6 +86,18 @@ - - snmpconsole 0 - -+# snmpconsole_threads: number of SNMP console threads for processing SNMP traps. -+ -+snmpconsole_threads 1 -+ -+# Attempt to translate variable bindings when processing SNMP traps. 1 enabled, 0 disabled. 0 by default. (ENTERPRISE ONLY). -+ -+translate_variable_bindings 0 -+ -+# Attempt to translate enterprise strings when processing SNMP traps. 1 enabled, 0 disabled. 1 by default. (ENTERPRISE ONLY). -+ -+translate_enterprise_strings 0 -+ - # snmptrapd will ignore authenticationFailure traps if set to 1. - - snmp_ignore_authfailure 1 -@@ -141,9 +153,10 @@ - network_threads 4 - - # icmp_checks x : defines number of pings for each icmp_proc module type. at least one of --# that ping should be 1 to report 1 -+# that ping should be 1 to report 1. Setting this to 1 will make all icmp montioring faster but -+# with more probability of failure. - --icmp_checks 1 -+icmp_checks 3 - - # tcp specific options : - # tcp_checks: number of tcp retries if first attempt fails. -@@ -231,6 +244,9 @@ - - nmap /usr/bin/nmap - -+# A value that specifies how aggressive nmap should be from 1 to 5. 1 means slower but more reliable, 5 means faster but less reliable. 2 by default. -+nmap_timing_template 2 -+ - # snmpget: Needed to do SNMP checks. By default is on /usr/bin/snmpget - - snmpget /usr/bin/snmpget -Index: ChangeLog -=================================================================== ---- ChangeLog (revision 10314) -+++ ChangeLog (working copy) -@@ -1,3 +1,160 @@ -+2014-08-14 Koichiro Kikuchi <koichiro@rworks.jp> -+ -+ * FreeBSD/tentacle_server: Set rcvar statically. -+ -+2014-08-13 Ramon Novoa <rnovoa@artica.es> -+ -+ * pandora_server.redhat.spec: Fixed some typos (packages were not -+ being built). -+ -+2014-08-12 Koichiro Kikuchi <koichiro@rworks.jp> -+ -+ * bin/pandora_server: Fixed issue that pandora_server failed to -+ shut down properly on non-Linux systems. -+ -+ Merged r10335 from branch 5.0. -+ -+2014-08-12 Koichiro Kikuchi <koichiro@rworks.jp> -+ -+ * pandora_server_installer: Refactord implementation, added -+ "fakeroot" installation support, small bug fixes and improvements: -+ fixed processing arguments, replace "test -e" with "test -f" for portability -+ (solaris' /bin/sh doesn't support "test -e"). -+ -+ * Makefile.PL: Install bin/tentacle_server if WITHOUT_TENTACLE=0 so that -+ MakeMaker can fix perl path in the shebang line. -+ -+ * pandora_server.redhat.spec: Added missing dependency. -+ -+ * FreeBSD/pandora_server.conf -> FreeBSD/pandora_server.conf.new: Renamed -+ * NetBSD/pandora_server.conf -> NetBSD/pandora_server.conf.new: Rename -+ -+ * FreeBSD/tentacle_server: Small bug fix and improvements. Fixed -+ "tentacle_server_flags" and modified code to use proper variables and -+ to get pid more strictly. -+ -+ * FreeBSD/pandora_server: Added support to start multiple pandora_server -+ instances. -+ -+2014-08-12 Junichi Satoh <junichi@rworks.jp> -+ -+ * lib/PandoraFMS/Core.pm, lib/PandoraFMS/DataServer.pm: Fixed sql -+ error with MySQL 5.6 and its default sql_mode. -+ -+2014-08-11 Hirofumi Kosaka <kosaka@rworks.jp> -+ -+ * lib/PandoraFMS/Core.pm: Fixed modules would have ignored -+ ff_threshold when the module shifted from normal to critical -+ while its status remained unknown. -+ -+2014-08-07 Ramon Novoa <rnovoa@artica.es> -+ -+ * util/recon_scripts/snmp-recon.pl, -+ util/recon_scripts/wmi-recon.pl: Set a default value -+ for nmap_timing_template. -+ -+2014-08-07 Ramon Novoa <rnovoa@artica.es> -+ -+ * conf/pandora_server.conf.new, -+ lib/PandoraFMS/Config.pm, -+ lib/PandoraFMS/ReconServer.pm, -+ util/recon_scripts/snmp-recon.pl, -+ util/recon_scripts/wmi-recon.pl: Added a new parameter to control how -+ aggressive nmap should be. -+ -+2014-08-06 Sancho Lerena <slerena@artica.es> -+ -+ * NetBSD/pandora_server.conf, -+ conf/pandora_server.conf.new, -+ conf/pandora_server.conf.windows: New default value for icmp_retries -+ to have default setup more realiable but a bit slower. -+ -+2014-08-06 Alejandro Gallardo <alejandro.gallardo@artica.es> -+ -+ * lib/PandoraFMS/NetworkServer.pm: Little syntax fix. -+ -+ * util/pandora_revent_create.pl: Changed the url encode -+ separator of the api call from "," to "|". -+ -+2014-08-06 Ramon Novoa <rnovoa@artica.es> -+ -+ * lib/PandoraFMS/NetworkServer.pm: Rewrote TCP module socket code for -+ sending data (tcp_send). Fixes ticket #1096. -+ -+2014-08-05 Hirofumi Kosaka <kosaka@rworks.jp> -+ -+ * lib/PandoraFMS/Core.pm: Suppress "going to normal (warning, -+ critical)" events from "unknown" status, if you disable "Throw -+ unknown events" at the Console. -+ -+2014-08-05 Hirofumi Kosaka <kosaka@rworks.jp> -+ -+ * lib/PandoraFMS/Core.pm: Fixed that unknown modules would be -+ set to normal if its status is not normal, when new data -+ arrives but ff_threshold is greater than 0. -+ -+2014-07-30 Ramon Novoa <rnovoa@artica.es> -+ -+ * util/trap_rate.sh: Added to repository. Script to calculate the rate of -+ SNMP traps received by snmptrapd. -+ -+2014-07-30 Ramon Novoa <rnovoa@artica.es> -+ -+ * lib/PandoraFMS/Core.pm: Set unknown modules to normal if new data -+ arrives but ff_threshold is greater than 0. -+ -+2014-07-28 Ramon Novoa <rnovoa@artica.es> -+ -+ * conf/pandora_server.conf.new, -+ lib/PandoraFMS/Config.pm: Added configuration tokens to disable the -+ translation of enterprise strings and variable bindings (SNMP console). -+ -+ * lib/PandoraFMS/SNMPServer.pm: Added thread support to the SNMP console. -+ -+ * lib/PandoraFMS/DB.pm: Fixed a warning. -+ -+2014-07-25 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * lib/PandoraFMS/GIS.pm, lib/PandoraFMS/DB.pm, -+ lib/PandoraFMS/Core.pm, lib/PandoraFMS/ReconServer.pm, -+ lib/PandoraFMS/DataServer.pm: tiny fixes for to improve the support -+ of PostgreSQL. -+ -+2014-07-25 Junichi Satoh <junichi@rworks.jp> -+ -+ * util/pandora_db.pl: Fixed error when 'dbengine' token is not defined -+ in pandora_server.conf with enterprise installed. -+ -+2014-07-23 Miguel de Dios <miguel.dedios@artica.es> -+ -+ * util/plugin/snmp_remote.pl: some fixed for the snmp v3. -+ -+2014-06-17 Vanessa Gil <vanessa.gil@artica.es> -+ -+ * lib/PandoraFMS/Core.pm: Added macros -+ '_alert_critical_instructions_' and -+ '_alert_warning_instructions_'. -+ -+2014-07-11 Hirofumi Kosaka <kosaka@rworks.jp> -+ -+ * util/pandora_manage.pl: To handle multi-byte strings in -+ command line arguments (assumes utf-8). -+ -+2014-07-08 Vanessa Gil <vanessa.gil@artica.es> -+ -+ * util/pandora_manage.pl: Fixed problem -+ with entities. -+ -+2014-07-08 Vanessa Gil <vanessa.gil@artica.es> -+ -+ * util/pandora_manage.pl: Fixed help screen. -+ -+2014-07-08 Vanessa Gil <vanessa.gil@artica.es> -+ -+ * util/pandora_manage.pl -+ lib/PandoraFMS/Core.pm: Added 'create_data_module_from_local_component' -+ and 'create_local_component' functions to CLI. -+ - 2014-06-26 Ramon Novoa <rnovoa@artica.es> - - * util/pandora_xml_stress.pl: Remove new line and carriage return -Index: Makefile.PL -=================================================================== ---- Makefile.PL (revision 10314) -+++ Makefile.PL (working copy) -@@ -1,6 +1,12 @@ - use 5.000; - use ExtUtils::MakeMaker; - -+my %ARGV = map { my @r = split /=/,$_; defined $r[1] or $r[1]=1; @r } @ARGV; -+ -+my @exe_files = qw(bin/pandora_server bin/pandora_exec); -+ -+$ARGV{WITHOUT_TENTACLE} or push @exe_files, 'bin/tentacle_server'; -+ - WriteMakefile( - INSTALLSITELIB => '/usr/lib/perl5', - (($^O eq 'freebsd') -@@ -27,10 +33,9 @@ - HTML::Entities => 0, - IO::Socket::INET6 => 0, - JSON => 0, -- }, -- EXE_FILES => [ 'bin/pandora_server', 'bin/pandora_exec'], -- PMLIBDIRS => [ 'lib' ], -- 'dist' => { 'TAR' => 'tar', 'TARFLAGS' => 'cvfz', 'SUFFIX' --=> '.gz', 'COMPRESS' => 'gzip'} -+ }, -+ EXE_FILES => [ @exe_files ], -+ PMLIBDIRS => [ 'lib' ], -+ 'dist' => { 'TAR' => 'tar', 'TARFLAGS' => 'cvfz', 'SUFFIX' => '.gz', 'COMPRESS' => 'gzip'} - ); - -Index: pandora_server_installer -=================================================================== ---- pandora_server_installer (revision 10314) -+++ pandora_server_installer (working copy) -@@ -10,97 +10,177 @@ - - - MODE=$1 --SECOPT=$2 -+shift -+ -+# Defaults -+PREFIX=/usr - PANDORA_SPOOL=/var/spool/pandora --PANDORA_HOME=/usr/share/pandora_server -+PANDORA_HOME=$PREFIX/share/pandora_server - PANDORA_CFG_DIR=/etc/pandora - PANDORA_LOG=/var/log/pandora - PANDORA_SERVER=/etc/init.d/pandora_server - TENTACLE_SERVER=/etc/init.d/tentacle_serverd --PANDORA_CFG_FILE=/etc/pandora/pandora_server.conf -+PANDORA_CFG_FILE=$PANDORA_CFG_DIR/pandora_server.conf -+PANDORA_CFG_FILE_DIST=conf/pandora_server.conf.new -+PANDORA_INIT_SCRIPT=util/pandora_server -+TENTACLE_INIT_SCRIPT=util/tentacle_serverd -+PERL=perl -+MANDIR=$PREFIX/share/man/man1 -+INITDIR=/etc/init.d -+WITHOUT_TENTACLE=0 - -+# -+# set_global_vars -+# Check platform and set DISTRO, OS_VERSION and LINUX. -+# Also, define some platform sepcific variables (e.g. PANDORA_RC_VAR for (Free|Net)BSD) -+# and override some of defaults defined above if needed. -+# -+set_global_vars () { -+ # Default -+ LINUX=NO -+ OS_VERSION=`uname -r` -+ DISTRO=`uname -s` - --get_distro () { -- # Get Linux Distro type and version -- # We assume we are on Linux unless told otherwise -- LINUX=YES -- if [ -f "/etc/SuSE-release" ] -- then -- OS_VERSION=`cat /etc/SuSE-release | grep VERSION | cut -f 3 -d " "` -- LINUX_DISTRO=SUSE -- elif [ -f "/etc/lsb-release" ] && [ ! -f "/etc/redhat-release" ] -- then -- OS_VERSION=`cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -f 2 -d "="` -- LINUX_DISTRO=UBUNTU -- OS_VERSION="UBUNTU $OS_VERSION" -- elif [ -f "/etc/debian_version" ] -- then -- OS_VERSION=`cat /etc/debian_version` -- OS_VERSION="DEBIAN $OS_VERSION" -- LINUX_DISTRO=DEBIAN -- elif [ -f "/etc/fedora-release" ] -- then -- OS_VERSION=`cat /etc/fedora-release | cut -f 4 -d " "` -- OS_VERSION="FEDORA $OS_VERSION" -- LINUX_DISTRO=FEDORA -- elif [ `uname -s` = "Darwin" ] -- then -- # For future reference, Darwin doesn't have /etc/init.d but uses LaunchDaemons -- LINUX_DISTRO="Darwin" -- OS_VERSION=`uname -r` -- LINUX=NO -- elif [ `uname -s` = "AIX" ] -- then -- # For future reference, AIX doesn't have /etc/init.d -- LINUX_DISTRO="AIX" -- OS_VERSION=`uname -r` -- LINUX=NO -- elif [ `uname -s` = "SunOS" ] -- then -+ # set corret value for LINUX_DISTRO -+ case $DISTRO in -+ Linux) -+ # Default for Linux -+ LINUX=YES -+ DISTRO="GENERIC" -+ # Get Linux Distro type and version -+ # We assume we are on Linux unless told otherwise -+ if [ -f "/etc/SuSE-release" ] -+ then -+ OS_VERSION=`cat /etc/SuSE-release | grep VERSION | cut -f 3 -d " "` -+ DISTRO=SUSE -+ elif [ -f "/etc/lsb-release" ] && [ ! -f "/etc/redhat-release" ] -+ then -+ OS_VERSION=`cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -f 2 -d "="` -+ DISTRO=UBUNTU -+ OS_VERSION="UBUNTU $OS_VERSION" -+ elif [ -f "/etc/debian_version" ] -+ then -+ OS_VERSION=`cat /etc/debian_version` -+ OS_VERSION="DEBIAN $OS_VERSION" -+ DISTRO=DEBIAN -+ elif [ -f "/etc/fedora-release" ] -+ then -+ OS_VERSION=`cat /etc/fedora-release | cut -f 4 -d " "` -+ OS_VERSION="FEDORA $OS_VERSION" -+ DISTRO=FEDORA -+ fi -+ ;; -+ Darwin|AIX) -+ # For future reference, Darwin doesn't have /etc/init.d but uses LaunchDaemons. -+ # AIX doesn't have /etc/init.d -+ ;; -+ SunOS) - # Some Solaris and other Unices don't have /etc/init.d, some have /usr/spool instead of /var/spool -- LINUX_DISTRO="Solaris" -- OS_VERSION=`uname -r` -- LINUX=NO -- elif [ `uname -s` = "Linux" ] -+ DISTRO="Solaris" -+ ;; -+ FreeBSD) -+ PREFIX=/usr/local -+ PANDORA_HOME=$PREFIX/share/pandora_server -+ PANDORA_CFG_DIR=$PREFIX/etc/pandora -+ PANDORA_SERVER=$PREFIX/etc/rc.d/pandora_server -+ TENTACLE_SERVER=$PREFIX/etc/rc.d/tentacle_server -+ PANDORA_CFG_FILE=$PANDORA_CFG_DIR/pandora_server.conf -+ PANDORA_CFG_FILE_DIST=$DISTRO/pandora_server.conf.new -+ PANDORA_INIT_SCRIPT=$DISTRO/pandora_server -+ TENTACLE_INIT_SCRIPT=$DISTRO/tentacle_server -+ MANDIR=$PREFIX/man/man1 -+ INITDIR=$PREFIX/etc/rc.d -+ PERL=/usr/local/bin/perl -+ PANDORA_RC_VAR="pandora_server_enable" -+ TENTACLE_RC_VAR="tentacle_server_enable" -+ ;; -+ NetBSD) -+ PREFIX=/usr/local -+ PANDORA_HOME=$PREFIX/share/pandora_server -+ PANDORA_CFG_DIR=$PREFIX/etc/pandora -+ PANDORA_SERVER=/etc/rc.d/pandora_server -+ TENTACLE_SERVER=/etc/rc.d/tentacle_server -+ PANDORA_CFG_FILE=$PANDORA_CFG_DIR/pandora_server.conf -+ PANDORA_CFG_FILE_DIST=$DISTRO/pandora_server.conf.new -+ PANDORA_INIT_SCRIPT=$DISTRO/pandora_server -+ TENTACLE_INIT_SCRIPT=$DISTRO/tentacle_server -+ PERL=/usr/pkg/bin/perl -+ INITDIR=/etc/rc.d -+ PANDORA_RC_VAR="pandora_server" -+ TENTACLE_RC_VAR="tentacle_server" -+ ;; -+ esac -+} -+ -+# -+# install_startup_script [options...] SRC -+# copy SRC into the $INITDIR and do additional required operation according to $DISTRO -+# if $INITDIR is not set or empty, do nothing. -+# If $DESTDIR is set, skip enabling service -+# OPTIONS: -+# -s SPRIO specify startup priority for service -+# -+install_startup_script () { -+ [ "$INITDIR" ] || return 1 -+ if [ "$1" = "-s" ] - then -- # Test for Linux to make sure we're on Linux -- LINUX_DISTRO="GENERIC" -- OS_VERSION=`uname -r` -- elif [ `uname -s` = "FreeBSD" ] -- then -- LINUX_DISTRO="FreeBSD" -- OS_VERSION=`uname -r` -- LINUX=NO -- elif [ `uname -s` = "NetBSD" ] -- then -- LINUX_DISTRO="NetBSD" -- OS_VERSION=`uname -r` -- LINUX=NO -- else -- # Default to Linux is false, test for real Linux above - that way we don't assume we can just plunk down files everywhere -- LINUX_DISTRO=`uname -s` -- OS_VERSION=`uname -r` -- LINUX=NO -+ SPRIO=$2 -+ shift;shift - fi -- echo "$LINUX_DISTRO:$OS_VERSION:$LINUX" -+ SRC=$1 -+ SCRIPT_NAME=`basename $SRC` -+ -+ echo "Copying the daemon script into $INITDIR" -+ cp $SRC $DESTDIR$INITDIR -+ -+ [ "$DESTDIR" ] && return -+ -+ case $DISTRO in -+ UBUNTU|DEBIAN) -+ echo "Linking startup script to /etc/rc2.d" -+ update-rc.d $SCRIPT_NAME defaults -+ ;; -+ SUSE) -+ echo "Creating startup daemons" -+ insserv $SCRIPT_NAME -+ ;; -+ FeeBSD|NetBSD) -+ chmod 555 $DESTDIR$INITDIR/$SCRIPT_NAME -+ ;; -+ *) -+ if [ "$LINUX" = YES ] -+ then -+ # Pandora FMS Server install (Other Distros) -+ INITLV=`grep '[0-9]:initdefault' /etc/inittab | cut -f 2 -d ':'` -+ : ${INITLV:=2} -+ echo "Linking startup script to /etc/rc.d/rc$INITLV.d/S$SPRIO$SCRIPT_NAME" -+ ln -s $INITDIR/$SCRIPT_NAME /etc/rc.d/rc$INITLV.d/S$SPRIO$SCRIPT_NAME -+ fi -+ ;; -+ esac - } - -- - install () { -+ set_global_vars - -- perl Makefile.PL > output 2>&1 #&& sleep 2 && cat output | grep "found" | wc -l -+ FORCE=0 -+ -+ # parse options -+ while : -+ do -+ case $1 in -+ --force) FORCE=1;; -+ --no-tentacle) WITHOUT_TENTALCE=1;; -+ --destdir) DESTDIR=$2;shift;; -+ *) break;; -+ esac -+ shift -+ done -+ -+ $PERL Makefile.PL INSTALLMAN1DIR=none WITHOUT_TENTACLE=$WITHOUT_TENTACLE > output 2>&1 -+ #&& sleep 2 && cat output | grep "found" | wc -l - DEPENDENCIAS=`cat output | grep "found" | wc -l` - -- FORCE=0 -- -- if [ ! -z "$SECOPT" ] -- then -- if [ "$SECOPT" = "--force" ] -- then -- FORCE=1 -- fi -- fi -- - if [ $DEPENDENCIAS -gt 0 ] && [ $FORCE -eq 0 ] - then - echo "You are missing the following dependencies" -@@ -142,448 +222,251 @@ - echo " $ cpan Time::Local DBI Socket6 XML::Simple XML::Twig IO::Socket Time::HiRes NetAddr::IP HTML::Entities IO::Socket::INET6 JSON" - echo " " - rm output -- else -+ exit 1 -+ fi -+ rm output - -- # This returns a multiple value string, separated with ":" -> $LINUX_DISTRO:$OS_VERSION:$LINUX -- GET_DISTRO="`get_distro`" -- DISTRO=`echo $GET_DISTRO | cut -f 1 -d ":"` -- OS_VERSION=`echo $GET_DISTRO | cut -f 2 -d ":"` -- LINUX=`echo $GET_DISTRO | cut -f 3 -d ":"` -- -- if [ "$DISTRO" = "UBUNTU" ] -- then -- echo "UBUNTU distribution detected" -- elif [ "$DISTRO" = "SUSE" ] -- then -- echo "SUSE distribution detected" -- elif [ "$DISTRO" = "FreeBSD" ] -- then -- echo "FreeBSD detected" -- PANDORA_SPOOL=/var/spool/pandora -- PANDORA_HOME=/usr/local/share/pandora_server -- PANDORA_CFG_DIR=/usr/local/etc/pandora -- PANDORA_LOG=/var/log/pandora -- PANDORA_SERVER=/usr/local/etc/rc.d/pandora_server -- TENTACLE_SERVER=/usr/local/etc/rc.d/tentacle_server -- PANDORA_CFG_FILE=/usr/local/etc/pandora/pandora_server.conf -- elif [ "$DISTRO" = "NetBSD" ] -- then -- echo "NetBSD detected" -- PANDORA_SPOOL=/var/spool/pandora -- PANDORA_HOME=/usr/local/share/pandora_server -- PANDORA_CFG_DIR=/usr/local/etc/pandora -- PANDORA_LOG=/var/log/pandora -- PANDORA_SERVER=/etc/rc.d/pandora_server -- TENTACLE_SERVER=/etc/rc.d/tentacle_server -- PANDORA_CFG_FILE=/usr/local/etc/pandora/pandora_server.conf -- -- sed s:/usr/bin/perl:/usr/pkg/bin/perl: bin/pandora_server > bin/tmp -- mv bin/tmp bin/pandora_server -- sed s:/usr/bin/perl:/usr/pkg/bin/perl: bin/pandora_exec > bin/tmp -- mv bin/tmp bin/pandora_exec -- sed s:/usr/bin/perl:/usr/pkg/bin/perl: bin/tentacle_server > bin/tmp -- mv bin/tmp bin/tentacle_server -- -- fi -+ if [ "$LINUX" = YES ] -+ then -+ echo "$DISTRO distribution detected" -+ else -+ echo "$DISTRO detected" -+ fi - -- echo "Installing binaries and libraries" -- make -- make install -+ echo "Installing binaries and libraries" -+ make -+ make DESTDIR=$DESTDIR install - -- echo "Checking binaries at /usr/local/bin -> /usr/bin" -- if [ ! -e "/usr/bin/pandora_server" ] -+ echo "Checking binaries at /usr/local/bin -> /usr/bin" -+ if [ ! -f "$DESTDIR/usr/bin/pandora_server" ] -+ then -+ if [ ! -f "$DESTDIR/usr/local/bin/pandora_server" ] - then -- if [ ! -e "/usr/local/bin/pandora_server" ] -- then -- echo "ERROR compiling Pandora FMS Server from sources. Aborting" -- exit 1 -- fi -- if [ "$DISTRO" != "FreeBSD" -a "$DISTRO" != "NetBSD" ] -- then -- ln -s /usr/local/bin/pandora_server /usr/bin -- ln -s /usr/local/bin/pandora_exec /usr/bin -- fi -+ echo "ERROR compiling Pandora FMS Server from sources. Aborting" -+ exit 1 - fi -- -- echo "Creating common Pandora FMS directories" -- id pandora 2> /dev/null -- if [ $? -eq 0 ]; then -- echo " " -- echo "User pandora does exist, make sure the SSH directories are correct" -- else -- echo "Are you sure we can create a standard 'pandora' user locally? [y/N]" -- read AREYOUSURE -- if [ "$AREYOUSURE" = "y" ]; then -- if [ "$DISTRO" = "FreeBSD" ] -- then -- echo "pandora:41121:::::Pandora FMS:/home/pandora:/usr/sbin/nologin:" | adduser -f - -w no 2> /dev/null -- else -- useradd pandora -- mkdir /home/pandora 2> /dev/null -- mkdir /home/pandora/.ssh 2> /dev/null -- chown -R pandora /home/pandora -- fi -- else -- echo "Please create the 'pandora' user manually according to your authentication scheme, then start again the installation" -- echo "Aborting..." -- exit 1 -- fi -+ if [ "$DISTRO" != "FreeBSD" ] && [ "$DISTRO" != "NetBSD" ] -+ then -+ ln -s /usr/local/bin/pandora_server $DESTDIR$PREFIX -+ ln -s /usr/local/bin/pandora_exec $DESTDIR$PREFIX - fi -+ fi - -- mkdir $PANDORA_SPOOL 2> /dev/null -- mkdir $PANDORA_SPOOL/data_in 2> /dev/null -- chmod 770 $PANDORA_SPOOL/data_in -- mkdir $PANDORA_SPOOL/data_in/conf 2> /dev/null -- chmod 770 $PANDORA_SPOOL/data_in/conf -- mkdir $PANDORA_SPOOL/data_in/md5 2> /dev/null -- chmod 770 $PANDORA_SPOOL/data_in/md5 -- mkdir $PANDORA_SPOOL/data_in/collections 2> /dev/null -- chmod 770 $PANDORA_SPOOL/data_in/collections -- mkdir $PANDORA_SPOOL/data_in/netflow 2> /dev/null -- chmod 770 $PANDORA_SPOOL/data_in/netflow -- mkdir $PANDORA_LOG 2> /dev/null -- -- echo "Giving proper permission to /var/spool/pandora" -- IDGROUP=`id -g www-data 2> /dev/null` -- if [ $? -eq 0 ] -- then -- GROUPNAME=`cat /etc/group | grep ":$IDGROUP:" | awk -F":" '{print $1}'` -- chown -R pandora:$GROUPNAME $PANDORA_SPOOL -- else -- IDGROUP=`id -g wwwrun 2> /dev/null` -- if [ $? -eq 0 ] -+ echo "Creating common Pandora FMS directories" -+ id pandora 2> /dev/null -+ if [ $? -eq 0 ]; then -+ echo " " -+ echo "User pandora does exist, make sure the SSH directories are correct" -+ elif [ "$DESTDIR" ] -+ then -+ # chown can fail with fakeroot installation -+ echo "User 'pandora' does not exist. All chown operations may fail." -+ echo "You should manualy set proper ownership to $DESTDIR$PANDORA_SPOOL if needed." -+ echo -+ else -+ echo "Are you sure we can create a standard 'pandora' user locally? [y/N]" -+ read AREYOUSURE -+ if [ "$AREYOUSURE" = "y" ]; then -+ if [ "$DISTRO" = "FreeBSD" ] - then -- GROUPNAME=`cat /etc/group | grep ":$IDGROUP:" | awk -F":" '{print $1}'` -- chown -R pandora:$GROUPNAME $PANDORA_SPOOL -+ echo "pandora:41121:::::Pandora FMS:/home/pandora:/usr/sbin/nologin:" | adduser -f - -w no 2> /dev/null - else -- IDGROUP=`id -g www 2> /dev/null` -- if [ $? -eq 0 ] -- then -- GROUPNAME=`cat /etc/group | grep ":$IDGROUP:" | awk -F":" '{print $1}'` -- chown -R pandora:$GROUPNAME $PANDORA_SPOOL -- else -- IDGROUP=`id -g apache 2> /dev/null` -- if [ $? -eq 0 ] -- then -- GROUPNAME=`cat /etc/group | grep ":$IDGROUP:" | awk -F":" '{print $1}'` -- chown -R pandora:$GROUPNAME $PANDORA_SPOOL -- else -- echo "No web server user found, some functionality might not perform correctly" -- chown -R pandora:root $PANDORA_SPOOL -- fi -- fi -+ useradd pandora -+ mkdir /home/pandora 2> /dev/null -+ mkdir /home/pandora/.ssh 2> /dev/null -+ chown -R pandora /home/pandora - fi -- fi -- -- -- echo "Creating setup directory in $PANDORA_CFG_DIR" -- mkdir $PANDORA_CFG_DIR 2> /dev/null -- if [ "$DISTRO" = "FreeBSD" ] -- then -- if [ -e $PANDORA_CFG_FILE ] -- then -- OLDFILENAMETMP=`date +"%Y-%m-%d"` -- echo "Old installation detected, backing up pandora_server.conf.$ODFILENAMETMP" -- mv $PANDORA_CFG_FILE $PANDORA_CFG_FILE.$OLDFILENAMETMP -- fi -- echo cp FreeBSD/pandora_server.conf $PANDORA_CFG_DIR -- cp FreeBSD/pandora_server.conf $PANDORA_CFG_DIR -- elif [ "$DISTRO" = "NetBSD" ] -- then -- if [ ! -d $PANDORA_CFG_DIR ] -- then -- mkdir -p $PANDORA_CFG_DIR -- fi -- if [ -e $PANDORA_CFG_FILE ] -- then -- OLDFILENAMETMP=`date +"%Y-%m-%d"` -- echo "Old installation detected, backing up pandora_server.conf.$ODFILENAMETMP" -- mv $PANDORA_CFG_FILE $PANDORA_CFG_FILE.$OLDFILENAMETMP -- fi -- echo cp NetBSD/pandora_server.conf $PANDORA_CFG_DIR -- cp NetBSD/pandora_server.conf $PANDORA_CFG_DIR - else -- if [ -f "$PANDORA_CFG_FILE" ] -- then -- echo cp conf/pandora_server.conf.new $PANDORA_CFG_DIR -- cp conf/pandora_server.conf.new $PANDORA_CFG_DIR -- else -- echo cp conf/pandora_server.conf.new $PANDORA_CFG_FILE -- cp conf/pandora_server.conf.new $PANDORA_CFG_FILE -- fi -+ echo "Please create the 'pandora' user manually according to your authentication scheme, then start again the installation" -+ echo "Aborting..." -+ exit 1 - fi -- chmod 770 $PANDORA_CFG_FILE -+ fi - -- echo "Installing Pandora Server manual" -- if [ "$DISTRO" = "FreeBSD" ] -+ mkdir -p $DESTDIR$PANDORA_SPOOL/data_in 2> /dev/null -+ chmod 770 $DESTDIR$PANDORA_SPOOL/data_in -+ mkdir $DESTDIR$PANDORA_SPOOL/data_in/conf 2> /dev/null -+ chmod 770 $DESTDIR$PANDORA_SPOOL/data_in/conf -+ mkdir $DESTDIR$PANDORA_SPOOL/data_in/md5 2> /dev/null -+ chmod 770 $DESTDIR$PANDORA_SPOOL/data_in/md5 -+ mkdir $DESTDIR$PANDORA_SPOOL/data_in/collections 2> /dev/null -+ chmod 770 $DESTDIR$PANDORA_SPOOL/data_in/collections -+ mkdir $DESTDIR$PANDORA_SPOOL/data_in/netflow 2> /dev/null -+ chmod 770 $DESTDIR$PANDORA_SPOOL/data_in/netflow -+ mkdir -p $DESTDIR$PANDORA_LOG 2> /dev/null -+ -+ echo "Giving proper permission to /var/spool/pandora" -+ for group in "www-data" wwwrun www apache -+ do -+ IDGROUP=`id -g "$group" 2> /dev/null` -+ if [ $? -eq 0 ] - then -- cp man/man1/pandora_server.1.gz /usr/local/man/man1 -- else -- cp man/man1/pandora_server.1.gz /usr/share/man/man1 -+ GROUPNAME=`grep ":$IDGROUP:" /etc/group | awk -F":" '{print $1}'` -+ break - fi -+ done -+ if [ -z "$GROUPNAME" ] -+ then -+ echo "No web server user found, some functionality might not perform correctly" -+ GROUPNAME=0 -+ fi -+ # when fakeroot installation, this can fail -+ chown -R pandora:$GROUPNAME $DESTDIR$PANDORA_SPOOL 2>/dev/null - -- if [ "$LINUX" = "YES" ] -- then -- echo "Copying the daemon script into /etc/init.d/pandora_server" -- cp util/pandora_server /etc/init.d/ -- -- if [ "$DISTRO" = "UBUNTU" ] || [ "$DISTRO" = "DEBIAN" ] -- then -- -- echo "Linking startup script to /etc/rc2.d" -- update-rc.d pandora_server defaults -- else -- if [ "$DISTRO" = "SUSE" ] -- then -- echo "Creating startup daemons" -- insserv pandora_server -- else -- # Pandora FMS Server install (Other Distros) -- INITLV=`cat /etc/inittab | grep "[0-9]\:initdefault" | cut -f 2 -d ":"` -- if [ -z "$INITLV" ] -- then -- INITLV=2 -- fi -- echo "Linking startup script to /etc/rc.d/rc$INITLV.d" -- ln -s $PANDORA_SERVER /etc/rc.d/rc$INITLV.d/S90pandora_server -- fi -- fi -- else -- if [ "$DISTRO" = "FreeBSD" ] -- then -- echo "Copying the daemon script into $PANDORA_SERVER" -- cp FreeBSD/pandora_server $PANDORA_SERVER -- chmod 555 $PANDORA_SERVER -- fi -- if [ "$DISTRO" = "NetBSD" ] -- then -- echo "Copying the daemon script into $PANDORA_SERVER" -- cp NetBSD/pandora_server $PANDORA_SERVER -- chmod 555 $PANDORA_SERVER -- fi -- fi -+ echo "Creating setup directory in $PANDORA_CFG_DIR" -+ mkdir -p $DESTDIR$PANDORA_CFG_DIR 2> /dev/null -+ if [ -f "$DESTDIR$PANDORA_CFG_FILE" ] -+ then -+ echo cp $PANDORA_CFG_FILE_DIST $DESTDIR$PANDORA_CFG_DIR -+ cp $PANDORA_CFG_FILE_DIST $DESTDIR$PANDORA_CFG_DIR -+ else -+ echo cp $PANDORA_CFG_FILE_DIST $DESTDIR$PANDORA_CFG_FILE -+ cp $PANDORA_CFG_FILE_DIST $DESTDIR$PANDORA_CFG_FILE -+ chmod 770 $DESTDIR$PANDORA_CFG_FILE -+ fi - -- if [ -d /etc/logrotate.d ]; then -- echo "Creating logrotate.d entry for Pandora FMS log management" -- cp util/pandora_logrotate /etc/logrotate.d/pandora -- else -- echo "Please add a log rotation schedule manually to your log rotation daemon (if any)" -- fi -+ echo "Installing Pandora Server manual" -+ cp man/man1/pandora_server.1.gz $DESTDIR$MANDIR -+ -+ install_startup_script -s 90 $PANDORA_INIT_SCRIPT -+ -+ 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" -+ cp util/pandora_logrotate $DESTDIR/etc/logrotate.d/pandora -+ else -+ echo "Please add a log rotation schedule manually to your log rotation daemon (if any)" -+ fi - -- if [ "$LINUX" = "YES" ] -- then -- if [ "$SECOPT" != "--no-tentacle" ] -- then -- if [ "$DISTRO" = "UBUNTU" ] || [ "$DISTRO" = "DEBIAN" ] -- then -- # Tentacle server install (Ubuntu) -- echo "Installing tentacle server" -- cp bin/tentacle_server /usr/bin -- chown pandora /usr/bin/tentacle_server -- cp util/tentacle_serverd $TENTACLE_SERVER -- update-rc.d tentacle_serverd defaults -- else -- if [ "$DISTRO" = "SUSE" ] -- then -- echo "Creating Tentacle startup daemon" -- cp bin/tentacle_server /usr/bin -- chown pandora /usr/bin/tentacle_server -- cp util/tentacle_serverd /etc/init.d/tentacle_serverd -- insserv tentacle_serverd -- else -- # Tentacle server install (Other Distros) -- echo "Installing tentacle server in /etc/rc.d/rc$INITLV.d/S80tentacle_serverd" -- cp bin/tentacle_server /usr/bin -- chown pandora /usr/bin/tentacle_server -- cp util/tentacle_serverd /etc/init.d/tentacle_serverd -- ln -s $TENTACLE_SERVER /etc/rc.d/rc$INITLV.d/S80tentacle_serverd -- fi -- fi -+ if [ $WITHOUT_TENTACLE -eq 0 ] -+ then -+ # tentacle_server is already installed by "make install" -+ install_startup_script -s 80 $TENTACLE_INIT_SCRIPT -+ -+ echo "Installing Tentacle Server manual" -+ cp man/man1/tentacle_server.1.gz $DESTDIR$MANDIR -+ fi - -- echo "Installing Tentacle Server manual" -- cp man/man1/tentacle_server.1.gz /usr/share/man/man1 -- fi -- else -- if [ "$SECOPT" != "--no-tentacle" ] -- then -- if [ "$DISTRO" = "FreeBSD" ] -- then -- echo "Installing tentacle server" -- cp bin/tentacle_server /usr/local/bin -- chown pandora /usr/local/bin/tentacle_server -- chmod 555 /usr/local/bin/tentacle_server -- cp FreeBSD/tentacle_server $TENTACLE_SERVER -- chmod 555 $TENTACLE_SERVER -- echo "Installing Tentacle Server manual" -- cp man/man1/tentacle_server.1.gz /usr/local/man/man1 -- fi -- if [ "$DISTRO" = "NetBSD" ] -- then -- echo "Installing tentacle server" -- cp bin/tentacle_server /usr/local/bin -- chown pandora /usr/local/bin/tentacle_server -- chmod 555 /usr/local/bin/tentacle_server -- cp NetBSD/tentacle_server $TENTACLE_SERVER -- chmod 555 $TENTACLE_SERVER -- echo "Installing Tentacle Server manual" -- cp man/man1/tentacle_server.1.gz /usr/share/man/man1 -- fi -- fi -- fi -+ echo "Creating Pandora FMS distribution directory in $PANDORA_HOME" -+ mkdir -p $DESTDIR$PANDORA_HOME 2> /dev/null -+ cp -R util $DESTDIR$PANDORA_HOME -+ find $DESTDIR$PANDORA_HOME -type l -delete - -- echo "Creating Pandora FMS distribution directory in $PANDORA_HOME" -- mkdir $PANDORA_HOME 2> /dev/null -- if [ ! -d $PANDORA_HOME ] -+ # install cron job -+ if [ -d /etc/cron.hourly ] -+ then -+ [ ! -d $DESTDIR/etc/cron.hourly ] && mkdir -p $DESTDIR/etc/cron.hourly -+ echo "Creating the Cron script to run Pandora DB tool each hour" -+ echo "#!/bin/bash" > $DESTDIR/etc/cron.hourly/pandora_db -+ echo "perl $PANDORA_HOME/util/pandora_db.pl /etc/pandora/pandora_server.conf" >> /etc/cron.hourly/pandora_db -+ chmod +x /etc/cron.hourly/pandora_db -+ elif [ "$DISTRO" = "FreeBSD" ] || [ "$DISTRO" = "NetBSD" ] -+ then -+ if [ "$DESTDIR" ] - then -- mkdir -p $PANDORA_HOME -- fi -- cp -R util $PANDORA_HOME -- -- if [ -d /etc/cron.hourly ] -- then -- echo "Creating the Cron script to run Pandora DB tool each hour" -- echo "#!/bin/bash" > /etc/cron.hourly/pandora_db -- echo "perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" >> /etc/cron.hourly/pandora_db -- chmod +x /etc/cron.hourly/pandora_db -+ echo "Skip adding cron entry for pandora_db.pl when performing fakeroot installation." - else -- if [ "$DISTRO" = "FreeBSD" -o "$DISTRO" = "NetBSD" ] -+ grep pandora_db.pl /etc/crontab > /dev/null 2>&1 -+ if [ $? -ne 0 ] - then -- grep pandora_db.pl /etc/crontab > /dev/null 2>&1 -- if [ $? -ne 0 ] -- then -- echo "# Pandora FMS" >> /etc/crontab -- echo "2 * * * * root perl /usr/local/share/pandora_server/util/pandora_db.pl /usr/local/etc/pandora/pandora_server.conf" >> /etc/crontab -- else -- echo "The crontab for pandora_db.pl is already configured." -- fi -+ echo "# Pandora FMS" >> /etc/crontab -+ echo "2 * * * * root perl $PANDORA_HOME/util/pandora_db.pl $PANDORA_CFG_FILE" >> /etc/crontab - else -- echo "You're probably not using cron for automatic scheduling. You should schedule the following command to run frequently (hourly) on your master server:" -- echo " perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" -+ echo "The crontab for pandora_db.pl is already configured." - fi - fi -- echo -- echo "Now you have to edit your $PANDORA_CFG_FILE file to change the database password (default is pandora) with the one set in include/config.php of your Pandora FMS Console." -- echo "After setting password you can start your Pandora FMS Server!!" -- rm output -+ else -+ echo "You're probably not using cron for automatic scheduling. You should schedule the following command to run frequently (hourly) on your master server:" -+ echo " perl $PANDORA_HOME/util/pandora_db.pl $PANDORA_CFG_FILE" -+ fi -+ echo -+ echo "Now you have to edit your $PANDORA_CFG_FILE file to change the database password (default is pandora) with the one set in include/config.php of your Pandora FMS Console." -+ echo "After setting password you can start your Pandora FMS Server!!" - -- if [ -d "/etc/logrotate.d" ] -- then -- echo "Managing Pandora FMS logs with logrotate (Distro independent)" -- cp -aRf util/pandora_logrotate /etc/logrotate.d/pandora -- fi -+ if [ "$DISTRO" = "FreeBSD" ] || [ "$DISTRO" = "NetBSD" ] -+ then -+ echo " " -+ echo "Define '$PANDORA_RC_VAR=\"YES\"' in /etc/rc.conf to enable pandora server daemon." -+ [ "$WITHOUT_TENTACLE" = 0 ] && \ -+ echo "Define '$TENTACLE_RC_VAR=\"YES\"' in /etc/rc.conf to enable tentacle server daemon." -+ fi -+} - -- if [ "$DISTRO" = "FreeBSD" ] -- then -- echo " " -- echo "Define 'pandora_server_enable=\"YES\"' in /etc/rc.conf to enable pandora server daemon." -- echo "Define 'tentacle_server_enable=\"YES\"' in /etc/rc.conf to enable tentacle server daemon." -- fi -+uninstall () { -+ set_global_vars - -- if [ "$DISTRO" = "NetBSD" ] -- then -- echo " " -- echo "Define 'pandora_server=\"YES\"' in /etc/rc.conf to enable pandora server daemon." -- echo "Define 'tentacle_server=\"YES\"' in /etc/rc.conf to enable tentacle server daemon." -- fi -- -+ if [ "$LINUX" != NO ] || [ "$DISTRO" != "FreeBSD" ] || [ "$DISTRO" != "NetBSD" ] -+ then -+ echo "This is not a Linux-based distro. Uninstaller is currently not working for your OS" -+ exit 1 - fi - --} -- --uninstall_bsd () { -- if [ "$DISTRO" = "FreeBSD" ] -+ echo "Removing PERL libs and man files" -+ -+ PERL_SITELIB=/usr/lib/perl5 -+ if [ "$DISTRO" != "FreeBSD" ] || [ "$DISTRO" != "NetBSD" ] - then -- PANDORA_SPOOL=/var/spool/pandora -- PANDORA_HOME=/usr/local/share/pandora_server -- PANDORA_CFG_DIR=/usr/local/etc/pandora -- PANDORA_LOG=/var/log/pandora -- PANDORA_SERVER=/usr/local/etc/rc.d/pandora_server -- TENTACLE_SERVER=/usr/local/etc/rc.d/tentacle_server -- PANDORA_CFG_FILE=/usr/local/etc/pandora/pandora_server.conf -- TMP_CRONTAB=/tmp/crontab.tmp -- else -- PANDORA_SPOOL=/var/spool/pandora -- PANDORA_HOME=/usr/local/share/pandora_server -- PANDORA_CFG_DIR=/usr/local/etc/pandora -- PANDORA_LOG=/var/log/pandora -- PANDORA_SERVER=/etc/rc.d/pandora_server -- TENTACLE_SERVER=/etc/rc.d/tentacle_server -- PANDORA_CFG_FILE=/usr/local/etc/pandora/pandora_server.conf -- TMP_CRONTAB=/tmp/crontab.tmp -- fi -+ PERL_SITELIB=$(eval $($PERL -V:sitelib);echo $sitelib); -+ fi -+ PERL_SITEMAN3DIR=`eval \`$PERL -V:siteman3dir\`;echo $siteman3dir`; - -- echo "Removing PERL libs" -- rm -rf /usr/lib/perl5/PandoraFMS/ -+ [ -d $DESTDIR/$PERL_SITELIB/PandoraFMS ] && rm -rf $DESTDIR/$PERL_SITELIB/PandoraFMS -+ rm -f $DESTDIR/$PERL_SITEMAN3DIR/PandoraFMS::* 2>/dev/null - -- echo "Removing Pandora Servers" -- rm -Rf $PANDORA_SPOOL/data_in/ - -- echo "If the user Pandora is not being used for any other operations, please delete using the following commands:" -- echo " rmuser pandora" -- -- rm -Rf $PANDORA_LOG 2> /dev/null -- rm -Rf $PANDORA_CFG_FILE 2> /dev/null -- rm -Rf $PANDORA_SERVER 2> /dev/null -- rm -Rf $PANDORA_HOME -- rm -Rf $PANDORA_SERVER -- rm -Rf $TENTACLE_SERVER -- -- cat /etc/crontab | grep -v "Pandora FMS" | grep -v "pandora_db.pl" > $TMP_CRONTAB -- cp $TMP_CRONTAB /etc/crontab -- rm $TMP_CRONTAB -- -- echo "Done" -- exit --} -- --uninstall () { -- GET_DISTRO="`get_distro`" -- DISTRO=`echo $GET_DISTRO | cut -f 1 -d ":"` -- if [ "`uname -s`" != "Linux" ]; then -- if [ "$DISTRO" = "FreeBSD" -o "$DISTRO" = "NetBSD" ] -- then -- uninstall_bsd -- else -- echo "This is not a Linux-based distro. Uninstaller is currently not working for your OS" -- fi -- fi -- -- echo "Removing PERL libs" -- rm -rf /usr/lib/perl5/PandoraFMS/ -- - echo "Removing Pandora Servers" -- if [ -d $PANDORA_SPOOL/data_out ]; then -- rm -Rf $PANDORA_SPOOL/data_in -+ if [ -d $DESTDIR$PANDORA_SPOOL/data_out ]; then -+ rm -Rf $DESTDIR$PANDORA_SPOOL/data_in - else -- rm -Rf $PANDORA_SPOOL -+ rm -Rf $DESTDIR$PANDORA_SPOOL - fi - - echo "If the user Pandora is not being used for any other operations, please delete using the following commands:" -- echo " userdel pandora" -- echo " rm -Rf /home/pandora/" -+ if [ "$DISTRO" != "FreeBSD" ] || [ "$DISTRO" != "NetBSD" ] -+ then -+ echo " rmuser pandora" -+ else -+ echo " userdel pandora" -+ echo " rm -Rf /home/pandora/" -+ fi - - ## Just to clarify here. Some people (like me) are using the pandora user - ## for other purposes and/or using an LDAP-based user management - ## I would hate to have a script clear out this users' information without any notification - -- rm -Rf $PANDORA_LOG 2> /dev/null -- rm -Rf $PANDORA_CFG_FILE 2> /dev/null -- rm -Rf "$PANDORA_CFG_FILE.new" 2> /dev/null -- rm -Rf $PANDORA_SERVER 2> /dev/null -- rm -Rf /usr/bin/pandora_server 2> /dev/null -- rm -Rf /usr/bin/pandora_exec 2> /dev/null -- rm -Rf $PANDORA_HOME -- rm -Rf /etc/cron.hourly/pandora_db -- rm -Rf /etc/logrotate.d/pandora -- if [ "$DISTRO" = "UBUNTU" ] || [ "$DISTRO" = "DEBIAN" ] -+ -+ rm -Rf $DESTDIR$PANDORA_LOG 2> /dev/null -+ rm -f $DESTDIR$PANDORA_CFG_FILE 2> /dev/null -+ rm -f "$DESTDIR$PANDORA_CFG_FILE.new" 2> /dev/null -+ rm -f $DESTDIR$PANDORA_SERVER 2> /dev/null -+ rm -f $DESTDIR$PREFIX/bin/pandora_server 2> /dev/null -+ rm -f $DESTDIR$PREFIX/bin/pandora_exec 2> /dev/null -+ rm -f $DESTDIR$PREFIX/bin/tentacle_server 2> /dev/null -+ rm -Rf $DESTDIR$PANDORA_HOME -+ rm -f $DESTDIR/etc/cron.hourly/pandora_db -+ rm -f $DESTDIR/etc/logrotate.d/pandora -+ if [ "$DESTDIR" ] - then -+ # do nothing with "fakeroot" uninstallation -+ : -+ elif [ "$DISTRO" = "UBUNTU" ] || [ "$DISTRO" = "DEBIAN" ] -+ then - update-rc.d -f pandora_server remove - update-rc.d -f tentacle_serverd remove -+ elif [ "$DISTRO" != "FreeBSD" ] || [ "$DISTRO" != "NetBSD" ] -+ then -+ TMP_CRONTAB=/tmp/crontab.tmp -+ egrep -v "Pandora FMS|pandora_db.pl" /etc/crontab > $TMP_CRONTAB -+ cp $TMP_CRONTAB /etc/crontab -+ rm $TMP_CRONTAB - fi -- rm -Rf /etc/rc2.d/S90pandora_server 2> /dev/null -- rm -Rf /etc/rc.d/rc3.d/S90pandora_server 2> /dev/null -- rm -Rf /usr/share/man/man1/pandora_server.1.gz 2>/dev/null -- rm -Rf /usr/share/man/man1/tentacle_server.1.gz 2>/dev/null -+ rm -f $DESTDIR/etc/rc2.d/S90pandora_server 2> /dev/null -+ rm -f $DESTDIR/etc/rc.d/rc3.d/S90pandora_server 2> /dev/null -+ rm -f $DESTDIR/etc/rc2.d/S80tentacle_serverd 2> /dev/null -+ rm -f $DESTDIR/etc/rc.d/rc3.d/S80tentacle_serverd 2> /dev/null -+ rm -f $DESTDIR$MANDIR/pandora_server.1.gz 2>/dev/null -+ rm -f $DESTDIR$MANDIR/tentacle_server.1.gz 2>/dev/null - echo "Done" - } - -@@ -595,24 +478,25 @@ - echo " " - echo " --force Ignore dependency problems and do the install" - echo " --no-tentacle Skip tentacle server installation (by default tentacle server installed)" -+ echo " --destdir DIR Specify root directory for \"fakeroot\" installation" - echo " " - } - - # Script banner at start - echo " " --echo "Pandora FMS 5.0 Server Installer (c) 2008-2013 Artica ST" -+echo "Pandora FMS 5.1 Server Installer (c) 2008-2014 Artica ST" - echo "This program is licensed under GPL2 Terms. http://pandorafms.com" - echo " " - - case "$MODE" in - - '--install') -- install -+ install "$@" - exit - ;; - - '--uninstall') -- uninstall -+ uninstall "$@" - exit - ;; - -Index: lib/PandoraFMS/SNMPServer.pm -=================================================================== ---- lib/PandoraFMS/SNMPServer.pm (revision 10314) -+++ lib/PandoraFMS/SNMPServer.pm (working copy) -@@ -25,6 +25,7 @@ - use Thread::Semaphore; - - use Time::Local; -+use Time::HiRes qw(usleep); - use XML::Simple; - - # Default lib dir for RPM and DEB packages -@@ -33,21 +34,27 @@ - use PandoraFMS::Tools; - use PandoraFMS::DB; - use PandoraFMS::Core; --use PandoraFMS::Server; -+use PandoraFMS::ProducerConsumerServer; - --# Inherits from PandoraFMS::Server --our @ISA = qw(PandoraFMS::Server); -+# Inherits from PandoraFMS::ProducerConsumerServer -+our @ISA = qw(PandoraFMS::ProducerConsumerServer); - --# Tells the server to keep running --my $RUN :shared; -+# Global variables -+my @TaskQueue :shared; -+my %PendingTasks :shared; -+my $Sem :shared; -+my $TaskSem :shared; - - # Trap statistics by agent - my %AGENTS = (); - -+# Index file management -+my ($IDX_FILE, $LAST_LINE, $LAST_SIZE) = (); -+ - ######################################################################################## - # SNMP Server class constructor. - ######################################################################################## --sub new ($$;$) { -+sub new ($$$) { - my ($class, $config, $dbh) = @_; - - return undef unless $config->{'snmpconsole'} == 1; -@@ -57,15 +64,46 @@ - return undef; - } - -+ # Wait for the SNMP log file to be available -+ my $log_file = $config->{'snmp_logfile'}; -+ sleep ($config->{'server_threshold'}) if (! -e $log_file); -+ if (!open (SNMPLOGFILE, $log_file)) { -+ logger ($config, ' [E] Could not open the SNMP log file ' . $config->{'snmp_logfile'} . ".", 1); -+ print_message ($config, ' [E] Could not open the SNMP log file ' . $config->{'snmp_logfile'} . ".", 1); -+ return 1; -+ } -+ -+ # Process index file, if available -+ ($IDX_FILE, $LAST_LINE, $LAST_SIZE) = ($log_file . '.index', 0, 0); -+ if (-e $IDX_FILE) { -+ open (INDEXFILE, $IDX_FILE) or return; -+ my $idx_data = <INDEXFILE>; -+ close INDEXFILE; -+ ($LAST_LINE, $LAST_SIZE) = split(/\s+/, $idx_data); -+ } -+ my $log_size = (stat ($log_file))[7]; -+ -+ # New SNMP log file found -+ if ($log_size < $LAST_SIZE) { -+ unlink ($IDX_FILE); -+ ($LAST_LINE, $LAST_SIZE) = (0, 0); -+ } -+ -+ # Skip already processed lines -+ readline SNMPLOGFILE for (1..$LAST_LINE); -+ -+ # Initialize semaphores and queues -+ @TaskQueue = (); -+ %PendingTasks = (); -+ $Sem = Thread::Semaphore->new; -+ $TaskSem = Thread::Semaphore->new (0); -+ - # Call the constructor of the parent class -- my $self = $class->SUPER::new($config, 2, $dbh); -+ my $self = $class->SUPER::new($config, 2, \&PandoraFMS::SNMPServer::data_producer, \&PandoraFMS::SNMPServer::data_consumer, $dbh); - - # Save the path of snmptrapd - $self->{'snmp_trapd'} = $config->{'snmp_trapd'}; - -- # Run! -- $RUN = 1; -- - bless $self, $class; - return $self; - } -@@ -77,242 +115,219 @@ - my $self = shift; - my $pa_config = $self->getConfig (); - -- print_message ($pa_config, " [*] Starting Pandora FMS SNMP Console.", 1); -- $self->SUPER::run (\&PandoraFMS::SNMPServer::pandora_snmptrapd); -+ print_message ($pa_config, " [*] Starting Pandora FMS SNMP Console.", 2); -+ -+ # Set the initial date for storm protection. -+ $pa_config->{"__storm_ref__"} = time(); -+ -+ # This is the only server that reads from disk instead of from the DB. No need for a higher server threshold. -+ $pa_config->{'server_threshold'} = 1; -+ -+ $self->setNumThreads ($pa_config->{'snmpconsole_threads'}); -+ $self->SUPER::run (\@TaskQueue, \%PendingTasks, $Sem, $TaskSem); - } - --########################################################################## --# Process SNMP log file. --########################################################################## --sub pandora_snmptrapd { -+############################################################################### -+# Data producer. -+############################################################################### -+sub data_producer ($) { - my $self = shift; -- my $pa_config = $self->getConfig (); -+ my ($pa_config, $dbh) = ($self->getConfig (), $self->getDBH ()); - -- my $dbh; -- eval { -- # Connect to the DB -- $dbh = db_connect ($pa_config->{'dbengine'}, $pa_config->{'dbname'}, $pa_config->{'dbhost'}, -- $pa_config->{'dbport'}, $pa_config->{'dbuser'}, $pa_config->{'dbpass'}); -- $self->setDBH ($dbh); -+ my @tasks; -+ -+ # Slave server -+ if ($pa_config->{'pandora_master'} == 0 && get_db_value ($dbh, 'SELECT name FROM tserver WHERE name = ANY(SELECT name FROM tserver WHERE status = 0)') == undef) { -+ return @tasks; -+ } - -- # Wait for the SNMP log file to be available -- my $log_file = $pa_config->{'snmp_logfile'}; -- sleep ($pa_config->{'server_threshold'}) while (! -e $log_file); -- open (SNMPLOGFILE, $log_file) or return; -+ # Reset storm protection counters -+ my $curr_time = time (); -+ if ($pa_config->{"__storm_ref__"} + $pa_config->{"snmp_storm_timeout"} < $curr_time) { -+ $pa_config->{"__storm_ref__"} = $curr_time; -+ %AGENTS = (); -+ } - -- # Process index file, if available -- my ($idx_file, $last_line, $last_size) = ($log_file . '.index', 0, 0); -- if (-e $idx_file) { -- open (INDEXFILE, $idx_file) or return; -- my $idx_data = <INDEXFILE>; -- close INDEXFILE; -- ($last_line, $last_size) = split(/\s+/, $idx_data); -- } -+ while (my $line = <SNMPLOGFILE>) { -+ $LAST_LINE++; -+ $LAST_SIZE = (stat ($pa_config->{'snmp_logfile'}))[7]; -+ chomp ($line); - -- my $log_size = (stat ($log_file))[7]; -+ # Update index file -+ open INDEXFILE, '>' . $IDX_FILE; -+ print INDEXFILE $LAST_LINE . ' ' . $LAST_SIZE; -+ close INDEXFILE; - -- # New SNMP log file found -- if ($log_size < $last_size) { -- unlink ($idx_file); -- ($last_line, $last_size) = (0, 0); -+ # Skip lines other than SNMP Trap logs -+ next unless ($line =~ m/^SNMPv[12]\[\*\*\]/); -+ -+ # Storm protection. -+ my ($ver, $date, $time, $source, $null) = split(/\[\*\*\]/, $line, 5); -+ next unless defined ($source); -+ if (! defined ($AGENTS{$source})) { -+ $AGENTS{$source}{'count'} = 1; -+ $AGENTS{$source}{'event'} = 0; -+ } else { -+ $AGENTS{$source}{'count'} += 1; - } -- -- # Skip already processed lines -- readline SNMPLOGFILE for (1..$last_line); -- -- # Main loop -- my $storm_ref = time (); -- while ($RUN == 1) { -- -- # Reset storm protection counters -- my $curr_time = time (); -- if ($storm_ref + $pa_config->{"snmp_storm_timeout"} < $curr_time) { -- $storm_ref = $curr_time; -- %AGENTS = (); -+ if ($pa_config->{'snmp_storm_protection'} > 0 && $AGENTS{$source}{'count'} > $pa_config->{'snmp_storm_protection'}) { -+ if ($AGENTS{$source}{'event'} == 0) { -+ pandora_event ($pa_config, "Too many traps coming from $source. Silenced for " . int ($pa_config->{"snmp_storm_timeout"} / 60) . " minutes.", 0, 0, 4, 0, 0, 'system', 0, $dbh); - } -+ $AGENTS{$source}{'event'} = 1; -+ next; -+ } - -- while (my $line = <SNMPLOGFILE>) { -- $last_line++; -- $last_size = (stat ($log_file))[7]; -- chomp ($line); -+ push (@tasks, $line); -+ } - -- # Update index file -- open INDEXFILE, '>' . $idx_file; -- print INDEXFILE $last_line . ' ' . $last_size; -- close INDEXFILE; -+ return @tasks; -+} - -- # Skip lines other than SNMP Trap logs -- next unless ($line =~ m/^SNMPv[12]\[\*\*\]/); -+############################################################################### -+# Data consumer. -+############################################################################### -+sub data_consumer ($$) { -+ my ($self, $task) = @_; - -- (my $trap_ver, $line) = split(/\[\*\*\]/, $line, 2); -+ pandora_snmptrapd ($self->getConfig (), $task, $self->getServerID (), $self->getDBH ()); -+} - -- # Process SNMP filter -- next if (matches_filter ($dbh, $pa_config, $line) == 1); -+########################################################################## -+# Process SNMP log file. -+########################################################################## -+sub pandora_snmptrapd { -+ my ($pa_config, $line, $server_id, $dbh) = @_; - -- logger($pa_config, "Reading trap '$line'", 10); -- my ($date, $time, $source, $oid, $type, $type_desc, $value, $data) = ('', '', '', '', '', '', '', ''); -+ (my $trap_ver, $line) = split(/\[\*\*\]/, $line, 2); - -- if ($trap_ver eq "SNMPv1") { -- ($date, $time, $source, $oid, $type, $type_desc, $value, $data) = split(/\[\*\*\]/, $line, 8); -+ # Process SNMP filter -+ next if (matches_filter ($dbh, $pa_config, $line) == 1); - -- $value = limpia_cadena ($value); -+ logger($pa_config, "Reading trap '$line'", 10); -+ my ($date, $time, $source, $oid, $type, $type_desc, $value, $data) = ('', '', '', '', '', '', '', ''); - -- # Try to save as much information as possible if the trap could not be parsed -- $oid = $type_desc if ($oid eq '' || $oid eq '.'); -+ if ($trap_ver eq "SNMPv1") { -+ ($date, $time, $source, $oid, $type, $type_desc, $value, $data) = split(/\[\*\*\]/, $line, 8); - -- } elsif ($trap_ver eq "SNMPv2") { -- ($date, $time, $source, $data) = split(/\[\*\*\]/, $line, 4); -- my @data = split(/\t/, $data); -+ $value = limpia_cadena ($value); - -- shift @data; # Drop unused 1st data. -- $oid = shift @data; -+ # Try to save as much information as possible if the trap could not be parsed -+ $oid = $type_desc if ($oid eq '' || $oid eq '.'); - -- if (!defined($oid)) { -- logger($pa_config, "[W] snmpTrapOID not found (Illegal SNMPv2 trap?)", 1); -- next; -- } -- $oid =~ s/.* = OID: //; -- $data = join("\t", @data); -- } -+ } elsif ($trap_ver eq "SNMPv2") { -+ ($date, $time, $source, $data) = split(/\[\*\*\]/, $line, 4); -+ my @data = split(/\t/, $data); - -- if ($trap_ver eq "SNMPv2" || $pa_config->{'snmp_pdu_address'} eq '1' ) { -- # extract IP address from %b part: -- # * destination part (->[dest_ip]:dest_port) appears in Net-SNMP > 5.3 -- # * protocol name (TCP: or UDP:) and bracketted IP addr w/ port number appear in -- # Net-SNMP > 5.1 (Net-SNMP 5.1 has IP addr only). -- # * port number is signed (often negative) in Net-SNMP 5.2 -- $source =~ s/(?:(?:TCP|UDP):\s*)?\[?([^] ]+)\]?(?::-?\d+)?(?:\s*->.*)?$/$1/; -- } -+ shift @data; # Drop unused 1st data. -+ $oid = shift @data; - -- my $timestamp = $date . ' ' . $time; -- my ($custom_oid, $custom_type, $custom_value) = ('', '', ''); -+ if (!defined($oid)) { -+ logger($pa_config, "[W] snmpTrapOID not found (Illegal SNMPv2 trap?)", 1); -+ next; -+ } -+ $oid =~ s/.* = OID: //; -+ $data = join("\t", @data); -+ } - -- # custom_type, custom_value is not used since 4.0 version, all custom data goes on custom_oid -- $custom_oid = $data; -+ if ($trap_ver eq "SNMPv2" || $pa_config->{'snmp_pdu_address'} eq '1' ) { -+ # extract IP address from %b part: -+ # * destination part (->[dest_ip]:dest_port) appears in Net-SNMP > 5.3 -+ # * protocol name (TCP: or UDP:) and bracketted IP addr w/ port number appear in -+ # Net-SNMP > 5.1 (Net-SNMP 5.1 has IP addr only). -+ # * port number is signed (often negative) in Net-SNMP 5.2 -+ $source =~ s/(?:(?:TCP|UDP):\s*)?\[?([^] ]+)\]?(?::-?\d+)?(?:\s*->.*)?$/$1/; -+ } - -- # Storm protection -- if (! defined ($AGENTS{$source})) { -- $AGENTS{$source}{'count'} = 1; -- $AGENTS{$source}{'event'} = 0; -- } else { -- $AGENTS{$source}{'count'} += 1; -- } -- if ($pa_config->{'snmp_storm_protection'} > 0 && $AGENTS{$source}{'count'} > $pa_config->{'snmp_storm_protection'}) { -- if ($AGENTS{$source}{'event'} == 0) { -- pandora_event ($pa_config, "Too many traps coming from $source. Silenced for " . int ($pa_config->{"snmp_storm_timeout"} / 60) . " minutes.", 0, 0, 4, 0, 0, 'system', 0, $dbh); -- } -- $AGENTS{$source}{'event'} = 1; -- next; -- } -+ my $timestamp = $date . ' ' . $time; -+ my ($custom_oid, $custom_type, $custom_value) = ('', '', ''); - -- #Trap forwarding -- if ($pa_config->{'snmp_forward_trap'}==1) { -- my $trap_data_string = ""; -+ # custom_type, custom_value is not used since 4.0 version, all custom data goes on custom_oid -+ $custom_oid = $data; - -- #We loop through all the custom data of the received trap, creating the $trap_data_string string to forward the trap properly -- while ($data =~ /([\.\d]+)\s=\s([^:]+):\s([\S ]+)/g) { -- my ($trap_data, $trap_type, $trap_value) = ($1, $2, $3); -- if ($trap_type eq "INTEGER") { -- #FIX for translated traps from IF-MIB.txt MIB -- $trap_value =~ s/\D//g; -- $trap_data_string = $trap_data_string . "$trap_data i $trap_value "; -- } -- elsif ($trap_type eq "UNSIGNED"){ -- $trap_data_string = $trap_data_string . "$trap_data u $trap_value "; -- } -- elsif ($trap_type eq "COUNTER32"){ -- $trap_data_string = $trap_data_string . "$trap_data c $trap_value "; -- } -- elsif ($trap_type eq "STRING"){ -- $trap_data_string = $trap_data_string . "$trap_data s $trap_value "; -- } -- elsif ($trap_type eq "HEX STRING"){ -- $trap_data_string = $trap_data_string . "$trap_data x $trap_value "; -- } -- elsif ($trap_type eq "DECIMAL STRING"){ -- $trap_data_string = $trap_data_string . "$trap_data d $trap_value "; -- } -- elsif ($trap_type eq "NULLOBJ"){ -- $trap_data_string = $trap_data_string . "$trap_data n $trap_value "; -- } -- elsif ($trap_type eq "OBJID"){ -- $trap_data_string = $trap_data_string . "$trap_data o $trap_value "; -- } -- elsif ($trap_type eq "TIMETICKS"){ -- $trap_data_string = $trap_data_string . "$trap_data t $trap_value "; -- } -- elsif ($trap_type eq "IPADDRESS"){ -- $trap_data_string = $trap_data_string . "$trap_data a $trap_value "; -- } -- elsif ($trap_type eq "BITS"){ -- $trap_data_string = $trap_data_string . "$trap_data b $trap_value "; -- } -- } -+ #Trap forwarding -+ if ($pa_config->{'snmp_forward_trap'}==1) { -+ my $trap_data_string = ""; - -- #We distinguish between the three different kinds of SNMP forwarding -- if ($pa_config->{'snmp_forward_version'} eq '3') { -- system("snmptrap -v $pa_config->{'snmp_forward_version'} -n \"\" -a $pa_config->{'snmp_forward_authProtocol'} -A $pa_config->{'snmp_forward_authPassword'} -x $pa_config->{'snmp_forward_privProtocol'} -X $pa_config->{'snmp_forward_privPassword'} -l $pa_config->{'snmp_forward_secLevel'} -u $pa_config->{'snmp_forward_secName'} -e $pa_config->{'snmp_forward_engineid'} $pa_config->{'snmp_forward_ip'} '' $oid $trap_data_string"); -- } -- elsif ($pa_config->{'snmp_forward_version'} eq '2' || $pa_config->{'snmp_forward_version'} eq '2c') { -- system("snmptrap -v 2c -n \"\" -c $pa_config->{'snmp_forward_community'} $pa_config->{'snmp_forward_ip'} '' $oid $trap_data_string"); -- } -- elsif ($pa_config->{'snmp_forward_version'} eq '1') { -- #Because of tne SNMP v1 protocol, we must perform additional steps for creating the trap -- my $value_sending = ""; -- my $type_sending = ""; -+ #We loop through all the custom data of the received trap, creating the $trap_data_string string to forward the trap properly -+ while ($data =~ /([\.\d]+)\s=\s([^:]+):\s([\S ]+)/g) { -+ my ($trap_data, $trap_type, $trap_value) = ($1, $2, $3); -+ if ($trap_type eq "INTEGER") { -+ #FIX for translated traps from IF-MIB.txt MIB -+ $trap_value =~ s/\D//g; -+ $trap_data_string = $trap_data_string . "$trap_data i $trap_value "; -+ } -+ elsif ($trap_type eq "UNSIGNED"){ -+ $trap_data_string = $trap_data_string . "$trap_data u $trap_value "; -+ } -+ elsif ($trap_type eq "COUNTER32"){ -+ $trap_data_string = $trap_data_string . "$trap_data c $trap_value "; -+ } -+ elsif ($trap_type eq "STRING"){ -+ $trap_data_string = $trap_data_string . "$trap_data s $trap_value "; -+ } -+ elsif ($trap_type eq "HEX STRING"){ -+ $trap_data_string = $trap_data_string . "$trap_data x $trap_value "; -+ } -+ elsif ($trap_type eq "DECIMAL STRING"){ -+ $trap_data_string = $trap_data_string . "$trap_data d $trap_value "; -+ } -+ elsif ($trap_type eq "NULLOBJ"){ -+ $trap_data_string = $trap_data_string . "$trap_data n $trap_value "; -+ } -+ elsif ($trap_type eq "OBJID"){ -+ $trap_data_string = $trap_data_string . "$trap_data o $trap_value "; -+ } -+ elsif ($trap_type eq "TIMETICKS"){ -+ $trap_data_string = $trap_data_string . "$trap_data t $trap_value "; -+ } -+ elsif ($trap_type eq "IPADDRESS"){ -+ $trap_data_string = $trap_data_string . "$trap_data a $trap_value "; -+ } -+ elsif ($trap_type eq "BITS"){ -+ $trap_data_string = $trap_data_string . "$trap_data b $trap_value "; -+ } -+ } - -- if ($value eq ''){ -- $value_sending = "\"\""; -- } -- else { -- $value_sending = $value; -- $value_sending =~ s/[\$#@~!&*()\[\];.,:?^ `\\\/]+//g; -- } -- if ($type eq ''){ -- $type_sending = "\"\""; -- } -- else{ -- $type_sending = $type; -- } -+ #We distinguish between the three different kinds of SNMP forwarding -+ if ($pa_config->{'snmp_forward_version'} eq '3') { -+ system("snmptrap -v $pa_config->{'snmp_forward_version'} -n \"\" -a $pa_config->{'snmp_forward_authProtocol'} -A $pa_config->{'snmp_forward_authPassword'} -x $pa_config->{'snmp_forward_privProtocol'} -X $pa_config->{'snmp_forward_privPassword'} -l $pa_config->{'snmp_forward_secLevel'} -u $pa_config->{'snmp_forward_secName'} -e $pa_config->{'snmp_forward_engineid'} $pa_config->{'snmp_forward_ip'} '' $oid $trap_data_string"); -+ } -+ elsif ($pa_config->{'snmp_forward_version'} eq '2' || $pa_config->{'snmp_forward_version'} eq '2c') { -+ system("snmptrap -v 2c -n \"\" -c $pa_config->{'snmp_forward_community'} $pa_config->{'snmp_forward_ip'} '' $oid $trap_data_string"); -+ } -+ elsif ($pa_config->{'snmp_forward_version'} eq '1') { -+ #Because of tne SNMP v1 protocol, we must perform additional steps for creating the trap -+ my $value_sending = ""; -+ my $type_sending = ""; - -- system("snmptrap -v 1 -c $pa_config->{'snmp_forward_community'} $pa_config->{'snmp_forward_ip'} $oid \"\" $type_sending $value_sending \"\" $trap_data_string"); -- } -- } -+ if ($value eq ''){ -+ $value_sending = "\"\""; -+ } -+ else { -+ $value_sending = $value; -+ $value_sending =~ s/[\$#@~!&*()\[\];.,:?^ `\\\/]+//g; -+ } -+ if ($type eq ''){ -+ $type_sending = "\"\""; -+ } -+ else{ -+ $type_sending = $type; -+ } - -- # Insert the trap into the DB -- if (! defined(enterprise_hook ('snmp_insert_trap', [$pa_config, $source, $oid, $type, $value, $custom_oid, $custom_value, $custom_type, $timestamp, $self->getServerID (), $dbh]))) { -- my $trap_id = db_insert ($dbh, 'id_trap', 'INSERT INTO ttrap (timestamp, source, oid, type, value, oid_custom, value_custom, type_custom) VALUES (?, ?, ?, ?, ?, ?, ?, ?)', -- $timestamp, $source, $oid, $type, $value, $custom_oid, $custom_value, $custom_type); -- logger ($pa_config, "Received SNMP Trap from $source", 4); -- -- # Evaluate alerts for this trap -- pandora_evaluate_snmp_alerts ($pa_config, $trap_id, $source, $oid, $type, $oid, $value, $custom_oid, $dbh); -- } -- } -- -- sleep ($pa_config->{'server_threshold'}); -+ system("snmptrap -v 1 -c $pa_config->{'snmp_forward_community'} $pa_config->{'snmp_forward_ip'} $oid \"\" $type_sending $value_sending \"\" $trap_data_string"); - } -- }; -- -- if ($@) { -- $self->setErrStr ($@); - } - -- db_disconnect ($dbh); --} -+ # Insert the trap into the DB -+ if (! defined(enterprise_hook ('snmp_insert_trap', [$pa_config, $source, $oid, $type, $value, $custom_oid, $custom_value, $custom_type, $timestamp, $server_id, $dbh]))) { -+ my $trap_id = db_insert ($dbh, 'id_trap', 'INSERT INTO ttrap (timestamp, source, oid, type, value, oid_custom, value_custom, type_custom) VALUES (?, ?, ?, ?, ?, ?, ?, ?)', -+ $timestamp, $source, $oid, $type, $value, $custom_oid, $custom_value, $custom_type); -+ logger ($pa_config, "Received SNMP Trap from $source", 4); - --######################################################################################## --# Stop the server, killing snmptrapd before. --######################################################################################## --sub stop () { -- my $self = shift; -- -- if ($self->{'snmp_trapd'} ne 'manual') { -- system ("kill -9 `cat /var/run/pandora_snmptrapd.pid 2>$DEVNULL`"); -- unlink ('/var/run/pandora_snmptrapd.pid'); -+ # Evaluate alerts for this trap -+ pandora_evaluate_snmp_alerts ($pa_config, $trap_id, $source, $oid, $type, $oid, $value, $custom_oid, $dbh); - } -- -- $self->SUPER::stop (); - } - - ######################################################################################## -@@ -328,14 +343,14 @@ - my $eval_result; - - # eval protects against server down (by invalid regular expressions) -- $eval_result = eval { -+ $eval_result = eval { - $string =~ m/$regexp/i ; - }; - -- if ($eval_result) { -- logger($pa_config, "Trap '$string' matches filter '$regexp'. Discarding...", 10); -- return 1; -- } -+ if ($eval_result) { -+ logger($pa_config, "Trap '$string' matches filter '$regexp'. Discarding...", 10); -+ return 1; -+ } - - } - -@@ -393,7 +408,7 @@ - print_message ($config, " [E] Could not start snmptrapd.", 1); - return 1; - } -- -+ - return 0; - } - -@@ -403,7 +418,10 @@ - sub DESTROY { - my $self = shift; - -- $RUN = 0; -+ if ($self->{'snmp_trapd'} ne 'manual') { -+ system ("kill -9 `cat /var/run/pandora_snmptrapd.pid 2>$DEVNULL`"); -+ unlink ('/var/run/pandora_snmptrapd.pid'); -+ } - } - - 1; -Index: lib/PandoraFMS/Config.pm -=================================================================== ---- lib/PandoraFMS/Config.pm (revision 10314) -+++ lib/PandoraFMS/Config.pm (working copy) -@@ -248,6 +248,9 @@ - $pa_config->{"snmp_pdu_address"} = 0; # 5.0 - $pa_config->{"snmp_storm_protection"} = 0; # 5.0 - $pa_config->{"snmp_storm_timeout"} = 600; # 5.0 -+ $pa_config->{"snmpconsole_threads"} = 1; # 5.1 -+ $pa_config->{"translate_variable_bindings"} = 0; # 5.1 -+ $pa_config->{"translate_enterprise_strings"} = 1; # 5.1 - - # Internal MTA for alerts, each server need its own config. - $pa_config->{"mta_address"} = '127.0.0.1'; # Introduced on 2.0 -@@ -261,6 +264,7 @@ - - # nmap for recon OS fingerprinting and tcpscan (optional) - $pa_config->{"nmap"} = "/usr/bin/nmap"; -+ $pa_config->{"nmap_timing_template"} = 2; # > 5.1 - - # braa for enterprise snmp server - $pa_config->{"braa"} = "/usr/bin/braa"; -@@ -465,6 +469,15 @@ - elsif ($parametro =~ m/^snmp_storm_timeout\s+(\d+)/i) { - $pa_config->{'snmp_storm_timeout'}= clean_blank($1); - } -+ elsif ($parametro =~ m/^snmpconsole_threads\s+(\d+)/i) { -+ $pa_config->{'snmpconsole_threads'}= clean_blank($1); -+ } -+ elsif ($parametro =~ m/^translate_variable_bindings\s+([0-1])/i) { -+ $pa_config->{'translate_variable_bindings'}= clean_blank($1); -+ } -+ elsif ($parametro =~ m/^translate_enterprise_strings\s+([0-1])/i) { -+ $pa_config->{'translate_enterprise_strings'}= clean_blank($1); -+ } - elsif ($parametro =~ m/^dbengine\s(.*)/i) { - $pa_config->{'dbengine'}= clean_blank($1); - } -@@ -595,6 +608,9 @@ - elsif ($parametro =~ m/^nmap\s(.*)/i) { - $pa_config->{'nmap'}= clean_blank($1); - } -+ elsif ($parametro =~ m/^nmap_timing_template\s([0-9]*)/i) { -+ $pa_config->{'nmap_timing_template'}= clean_blank($1); -+ } - elsif ($parametro =~ m/^braa\s(.*)/i) { - $pa_config->{'braa'}= clean_blank($1); - } -Index: lib/PandoraFMS/NetworkServer.pm -=================================================================== ---- lib/PandoraFMS/NetworkServer.pm (revision 10314) -+++ lib/PandoraFMS/NetworkServer.pm (working copy) -@@ -25,6 +25,7 @@ - use Thread::Semaphore; - - use IO::Socket::INET6; -+use IO::Select; - use HTML::Entities; - use POSIX qw(strftime); - -@@ -170,100 +171,103 @@ - $retries = $pa_config->{'tcp_checks'}; - } - -- $tcp_send = decode_entities($tcp_send); -- $tcp_rcv = decode_entities($tcp_rcv); -+ $tcp_send = decode_entities($tcp_send); -+ $tcp_rcv = decode_entities($tcp_rcv); - -- my $counter; -- for ($counter =0; $counter < $retries; $counter++){ -- my $temp; my $temp2; -- my $tam; -- my $handle=IO::Socket::INET6->new( -- Proto=>"tcp", -- PeerAddr=>$ip_target, -- Timeout=>$timeout, -- PeerPort=>$tcp_port, -+ my $counter; -+ for ($counter =0; $counter < $retries; $counter++){ -+ my $temp; my $temp2; -+ my $tam; -+ my $handle=IO::Socket::INET6->new( -+ Proto=>"tcp", -+ PeerAddr=>$ip_target, -+ Timeout=>$timeout, -+ PeerPort=>$tcp_port, - Multihomed=>1, -- Blocking=>0 ); # Non blocking !!, very important ! -- -- if (defined ($handle)){ -+ Blocking=>0 ); # Non blocking !!, very important ! -+ -+ if (defined ($handle)){ - # Multi request patch, submitted by Glen Eustace (new zealand) - my @tcp_send = split( /\|/, $tcp_send ); - my @tcp_rcv = split( /\|/, $tcp_rcv ); - -+ # Add server socket to select queue -+ my $select = IO::Select->new (); -+ $select->add ($handle); -+ - next_pair: - $tcp_send = shift( @tcp_send ); - $tcp_rcv = shift( @tcp_rcv ); - -- if ((defined ($tcp_send)) && ($tcp_send ne "")){ # its Expected to sending data ? -- # Send data -- $handle->autoflush(1); -- $tcp_send =~ s/\^M/\r\n/g; -- # Replace Carriage rerturn and line feed -- $handle->send($tcp_send); -- } -- # we expect to receive data ? (non proc types) -- if ((defined ($tcp_rcv) && $tcp_rcv ne "") || (($id_tipo_modulo == 10) || ($id_tipo_modulo ==8) || ($id_tipo_modulo == 11))) { -- # Receive data, non-blocking !!!! (VERY IMPORTANT!) -- $temp2 = ""; -- for ($tam=0; $tam<$timeout; $tam++){ -- $handle->recv($temp,16000,0x40); -- $temp2 = $temp2.$temp; -- if ($temp ne ""){ -- $tam++; # If doesnt receive data, increase counter -- } -- sleep(1); -- } -- if ($id_tipo_modulo == 9){ # only for TCP Proc -- if ($temp2 =~ /$tcp_rcv/i){ # String match ! -+ if ((defined ($tcp_send)) && ($tcp_send ne "")){ # its Expected to sending data ? -+ # Send data -+ $handle->autoflush(1); -+ $tcp_send =~ s/\^M/\r\n/g; -+ # Replace Carriage rerturn and line feed -+ $handle->send($tcp_send); -+ } -+ # we expect to receive data ? (non proc types) -+ if ((defined ($tcp_rcv) && $tcp_rcv ne "") || (($id_tipo_modulo == 10) || ($id_tipo_modulo ==8) || ($id_tipo_modulo == 11))) { -+ # Receive data, non-blocking !!!! (VERY IMPORTANT!) -+ $temp2 = ""; -+ for ($tam = 0; $tam < $timeout; $tam ++) { -+ if ($select->can_read (1)) { -+ my $read = sysread ($handle, $temp, 16000); -+ last if (! defined ($read) || $read == 0); # No more data or something went wrong -+ $temp2 = $temp2.$temp; -+ } -+ } -+ if ($id_tipo_modulo == 9){ # only for TCP Proc -+ if ($temp2 =~ /$tcp_rcv/i){ # String match ! - if ( @tcp_send ) { # still more pairs - goto next_pair; - } -- $$module_data = 1; -- $$module_result = 0; -- $counter = $retries; -- } else { -- $$module_data = 0; -- $$module_result = 0; -- $counter = $retries; -- } -- } elsif ($id_tipo_modulo == 10 ){ # TCP String (no int conversion)! -- $$module_data = $temp2; -- $$module_result =0; -- } else { # TCP Data numeric (inc or data) -- if ($temp2 ne ""){ -- if ($temp2 =~ /[A-Za-z\.\,\-\/\\\(\)\[\]]/){ -- $$module_result = 1; -- $$module_data = 0; # invalid data -- $counter = $retries; -- } else { -- $$module_data = int($temp2); -- $$module_result = 0; # Successful -- $counter = $retries; -- } -- } else { -- $$module_result = 1; -- $$module_data = 0; # invalid data -- $counter = $retries; -- } -- } -- } else { # No expected data to receive, if connected and tcp_proc type successful -- if ($id_tipo_modulo == 9){ # TCP Proc -- $$module_result = 0; -- $$module_data = 1; -- $counter = $retries; -- } -- } -- $handle->close(); -- undef ($handle); -- } else { # Cannot connect (open sock failed) -- $$module_result = 1; # Fail -- if ($id_tipo_modulo == 9){ # TCP Proc -- $$module_result = 0; -- $$module_data = 0; # Failed, but data exists -- $counter = $retries; -- } -- } -- } -+ $$module_data = 1; -+ $$module_result = 0; -+ $counter = $retries; -+ } else { -+ $$module_data = 0; -+ $$module_result = 0; -+ $counter = $retries; -+ } -+ } elsif ($id_tipo_modulo == 10 ){ # TCP String (no int conversion)! -+ $$module_data = $temp2; -+ $$module_result =0; -+ } else { # TCP Data numeric (inc or data) -+ if ($temp2 ne ""){ -+ if ($temp2 =~ /[A-Za-z\.\,\-\/\\\(\)\[\]]/){ -+ $$module_result = 1; -+ $$module_data = 0; # invalid data -+ $counter = $retries; -+ } else { -+ $$module_data = int($temp2); -+ $$module_result = 0; # Successful -+ $counter = $retries; -+ } -+ } else { -+ $$module_result = 1; -+ $$module_data = 0; # invalid data -+ $counter = $retries; -+ } -+ } -+ } else { # No expected data to receive, if connected and tcp_proc type successful -+ if ($id_tipo_modulo == 9){ # TCP Proc -+ $$module_result = 0; -+ $$module_data = 1; -+ $counter = $retries; -+ } -+ } -+ $handle->close(); -+ undef ($handle); -+ } else { # Cannot connect (open sock failed) -+ $$module_result = 1; # Fail -+ if ($id_tipo_modulo == 9){ # TCP Proc -+ $$module_result = 0; -+ $$module_data = 0; # Failed, but data exists -+ $counter = $retries; -+ } -+ } -+ } - } - - ############################################################################### -@@ -352,7 +356,7 @@ - - return (undef, 0) unless ($snmp_oid ne ''); - if ($snmp_oid =~ m/[a-zA-Z]/) { -- $snmp_oid = translate_obj ($pa_config, $dbh, $snmp_oid, ); -+ $snmp_oid = translate_obj ($pa_config, $dbh, $snmp_oid); - - # Could not translate OID, disable the module - if (! defined ($snmp_oid) || $snmp_oid eq '') { -Index: lib/PandoraFMS/GIS.pm -=================================================================== ---- lib/PandoraFMS/GIS.pm (revision 10314) -+++ lib/PandoraFMS/GIS.pm (working copy) -@@ -146,12 +146,24 @@ - ########################################################################## - sub get_reverse_geoip_sql($$$) { - my ($pa_config,$ip_addr, $dbh) = @_; -- -- my $id_range = get_db_value($dbh, 'SELECT `id_range` FROM tgis_reverse_geoip_ranges WHERE INET_ATON(?) >= `first_IP_decimal` AND INET_ATON(?) <= `last_IP_decimal` LIMIT 1', $ip_addr, $ip_addr); -- if (defined($id_range)) { -- logger($pa_config,"Range id of '$ip_addr' is '$id_range'", 8); -- my $region_info = get_db_single_row($dbh, 'SELECT * FROM tgis_reverse_geoip_info WHERE `id_range` = ?',$id_range); -- logger($pa_config, "region info of id_range '$id_range' is: country:".$region_info->{'country_name'}." region:".$region_info->{'region'}." city:".$region_info->{'city'}." longitude:".$region_info->{'longitude'}." latitude:".$region_info->{'longitude'}, 8); -+ -+ my $id_range = get_db_value($dbh, -+ 'SELECT ' . $RDBMS_QUOTE . 'id_range' . $RDBMS_QUOTE . ' -+ FROM tgis_reverse_geoip_ranges -+ WHERE INET_ATON(?) >= ' . $RDBMS_QUOTE . 'first_IP_decimal' . $RDBMS_QUOTE . ' -+ AND INET_ATON(?) <= ' . $RDBMS_QUOTE . 'last_IP_decimal ' . $RDBMS_QUOTE . ' -+ LIMIT 1', $ip_addr, $ip_addr); -+ -+ if (defined($id_range)) { -+ logger($pa_config,"Range id of '$ip_addr' is '$id_range'", 8); -+ my $region_info = get_db_single_row($dbh, -+ 'SELECT * -+ FROM tgis_reverse_geoip_info -+ WHERE ' . $RDBMS_QUOTE . 'id_range ' . $RDBMS_QUOTE . ' = ?', -+ $id_range); -+ -+ logger($pa_config, "region info of id_range '$id_range' is: country:".$region_info->{'country_name'}." region:".$region_info->{'region'}." city:".$region_info->{'city'}." longitude:".$region_info->{'longitude'}." latitude:".$region_info->{'longitude'}, 8); -+ - return $region_info; - } - return undef; -Index: lib/PandoraFMS/DB.pm -=================================================================== ---- lib/PandoraFMS/DB.pm (revision 10314) -+++ lib/PandoraFMS/DB.pm (working copy) -@@ -86,14 +86,18 @@ - get_agentmodule_data - $RDBMS - $RDBMS_QUOTE -+ $RDBMS_QUOTE_STRING - ); - - # Relational database management system in use - our $RDBMS = ''; - --# Character used to quote reserved words in the current RDBMS -+# For fields, character used to quote reserved words in the current RDBMS - our $RDBMS_QUOTE = ''; - -+# For strings, Character used to quote in the current RDBMS -+our $RDBMS_QUOTE_STRING = ''; -+ - ########################################################################## - ## Connect to the DB. - ########################################################################## -@@ -103,7 +107,8 @@ - if ($rdbms eq 'mysql') { - $RDBMS = 'mysql'; - $RDBMS_QUOTE = '`'; -- -+ $RDBMS_QUOTE_STRING = '"'; -+ - # Connect to MySQL - my $dbh = DBI->connect("DBI:mysql:$db_name:$db_host:$db_port", $db_user, $db_pass, { RaiseError => 1, AutoCommit => 1 }); - return undef unless defined ($dbh); -@@ -119,15 +124,18 @@ - elsif ($rdbms eq 'postgresql') { - $RDBMS = 'postgresql'; - $RDBMS_QUOTE = '"'; -+ $RDBMS_QUOTE_STRING = "'"; - - # Connect to PostgreSQL - my $dbh = DBI->connect("DBI:Pg:dbname=$db_name;host=$db_host;port=$db_port", $db_user, $db_pass, { RaiseError => 1, AutoCommit => 1 }); - return undef unless defined ($dbh); - - return $dbh; -- } elsif ($rdbms eq 'oracle') { -+ } -+ elsif ($rdbms eq 'oracle') { - $RDBMS = 'oracle'; - $RDBMS_QUOTE = '"'; -+ $RDBMS_QUOTE_STRING = '"'; - - # Connect to Oracle - my $dbh = DBI->connect("DBI:Oracle:dbname=$db_name;host=$db_host;port=$db_port;sid=pandora", $db_user, $db_pass, { RaiseError => 1, AutoCommit => 1 }); -@@ -641,6 +649,7 @@ - my ($dbh, $index, $query, @values) = @_; - my $insert_id = undef; - -+ - # MySQL - if ($RDBMS eq 'mysql') { - $dbh->do($query, undef, @values); -@@ -684,9 +693,9 @@ - return defined ($rc) ? $rc : -1; - } - --########################################################################## -+######################################################################## - ## SQL insert. Returns the ID of the inserted row. --########################################################################## -+######################################################################## - sub db_process_insert($$$$;@) { - my ($dbh, $index, $table, $parameters, @values) = @_; - -@@ -711,10 +720,14 @@ - } - $wildcards = '('.$wildcards.')'; - -- my $columns_string = join('`,`',@columns_array); -+ my $columns_string = join($RDBMS_QUOTE . ',' . $RDBMS_QUOTE, -+ @columns_array); - -- my $res = db_insert ($dbh, $index, "INSERT INTO $table (`".$columns_string."`) VALUES ".$wildcards, @values_array); -+ my $res = db_insert ($dbh, -+ $index, -+ "INSERT INTO $table (" . $RDBMS_QUOTE . $columns_string . $RDBMS_QUOTE . ") VALUES " . $wildcards, @values_array); - -+ - return $res; - } - -@@ -740,7 +753,8 @@ - if ($i > 0 && $i <= $#values_array) { - $fields = $fields.','; - } -- $fields = $fields." `$columns_array[$i]` = ?"; -+ $fields = $fields . -+ " " . $RDBMS_QUOTE . "$columns_array[$i]" . $RDBMS_QUOTE . " = ?"; - } - - push(@values_array, $where_value); -@@ -752,28 +766,30 @@ - return $res; - } - --########################################################################## -+######################################################################## - # Add the given address to taddress. --########################################################################## -+######################################################################## - sub add_address ($$) { - my ($dbh, $ip_address) = @_; -- -+ - return db_insert ($dbh, 'id_a', 'INSERT INTO taddress (ip) VALUES (?)', $ip_address); - } - --########################################################################## -+######################################################################## - # Assign the new address to the agent --########################################################################## -+######################################################################## - sub add_new_address_agent ($$$) { - my ($dbh, $addr_id, $agent_id) = @_; - -- db_do ($dbh, 'INSERT INTO taddress_agent (`id_a`, `id_agent`) -+ db_do ($dbh, 'INSERT INTO taddress_agent (' . -+ $RDBMS_QUOTE . 'id_a' . $RDBMS_QUOTE . ', ' . -+ $RDBMS_QUOTE. 'id_agent' . $RDBMS_QUOTE. ') - VALUES (?, ?)', $addr_id, $agent_id); - } - --########################################################################## -+######################################################################## - # Return the ID of the given address, -1 if it does not exist. --########################################################################## -+######################################################################## - sub get_addr_id ($$) { - my ($dbh, $addr) = @_; - -@@ -825,9 +841,9 @@ - return (defined ($id_ag)) ? $id_ag : 0; - } - --########################################################################## -+######################################################################## - ## Quote the given string. --########################################################################## -+######################################################################## - sub db_string ($) { - my $string = shift; - -@@ -856,7 +872,10 @@ - sub get_alert_template_name ($$) { - my ($dbh, $alert_id) = @_; - -- return get_db_value ($dbh, "SELECT name FROM talert_templates, talert_template_modules WHERE talert_templates.id = talert_template_modules.id_alert_template AND talert_template_modules.id = ?", $alert_id); -+ return get_db_value ($dbh, "SELECT name -+ FROM talert_templates, talert_template_modules -+ WHERE talert_templates.id = talert_template_modules.id_alert_template -+ AND talert_template_modules.id = ?", $alert_id); - } - - ######################################################################## -@@ -865,9 +884,8 @@ - sub db_concat ($$) { - my ($element1, $element2) = @_; - -- return " concat(" . $element1 . ", ' '," . $element2 . ") " if ($RDBMS eq 'mysql'); -- - return " " . $element1 . " || ' ' || " . $element2 . " " if ($RDBMS eq 'oracle' or $RDBMS eq 'postgresql'); -+ return " concat(" . $element1 . ", ' '," . $element2 . ") "; - } - - ######################################################################## -@@ -906,18 +924,18 @@ - ######################################################################## - sub db_update_get_values ($) { - my ($set_ref) = @_; -- -+ - my $set = ''; - my @values; - while (my ($key, $value) = each (%{$set_ref})) { -- -- # Not value for the given column -- next if (! defined ($value)); -- -- $set .= "$key = ?,"; -- push (@values, $value); -+ -+ # Not value for the given column -+ next if (! defined ($value)); -+ -+ $set .= "$key = ?,"; -+ push (@values, $value); - } -- -+ - # Remove the last , - chop ($set); - -@@ -929,34 +947,34 @@ - ######################################################################## - sub db_insert_get_values ($) { - my ($insert_ref) = @_; -- -+ - my $columns = '('; - my @values; - while (my ($key, $value) = each (%{$insert_ref})) { -- -- # Not value for the given column -- next if (! defined ($value)); -- -- $columns .= $PandoraFMS::DB::RDBMS_QUOTE . "$key" . $PandoraFMS::DB::RDBMS_QUOTE . ","; -- push (@values, $value); -+ -+ # Not value for the given column -+ next if (! defined ($value)); -+ -+ $columns .= $PandoraFMS::DB::RDBMS_QUOTE . "$key" . $PandoraFMS::DB::RDBMS_QUOTE . ","; -+ push (@values, $value); - } -- -+ - # Remove the last , and close the parentheses - chop ($columns); - $columns .= ')'; - -- # No columns -+ # No columns - if ($columns eq '()') { - return; - } -- -+ - # Add placeholders for the values - $columns .= ' VALUES (' . ("?," x ($#values + 1)); -- -+ - # Remove the last , and close the parentheses - chop ($columns); - $columns .= ')'; -- -+ - return ($columns, \@values); - } - -@@ -973,7 +991,7 @@ - my $sth = $dbh->prepare('SELECT GET_LOCK(?, ?)'); - $sth->execute($lock_name, $lock_timeout); - my ($lock) = $sth->fetchrow; -- -+ - # Something went wrong - return 0 if (! defined ($lock)); - -Index: lib/PandoraFMS/Core.pm -=================================================================== ---- lib/PandoraFMS/Core.pm (revision 10314) -+++ lib/PandoraFMS/Core.pm (working copy) -@@ -511,6 +511,9 @@ - my $critical_instructions = get_db_value ($dbh, 'SELECT critical_instructions FROM tagente_modulo WHERE id_agente_modulo = ?', $alert->{'id_agent_module'}); - my $warning_instructions = get_db_value ($dbh, 'SELECT warning_instructions FROM tagente_modulo WHERE id_agente_modulo = ?', $alert->{'id_agent_module'}); - my $unknown_instructions = get_db_value ($dbh, 'SELECT unknown_instructions FROM tagente_modulo WHERE id_agente_modulo = ?', $alert->{'id_agent_module'}); -+ -+ $alert->{'critical_instructions'} = $critical_instructions; -+ $alert->{'warning_instructions'} = $warning_instructions; - - # Generate an event - if ($table eq 'tevent_alert') { -@@ -666,6 +669,14 @@ - return; - } - -+ # Critical_instructions, warning_instructions, unknown_instructions -+ my $critical_instructions = get_db_value ($dbh, 'SELECT critical_instructions FROM tagente_modulo WHERE id_agente_modulo = ?', $alert->{'id_agent_module'}); -+ my $warning_instructions = get_db_value ($dbh, 'SELECT warning_instructions FROM tagente_modulo WHERE id_agente_modulo = ?', $alert->{'id_agent_module'}); -+ my $unknown_instructions = get_db_value ($dbh, 'SELECT unknown_instructions FROM tagente_modulo WHERE id_agente_modulo = ?', $alert->{'id_agent_module'}); -+ -+ $alert->{'critical_instructions'} = $critical_instructions; -+ $alert->{'warning_instructions'} = $warning_instructions; -+ - # Execute actions - my $event_generated = 0; - foreach my $action (@actions) { -@@ -692,11 +703,6 @@ - } - } - -- # Critical_instructions, warning_instructions, unknown_instructions -- my $critical_instructions = get_db_value ($dbh, 'SELECT critical_instructions FROM tagente_modulo WHERE id_agente_modulo = ?', $alert->{'id_agent_module'}); -- my $warning_instructions = get_db_value ($dbh, 'SELECT warning_instructions FROM tagente_modulo WHERE id_agente_modulo = ?', $alert->{'id_agent_module'}); -- my $unknown_instructions = get_db_value ($dbh, 'SELECT unknown_instructions FROM tagente_modulo WHERE id_agente_modulo = ?', $alert->{'id_agent_module'}); -- - # Generate an event only if an event has not already been generated by an alert action - if ($event_generated == 0) { - -@@ -840,6 +846,8 @@ - _alert_times_fired_ => $alert->{'times_fired'}, - _alert_priority_ => $alert->{'priority'}, - _alert_text_severity_ => get_priority_name($alert->{'priority'}), -+ _alert_critical_instructions_ => $alert->{'critical_instructions'}, -+ _alert_warning_instructions_ => $alert->{'warning_instructions'}, - _groupcontact_ => (defined ($group)) ? $group->{'contact'} : '', - _groupother_ => (defined ($group)) ? $group->{'other'} : '', - _module_ => (defined ($module)) ? $module->{'nombre'} : '', -@@ -1095,6 +1103,11 @@ - $min_ff_event = $module->{'min_ff_event_warning'} if ($new_status == 2); - } - -+ # replace $new_status with $last_known_status when recovering from 'unknown' -+ if ($status == 3) { -+ $new_status = $last_known_status; -+ } -+ - if ($last_status == $new_status) { - - # Avoid overflows -@@ -1124,17 +1137,24 @@ - # Update module status count - pandora_mark_agent_for_module_update ($dbh, $agent->{'id_agente'}); - } -- # Set not-init modules to normal even if min_ff_event is not matched the first time they receive data -+ # Set not-init modules to normal status even if min_ff_event is not matched the first time they receive data. -+ # if critical or warning status, just pass through here and wait the time min_ff_event will be matched. - elsif ($status == 4) { -- $new_status = 0; -- -+ generate_status_event ($pa_config, $processed_data, $agent, $module, 0, $status, $last_known_status, $dbh); -+ $status = 0; -+ -+ # Update module status count -+ pandora_mark_agent_for_module_update ($dbh, $agent->{'id_agente'}); -+ } -+ # If unknown modules receive data, restore status even if min_ff_event is not matched. -+ elsif ($status == 3) { - generate_status_event ($pa_config, $processed_data, $agent, $module, $new_status, $status, $last_known_status, $dbh); - $status = $new_status; - - # Update module status count - pandora_mark_agent_for_module_update ($dbh, $agent->{'id_agente'}); - } -- -+ - $last_status = $new_status; - - # tagente_estado.last_try defaults to NULL, should default to '1970-01-01 00:00:00' -@@ -1193,8 +1213,10 @@ - # Stop executed downtimes (enable agents and disable_agents_alerts) - my @downtimes = get_db_rows($dbh, 'SELECT * - FROM tplanned_downtime -- WHERE type_downtime != "quiet" AND type_execution="once" -- AND executed = 1 AND date_to <= ?', $utimestamp); -+ WHERE type_downtime != ' . $RDBMS_QUOTE_STRING. 'quiet' . $RDBMS_QUOTE_STRING. ' -+ AND type_execution = ' . $RDBMS_QUOTE_STRING. 'once' . $RDBMS_QUOTE_STRING. ' -+ AND executed = 1 -+ AND date_to <= ?', $utimestamp); - - foreach my $downtime (@downtimes) { - -@@ -1226,7 +1248,8 @@ - # Start pending downtimes (disable agents and disable_agents_alerts) - my @downtimes = get_db_rows($dbh, 'SELECT * - FROM tplanned_downtime -- WHERE type_downtime != "quiet" AND type_execution="once" -+ WHERE type_downtime != ' . $RDBMS_QUOTE_STRING . 'quiet' . $RDBMS_QUOTE_STRING . ' -+ AND type_execution = ' . $RDBMS_QUOTE_STRING . 'once' . $RDBMS_QUOTE_STRING . ' - AND executed = 0 AND date_from <= ? - AND date_to >= ?', $utimestamp, $utimestamp); - -@@ -1423,7 +1446,8 @@ - # Stop pending downtimes - my @downtimes = get_db_rows($dbh, 'SELECT * - FROM tplanned_downtime -- WHERE type_downtime = "quiet" AND type_execution="once" -+ WHERE type_downtime = ' . $RDBMS_QUOTE_STRING . 'quiet' . $RDBMS_QUOTE_STRING . ' -+ AND type_execution = ' . $RDBMS_QUOTE_STRING. 'once' . $RDBMS_QUOTE_STRING . ' - AND executed = 1 AND date_to <= ?', $utimestamp); - - foreach my $downtime (@downtimes) { -@@ -1463,7 +1487,8 @@ - # Start pending downtimes - my @downtimes = get_db_rows($dbh, 'SELECT * - FROM tplanned_downtime -- WHERE type_downtime = "quiet" AND type_execution="once" -+ WHERE type_downtime = ' . $RDBMS_QUOTE_STRING . 'quiet' . $RDBMS_QUOTE_STRING . ' -+ AND type_execution = ' . $RDBMS_QUOTE_STRING . 'once' . $RDBMS_QUOTE_STRING . ' - AND executed = 0 AND date_from <= ? - AND date_to >= ?', $utimestamp, $utimestamp); - -@@ -1517,7 +1542,7 @@ - # Start pending downtimes - my @downtimes = get_db_rows($dbh, 'SELECT * - FROM tplanned_downtime -- WHERE type_periodicity="monthly" -+ WHERE type_periodicity = ' . $RDBMS_QUOTE_STRING . 'monthly' . $RDBMS_QUOTE_STRING . ' - AND executed = 0 - AND periodically_day_from <= ? - AND periodically_day_to >= ?', -@@ -1619,9 +1644,9 @@ - # Start pending downtimes - my @downtimes = get_db_rows($dbh, 'SELECT * - FROM tplanned_downtime -- WHERE type_periodicity = "monthly" -+ WHERE type_periodicity = ' . $RDBMS_QUOTE_STRING . 'monthly' . $RDBMS_QUOTE_STRING . ' - AND executed = 1 -- AND type_execution <> "once"'); -+ AND type_execution <> ' . $RDBMS_QUOTE_STRING . 'once' . $RDBMS_QUOTE_STRING); - - foreach my $downtime (@downtimes) { - #Convert to identical type. -@@ -1695,18 +1720,18 @@ - # Start pending downtimes - my @downtimes = get_db_rows($dbh, 'SELECT * - FROM tplanned_downtime -- WHERE type_periodicity="weekly" -+ WHERE type_periodicity = ' . $RDBMS_QUOTE_STRING . 'weekly' . $RDBMS_QUOTE_STRING . ' - AND executed = 0'); - - foreach my $downtime (@downtimes) { - my $across_date = $downtime->{'periodically_time_from'} gt $downtime->{'periodically_time_to'} ? 1 : 0 ; - $found = 0; -- -+ - if ($across_date && ($time lt $downtime->{'periodically_time_to'})) { -- $number_day_week--; -- $number_day_week = 6 if ($number_day_week == -1); -- } -- -+ $number_day_week--; -+ $number_day_week = 6 if ($number_day_week == -1); -+ } -+ - if (($number_day_week == 1) && - ($downtime->{'monday'})) { - $found = 1; -@@ -1817,8 +1842,8 @@ - # Start pending downtimes - my @downtimes = get_db_rows($dbh, 'SELECT * - FROM tplanned_downtime -- WHERE type_periodicity = "weekly" -- AND type_execution <> "once" -+ WHERE type_periodicity = ' . $RDBMS_QUOTE_STRING . 'weekly' . $RDBMS_QUOTE_STRING . ' -+ AND type_execution <> ' . $RDBMS_QUOTE_STRING . 'once' . $RDBMS_QUOTE_STRING . ' - AND executed = 1'); - - foreach my $downtime (@downtimes) { -@@ -2137,7 +2162,7 @@ - Create a template module. - - =cut --########################################################################## -+######################################################################## - sub pandora_create_template_module ($$$$;$$$) { - my ($pa_config, $dbh, $id_agent_module, $id_alert_template, $id_policy_alerts, $disabled, $standby) = @_; - -@@ -2146,16 +2171,27 @@ - $standby = 0 unless defined $standby; - - my $module_name = get_module_name($dbh, $id_agent_module); -- return db_insert ($dbh, 'id', "INSERT INTO talert_template_modules (`id_agent_module`, `id_alert_template`, `id_policy_alerts`, `disabled`, `standby`, `last_reference`) VALUES (?, ?, ?, ?, ?, ?)", $id_agent_module, $id_alert_template, $id_policy_alerts, $disabled, $standby, time); -+ -+ return db_insert ($dbh, -+ 'id', -+ "INSERT INTO talert_template_modules( -+ " . $RDBMS_QUOTE . "id_agent_module" . $RDBMS_QUOTE . ", -+ " . $RDBMS_QUOTE . "id_alert_template" . $RDBMS_QUOTE . ", -+ " . $RDBMS_QUOTE . "id_policy_alerts" . $RDBMS_QUOTE . ", -+ " . $RDBMS_QUOTE . "disabled" . $RDBMS_QUOTE . ", -+ " . $RDBMS_QUOTE . "standby" . $RDBMS_QUOTE . ", -+ " . $RDBMS_QUOTE . "last_reference" . $RDBMS_QUOTE . ") -+ VALUES (?, ?, ?, ?, ?, ?)", -+ $id_agent_module, $id_alert_template, $id_policy_alerts, $disabled, $standby, time); - } - --########################################################################## -+######################################################################## - =head2 C<< pandora_update_template_module(I<$pa_config>, I<$dbh>, I<$id_alert>, I<$id_policy_alerts>, I<$disabled>, I<$standby>) >> - - Update a template module. - - =cut --########################################################################## -+######################################################################## - - sub pandora_update_template_module ($$$;$$$) { - my ($pa_config, $dbh, $id_alert, $id_policy_alerts, $disabled, $standby) = @_; -@@ -2164,16 +2200,22 @@ - $disabled = 0 unless defined $disabled; - $standby = 0 unless defined $standby; - -- db_do ($dbh, "UPDATE talert_template_modules SET `id_policy_alerts` = ?, `disabled` = ?, `standby` = ? WHERE id = ?", $id_policy_alerts, $disabled, $standby, $id_alert); -+ db_do ($dbh, -+ "UPDATE talert_template_modules -+ SET " . $RDBMS_QUOTE . "id_policy_alerts" . $RDBMS_QUOTE . " = ?, -+ " . $RDBMS_QUOTE . "disabled" . $RDBMS_QUOTE . " = ?, -+ " . $RDBMS_QUOTE . "standby" . $RDBMS_QUOTE . " = ? -+ WHERE id = ?", -+ $id_policy_alerts, $disabled, $standby, $id_alert); - } - --########################################################################## -+######################################################################## - =head2 C<< pandora_create_template_module_action(I<$pa_config>, I<$parameters>, I<$dbh>) >> - - Create a template action. - - =cut --########################################################################## -+######################################################################## - sub pandora_create_template_module_action ($$$) { - my ($pa_config, $parameters, $dbh) = @_; - -@@ -2184,26 +2226,26 @@ - return $action_id; - } - --########################################################################## -+######################################################################## - =head2 C<< pandora_delete_all_template_module_actions(I<$dbh>, I<$template_module_id>) >> - - Delete all actions of policy template module. - - =cut --########################################################################## -+######################################################################## - sub pandora_delete_all_template_module_actions ($$) { - my ($dbh, $template_module_id) = @_; - - return db_do ($dbh, 'DELETE FROM talert_template_module_actions WHERE id_alert_template_module = ?', $template_module_id); - } - --########################################################################## -+######################################################################## - =head2 C<< pandora_update_agent_address(I<$pa_config>, I<$agent_id>, I<$address>, I<$dbh>) >> - - Update the address of an agent. - - =cut --########################################################################## -+######################################################################## - sub pandora_update_agent_address ($$$$$) { - my ($pa_config, $agent_id, $agent_name, $address, $dbh) = @_; - -@@ -2298,9 +2340,13 @@ - $status = 0; - } - -- my $module_id = db_insert($dbh, 'id_agente_modulo', 'INSERT INTO tagente_modulo (id_agente, id_tipo_modulo, nombre, max, min, post_process, descripcion, module_interval, id_modulo) -- VALUES (?, ?, ?, ?, ?, ?, ?, ?, 1)', $agent_id, $module_type_id, safe_input($module_name), $max, $min, $post_process, $description, $interval); -- db_do ($dbh, 'INSERT INTO tagente_estado (id_agente_modulo, id_agente, estado, last_status, last_known_status, last_try) VALUES (?, ?, ?, ?, ?, \'1970-01-01 00:00:00\')', $module_id, $agent_id, $status, $status, $status); -+ my $module_id = db_insert($dbh, 'id_agente_modulo', -+ 'INSERT INTO tagente_modulo (id_agente, id_tipo_modulo, nombre, max, min, post_process, descripcion, module_interval, id_modulo, critical_instructions, warning_instructions, unknown_instructions, disabled_types_event, module_macros) -+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, 1, \'\', \'\', \'\', \'\', \'\')', -+ $agent_id, $module_type_id, safe_input($module_name), $max, $min, $post_process, $description, $interval); -+ db_do ($dbh, 'INSERT INTO tagente_estado (id_agente_modulo, id_agente, estado, last_status, last_known_status, last_try, datos) -+ VALUES (?, ?, ?, ?, ?, \'1970-01-01 00:00:00\', \'\')', -+ $module_id, $agent_id, $status, $status, $status); - - # Update the module status count. When the module is created disabled dont do it - pandora_mark_agent_for_module_update ($dbh, $agent_id); -@@ -2400,7 +2446,18 @@ - delete $parameters->{'type'}; - delete $parameters->{'datalist'}; - delete $parameters->{'status'}; -- -+ if (defined $parameters->{'id_os'}) { -+ delete $parameters->{'id_os'}; -+ } -+ if (defined $parameters->{'os_version'}) { -+ delete $parameters->{'os_version'}; -+ } -+ if (defined $parameters->{'id_os'}) { -+ delete $parameters->{'id'}; -+ } -+ if (defined $parameters->{'id_network_component_group'}) { -+ delete $parameters->{'id_network_component_group'}; -+ } - my $module_id = db_process_insert($dbh, 'id_agente_modulo', - 'tagente_modulo', $parameters); - -@@ -2409,7 +2466,7 @@ - $status = 0; - } - -- db_do ($dbh, 'INSERT INTO tagente_estado (id_agente_modulo, id_agente, estado, last_status, last_known_status, last_try) VALUES (?, ?, ?, ?, ?, \'1970-01-01 00:00:00\')', $module_id, $parameters->{'id_agente'}, $status, $status, $status); -+ db_do ($dbh, 'INSERT INTO tagente_estado (id_agente_modulo, id_agente, estado, last_status, last_known_status, last_try, datos) VALUES (?, ?, ?, ?, ?, \'1970-01-01 00:00:00\', \'\')', $module_id, $parameters->{'id_agente'}, $status, $status, $status); - - # Update the module status count. When the module is created disabled dont do it - pandora_mark_agent_for_module_update ($dbh, $parameters->{'id_agente'}); -@@ -2495,8 +2552,16 @@ - } - - foreach my $tag_name (split (',', $serialized_tags)) { -- my $tag_id = get_db_value ($dbh, "SELECT id_tag FROM ttag WHERE name = ?", $tag_name); -- db_insert ($dbh, 'id_tag', "INSERT INTO ttag_module (`id_tag`, `id_agente_modulo`) VALUES (?, ?)", $tag_id, $id_agent_module); -+ my $tag_id = get_db_value ($dbh, -+ "SELECT id_tag FROM ttag WHERE name = ?", $tag_name); -+ -+ db_insert ($dbh, -+ 'id_tag', -+ "INSERT INTO ttag_module( -+ " . $RDBMS_QUOTE . "id_tag" . $RDBMS_QUOTE . ", -+ " . $RDBMS_QUOTE . "id_agente_modulo" . $RDBMS_QUOTE . ") -+ VALUES (?, ?)", -+ $tag_id, $id_agent_module); - } - } - -@@ -3385,6 +3450,19 @@ - return; - } - -+ # disable event just recovering from 'Unknown' without status change -+ if($last_status == 3 && $status == $last_known_status && $module->{'disabled_types_event'} ) { -+ my $disabled_types_event; -+ eval { -+ local $SIG{__DIE__}; -+ $disabled_types_event = decode_json($module->{'disabled_types_event'}); -+ }; -+ -+ if ($disabled_types_event->{'going_unknown'}) { -+ return; -+ } -+ } -+ - # Mark as "validated" any previous event for this module - pandora_validate_event ($pa_config, $module->{'id_agente_modulo'}, $dbh); - -@@ -3968,33 +4046,46 @@ - AND estado = 3"); - $agents_unknown = 0 if (!defined($agents_unknown)); - } -- -+ - my $queued_modules = get_db_value ($dbh, "SELECT SUM(queued_modules) FROM tserver WHERE name = '".$pa_config->{"servername"}."'"); -- -- if (!defined($queued_modules)){ -+ -+ if (!defined($queued_modules)) { - $queued_modules = 0; - } -- -- my $dbmaintance = get_db_value ($dbh, "SELECT COUNT(*) FROM tconfig WHERE token = 'db_maintance' AND value > UNIX_TIMESTAMP() - 86400"); -- -+ -+ my $dbmaintance; -+ if ($RDBMS eq 'postgresql') { -+ $dbmaintance = get_db_value ($dbh, -+ "SELECT COUNT(*) -+ FROM tconfig -+ WHERE token = 'db_maintance' -+ AND NULLIF(value, '')::int > UNIX_TIMESTAMP() - 86400"); -+ } -+ else { -+ $dbmaintance = get_db_value ($dbh, -+ "SELECT COUNT(*) -+ FROM tconfig -+ WHERE token = 'db_maintance' AND value > UNIX_TIMESTAMP() - 86400"); -+ } -+ - $xml_output .=" <module>"; - $xml_output .=" <name>Database Maintenance</name>"; - $xml_output .=" <type>generic_proc</type>"; - $xml_output .=" <data>$dbmaintance</data>"; - $xml_output .=" </module>"; -- -+ - $xml_output .=" <module>"; - $xml_output .=" <name>Queued_Modules</name>"; - $xml_output .=" <type>generic_data</type>"; - $xml_output .=" <data>$queued_modules</data>"; - $xml_output .=" </module>"; -- -+ - $xml_output .=" <module>"; - $xml_output .=" <name>Agents_Unknown</name>"; - $xml_output .=" <type>generic_data</type>"; - $xml_output .=" <data>$agents_unknown</data>"; - $xml_output .=" </module>"; -- -+ - $xml_output .=" <module>"; - $xml_output .=" <name>System_Load_AVG</name>"; - $xml_output .=" <type>generic_data</type>"; -Index: lib/PandoraFMS/ReconServer.pm -=================================================================== ---- lib/PandoraFMS/ReconServer.pm (revision 10314) -+++ lib/PandoraFMS/ReconServer.pm (working copy) -@@ -141,9 +141,11 @@ - } - - # Call nmap -+ my $timeout = $pa_config->{'networktimeout'}*1000; -+ my $nmap_args = '-nsP -PE --max-retries '.$pa_config->{'icmp_checks'}.' --host-timeout '.$timeout.' -T'.$pa_config->{'nmap_timing_template'}; - my $np = new PandoraFMS::NmapParser; - eval { -- $np->parsescan($pa_config->{'nmap'},'-nsP', ($task->{'subnet'})); -+ $np->parsescan($pa_config->{'nmap'}, $nmap_args, ($task->{'subnet'})); - }; - if ($@) { - update_recon_task ($dbh, $task_id, -1); -@@ -262,7 +264,7 @@ - } - } - # End of GIS code ----------------------------- -- else { -+ else { - # Create a new agent - $agent_id = pandora_create_agent ($pa_config, $pa_config->{'servername'}, - $host_name, $addr, $task->{'id_group'}, -@@ -274,7 +276,7 @@ - logger($pa_config, "Error creating agent '$host_name'.", 3); - next; - } -- -+ - # Add the new address if it does not exist - my $addr_id = get_addr_id ($dbh, $addr); - $addr_id = add_address ($dbh, $addr) unless ($addr_id > 0); -@@ -282,14 +284,15 @@ - logger($pa_config, "Could not add address '$addr' for host '$host_name'.", 3); - next; - } -- -+ - # Assign the new address to the agent - my $agent_addr_id = get_agent_addr_id ($dbh, $addr_id, $agent_id); - if ($agent_addr_id <= 0) { -- db_do ($dbh, 'INSERT INTO taddress_agent (`id_a`, `id_agent`) -- VALUES (?, ?)', $addr_id, $agent_id); -+ db_do ($dbh, 'INSERT INTO taddress_agent (' . $RDBMS_QUOTE . 'id_a' . $RDBMS_QUOTE . ', ' . -+ $RDBMS_QUOTE . 'id_agent' . $RDBMS_QUOTE . ') -+ VALUES (?, ?)', $addr_id, $agent_id); - } -- -+ - # Create network profile modules for the agent - create_network_profile_modules ($pa_config, $dbh, $agent_id, $task->{'id_network_profile'}, $addr, $task->{'snmp_community'}); - -@@ -309,9 +312,9 @@ - $text .= "\n\nThis is the list of IP addresses found: \n\n$added_hosts"; - pandora_create_incident ($pa_config, $dbh, "[RECON] New hosts detected", $text, 0, 0, 'Pandora FMS Recon Server', $task->{'id_group'}); - } -- -+ - logger($pa_config, "Finished recon task for net " . $task->{'subnet'} . ".", 10); -- -+ - # Mark recon task as done - update_recon_task ($dbh, $task_id, -1); - } -@@ -324,9 +327,11 @@ - my ($pa_config, $host, $dbh, $group, $max_depth, $resolve, $os_detect) = @_; - - # Call nmap -+ my $timeout = $pa_config->{'networktimeout'}*1000; -+ my $nmap_args = '-nsP -PE --traceroute --max-retries '.$pa_config->{'icmp_checks'}.' --host-timeout '.$timeout.' -T'.$pa_config->{'nmap_timing_template'}; - my $np = new PandoraFMS::NmapParser; - eval { -- $np->parsescan($pa_config->{'nmap'},'-nsP --traceroute', ($host)); -+ $np->parsescan($pa_config->{'nmap'}, $nmap_args, ($host)); - }; - if ($@) { - return 0; -@@ -388,12 +393,13 @@ - if ($os_detect == 1) { - $id_os = guess_os ($pa_config, $dbh, $host_addr); - } -- -+ - # Create the host - my $agent_id = pandora_create_agent ($pa_config, $pa_config->{'servername'}, $host_name, $host_addr, $group, $parent_id, $id_os, '', 300, $dbh); - $agent_id = 0 unless defined ($parent_id); -- db_do ($dbh, 'INSERT INTO taddress_agent (`id_a`, `id_agent`) -- VALUES (?, ?)', $addr_id, $agent_id); -+ db_do ($dbh, 'INSERT INTO taddress_agent (' . $RDBMS_QUOTE . 'id_a' . $RDBMS_QUOTE . ',' . -+ $RDBMS_QUOTE . 'id_agent' . $RDBMS_QUOTE . ') -+ VALUES (?, ?)', $addr_id, $agent_id); - - # Move to the next host - $parent_id = $agent_id; -@@ -417,9 +423,9 @@ - # Guess OS using xprobe2. - ########################################################################## - sub guess_os { -- my ($pa_config, $dbh, $host) = @_; -- -- # Use xprobe2 if available -+ my ($pa_config, $dbh, $host) = @_; -+ -+ # Use xprobe2 if available - my $xprobe = $pa_config->{'xprobe2'}; - if (-e $xprobe){ - my $output = `$xprobe $host 2>$DEVNULL | grep 'Running OS' | head -1`; -Index: lib/PandoraFMS/DataServer.pm -=================================================================== ---- lib/PandoraFMS/DataServer.pm (revision 10314) -+++ lib/PandoraFMS/DataServer.pm (working copy) -@@ -528,7 +528,7 @@ - 'str_warning' => '', 'str_critical' => '', 'critical_instructions' => '', 'warning_instructions' => '', - 'unknown_instructions' => '', 'tags' => '', 'critical_inverse' => 0, 'warning_inverse' => 0, 'quiet' => 0, - 'module_ff_interval' => 0}; -- -+ - # Other tags will be saved here - $module_conf->{'extended_info'} = ''; - -@@ -539,8 +539,8 @@ - } else { - $module_conf->{'extended_info'} .= "$tag: " . get_tag_value ($data, $tag, '') . '<br/>'; - } -- } -- -+ } -+ - # Description XML tag and column name don't match - $module_conf->{'descripcion'} = $module_conf->{'description'}; - $module_conf->{'descripcion'} = '' unless defined ($module_conf->{'descripcion'}); -@@ -549,14 +549,21 @@ - # Name XML tag and column name don't match - $module_conf->{'nombre'} = safe_input($module_name); - delete $module_conf->{'name'}; -- -+ - # Calculate the module interval in seconds - $module_conf->{'module_interval'} = 1 unless defined ($module_conf->{'module_interval'}); - $module_conf->{'module_interval'} *= $interval if (defined ($module_conf->{'module_interval'})); -- -+ - # Allow , as a decimal separator - $module_conf->{'post_process'} =~ s/,/./ if (defined ($module_conf->{'post_process'})); - -+ # avoid NULL columns -+ $module_conf->{'critical_instructions'} = '' unless defined ($module_conf->{'critical_instructions'}); -+ $module_conf->{'warning_instructions'} = '' unless defined ($module_conf->{'warning_instructions'}); -+ $module_conf->{'unknown_instructions'} = '' unless defined ($module_conf->{'unknown_instructions'}); -+ $module_conf->{'disabled_types_event'} = '' unless defined ($module_conf->{'disabled_types_event'}); -+ $module_conf->{'module_macros'} = '' unless defined ($module_conf->{'module_macros'}); -+ - # Get module data or create it if it does not exist - $ModuleSem->down (); - my $module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente = ? AND ' . db_text ('nombre') . ' = ?', $agent->{'id_agente'}, safe_input($module_name)); -@@ -568,14 +575,14 @@ - $ModuleSem->up (); - return; - } -- -+ - # Is the agent learning? - if ($agent->{'modo'} ne '1') { - logger($pa_config, "Learning mode disabled. Skipping module '$module_name' agent '$agent_name'.", 10); - $ModuleSem->up (); - return; - } -- -+ - # Get the module type - $module_conf->{'id_tipo_modulo'} = get_module_id ($dbh, $module_type); - if ($module_conf->{'id_tipo_modulo'} <= 0) { -@@ -583,16 +590,16 @@ - $ModuleSem->up (); - return; - } -- -+ - # The group name has to be translated to a group ID - if (defined $module_conf->{'module_group'}) { - $module_conf->{'id_module_group'} = get_module_group_id ($dbh, $module_conf->{'module_group'}); - delete $module_conf->{'module_group'}; - } -- -+ - $module_conf->{'id_modulo'} = 1; - $module_conf->{'id_agente'} = $agent->{'id_agente'}; -- -+ - my $module_tags = undef; - if(defined ($module_conf->{'tags'})) { - $module_tags = $module_conf->{'tags'}; -@@ -601,7 +608,7 @@ - - # Create the module - my $module_id = pandora_create_module_from_hash ($pa_config, $module_conf, $dbh); -- -+ - $module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente = ? AND ' . db_text('nombre') . ' = ?', $agent->{'id_agente'}, safe_input($module_name)); - if (! defined ($module)) { - logger($pa_config, "Could not create module '$module_name' for agent '$agent_name'.", 3); -@@ -626,7 +633,8 @@ - } - } - -- } else { -+ } -+ else { - # Control NULL columns - $module->{'descripcion'} = '' unless defined ($module->{'descripcion'}); - $module->{'extended_info'} = '' unless defined ($module->{'extended_info'}); -@@ -649,15 +657,15 @@ - if ($agent->{'modo'} eq '1' && $policy_linked == 0) { - update_module_configuration ($pa_config, $dbh, $module, $module_conf); - } -- -+ - $ModuleSem->up (); -- -+ - # Module disabled! - if ($module->{'disabled'} eq '1') { - logger($pa_config, "Skipping disabled module '$module_name' agent '$agent_name'.", 10); - return; - } -- -+ - # Parse the timestamp and process the module - if ($timestamp !~ /(\d+)\/(\d+)\/(\d+) +(\d+):(\d+):(\d+)/ && - $timestamp !~ /(\d+)\-(\d+)\-(\d+) +(\d+):(\d+):(\d+)/) { -Index: bin/pandora_server -=================================================================== ---- bin/pandora_server (revision 10314) -+++ bin/pandora_server (working copy) -@@ -47,11 +47,22 @@ - my @Servers; - my $DBH; - my $RUN :shared = 1; -+my $MainThread = threads->self; - - ######################################################################################## - # Server shutdown. Handler to do a controlled shutdown. - ######################################################################################## - sub pandora_shutdown () { -+ my $signal = shift; -+ -+ logger (\%Config, 'Pandora FMS Server \'' . $Config{'servername'} . '\' Caught SIG' . $signal . ' by thread(' . threads->self()->tid() . ')', 10); -+ -+ if (!threads->self->equal($MainThread)) { -+ # deliver signal to the main thread since no other threads than main thread -+ # could disconnet $DBH properly -+ $MainThread->kill($signal); -+ return; -+ } - logger (\%Config, 'Pandora FMS Server \'' . $Config{'servername'} . '\' Shutdown by signal ', 1); - - # Stop servers -Index: pandora_server.redhat.spec -=================================================================== ---- pandora_server.redhat.spec (revision 10314) -+++ pandora_server.redhat.spec (working copy) -@@ -28,6 +28,7 @@ - Requires: perl-NetAddr-IP net-snmp net-tools - Requires: perl-IO-Socket-INET6 perl-Socket6 perl-Net-Telnet - Requires: nmap wmic sudo perl-JSON -+Requires: perl-Time-HiRes - - %description - Pandora FMS is a monitoring system for big IT environments. It uses remote tests, or local agents to grab information. Pandora supports all standard OS (Linux, AIX, HP-UX, Solaris and Windows XP,2000/2003), and support multiple setups in HA enviroments. -Index: FreeBSD/pandora_server.conf.new -=================================================================== ---- FreeBSD/pandora_server.conf.new (revision 0) -+++ FreeBSD/pandora_server.conf.new (revision 10417) -@@ -0,0 +1,442 @@ -+############################################################################# -+# Pandora FMS Server Parameters -+# Pandora FMS, the Flexible Monitoring System. -+# Version 5.1BETA1 -+# Licensed under GPL license v2, -+# (c) 2003-2014 Artica Soluciones Tecnologicas -+# http://www.pandorafms.com -+# Please change it for your setup needs -+############################################################################# -+ -+# Servername: Name of this server -+# if not given, it takes hostname. It's preferable to setup one -+# because machine name could change by some reason. -+ -+#servername greystone -+ -+# incomingdir: Defines directory where incoming data packets are stored -+# You could set directory relative to base path or absolute, starting with / -+ -+incomingdir /var/spool/pandora/data_in -+ -+# log_file: Main logfile for pandora_server -+# You could set file relative to base path or absolute, starting with / -+ -+log_file /var/log/pandora/pandora_server.log -+ -+# Log file for Pandora FMS SNMP console. Its generated by NetSNMP Trap daemon -+ -+snmp_logfile /var/log/pandora/pandora_snmptrap.log -+ -+# Error logfile: aux logfile for pandora_server errors (in Daemon mode) -+# You could set file relative to base path or absolute, starting with / -+ -+errorlog_file /var/log/pandora/pandora_server.error -+ -+# daemon: Runs in daemon mode (background) if 1, if 0 runs in foreground -+# this could be also configured on commandline with -D option -+ -+# daemon 1 -+ -+# dbengine: mysql, postgresql or oracle (mysql by default) -+ -+dbengine mysql -+ -+# Database credentials. A VERY important configuration. -+# This must be the same credentials used by your Pandora FMS Console -+# but could be different if your console is not running in the same -+# host than the server. Check your console setup in /include/config.php -+ -+# dbname: Database name (pandora by default) -+ -+dbname pandora -+ -+# dbuser: Database user name (pandora by default) -+ -+dbuser pandora -+ -+# dbpass: Database password -+ -+dbpass pandora -+ -+# dbhost: Database hostname or IP address -+ -+dbhost 127.0.0.1 -+ -+# dbport: Database port number -+# Default value depends on the dbengine (mysql: 3306, postgresql: 5432, oracle: 1521) -+ -+#dbport 3306 -+ -+# By default, parent agent will not be updated -+ -+#update_parent 0 -+ -+# verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy) -+# -v in command line (verbose) or -d (debug). Set this to 10 when try to locate problems and -+# set to 0 or 1 on production enviroments. -+ -+verbosity 1 -+ -+# Master Server, 1 if master server (normal mode), 0 for slave mode (slave in multi-server setup) -+ -+master 1 -+ -+# Activate Pandora SNMP console (depending on snmptrapd) -+ -+snmpconsole 0 -+ -+# snmptrapd will ignore authenticationFailure traps if set to 1. -+ -+snmp_ignore_authfailure 1 -+ -+# snmptrapd will read the PDU source address instead of the agent-addr field is set to 1. -+ -+snmp_pdu_address 0 -+ -+# Activate (1) Pandora Network Server -+ -+networkserver 1 -+ -+# Activate (1) Pandora Data Server -+ -+dataserver 1 -+ -+# Activate (1) Pandora FMS Recon server -+ -+reconserver 1 -+ -+# pluginserver : 1 or 0. Set to 1 to activate plugin server with this setup -+ -+pluginserver 1 -+ -+# Pandora FMS Plugin exec tool filepath (by default at /usr/local/bin) -+ -+plugin_exec /usr/local/bin/gtimeout -+ -+# predictionserver : 1 or 0. Set to 1 to activate prediction server with this setup -+# DISABLED BY DEFAULT -+ -+predictionserver 0 -+ -+# wmiserver : 1 or 0. Set to 1 to activate WMI server with this setup -+# DISABLED BY DEFAULT -+ -+wmiserver 1 -+ -+# wmic: Needed by Pandora FMS wmi server. -+ -+wmi_client /usr/local/bin/wmic -+ -+# Network timeout (in seconds) for timeout in network connections for Network agents -+ -+network_timeout 4 -+ -+# Server keepalive (in seconds) -+ -+server_keepalive 45 -+ -+# Server Threshold: defines number of seconds of main loop (in sec) -+ -+server_threshold 5 -+ -+# Network threads: Do not set too high (~40). Each threads make a network module check. -+ -+network_threads 4 -+ -+# icmp_checks x : defines number of pings for each icmp_proc module type. at least one of -+# that ping should be 1 to report 1 -+ -+icmp_checks 1 -+ -+# tcp specific options : -+# tcp_checks: number of tcp retries if first attempt fails. -+# tcp_timeout: specific timeout for tcp connections -+ -+tcp_checks 1 -+tcp_timeout 10 -+ -+# snmp specific options : -+# snmp_checks: number of snmp request retries if first attempt fails. -+# snmp_timeout: specific timeout for snmp request. -+ -+snmp_checks 1 -+snmp_timeout 4 -+ -+# snmp_proc_deadresponse 1 (default): Return DOWN if cannot contact -+# or receive NULL from a SNMP PROC module. -+ -+snmp_proc_deadresponse 1 -+ -+# plugin_threads: Specify number of plugin server threads for processing plugin calls -+ -+plugin_threads 1 -+ -+# plugin_timeout: Specify number of seconds calling plugin exec waiting for response -+# after this time, call is aborted and result is "unknown". -+ -+plugin_timeout 12 -+ -+# wmi_timeout : specific timeout for wmi request. -+ -+wmi_timeout 7 -+ -+# wmi_threads: Specify number of WMI server threads for processing WMI remote calls -+ -+wmi_threads 1 -+ -+# recon_threads. Each thread will scan a different scantask. -+ -+recon_threads 1 -+ -+# dataserver_threads: Number of threads for data server (XML processing threads) -+ -+dataserver_threads 1 -+ -+# mta_address: External Mailer (MTA) IP Address to be used by Pandora FMS internal email capabilities -+ -+mta_address localhost -+ -+# mta_port, this is the mail server port (default 25) -+ -+#mta_port 25 -+ -+# mta_user MTA User (if needed for auth, FQD or simple user, depending on your server) -+ -+#mta_user myuser@mydomain.com -+ -+# mta_pass MTA Pass (if needed for auth) -+ -+#mta_pass mypassword -+ -+# mta_auth MTA Auth system (if needed, it supports LOGIN, PLAIN, CRAM-MD5, DIGEST-MD) -+ -+#mta_auth LOGIN -+ -+# mta_from Email address that sends the mail, by default is pandora@localhost -+# probably you need to change it to avoid problems with your antispam -+ -+#mta_from Pandora FMS <pandora@mydomain.com> -+ -+# Set 1 if want eMail deliver alert in separate mail (default). -+# Set 0 if want eMail deliver shared mail by all destination. -+mail_in_separate 1 -+ -+ -+# xprobe2: Optional package to detect OS types using advanced TCP/IP -+# fingerprinting tecniques, much more accurates than stadard nmap. -+# If not provided, nmap is used insted xprobe2 -+ -+xprobe2 /usr/local/bin/xprobe2 -+ -+# nmap: If provided, is used to detect OS type with recon server using -+# advanded OS fingerprint technique. Xprobe2 gives more accurate results -+# Nmap is also used to do TCP port scanning in detected host. -+ -+nmap /usr/local/bin/nmap -+ -+# snmpget: Needed to do SNMP checks. By default is on /usr/local/bin/snmpget -+ -+snmpget /usr/local/bin/snmpget -+ -+# snmp_trapd: Needed by Pandora FMS SNMP console. -+ -+snmp_trapd /usr/local/sbin/snmptrapd -+ -+# Location of the braa binary needed by the Enterprise SNMP Server (/usr/local/bin/braa by default) (PANDORA FMS ENTERPRISE ONLY). -+ -+braa /usr/local/bin/braa -+ -+# Number of retries before braa hands a module over to the Network Server (PANDORA FMS ENTERPRISE ONLY). -+ -+braa_retries 3 -+ -+# Default group id for new agents created with Pandora FMS Data Server -+ -+autocreate_group 2 -+ -+# Set to 1 if want to autocreate agents with Pandora FMS Data Server, -+# set to 0 to disable (for security purposes, for example). -+ -+autocreate 1 -+ -+# max_log_size: Specify max size of Pandora FMS server log file (1MB by default). If -+# log file grows above this limit, is renamed to "pandora_server.log.old". -+ -+max_log_size 65536 -+ -+# max_queue_files (500 by default) -+# When server have more than max_queue_files in incoming directory, skips the read -+# the directory to avoid filesystem overhead. -+ -+max_queue_files 500 -+ -+# Use the XML file last modification time as timestamp. -+# use_xml_timestamp 1 -+ -+# Pandora FMS will autorestart itself each XXX seconds, use this if you experience problems with -+# shutting down threads, or other stability problems. -+ -+# auto_restart 86400 -+ -+# Pandora FMS will restart after restart_delay seconds on critical errors. -+ -+restart 1 -+restart_delay 60 -+ -+# More information about GIS Setup in /usr/share/pandora_server/util/gis.README -+# Flag to activate GIS (positional information for agents and maps) -+# by default it is desactivated -+ -+#activate_gis 0 -+ -+# Radius of error in meters to consider two gis locations as the same location. -+ -+#location_error 50 -+ -+# Recon reverse geolocation mode [disabled, sql, file] -+# disabled The recon task doesn't try to geolocate the ip discovered. -+# sql The recon task trys to query the SQL database to geolocate the -+# ip discovered -+# file The recon task trys to find the geolocation information of the -+# ip discovered in the file indicated in the -+# recon_reverse_geolocation_file parameter -+ -+# recon_reverse_geolocation_mode disabled -+ -+# Recon reverse geolocation file. This is the database with the reverse -+# geolocation information using MaxMind GPL GeoLiteCity.dat format). -+ -+#recon_reverse_geolocation_file /usr/local/share/GeoIP/GeoIPCity.dat -+ -+# Radius (in meters) of the circle in where the agents will be place randomly -+# when finded by a recon task. Center of the circle is guessed -+# by geolocating the IP. -+#recon_location_scatter_radius 1000 -+ -+# Pandora Server self-monitoring (embedded agent) (by default enabled) -+ -+self_monitoring 1 -+ -+# Update parent from the agent xml -+ -+#update_parent 1 -+# -+# -+# This enable realtime reverse geocoding using Google Maps public api. -+# This requires internet access, and could have performance penalties processing GIS -+# information due the connetion needed to resolve all GIS input. -+# NOTE: If you dont pay the service to google, they will ban your IP in a few days. -+ -+# google_maps_description 1 -+ -+# This enable realtime reverse geocoding using Openstreet Maps public api. -+# This requires internet access, and could have performance penalties processing GIS -+# information due the connetion needed to resolve all GIS input. -+# You can alter the code to use a local (your own) openstreet maps server. -+ -+# openstreetmaps_description 1 -+ -+# Enable (1) or disable (0) Pandora FMS Event Web Server (PANDORA FMS ENTERPRISE ONLY). -+ -+webserver 1 -+ -+# Number of threads for the Web Server (PANDORA FMS ENTERPRISE ONLY). -+ -+web_threads 1 -+ -+# Enable (1) or disable (0) Pandora FMS Inventory Server (PANDORA FMS ENTERPRISE ONLY). -+ -+inventoryserver 1 -+ -+# Number of threads for the Web Server (PANDORA FMS ENTERPRISE ONLY). -+ -+inventory_threads 1 -+ -+# Enable (1) or disable (0) Pandora FMS Export Server (PANDORA FMS ENTERPRISE ONLY). -+ -+exportserver 0 -+ -+# Number of threads for the Export Server (PANDORA FMS ENTERPRISE ONLY). -+ -+export_threads 1 -+ -+# Enable (1) or disable (0) Pandora FMS Event Server (PANDORA FMS ENTERPRISE ONLY). -+ -+eventserver 0 -+ -+# Event Server event window in seconds (3600 by default) (PANDORA FMS ENTERPRISE ONLY). -+ -+event_window 3600 -+ -+# Enable (1) or disable (0) Pandora FMS Enterprise ICMP Server (PANDORA FMS ENTERPRISE ONLY). -+# You need nmap 5.20 or higher in order to use this ! -+ -+icmpserver 1 -+ -+# Number of threads for the Enterprise ICMP Server (PANDORA FMS ENTERPRISE ONLY). -+ -+icmp_threads 1 -+ -+# Enable (1) or disable (0) Pandora FMS Enterprise SNMP Server (PANDORA FMS ENTERPRISE ONLY). -+# Check braa tool is running and operative. -+ -+snmpserver 1 -+ -+# Number of threads for the Enterprise SNMP Server (PANDORA FMS ENTERPRISE ONLY). -+ -+snmp_threads 1 -+ -+# Block size for block producer/consumer servers, that is, the number of modules -+# per block (20 by default) (PANDORA FMS ENTERPRISE ONLY). -+ -+block_size 20 -+ -+# Path to the netflow daemon nfcapd. -+ -+netflow_daemon /usr/local/bin/nfcapd -+ -+# If set to 1, process XML data files in a stack instead of a queue. 0 by default. -+# WARNING: Incremental modules will not work properly if dataserver_lifo is set to 1!!! -+ -+dataserver_lifo 0 -+ -+# If set to 1, the policy manager is enabled and the server is listening the policy queue. -+# 0 by default (PANDORA FMS ENTERPRISE ONLY) -+ -+policy_manager 1 -+ -+# If set to 1, the event replicate process is enabled. 0 by default. (PANDORA FMS ENTERPRISE ONLY) -+# WARNING: This process doesn't do anything if is not properly configured from the console setup -+ -+event_replication 0 -+ -+# If set to 1, new events validate older event for the same module. This will -+# affect the performance of the server. This was the "normal behaviour" on previous (4.x) versions. -+# disable only if you really know what you are doing !!. -+ -+event_auto_validation 1 -+ -+# If defined, events generated by Pandora FMS will be written to the specified text file. -+#event_file /var/log/pandora/pandora_events.txt -+ -+# Set the maximum number of traps that will be processed from a single source in a -+# configured time interval. -+snmp_storm_protection 25 -+ -+# Time interval for snmp_storm protection (in seconds). -+snmp_storm_timeout 10 -+ -+# Default texts for some events. The macros _module_ and _data_ are supported. -+#text_going_down_normal Module '_module_' is going to NORMAL (_data_) -+#text_going_up_critical Module '_module_' is going to CRITICAL (_data_) -+#text_going_up_warning Module '_module_' is going to WARNING (_data_) -+#text_going_down_warning Module '_module_' is going to WARNING (_data_) -+#text_going_unknown Module '_module_' is going to UNKNOWN -+ -+# Events older that the specified time (in seconds) will be auto-validated. Set to 0 to disable this feature. -+event_expiry_time 0 -+ -+# Only events more recent than the specified time window (in seconds) will be auto-validated. This value must -+# be greater than event_expiry_time. -+#event_expiry_window 86400 -Index: FreeBSD/tentacle_server -=================================================================== ---- FreeBSD/tentacle_server (revision 10314) -+++ FreeBSD/tentacle_server (working copy) -@@ -18,28 +18,27 @@ - . "/etc/rc.subr" - - name="tentacle_server" --rcvar=`set_rcvar` -+rcvar=tentacle_server_enable - - # read configuration and set defaults - tentacle_server_enable=${tentacle_server_enable:-"NO"} --tentacle_server_flags=${tentacle_server_flags:-"-a 0.0.0.0 -p 41121 -s /var/spool/pandora/data_in -i.*\.conf:conf\;.*\.md5:md5\;.*\.zip:collections -d"} -+tentacle_server_flags=${tentacle_server_flags:-'-a 0.0.0.0 -p 41121 -s /var/spool/pandora/data_in -i.*\.conf:conf\;.*\.md5:md5\;.*\.zip:collections -d'} - tentacle_server_user=${tentacle_server_user:-"pandora"} - load_rc_config $name - - PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin - - command=/usr/local/bin/${name} -+command_interpreter=/usr/local/bin/perl -+procname=$command -+pidfile=/var/run/$name.pid - --pidfile=/var/run/$name.pid - start_postcmd=start_postcmd - stop_postcmd=stop_postcmd - --procname="/usr/bin/perl" -- - start_postcmd() - { -- TENTACLE_PID=`pgrep -f -j none "$procname $command"` -- echo $TENTACLE_PID > $pidfile -+ pgrep -f -j none "^$command_interpreter $command" > $pidfile - } - - stop_postcmd() -Index: FreeBSD/pandora_server -=================================================================== ---- FreeBSD/pandora_server (revision 10314) -+++ FreeBSD/pandora_server (working copy) -@@ -3,6 +3,7 @@ - # ********************************************************************** - # Pandora FMS Server Daemon launcher for FreeBSD - # (c) 2010 Junichi Satoh <junichi@rworks.jp> -+# (c) 2014 Koichiro Kikuchi <koichiro@rworks.jp> - # - # ********************************************************************** - -@@ -10,27 +11,65 @@ - # REQUIRE: LOGIN mysql - # KEYWORD: shutdown - --# Add the following line to /etc/rc.conf to enable `pandora_server': -+# Add the following lines to /etc/rc.conf to enable pandora_server: -+# pandora_server_enable (bool): Set to "YES" to enable pandora_server (default: NO) -+# pandora_server_profiles (str): Define your profiles here (default: "") - # --# pandora_server_enable="YES" --# - - . "/etc/rc.subr" - -+PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin -+ - name="pandora_server" --rcvar=`set_rcvar` -+rcvar=pandora_server_enable - --# read configuration and set defaults --pandora_server_enable=${pandora_server_enable:-"NO"} -+: ${pandora_server_enable:=NO} -+: ${pandora_server_configfile:=/usr/local/etc/pandora/pandora_server.conf} -+ -+command=/usr/local/bin/${name} -+command_args="-D" -+command_interpreter=/usr/local/bin/perl -+_pidprefix=/var/run/$name -+pidfile=${_pidprefix}.pid -+required_files="$pandora_server_configfile" -+ - load_rc_config $name - --PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin -+if [ "$2" ]; then -+ profile="$2" -+ if [ "$pandora_server_profiles" ]; then -+ pidfile="${_pidprefix}.${profile}.pid" -+ eval pandora_server_configfile="\${pandora_server_${profile}_configfile:-}" -+ if [ -z "$pandora_server_configfile" ]; then -+ echo "You must define a configuration file (pandora_server_${profile}_configfile)" -+ exit 1 -+ fi -+ required_files="$pandora_server_configfile" -+ eval pandora_server_enable="\${pandora_server_${profile}_enable:-$pandora_server_enable}" -+ eval pandora_server_flags="\${pandora_server_${profile}_flags:-$pandora_server_flags}" -+ eval pidfile="\${pandora_server_${profile}_pidfile:-$pidfile}" -+ else -+ echo "$0: extra argument ignored" -+ fi -+elif [ "${pandora_server_profiles}" ] && [ "$1" ]; then -+ for profile in ${pandora_server_profiles}; do -+ eval _enable="\${pandora_server_${profile}_enable}" -+ case "${_enable:-${pandora_server_enable}}" in -+ [Yy][Ee][Ss]);; -+ *) continue;; -+ esac -+ echo "===> pandora_server profile: ${profile}" -+ /usr/local/etc/rc.d/pandora_server $1 ${profile} -+ retcode="$?" -+ if [ "0${retcode}" -ne 0 ]; then -+ failed="${profile} (${retcode}) ${failed:-}" -+ else -+ success="${profile} ${success:-}" -+ fi -+ done -+ exit 0 -+fi - --pidfile=/var/run/$name.pid --command=/usr/local/bin/${name} --command_args="-D -P ${pidfile} /usr/local/etc/pandora/pandora_server.conf" --required_files="/usr/local/etc/pandora/pandora_server.conf" -+pandora_server_flags="$pandora_server_flags -P $pidfile $pandora_server_configfile" - --procname="/usr/local/bin/perl" -- - run_rc_command "$1" -Index: FreeBSD/pandora_server.conf -=================================================================== ---- FreeBSD/pandora_server.conf (revision 10314) -+++ FreeBSD/pandora_server.conf (working copy) -@@ -1,442 +0,0 @@ --############################################################################# --# Pandora FMS Server Parameters --# Pandora FMS, the Flexible Monitoring System. --# Version 5.1BETA1 --# Licensed under GPL license v2, --# (c) 2003-2014 Artica Soluciones Tecnologicas --# http://www.pandorafms.com --# Please change it for your setup needs --############################################################################# -- --# Servername: Name of this server --# if not given, it takes hostname. It's preferable to setup one --# because machine name could change by some reason. -- --#servername greystone -- --# incomingdir: Defines directory where incoming data packets are stored --# You could set directory relative to base path or absolute, starting with / -- --incomingdir /var/spool/pandora/data_in -- --# log_file: Main logfile for pandora_server --# You could set file relative to base path or absolute, starting with / -- --log_file /var/log/pandora/pandora_server.log -- --# Log file for Pandora FMS SNMP console. Its generated by NetSNMP Trap daemon -- --snmp_logfile /var/log/pandora/pandora_snmptrap.log -- --# Error logfile: aux logfile for pandora_server errors (in Daemon mode) --# You could set file relative to base path or absolute, starting with / -- --errorlog_file /var/log/pandora/pandora_server.error -- --# daemon: Runs in daemon mode (background) if 1, if 0 runs in foreground --# this could be also configured on commandline with -D option -- --# daemon 1 -- --# dbengine: mysql, postgresql or oracle (mysql by default) -- --dbengine mysql -- --# Database credentials. A VERY important configuration. --# This must be the same credentials used by your Pandora FMS Console --# but could be different if your console is not running in the same --# host than the server. Check your console setup in /include/config.php -- --# dbname: Database name (pandora by default) -- --dbname pandora -- --# dbuser: Database user name (pandora by default) -- --dbuser pandora -- --# dbpass: Database password -- --dbpass pandora -- --# dbhost: Database hostname or IP address -- --dbhost 127.0.0.1 -- --# dbport: Database port number --# Default value depends on the dbengine (mysql: 3306, postgresql: 5432, oracle: 1521) -- --#dbport 3306 -- --# By default, parent agent will not be updated -- --#update_parent 0 -- --# verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy) --# -v in command line (verbose) or -d (debug). Set this to 10 when try to locate problems and --# set to 0 or 1 on production enviroments. -- --verbosity 1 -- --# Master Server, 1 if master server (normal mode), 0 for slave mode (slave in multi-server setup) -- --master 1 -- --# Activate Pandora SNMP console (depending on snmptrapd) -- --snmpconsole 0 -- --# snmptrapd will ignore authenticationFailure traps if set to 1. -- --snmp_ignore_authfailure 1 -- --# snmptrapd will read the PDU source address instead of the agent-addr field is set to 1. -- --snmp_pdu_address 0 -- --# Activate (1) Pandora Network Server -- --networkserver 1 -- --# Activate (1) Pandora Data Server -- --dataserver 1 -- --# Activate (1) Pandora FMS Recon server -- --reconserver 1 -- --# pluginserver : 1 or 0. Set to 1 to activate plugin server with this setup -- --pluginserver 1 -- --# Pandora FMS Plugin exec tool filepath (by default at /usr/local/bin) -- --plugin_exec /usr/local/bin/gtimeout -- --# predictionserver : 1 or 0. Set to 1 to activate prediction server with this setup --# DISABLED BY DEFAULT -- --predictionserver 0 -- --# wmiserver : 1 or 0. Set to 1 to activate WMI server with this setup --# DISABLED BY DEFAULT -- --wmiserver 1 -- --# wmic: Needed by Pandora FMS wmi server. -- --wmi_client /usr/local/bin/wmic -- --# Network timeout (in seconds) for timeout in network connections for Network agents -- --network_timeout 4 -- --# Server keepalive (in seconds) -- --server_keepalive 45 -- --# Server Threshold: defines number of seconds of main loop (in sec) -- --server_threshold 5 -- --# Network threads: Do not set too high (~40). Each threads make a network module check. -- --network_threads 4 -- --# icmp_checks x : defines number of pings for each icmp_proc module type. at least one of --# that ping should be 1 to report 1 -- --icmp_checks 1 -- --# tcp specific options : --# tcp_checks: number of tcp retries if first attempt fails. --# tcp_timeout: specific timeout for tcp connections -- --tcp_checks 1 --tcp_timeout 10 -- --# snmp specific options : --# snmp_checks: number of snmp request retries if first attempt fails. --# snmp_timeout: specific timeout for snmp request. -- --snmp_checks 1 --snmp_timeout 4 -- --# snmp_proc_deadresponse 1 (default): Return DOWN if cannot contact --# or receive NULL from a SNMP PROC module. -- --snmp_proc_deadresponse 1 -- --# plugin_threads: Specify number of plugin server threads for processing plugin calls -- --plugin_threads 1 -- --# plugin_timeout: Specify number of seconds calling plugin exec waiting for response --# after this time, call is aborted and result is "unknown". -- --plugin_timeout 12 -- --# wmi_timeout : specific timeout for wmi request. -- --wmi_timeout 7 -- --# wmi_threads: Specify number of WMI server threads for processing WMI remote calls -- --wmi_threads 1 -- --# recon_threads. Each thread will scan a different scantask. -- --recon_threads 1 -- --# dataserver_threads: Number of threads for data server (XML processing threads) -- --dataserver_threads 1 -- --# mta_address: External Mailer (MTA) IP Address to be used by Pandora FMS internal email capabilities -- --mta_address localhost -- --# mta_port, this is the mail server port (default 25) -- --#mta_port 25 -- --# mta_user MTA User (if needed for auth, FQD or simple user, depending on your server) -- --#mta_user myuser@mydomain.com -- --# mta_pass MTA Pass (if needed for auth) -- --#mta_pass mypassword -- --# mta_auth MTA Auth system (if needed, it supports LOGIN, PLAIN, CRAM-MD5, DIGEST-MD) -- --#mta_auth LOGIN -- --# mta_from Email address that sends the mail, by default is pandora@localhost --# probably you need to change it to avoid problems with your antispam -- --#mta_from Pandora FMS <pandora@mydomain.com> -- --# Set 1 if want eMail deliver alert in separate mail (default). --# Set 0 if want eMail deliver shared mail by all destination. --mail_in_separate 1 -- -- --# xprobe2: Optional package to detect OS types using advanced TCP/IP --# fingerprinting tecniques, much more accurates than stadard nmap. --# If not provided, nmap is used insted xprobe2 -- --xprobe2 /usr/local/bin/xprobe2 -- --# nmap: If provided, is used to detect OS type with recon server using --# advanded OS fingerprint technique. Xprobe2 gives more accurate results --# Nmap is also used to do TCP port scanning in detected host. -- --nmap /usr/local/bin/nmap -- --# snmpget: Needed to do SNMP checks. By default is on /usr/local/bin/snmpget -- --snmpget /usr/local/bin/snmpget -- --# snmp_trapd: Needed by Pandora FMS SNMP console. -- --snmp_trapd /usr/local/sbin/snmptrapd -- --# Location of the braa binary needed by the Enterprise SNMP Server (/usr/local/bin/braa by default) (PANDORA FMS ENTERPRISE ONLY). -- --braa /usr/local/bin/braa -- --# Number of retries before braa hands a module over to the Network Server (PANDORA FMS ENTERPRISE ONLY). -- --braa_retries 3 -- --# Default group id for new agents created with Pandora FMS Data Server -- --autocreate_group 2 -- --# Set to 1 if want to autocreate agents with Pandora FMS Data Server, --# set to 0 to disable (for security purposes, for example). -- --autocreate 1 -- --# max_log_size: Specify max size of Pandora FMS server log file (1MB by default). If --# log file grows above this limit, is renamed to "pandora_server.log.old". -- --max_log_size 65536 -- --# max_queue_files (500 by default) --# When server have more than max_queue_files in incoming directory, skips the read --# the directory to avoid filesystem overhead. -- --max_queue_files 500 -- --# Use the XML file last modification time as timestamp. --# use_xml_timestamp 1 -- --# Pandora FMS will autorestart itself each XXX seconds, use this if you experience problems with --# shutting down threads, or other stability problems. -- --# auto_restart 86400 -- --# Pandora FMS will restart after restart_delay seconds on critical errors. -- --restart 1 --restart_delay 60 -- --# More information about GIS Setup in /usr/share/pandora_server/util/gis.README --# Flag to activate GIS (positional information for agents and maps) --# by default it is desactivated -- --#activate_gis 0 -- --# Radius of error in meters to consider two gis locations as the same location. -- --#location_error 50 -- --# Recon reverse geolocation mode [disabled, sql, file] --# disabled The recon task doesn't try to geolocate the ip discovered. --# sql The recon task trys to query the SQL database to geolocate the --# ip discovered --# file The recon task trys to find the geolocation information of the --# ip discovered in the file indicated in the --# recon_reverse_geolocation_file parameter -- --# recon_reverse_geolocation_mode disabled -- --# Recon reverse geolocation file. This is the database with the reverse --# geolocation information using MaxMind GPL GeoLiteCity.dat format). -- --#recon_reverse_geolocation_file /usr/local/share/GeoIP/GeoIPCity.dat -- --# Radius (in meters) of the circle in where the agents will be place randomly --# when finded by a recon task. Center of the circle is guessed --# by geolocating the IP. --#recon_location_scatter_radius 1000 -- --# Pandora Server self-monitoring (embedded agent) (by default enabled) -- --self_monitoring 1 -- --# Update parent from the agent xml -- --#update_parent 1 --# --# --# This enable realtime reverse geocoding using Google Maps public api. --# This requires internet access, and could have performance penalties processing GIS --# information due the connetion needed to resolve all GIS input. --# NOTE: If you dont pay the service to google, they will ban your IP in a few days. -- --# google_maps_description 1 -- --# This enable realtime reverse geocoding using Openstreet Maps public api. --# This requires internet access, and could have performance penalties processing GIS --# information due the connetion needed to resolve all GIS input. --# You can alter the code to use a local (your own) openstreet maps server. -- --# openstreetmaps_description 1 -- --# Enable (1) or disable (0) Pandora FMS Event Web Server (PANDORA FMS ENTERPRISE ONLY). -- --webserver 1 -- --# Number of threads for the Web Server (PANDORA FMS ENTERPRISE ONLY). -- --web_threads 1 -- --# Enable (1) or disable (0) Pandora FMS Inventory Server (PANDORA FMS ENTERPRISE ONLY). -- --inventoryserver 1 -- --# Number of threads for the Web Server (PANDORA FMS ENTERPRISE ONLY). -- --inventory_threads 1 -- --# Enable (1) or disable (0) Pandora FMS Export Server (PANDORA FMS ENTERPRISE ONLY). -- --exportserver 0 -- --# Number of threads for the Export Server (PANDORA FMS ENTERPRISE ONLY). -- --export_threads 1 -- --# Enable (1) or disable (0) Pandora FMS Event Server (PANDORA FMS ENTERPRISE ONLY). -- --eventserver 0 -- --# Event Server event window in seconds (3600 by default) (PANDORA FMS ENTERPRISE ONLY). -- --event_window 3600 -- --# Enable (1) or disable (0) Pandora FMS Enterprise ICMP Server (PANDORA FMS ENTERPRISE ONLY). --# You need nmap 5.20 or higher in order to use this ! -- --icmpserver 1 -- --# Number of threads for the Enterprise ICMP Server (PANDORA FMS ENTERPRISE ONLY). -- --icmp_threads 1 -- --# Enable (1) or disable (0) Pandora FMS Enterprise SNMP Server (PANDORA FMS ENTERPRISE ONLY). --# Check braa tool is running and operative. -- --snmpserver 1 -- --# Number of threads for the Enterprise SNMP Server (PANDORA FMS ENTERPRISE ONLY). -- --snmp_threads 1 -- --# Block size for block producer/consumer servers, that is, the number of modules --# per block (20 by default) (PANDORA FMS ENTERPRISE ONLY). -- --block_size 20 -- --# Path to the netflow daemon nfcapd. -- --netflow_daemon /usr/local/bin/nfcapd -- --# If set to 1, process XML data files in a stack instead of a queue. 0 by default. --# WARNING: Incremental modules will not work properly if dataserver_lifo is set to 1!!! -- --dataserver_lifo 0 -- --# If set to 1, the policy manager is enabled and the server is listening the policy queue. --# 0 by default (PANDORA FMS ENTERPRISE ONLY) -- --policy_manager 1 -- --# If set to 1, the event replicate process is enabled. 0 by default. (PANDORA FMS ENTERPRISE ONLY) --# WARNING: This process doesn't do anything if is not properly configured from the console setup -- --event_replication 0 -- --# If set to 1, new events validate older event for the same module. This will --# affect the performance of the server. This was the "normal behaviour" on previous (4.x) versions. --# disable only if you really know what you are doing !!. -- --event_auto_validation 1 -- --# If defined, events generated by Pandora FMS will be written to the specified text file. --#event_file /var/log/pandora/pandora_events.txt -- --# Set the maximum number of traps that will be processed from a single source in a --# configured time interval. --snmp_storm_protection 25 -- --# Time interval for snmp_storm protection (in seconds). --snmp_storm_timeout 10 -- --# Default texts for some events. The macros _module_ and _data_ are supported. --#text_going_down_normal Module '_module_' is going to NORMAL (_data_) --#text_going_up_critical Module '_module_' is going to CRITICAL (_data_) --#text_going_up_warning Module '_module_' is going to WARNING (_data_) --#text_going_down_warning Module '_module_' is going to WARNING (_data_) --#text_going_unknown Module '_module_' is going to UNKNOWN -- --# Events older that the specified time (in seconds) will be auto-validated. Set to 0 to disable this feature. --event_expiry_time 0 -- --# Only events more recent than the specified time window (in seconds) will be auto-validated. This value must --# be greater than event_expiry_time. --#event_expiry_window 86400 -Index: util/trap_rate.sh -=================================================================== ---- util/trap_rate.sh (revision 0) -+++ util/trap_rate.sh (revision 10417) -@@ -0,0 +1,49 @@ -+#!/bin/bash -+# Calculate the rate of SNMP traps received by snmptrapd. -+TEMP_FILE="/tmp/trap_rate.tmp" -+COUNT="100" -+ -+# Parse command line arguments -+if [ "$1" == "" ]; then -+ echo "Usage: $0 <path to pandora_server.conf> [trap count]" -+ exit 1 -+fi -+ -+if [ "$2" != "" ]; then -+ COUNT="$2" -+fi -+ -+# Read the SNMP log file and generate the temporary file -+SNMP_LOG=`grep snmp_logfile $1 | cut -d' ' -f2` -+if [ ! -f "$SNMP_LOG" ]; then -+ echo "SNMP log file $SNMP_LOG does not exists or is not readable." -+ exit 1 -+fi -+grep "SNMPv" "$SNMP_LOG" | tail -$COUNT | cut -d']' -f 3 | cut -d'[' -f 1 > "$TEMP_FILE" -+ -+# Get the newest trap -+START=`head -1 "$TEMP_FILE"` -+if [ "$START" == "" ]; then -+ echo "START: 0 END: 0 TRAPS RECEIVED: 0 RATE: 0 traps/s" -+ exit 0 -+fi -+ -+# Get the oldest trap -+END=`tail -1 "$TEMP_FILE"` -+if [ "$END" == "" ]; then -+ echo "START: 0 END: 0 TRAPS RECEIVED: 0 RATE: 0 traps/s" -+ exit 0 -+fi -+ -+# Get the trap count -+COUNT=`cat "$SNMP_LOG" | wc -l` -+ -+# Calculate the trap rate -+START_UTIME=`date +"%s" -d"$START"` -+END_UTIME=`date +"%s" -d"$END"` -+ELAPSED=$(($END_UTIME - $START_UTIME)) -+RATE=`bc -l <<< "$COUNT / $ELAPSED"` -+ -+echo "START: $START END: $END TRAPS RECEIVED: $COUNT RATE: $RATE traps/s" -+rm -f "$TEMP_FILE" -+ - -Property changes on: util/trap_rate.sh -___________________________________________________________________ -Added: svn:executable -## -0,0 +1 ## -+* -\ No newline at end of property -Index: util/plugin/snmp_remote.pl -=================================================================== ---- util/plugin/snmp_remote.pl (revision 10314) -+++ util/plugin/snmp_remote.pl (working copy) -@@ -1,5 +1,5 @@ - #!/usr/bin/perl --#--------------------------------------------------------------------------- -+#----------------------------------------------------------------------- - # SNMP remote plugin - # Depending on the configuration returns the result of these modules: - # - % Memory Use -@@ -11,7 +11,7 @@ - # Copyright (C) 2013 mario.pulido@artica.es - # - # License: GPLv2+ --#--------------------------------------------------------------------------- -+#----------------------------------------------------------------------- - # 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 -@@ -23,111 +23,249 @@ - # GNU General Public License for more details. - # - # GPL License: http://www.gnu.org/licenses/gpl.txt --#--------------------------------------------------------------------------- -+#----------------------------------------------------------------------- - - use strict; - use Getopt::Std; - - my $VERSION = 'v1r1'; - --#----------------------------------------------------------------------------- -+#----------------------------------------------------------------------- - # HELP --#----------------------------------------------------------------------------- -+#----------------------------------------------------------------------- - --if ($#ARGV == -1 ) --{ -- print "-H, --host=STRING\n"; -- print "\tHost IP\n"; -- print "-c, --community=STRING\n"; -- print "\tSnmp Community\n"; -- print "-m, --module=STRING\n"; -- print "\tDefine module (memuse|diskuse|process|cpuload) \n"; -- print "-d, --disk=STRING\n"; -- print "\tDefine disk name (C:, D: in Windows) or mount point (Linux)(only in diskuse module)\n"; -- print "-p, --process=STRING\n"; -- print "\tProcess or service name (only in process module)\n"; -- print "\n"; -- print "Example of use \n"; -- print "perl snmp_remoto.pl -H host -c community -m (memuse|diskuse|process|cpuload) [-p process -d disk] \n"; -- print "Version=$VERSION"; -- exit; -+if ($#ARGV == -1 ) { -+ print "-H, --host=STRING\n"; -+ print "\tHost IP\n"; -+ -+ print "-c, --community=STRING\n"; -+ print "\tSnmp Community\n"; -+ -+ print "-m, --module=STRING\n"; -+ print "\tDefine module (memuse|diskuse|process|cpuload) \n"; -+ -+ print "-d, --disk=STRING\n"; -+ print "\tDefine disk name (C:, D: in Windows) or mount point (Linux)(only in diskuse module)\n"; -+ -+ print "-p, --process=STRING\n"; -+ print "\tProcess or service name (only in process module)\n"; -+ -+ print "-v, --version=NUMBER\n"; -+ print "\tVersion of protocol\n"; -+ -+ print "-u, --user=STRING\n"; -+ print "\tAuth user\n"; -+ -+ print "-A, --auth=STRING\n"; -+ print "\tAuth pass\n"; -+ -+ print "-l, --level=STRING\n"; -+ print "\tSecurity level\n"; -+ -+ print "-a STRING\n"; -+ print "\tAuth method\n"; -+ -+ print "-x STRING\n"; -+ print "\tPrivacy method\n"; -+ -+ print "-X STRING\n"; -+ print "\tPrivacy pass\n"; -+ -+ print "\n"; -+ print "Example of use \n"; -+ print "perl snmp_remoto.pl -H host -c community -m (memuse|diskuse|process|cpuload) [-p process -d disk] \n"; -+ print "Version=$VERSION"; -+ exit; - } - --my ( $host, $community, $module, $disk, $process ) = &options; -+my ($host, -+ $community, -+ $module, -+ $disk, -+ $process, -+ $version, -+ $user, -+ $pass, -+ $auth_method, -+ $privacy_method, -+ $privacy_pass ) = &options; - --#------------------------------------------------------------------------------------- -+#----------------------------------------------------------------------- - # OPTIONS --#------------------------------------------------------------------------------------- -- -+#----------------------------------------------------------------------- - sub options { -- -- # Get and check args -- my %opts; -- getopt( 'Hcmdp', \%opts ); -- -- $opts{"H"} = 0 unless ( exists( $opts{"H"} ) ); -- $opts{"c"} = 0 unless ( exists( $opts{"c"} ) ); -- $opts{"m"} = 0 unless ( exists( $opts{"m"} ) ); -- $opts{"d"} = "/" unless ( exists( $opts{"d"} ) ); -- $opts{"p"} = 0 unless ( exists( $opts{"p"} ) ); -- return ( $opts{"H"}, $opts{"c"}, $opts{"m"}, $opts{"d"}, $opts {"p"}); -+ -+ # Get and check args -+ my %opts; -+ getopt( 'HcmdpvuAlaxX', \%opts ); -+ -+ #~ ' -u ' . $snmp3_auth_user . -+ #~ ' -A ' . $snmp3_auth_pass . -+ #~ ' -l ' . $snmp3_security_level . -+ #~ ' -a ' . $snmp3_auth_method . -+ #~ ' -x ' . $snmp3_privacy_method . -+ #~ ' -X' $snmp3_privacy_pass; -+ -+ $opts{"H"} = 0 unless ( exists( $opts{"H"} ) ); -+ $opts{"c"} = 0 unless ( exists( $opts{"c"} ) ); -+ $opts{"m"} = 0 unless ( exists( $opts{"m"} ) ); -+ $opts{"d"} = "/" unless ( exists( $opts{"d"} ) ); -+ $opts{"p"} = 0 unless ( exists( $opts{"p"} ) ); -+ $opts{"p"} = 0 unless ( exists( $opts{"p"} ) ); -+ $opts{"v"} = 2 unless ( exists( $opts{"v"} ) ); -+ $opts{"u"} = "" unless ( exists( $opts{"u"} ) ); -+ $opts{"A"} = "" unless ( exists( $opts{"A"} ) ); -+ $opts{"l"} = "noAuthNoPriv" unless ( exists( $opts{"l"} ) ); -+ $opts{"a"} = "" unless ( exists( $opts{"a"} ) ); -+ $opts{"x"} = "" unless ( exists( $opts{"x"} ) ); -+ $opts{"X"} = "" unless ( exists( $opts{"X"} ) ); -+ -+ return ( $opts{"H"}, -+ $opts{"c"}, -+ $opts{"m"}, -+ $opts{"d"}, -+ $opts {"p"}, -+ $opts{"v"}, -+ $opts{"u"}, -+ $opts{"A"}, -+ $opts{"l"}, -+ $opts{"a"}, -+ $opts{"x"}, -+ $opts{"X"}); - } - --#-------------------------------------------------------------------------------------------------- -+#----------------------------------------------------------------------- - # Module % Memory use --#-------------------------------------------------------------------------------------------------- -+#----------------------------------------------------------------------- -+if ($module eq "memuse") { -+ my $memuse = 0; -+ my $command_line_parammeters; -+ -+ if ($version == 3) { -+ if ($auth_method eq 'authNoPriv') { -+ $command_line_parammeters = "-v 3 -u $user -a $privacy_method -A $pass -l $auth_method $host"; -+ } -+ elsif ($auth_method eq "noAuthNoPriv") { -+ $command_line_parammeters = "-v 3 -u $user -l $auth_method $host"; -+ } -+ else { -+ $command_line_parammeters = "-v 3 -u $user -a $privacy_method -A $pass -l $auth_method -x $privacy_method -X $privacy_pass $host"; -+ } -+ } -+ else { -+ $command_line_parammeters = "-v 1 -c $community $host"; -+ } -+ -+ my $memid = `snmpwalk -On $command_line_parammeters .1.3.6.1.2.1.25.2.3.1.3 | grep Physical | head -1 | gawk '{print \$1}' | gawk -F "." '{print \$13}' | tr -d "\r"`; -+ my $memtot = `snmpget $command_line_parammeters .1.3.6.1.2.1.25.2.3.1.5.$memid ` ; -+ my $memtot2 = `echo "$memtot" | gawk '{print \$4}'`; -+ my $memfree = `snmpget $command_line_parammeters .1.3.6.1.2.1.25.2.3.1.6.$memid` ; -+ my $memfree2 = `echo "$memfree" | gawk '{print \$4}'`; -+ -+ $memuse = ($memfree2) * 100 / $memtot2; -+ -+ printf("%.2f", $memuse); -+} - --if ($module eq "memuse"){ -- my $memid = `snmpwalk -On -v 1 -c $community $host .1.3.6.1.2.1.25.2.3.1.3 | grep Physical | head -1 | gawk '{print \$1}' | gawk -F "." '{print \$13}' | tr -d "\r"`; -- my $memtot = `snmpget -v 1 -c $community $host .1.3.6.1.2.1.25.2.3.1.5.$memid ` ; -- my $memtot2 = `echo "$memtot" | gawk '{print \$4}'`; -- my $memfree = `snmpget -v 1 -c $community $host .1.3.6.1.2.1.25.2.3.1.6.$memid` ; -- my $memfree2 = `echo "$memfree" | gawk '{print \$4}'`; -- my $memuse = ($memfree2)*100/$memtot2; -- printf("%.2f", $memuse); -- } --#-------------------------------------------------------------------------------------------------- -+#----------------------------------------------------------------------- - # Module % Disk use --#-------------------------------------------------------------------------------------------------- --if ($module eq "diskuse"){ -- my $diskid = `snmpwalk -On -v 1 -c $community $host .1.3.6.1.2.1.25.2.3.1.3 | grep "$disk" | head -1 | gawk '{print \$1}' | gawk -F "." '{print \$13}' | tr -d "\r"`; -- my $disktot = `snmpget -v 1 -c $community $host .1.3.6.1.2.1.25.2.3.1.5.$diskid ` ; -- my $disktot2 = `echo "$disktot" | gawk '{print \$4}'`; -- -- if($disktot2 == 0) { -- print 0; -- } -- else { -- my $diskfree = `snmpget -v 1 -c $community $host .1.3.6.1.2.1.25.2.3.1.6.$diskid` ; -- my $diskfree2 = `echo "$diskfree" | gawk '{print \$4}'`; -- my $diskuse = ($disktot2 - $diskfree2)*100/$disktot2; -- printf("%.2f", $diskuse); -- } -- } -- --#-------------------------------------------------------------------------------------------------- -+#----------------------------------------------------------------------- -+if ($module eq "diskuse") { -+ my $diskuse = 0; -+ my $command_line_parammeters; -+ -+ if ($version == 3) { -+ if ($auth_method eq 'authNoPriv') { -+ $command_line_parammeters = "-v 3 -u $user -a $privacy_method -A $pass -l $auth_method $host"; -+ } -+ elsif ($auth_method eq "noAuthNoPriv") { -+ $command_line_parammeters = "-v 3 -u $user -l $auth_method $host"; -+ } -+ else { -+ $command_line_parammeters = "-v 3 -u $user -a $privacy_method -A $pass -l $auth_method -x $privacy_method -X $privacy_pass $host"; -+ } -+ } -+ else { -+ $command_line_parammeters = "-v 1 -c $community $host"; -+ } -+ -+ my $diskid = `snmpwalk -On $command_line_parammeters .1.3.6.1.2.1.25.2.3.1.3 | grep "$disk" | head -1 | gawk '{print \$1}' | gawk -F "." '{print \$13}' | tr -d "\r"`; -+ my $disktot = `snmpget $command_line_parammeters .1.3.6.1.2.1.25.2.3.1.5.$diskid ` ; -+ my $disktot2 = `echo "$disktot" | gawk '{print \$4}'`; -+ -+ if ($disktot2 == 0) { -+ $diskuse = 0; -+ } -+ else { -+ my $diskfree = `snmpget $command_line_parammeters .1.3.6.1.2.1.25.2.3.1.6.$diskid` ; -+ my $diskfree2 = `echo "$diskfree" | gawk '{print \$4}'`; -+ -+ $diskuse = ($disktot2 - $diskfree2) * 100 / $disktot2; -+ } -+ -+ printf("%.2f", $diskuse); -+} -+ -+#----------------------------------------------------------------------- - # Module Process Status --#-------------------------------------------------------------------------------------------------- -- --if ($module eq "process"){ -- my $status = `snmpwalk -v 2c -c $community $host 1.3.6.1.2.1.25.4.2.1.2 | grep "$process" | head -1 | wc -l`; -- print $status; -- } --#-------------------------------------------------------------------------------------------------- -+#----------------------------------------------------------------------- -+if ($module eq "process") { -+ my $status = 0; -+ my $command_line_parammeters; -+ -+ if ($version == 3) { -+ if ($auth_method eq 'authNoPriv') { -+ $command_line_parammeters = "-v 3 -u $user -a $privacy_method -A $pass -l $auth_method $host"; -+ } -+ elsif ($auth_method eq "noAuthNoPriv") { -+ $command_line_parammeters = "-v 3 -u $user -l $auth_method $host"; -+ } -+ else { -+ $command_line_parammeters = "-v 3 -u $user -a $privacy_method -A $pass -l $auth_method -x $privacy_method -X $privacy_pass $host"; -+ } -+ } -+ else { -+ $command_line_parammeters = "-v 2c -c $community $host"; -+ } -+ -+ $status = `snmpwalk $command_line_parammeters 1.3.6.1.2.1.25.4.2.1.2 | grep "$process" | head -1 | wc -l`; -+ -+ print $status; -+} -+ -+#----------------------------------------------------------------------- - # Module % Cpu Load --#-------------------------------------------------------------------------------------------------- -+#----------------------------------------------------------------------- -+if ($module eq "cpuload") { -+ my $cputotal = 0; -+ my $command_line_parammeters; -+ -+ if ($version == 3) { -+ if ($auth_method eq 'authNoPriv') { -+ $command_line_parammeters = "-v 3 -u $user -a $privacy_method -A $pass -l $auth_method $host"; -+ } -+ elsif ($auth_method eq "noAuthNoPriv") { -+ $command_line_parammeters = "-v 3 -u $user -l $auth_method $host"; -+ } -+ else { -+ $command_line_parammeters = "-v 3 -u $user -a $privacy_method -A $pass -l $auth_method -x $privacy_method -X $privacy_pass $host"; -+ } -+ } -+ else { -+ $command_line_parammeters = "-v 1 -c $community $host"; -+ } -+ -+ my $cpuload = `snmpwalk $command_line_parammeters .1.3.6.1.2.1.25.3.3.1.2 | gawk '{print \$4}' `; -+ my @cpuload = split(/\n/, $cpuload); -+ my $sum; -+ my $counter = 0; -+ foreach my $val(@cpuload) { -+ $sum = $sum + $val; -+ $counter++; -+ } -+ -+ $cputotal = $sum/$counter; -+ -+ print $cputotal; -+} - --if ($module eq "cpuload"){ -- my $cpuload = `snmpwalk -v 1 -c $community $host .1.3.6.1.2.1.25.3.3.1.2 | gawk '{print \$4}' `; -- my @cpuload = split(/\n/, $cpuload); -- my $sum; -- my $counter = 0; -- foreach my $val(@cpuload){ -- $sum = $sum+$val; -- $counter ++; -- } -- my $cputotal = $sum/$counter; -- print $cputotal; -- -- } -- -Index: util/pandora_db.pl -=================================================================== ---- util/pandora_db.pl (revision 10314) -+++ util/pandora_db.pl (working copy) -@@ -547,7 +547,9 @@ - foreach my $param ('dbuser', 'dbpass', 'dbname', 'dbhost', 'log_file') { - die ("[ERROR] Bad config values. Make sure " . $conf->{'_pandora_path'} . " is a valid config file.\n\n") unless defined ($conf->{$param}); - } -+ $conf->{'dbengine'} = 'mysql' unless defined ($conf->{'dbengine'}); - $conf->{'dbport'} = '3306' unless defined ($conf->{'dbport'}); -+ $conf->{'claim_back_snmp_modules'} = '1' unless defined ($conf->{'claim_back_snmp_modules'}); - - # Read additional tokens from the DB - my $dbh = db_connect ('mysql', $conf->{'dbname'}, $conf->{'dbhost'}, $conf->{'dbport'}, $conf->{'dbuser'}, $conf->{'dbpass'}); -Index: util/pandora_revent_create.pl -=================================================================== ---- util/pandora_revent_create.pl (revision 10314) -+++ util/pandora_revent_create.pl (working copy) -@@ -232,9 +232,9 @@ - $i++; - } - -- $data_event = $event_name.",".$id_group.",".$id_agent.",".$status.",".$id_user.",".$event_type.",".$criticity.",".$id_agent_module.",".$id_alert_am.",".$critical_instructions.",".$warning_instructions.",".$unknown_instructions.",".$user_comment.",".$owner_user.",".$source.",".$tags; -+ $data_event = $event_name."|".$id_group."|".$id_agent."|".$status."|".$id_user."|".$event_type."|".$criticity."|".$id_agent_module."|".$id_alert_am."|".$critical_instructions."|".$warning_instructions."|".$unknown_instructions."|".$user_comment."|".$owner_user."|".$source."|".$tags; - -- $call_api = $api_path.'?op=set&op2=create_event&id='.$event_name.'&other='.$data_event.'&other_mode=url_encode_separator_,&apipass='.$api_pass.'&user='.$db_user.'&pass='.$db_pass; -+ $call_api = $api_path.'?op=set&op2=create_event&id='.$event_name.'&other='.$data_event.'&other_mode=url_encode_separator_|&apipass='.$api_pass.'&user='.$db_user.'&pass='.$db_pass; - - #DEBUG TRACE# - -Index: util/pandora_manage.pl -=================================================================== ---- util/pandora_manage.pl (revision 10314) -+++ util/pandora_manage.pl (working copy) -@@ -29,6 +29,10 @@ - use PandoraFMS::Core; - use PandoraFMS::Config; - -+# To handle 'UTF-8' encoded string in command like arguments (similar to "-CA" option for perl) -+use Encode::Locale; -+Encode::Locale::decode_argv; -+ - # version: define current version - my $version = "5.1 PS140630"; - -@@ -128,6 +132,8 @@ - help_screen_line('--create_special_day', "<special_day> <same_day> <description> <group>", 'Create special day'); - help_screen_line('--delete_special_day', '<special_day>', 'Delete special day'); - help_screen_line('--update_special_day', "<special_day> <field_to_change> <new_value>", 'Update a field of a special day'); -+ help_screen_line('--create_data_module_from_local_component', '<agent_name> <component_name>', "Create a new data \n\t module from a local component"); -+ help_screen_line('--create_local_component', "<component_name> <data> [<description> <id_os> <os_version> \n\t <id_network_component_group> <type> <min> <max> <module_interval> <id_module_group> <history_data> <min_warning> \n\t <max_warning> <str_warning> <min_critical> <max_critical>\n\t <str_critical> <min_ff_event> <post_process> <unit>\n\t <wizard_level> <critical_instructions>\n\t <warning_instructions> <unknown_instructions> <critical_inverse>\n\t <warning_inverse> <id_category> <disabled_types_event>\n\t <tags> <min_ff_event_normal> <min_ff_event_warning>\n\t <min_ff_event_critical> <each_ff> <ff_timeout>]", 'Create local component'); - - print "\nUSERS:\n\n" unless $param ne ''; - help_screen_line('--create_user', '<user_name> <user_password> <is_admin> [<comments>]', 'Create user'); -@@ -3885,6 +3891,14 @@ - param_check($ltotal, 1); - cli_delete_special_day(); - } -+ elsif ($param eq '--create_data_module_from_local_component') { -+ param_check($ltotal, 2); -+ cli_create_data_module_from_local_component(); -+ } -+ elsif ($param eq '--create_local_component') { -+ param_check($ltotal, 35, 33); -+ cli_create_local_component(); -+ } - else { - print_log "[ERROR] Invalid option '$param'.\n\n"; - $param = ''; -@@ -3980,3 +3994,110 @@ - pandora_delete_graph_source($id_graph, $dbh, $module); - } - } -+ -+############################################################################## -+# Return local component id given the name -+############################################################################## -+ -+sub pandora_get_local_component_id($$) { -+ my ($dbh,$name) = @_; -+ -+ my $lc_id = get_db_value($dbh, 'SELECT id FROM tlocal_component WHERE name = ?',safe_input($name)); -+ -+ return defined ($lc_id) ? $lc_id : -1; -+} -+ -+############################################################################## -+# Create data module from local component. -+# Related option: --create_data_module_from_local_component -+############################################################################## -+ -+sub cli_create_data_module_from_local_component() { -+ my ($agent_name, $component_name) = @ARGV[2..3]; -+ -+ my $agent_id = get_agent_id($dbh,$agent_name); -+ exist_check($agent_id,'agent',$agent_name); -+ -+ my $lc_id = pandora_get_local_component_id($dbh, $component_name); -+ exist_check($lc_id,'local component',$component_name); -+ -+ my $module_exists = get_agent_module_id($dbh, $component_name, $agent_id); -+ non_exist_check($module_exists, 'module name', $component_name); -+ -+ # Get local component data -+ my $component = get_db_single_row ($dbh, 'SELECT * FROM tlocal_component WHERE id = ?', $lc_id); -+ -+ #~ pandora_create_module_from_local_component ($conf, $component, $agent_id, $dbh); -+ enterprise_hook('pandora_create_module_from_local_component',[$conf, $component, $agent_id, $dbh]); -+} -+ -+############################################################################## -+# Create local component. -+# Related option: --create_local_component -+############################################################################## -+ -+sub cli_create_local_component() { -+ -+ my ($component_name, $data, $description, $id_os, $os_version, $id_network_component_group, $type, -+ $min,$max,$module_interval, $id_module_group, $history_data, $min_warning, $max_warning, $str_warning, -+ $min_critical, $max_critical, $str_critical, $min_ff_event, $post_process, $unit, $wizard_level, -+ $critical_instructions, $warning_instructions, $unknown_instructions, $critical_inverse, $warning_inverse, -+ $id_category, $tags, $disabled_types_event, $min_ff_event_normal, $min_ff_event_warning, $min_ff_event_critical, -+ $each_ff, $ff_timeout) = @ARGV[2..37]; -+ -+ my %parameters; -+ -+ $parameters{'name'} = safe_input($component_name); -+ my $data_aux = safe_input($data); -+ $data_aux =~ s/\n/
/g; -+ $parameters{'data'} = $data_aux; -+ $parameters{'description'} = safe_input($description) unless !defined ($description); -+ $parameters{'id_os'} = $id_os unless !defined ($id_os); -+ $parameters{'type'} = $type unless !defined ($type); -+ if (defined $id_network_component_group) { -+ $parameters{'id_network_component_group'} = $id_network_component_group; -+ } else { -+ $parameters{'id_network_component_group'} = 1; -+ } -+ $parameters{'max'} = $max unless !defined ($max); -+ $parameters{'min'} = $min unless !defined ($min); -+ $parameters{'module_interval'} = $module_interval unless !defined ($module_interval); -+ $parameters{'id_module_group'} = $id_module_group unless !defined ($id_module_group); -+ $parameters{'history_data'} = safe_input($history_data) unless !defined ($history_data); -+ $parameters{'min_warning'} = $min_warning unless !defined ($min_warning); -+ $parameters{'max_warning'} = $max_warning unless !defined ($max_warning); -+ $parameters{'str_warning'} = $str_warning unless !defined ($str_warning); -+ $parameters{'min_critical'} = $min_critical unless !defined ($min_critical); -+ $parameters{'max_critical'} = $max_critical unless !defined ($max_critical); -+ $parameters{'str_critical'} = $str_critical unless !defined ($str_critical); -+ $parameters{'min_ff_event'} = $min_ff_event unless !defined ($min_ff_event); -+ $parameters{'post_process'} = $post_process unless !defined ($post_process); -+ $parameters{'unit'} = $unit unless !defined ($unit); -+ $parameters{'wizard_level'} = $wizard_level unless !defined ($wizard_level); -+ $parameters{'critical_instructions'} = safe_input($critical_instructions) unless !defined ($critical_instructions); -+ $parameters{'warning_instructions'} = safe_input($warning_instructions) unless !defined ($warning_instructions); -+ $parameters{'unknown_instructions'} = safe_input($unknown_instructions) unless !defined ($unknown_instructions); -+ $parameters{'critical_inverse'} = $critical_inverse unless !defined ($critical_inverse); -+ $parameters{'warning_inverse'} = $warning_inverse unless !defined ($warning_inverse); -+ $parameters{'id_category'} = $id_category unless !defined ($id_category); -+ $parameters{'tags'} = safe_input($tags) unless !defined ($tags); -+ -+ my $disabled_types_event_hash = {}; -+ if ($disabled_types_event) { -+ $disabled_types_event_hash->{'going_unknown'} = 0; -+ } -+ else { -+ $disabled_types_event_hash->{'going_unknown'} = 1; -+ } -+ my $disabled_types_event_json = encode_json($disabled_types_event_hash); -+ $parameters{'disabled_types_event'} = $disabled_types_event_json unless !defined ($disabled_types_event); -+ -+ $parameters{'min_ff_event_normal'} = $min_ff_event_normal unless !defined ($min_ff_event_normal); -+ $parameters{'min_ff_event_warning'} = $min_ff_event_warning unless !defined ($min_ff_event_warning); -+ $parameters{'min_ff_event_critical'} = $min_ff_event_critical unless !defined ($min_ff_event_critical); -+ $parameters{'each_ff'} = $each_ff unless !defined ($each_ff); -+ $parameters{'ff_timeout'} = $ff_timeout unless !defined ($ff_timeout); -+ -+ my $component_id = enterprise_hook('pandora_create_local_component_from_hash',[$conf, \%parameters, $dbh]); -+ -+} -Index: util/recon_scripts/wmi-recon.pl -=================================================================== ---- util/recon_scripts/wmi-recon.pl (revision 10314) -+++ util/recon_scripts/wmi-recon.pl (working copy) -@@ -27,8 +27,9 @@ - 'daemon' => 0, - 'PID' => '', - 'pandora_path' => '/usr/local/etc/pandora/pandora_server.conf', -- 'ping_timeout' => 2, -- 'ping_retries' => 1, -+ 'networktimeout' => 2, -+ 'icmp_checks' => 1, -+ 'nmap_timing_template' => 2, - 'wmi_client' => '/usr/local/bin/wmic'); - } else { - %CONF = ('quiet' => 0, -@@ -36,8 +37,9 @@ - 'daemon' => 0, - 'PID' => '', - 'pandora_path' => '/etc/pandora/pandora_server.conf', -- 'ping_timeout' => 2, -- 'ping_retries' => 1, -+ 'networktimeout' => 2, -+ 'icmp_checks' => 1, -+ 'nmap_timing_template' => 2, - 'wmi_client' => '/usr/bin/wmic'); - } - -@@ -106,10 +108,10 @@ - my ($task, $function) = @_; - - # Timeout in ms. -- my $timeout = $CONF{'ping_timeout'} * 1000; -+ my $timeout = $CONF{'networktimeout'} * 1000; - - # Added -PE to make nmap behave like ping and avoid confusion if ICMP traffic is blocked. -- my $nmap_args = '-nsP -PE --max-retries ' . $CONF{'ping_retries'} . ' --host-timeout ' . $timeout; -+ my $nmap_args = '-nsP -PE --max-retries ' . $CONF{'icmp_checks'} . ' --host-timeout '.$timeout.' -T'.$CONF{'nmap_timing_template'}; - - # Scan the network. - my $np = new PandoraFMS::NmapParser; -Index: util/recon_scripts/snmp-recon.pl -=================================================================== ---- util/recon_scripts/snmp-recon.pl (revision 10314) -+++ util/recon_scripts/snmp-recon.pl (working copy) -@@ -35,8 +35,9 @@ - %CONF = ( - 'nmap' => '/usr/local/bin/nmap', - 'pandora_path' => '/usr/local/etc/pandora/pandora_server.conf', -- 'ping_retries' => 1, -- 'ping_timeout' => 2, -+ 'icmp_checks' => 1, -+ 'networktimeout' => 2, -+ 'nmap_timing_template' => 2, - 'PID' => '', - 'quiet' => 1, - ); -@@ -44,8 +45,9 @@ - %CONF = ( - 'nmap' => '/usr/bin/nmap', - 'pandora_path' => '/etc/pandora/pandora_server.conf', -- 'ping_retries' => 1, -- 'ping_timeout' => 2, -+ 'icmp_checks' => 1, -+ 'networktimeout' => 2, -+ 'nmap_timing_template' => 2, - 'PID' => '', - 'quiet' => 1, - ); -@@ -861,9 +863,11 @@ - return unless defined($agent); - - # Perform a traceroute. -+ my $timeout = $CONF{'networktimeout'}*1000; -+ my $nmap_args = '-nsP -PE --traceroute --max-retries '.$CONF{'icmp_checks'}.' --host-timeout '.$timeout.' -T'.$CONF{'nmap_timing_template'}; - my $np = new PandoraFMS::NmapParser; - eval { -- $np->parsescan($CONF{'nmap'}, '-nsP --traceroute', ($host)); -+ $np->parsescan($CONF{'nmap'}, $nmap_args, ($host)); - }; - return if ($@); - -@@ -930,10 +934,11 @@ - - # Populate ARP caches. - message("Populating ARP caches..."); --my $timeout = $CONF{'ping_timeout'} * 1000; # Convert the timeout from s to ms. -+my $timeout = $CONF{'networktimeout'} * 1000; # Convert the timeout from s to ms. -+my $nmap_args = '-nsP --send-ip --max-retries '.$CONF{'icmp_checks'}.' --host-timeout '.$timeout.' -T'.$CONF{'nmap_timing_template'}; - my $np = new PandoraFMS::NmapParser; - if ($#SUBNETS >= 0) { -- $np->parsescan($CONF{'nmap'}, '-nsP --send-ip --max-retries ' . $CONF{'ping_retries'} . ' --host-timeout ' . $timeout, @SUBNETS); -+ $np->parsescan($CONF{'nmap'}, $nmap_args, @SUBNETS); - } - - # Find routers. diff --git a/net-mgmt/pandorafms_server/pkg-plist b/net-mgmt/pandorafms_server/pkg-plist index 21043e2b151e..83adb4cfd3a8 100644 --- a/net-mgmt/pandorafms_server/pkg-plist +++ b/net-mgmt/pandorafms_server/pkg-plist @@ -43,6 +43,8 @@ man/man1/tentacle_server.1.gz %%DATADIR%%/util/esx_trap_manager.pl %%DATADIR%%/util/gis.README %%DATADIR%%/util/gpx2pandora_agent_data.pl +%%DATADIR%%/util/integria_rticket.pl +%%DATADIR%%/util/integrity_check %%DATADIR%%/util/n2p.README %%DATADIR%%/util/n2p.pl %%DATADIR%%/util/pandora2ast/GPL @@ -95,6 +97,7 @@ man/man1/tentacle_server.1.gz %%DATADIR%%/util/plugin/multicast.pl %%DATADIR%%/util/plugin/mysql_plugin.sh %%DATADIR%%/util/plugin/openvpn_pandoraplugin.pl +%%DATADIR%%/util/plugin/packet_loss.sh %%DATADIR%%/util/plugin/pandora_inventory_change.README %%DATADIR%%/util/plugin/pandora_inventory_change.pl %%DATADIR%%/util/plugin/pandora_loadgen.pl @@ -107,15 +110,8 @@ man/man1/tentacle_server.1.gz %%DATADIR%%/util/recon_scripts/ipmi-recon.pl %%DATADIR%%/util/recon_scripts/snmp-recon.pl %%DATADIR%%/util/recon_scripts/wmi-recon.pl +%%DATADIR%%/util/snmptrap_gen.sh %%DATADIR%%/util/tentacle_serverd %%DATADIR%%/util/trap_rate.sh %%DATADIR%%/util/udp_client.pl %%DATADIR%%/util/windows.README -@dirrm %%DATADIR%%/util/plugin/babel_plugin -@dirrm %%DATADIR%%/util/plugin/integria_plugin -@dirrm %%DATADIR%%/util/pandora2ast -@dirrmtry %%DATADIR%%/util/plugin -@dirrmtry %%DATADIR%%/util/recon_scripts -@dirrmtry %%DATADIR%%/util -@dirrmtry %%DATADIR%% -@dirrmtry %%ETCDIR%% diff --git a/net-mgmt/pandorafms_server/pkg-plist.spool b/net-mgmt/pandorafms_server/pkg-plist.spool index 8fd054fcfc6e..b3b510eea11c 100644 --- a/net-mgmt/pandorafms_server/pkg-plist.spool +++ b/net-mgmt/pandorafms_server/pkg-plist.spool @@ -1,21 +1,17 @@ -@comment /var/log/pandora -@mode 770 @owner pandora @group wheel -%%USE_LOGDIR%%@unexec rmdir %%LOGDIR%% 2>/dev/null || : -@comment /var/spool/pandora/data_out -@mode 700 -%%USE_SPOOL_OUT%%@unexec rmdir %%SPOOLDIR%%/data_out 2>/dev/null || : -@comment /var/spool/pandora/data_in and subdirectories +%%USE_LOGDIR%%@mode 770 +%%USE_LOGDIR%%@dir %%LOGDIR%% +%%USE_SPOOL_OUT%%@mode 700 +%%USE_SPOOL_OUT%%@dir %%SPOOLDIR%%/data_out @mode 770 @group www -%%USE_SPOOL_IN%%@unexec rmdir %%SPOOLDIR%%/data_in/collections 2>/dev/null || : -%%USE_SPOOL_IN%%@unexec rmdir %%SPOOLDIR%%/data_in/conf 2>/dev/null || : -%%USE_SPOOL_IN%%@unexec rmdir %%SPOOLDIR%%/data_in/md5 2>/dev/null || : -%%USE_SPOOL_IN%%@unexec rmdir %%SPOOLDIR%%/data_in/netflow 2>/dev/null || : -%%USE_SPOOL_IN%%@unexec rmdir %%SPOOLDIR%%/data_in 2>/dev/null || : -@comment /var/spool/pandora -@unexec rmdir %%SPOOLDIR%% 2>/dev/null || : +%%USE_SPOOL_IN%%@dir %%SPOOLDIR%%/data_in/collections +%%USE_SPOOL_IN%%@dir %%SPOOLDIR%%/data_in/conf +%%USE_SPOOL_IN%%@dir %%SPOOLDIR%%/data_in/md5 +%%USE_SPOOL_IN%%@dir %%SPOOLDIR%%/data_in/netflow +%%USE_SPOOL_IN%%@dir %%SPOOLDIR%%/data_in +@dir %%SPOOLDIR%% @comment unset mode/owner/group @mode @owner |