Merge branch 'develop' into 1611-No-se-envían-los-informes-por-correo-desde-Metaconsola-4881-vodat

Conflicts:
	pandora_console/extras/mr/10.sql
This commit is contained in:
enriquecd 2018-01-02 16:56:48 +01:00
commit 9a0438bc36
181 changed files with 46989 additions and 60816 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.716-171205
Version: 7.0NG.717-180102
Architecture: all
Priority: optional
Section: admin

View File

@ -1,14 +0,0 @@
package: pandorafms-agent-unix
<<<<<<< HEAD
Version: 7.0NG-170406
=======
Version: 7.0NG-170418
>>>>>>> develop
Architecture: all
Priority: optional
Section: admin
Installed-Size: 260
Maintainer: Miguel de Dios <miguel.dedios@artica.es>
Homepage: http://pandorafms.org/
Depends: coreutils, perl, unzip
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. Its possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.

View File

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

View File

@ -1,132 +0,0 @@
#!/bin/bash
#Pandora FMS- http:#pandorafms.com
# ==================================================
# Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
# Please see http:#pandorafms.org for full contribution list
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; version 2
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
<<<<<<< HEAD
pandora_version="7.0NG-170406"
=======
pandora_version="7.0NG-170418"
>>>>>>> develop
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
if [ $? = 1 ]
then
echo "No found \"dpkg-deb\" aplication, please install."
exit 1
else
echo "Found \"dpkg-debs\"."
fi
cd ..
echo "Make a \"temp_package\" temp dir for job."
mkdir -p temp_package/usr
mkdir -p temp_package/usr/share/pandora_agent/
mkdir -p temp_package/usr/bin/
mkdir -p temp_package/usr/sbin/
mkdir -p temp_package/etc/pandora/plugins
mkdir -p temp_package/etc/pandora/collections
mkdir -p temp_package/etc/init.d/
mkdir -p temp_package/lib/systemd/system/
mkdir -p temp_package/var/log/pandora/
mkdir -p temp_package/var/spool/pandora/data_out
mkdir -p temp_package/usr/share/man/man1/
mkdir -p temp_package/usr/share/pandora_agent/plugins
mkdir -p temp_package/tmp
mkdir -p temp_package/etc/logrotate.d/
echo "Make directory system tree for package."
cp DEBIAN temp_package -R
chmod 755 -R temp_package/DEBIAN
#Next lines is same to
#cp -aRf * temp_package/usr/share/pandora_agent/
#but don't copy recursive the temp_package into temp_package
for item in `ls | grep -v NT4 | grep -v AIX | grep -v FreeBSD | grep -v HP-UX | grep -v SunOS | grep -v temp_package`
do
#if [ \( $item != 'temp_package' \) -a \( $item != 'NT4' \) ]
#then
cp -aRf $item temp_package/usr/share/pandora_agent/
#fi
done
cp -aRf tentacle_client temp_package/usr/bin/
cp -aRf pandora_agent temp_package/usr/bin/
cp -aRf pandora_agent_exec temp_package/usr/bin/pandora_agent_exec
cp -aRf pandora_agent_daemon temp_package/etc/init.d/pandora_agent_daemon
cp -aRf pandora_agent_daemon.service temp_package/lib/systemd/system/pandora_agent_daemon.service
cp -aRf pandora_agent_logrotate temp_package/etc/logrotate.d/pandora_agent
cp Linux/pandora_agent.conf temp_package/etc/pandora/
cp -aRf man/man1/* temp_package/usr/share/man/man1/
# Relocate plugins to the final dir and delete
mv temp_package/usr/share/pandora_agent/plugins/* temp_package/etc/pandora/plugins
echo "Official plugins are placed on /etc/pandora/plugins" > temp_package/usr/share/pandora_agent/plugins/README
#Disabled, now the package overwrite the previous files.
##Create a temp file for to update files of plugins dir but don't crush dir.
##cp -aRf temp_package/usr/share/pandora_agent/plugins temp_package/tmp
##rm -rf temp_package/usr/share/pandora_agent/plugins/*
echo "Remove the SVN files and other temp files."
for item in `find temp_package`
do
echo -n "."
echo $item | grep "svn" > /dev/null
#last command success
if [ $? -eq 0 ]
then
rm -rf $item
fi
echo $item | grep "make_deb_package.sh" > /dev/null
#last command success
if [ $? -eq 0 ]
then
rm -rf $item
fi
done
echo "END"
echo "Calcule md5sum for md5sums file control of package"
for item in `find temp_package`
do
echo -n "."
if [ ! -d $item ]
then
echo $item | grep "DEBIAN" > /dev/null
#last command success
if [ $? -eq 1 ]
then
md5=`md5sum $item | cut -d" " -f1`
#delete "temp_package" in the path
final_path=${item#temp_package}
echo $md5" "$final_path >> temp_package/DEBIAN/md5sums
fi
fi
done
echo "END"
echo "Make the package \"Pandorafms console\"."
dpkg-deb --build temp_package
mv temp_package.deb pandorafms.agent_unix_$pandora_version.deb
echo "Delete the \"temp_package\" temp dir for job."
rm -rf temp_package

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -40,8 +40,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.716';
use constant AGENT_BUILD => '171205';
use constant AGENT_VERSION => '7.0NG.717';
use constant AGENT_BUILD => '180102';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -832,7 +832,7 @@ sub read_config (;$) {
config_update('agent_name', $Conf{'agent_name'});
} elsif ($Conf{'agent_name_cmd'} ne '') {
my $result = `$Conf{'agent_name_cmd'}`;
if($result ne '') {
# Use only the first line.
my ($temp_agent_name, $remain) = split(/\n/, $result);
chomp ($temp_agent_name);
@ -841,10 +841,14 @@ sub read_config (;$) {
$temp_agent_name =~ s/^ *(.*?) *$/$1/;
$Conf{'agent_name'} = $temp_agent_name if ($temp_agent_name ne '');
} else {
$Conf{'agent_name'} = hostname();
}
}
}
# Fall back to the hostname if agent_name is still empty.
if ($Conf{'agent_name'} eq '') {
$Conf{'agent_name'} = hostname();
}
# Update the agent MD5 since agent_name may have changed
$AgentMD5 = md5 ($Conf{'agent_name'});

File diff suppressed because it is too large Load Diff

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.716
%define release 171205
%define version 7.0NG.717
%define release 180102
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -1,145 +0,0 @@
#
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG
<<<<<<< HEAD
%define release 170406
=======
%define release 170418
>>>>>>> develop
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Vendor: ArticaST <http://www.artica.es>
Source0: %{name}-%{version}.tar.gz
URL: http://pandorafms.org
Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es>
Prefix: /usr/share
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: noarch
Requires(pre): shadow-utils
Requires(post): chkconfig /bin/ln
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: fileutils textutils unzip
Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk
Requires: perl perl(Sys::Syslog) perl(IO::Socket::SSL)
# Required by plugins
#Requires: sh-utils sed passwd net-tools rpm
AutoReq: 0
Provides: %{name}-%{version}
%description
Pandora FMS agent for unix. Pandora FMS is an OpenSource full-featured monitoring software.
%prep
rm -rf $RPM_BUILD_ROOT
%setup -q -n unix
%build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
mkdir -p $RPM_BUILD_ROOT/usr/bin/
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
install -m 0644 pandora_agent_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_agent
if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec ] ; then
rm $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec
fi
%clean
rm -Rf $RPM_BUILD_ROOT
%pre
getent passwd pandora >/dev/null || \
/usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora
exit 0
chown pandora:root /var/log/pandora
%post
if [ ! -d /etc/pandora ] ; then
mkdir -p /etc/pandora
fi
if [ ! -f /usr/share/pandora_agent/pandora_agent.conf ] ; then
cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf
fi
if [ ! -f /etc/pandora/pandora_agent.conf ] ; then
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
else
ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew
fi
if [ ! -e /etc/pandora/plugins ]; then
ln -s /usr/share/pandora_agent/plugins /etc/pandora
fi
if [ ! -e /etc/pandora/collections ]; then
ln -s /usr/share/pandora_agent/collections /etc/pandora
fi
mkdir -p /var/spool/pandora/data_out
if [ ! -d /var/log/pandora ]; then
mkdir -p /var/log/pandora
fi
/sbin/chkconfig --add pandora_agent_daemon
/sbin/chkconfig pandora_agent_daemon on
%preun
# Upgrading
if [ "$1" = "1" ]; then
exit 0
fi
/sbin/chkconfig --del pandora_agent_daemon
/etc/rc.d/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || :
# Remove symbolic links
pushd /etc/pandora
for f in pandora_agent.conf plugins collections
do
[ -L $f ] && rm -f $f
done
exit 0
%files
%defattr(750,root,root)
/usr/bin/pandora_agent
%defattr(755,pandora,root)
%{prefix}/pandora_agent
%defattr(755,root,root)
/usr/bin/pandora_agent_exec
/usr/bin/tentacle_client
/etc/rc.d/init.d/pandora_agent_daemon
%defattr(644,root,root)
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_agent

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.716
%define release 171205
%define version 7.0NG.717
%define release 180102
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -1,142 +0,0 @@
#
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG
<<<<<<< HEAD
%define release 170406
=======
%define release 170418
>>>>>>> develop
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Vendor: ArticaST <http://www.artica.es>
Source0: %{name}-%{version}.tar.gz
URL: http://pandorafms.org
Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es>
Prefix: /usr/share
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: noarch
PreReq: %fillup_prereq %insserv_prereq /usr/bin/sed /usr/bin/grep /usr/sbin/useradd
Requires: coreutils unzip perl
AutoReq: 0
Provides: %{name}-%{version}
%description
Pandora FMS agent for unix. Pandora FMS is an OpenSource full-featured monitoring software.
%prep
rm -rf $RPM_BUILD_ROOT
%setup -q -n unix
%build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
mkdir -p $RPM_BUILD_ROOT/usr/bin/
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
mkdir -p $RPM_BUILD_ROOT/etc/init.d/
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
#if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec ] ; then
# rm $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec
#fi
%clean
rm -Rf $RPM_BUILD_ROOT
%pre
if [ "`id pandora | grep uid | wc -l`" = 0 ]
then
/usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora
fi
%post
chown pandora:root /var/log/pandora
if [ ! -d /etc/pandora ] ; then
mkdir -p /etc/pandora
fi
if [ ! -f /usr/share/pandora_agent/pandora_agent.conf ] ; then
cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf
fi
if [ ! -f /etc/pandora/pandora_agent.conf ] ; then
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
else
ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew
fi
if [ ! -e /etc/pandora/plugins ]; then
ln -s /usr/share/pandora_agent/plugins /etc/pandora
fi
if [ ! -e /etc/pandora/collections ]; then
ln -s /usr/share/pandora_agent/collections /etc/pandora
fi
cp -aRf /usr/share/pandora_agent/pandora_agent_logrotate /etc/logrotate.d/pandora_agent
mkdir -p /var/spool/pandora/data_out
chkconfig pandora_agent_daemon on
%preun
# Upgrading
if [ "$1" = "1" ]; then
exit 0
fi
chkconfig --del pandora_agent_daemon
/etc/init.d/pandora_agent_daemon stop
rm /etc/init.d/pandora_agent_daemon
/usr/sbin/userdel pandora
rm -Rf /etc/pandora/pandora_agent.conf
rm -Rf /var/log/pandora/pandora_agent* 2> /dev/null
rm -Rf /usr/share/pandora_agent
rm -Rf /usr/share/man/man1/pandora_agent.1.gz
rm -Rf /usr/share/man/man1/tentacle_client.1.gz
exit 0
%postun
# Upgrading
if [ "$1" = "1" ]; then
exit 0
fi
rm -Rf /etc/logrotate.d/pandora_agent
%files
%defattr(750,pandora,root)
/usr/bin/pandora_agent
/usr/bin/pandora_agent_exec
%defattr(755,pandora,root)
/usr/bin/tentacle_client
/etc/init.d/pandora_agent_daemon
%docdir %{prefix}/pandora_agents/docs
%{prefix}/pandora_agent
%defattr(644,pandora,root)
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz

View File

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

View File

@ -1,557 +0,0 @@
#!/bin/sh
# **********************************************************************
# Pandora FMS Agent Installer for Unix (generic installer)
# (c) 2008-2015 Artica ST
# (c) 2008-2010 Sancho Lerena <slerena@gmail.com>
#
# This is a generic installer for all Unix-like systems.(AIX, HP-UX, SunOS, Linux, FreeBSD, NetBSD)
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG"
<<<<<<< HEAD
PI_BUILD="170406"
=======
PI_BUILD="170418"
>>>>>>> develop
OS_NAME=`uname -s`
FORCE=0
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
PREFIX=/usr
if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ]
then
PREFIX=/usr/local
fi
PANDORA_HOME=$PREFIX/share/pandora_agent
PANDORA_BIN=$PREFIX/bin/pandora_agent
PANDORA_EXEC_BIN=$PREFIX/bin/pandora_agent_exec
PANDORA_REVENT_BIN=$PREFIX/bin/pandora_revent
PANDORA_TEMP=/var/spool/pandora
PANDORA_CFG=/etc/pandora
PANDORA_LOG_DIR=/var/log/pandora
PANDORA_LOG=pandora_agent.log
TENTACLE=$PREFIX/bin/tentacle_client
TENTACLE_SERVER=$PREFIX/bin/tentacle_server
PANDORA_MAN=$PREFIX/share/man
PANDORA_STARTUP=/etc/init.d/pandora_agent_daemon
DAEMON_SCRIPT=pandora_agent_daemon
PANDORA_USER="root"
PANDORA_PERL_PATH="perl"
WITHOUT_TENTACLE_SERVER=0
FAKEROOT=0
# defaults for each platforms
case $OS_NAME in
AIX)
PANDORA_STARTUP=/etc/rc.pandora_agent_daemon
;;
HP-UX)
PANDORA_STARTUP=/sbin/init.d/pandora_agent_daemon
;;
FreeBSD)
PANDORA_CFG=$PREFIX/etc/pandora
PANDORA_MAN=$PREFIX/man
PANDORA_STARTUP=$PREFIX/etc/rc.d/pandora_agent
DAEMON_SCRIPT=$OS_NAME/pandora_agent
PANDORA_PERL_PATH=/usr/local/bin/perl
;;
NetBSD)
PANDORA_CFG=/usr/local/etc/pandora
PANDORA_STARTUP=/etc/rc.d/pandora_agent
DAEMON_SCRIPT=$OS_NAME/pandora_agent
PANDORA_PERL_PATH=/usr/pkg/bin/perl
;;
esac
MODE=$1
# options
while :
do
case "$2" in
"--no-tentacle-server") WITHOUT_TENTACLE_SERVER=1;;
"--fakeroot") FAKEROOT=1;;
*) break;;
esac
shift
done
PANDORA_BASE=`echo $2 | sed -e 's|/$||'`
if [ "$3" != "" ]
then
PANDORA_USER=$3
if [ -z "$PANDORA_BASE" ]
then
echo "When specifying a custom user the agent must be installed to a custom location where that user has write permissions!"
exit 1
fi
fi
[ "$4" ] && PANDORA_PERL_PATH=$4
# Check for Perl 5.6.x or higher available
PERL_VERSION=`$PANDORA_PERL_PATH -v | egrep 'v5.[6-9]|v5.[12][0-9]' | grep perl`
if [ -z "$PERL_VERSION" ]
then
echo "Perl 5.6.x or higher is not detected. This is required for Pandora FMS"
echo "Detected: $PERL_VERSION "
echo "Aborting install..."
exit 2
fi
if [ -z "`echo Linux HP-UX SunOS AIX Solaris Darwin BSD bsd FreeBSD NetBSD | grep \"$OS_NAME\"`" ]
then
echo "This system: '$OS_NAME' is not supported by this script"
echo "Please make the install yourself as it's described in documentation"
exit 1
fi
# check for root to do the install
if [ $FAKEROOT -ne 1 ] && [ -z "`id | grep \"uid=0(root)\"`" ]
then
echo "You need to be root to do the install. Please made a manual install"
echo "if you want to install Pandora FMS agent without root"
echo " "
echo "Aborting install"
exit 2
fi
help () {
echo "Syntax":
echo " "
echo " ./pandora_agent_installer < --mode > [ --option ] [ destination_path ] [ user_to_run_as ] [custom_perl_path]"
echo " "
echo "Modes:"
echo " "
echo " --force-install To force installation if already installed on system"
echo " --install To install Pandora FMS Agent on this system"
echo " --uninstall To uninstall/remove Pandora FMS Agent on this System"
echo " "
echo "Option:"
echo " "
echo " --no-tentacle-server Skip tentacle server installation (by default tentalce server installed)"
echo " --fakeroot treate \"destination_path\" as root directory"
echo " "
echo "Some exaples of how to use the installer:"
echo " "
echo " ./pandora_agent_installer --install"
echo " ./pandora_agent_installer --install /opt/pandora"
echo " ./pandora_agent_installer --install \"\" pandora"
echo " ./pandora_agent_installer --install /opt/pandora root /opt/pandora/perl5/usr/local/bin/perl"
echo " ./pandora_agent_installer --uninstall /opt/pandora"
echo " "
}
uninstall () {
if [ "$OS_NAME" = "Darwin" ]
then
launchctl remove com.pandorafms.pandorafms
rm /Library/LaunchDaemons/com.pandorafms.pandorafms.plist 2> /dev/null
fi
echo "Removing Pandora FMS Agent..."
rm -Rf $PANDORA_BASE$PANDORA_BIN 2> /dev/null
rm -Rf $PANDORA_BASE$PANDORA_EXEC_BIN 2> /dev/null
rm -Rf $PANDORA_BASE$PANDORA_REVENT_BIN 2> /dev/null
rm -f $DESTDIR/etc/logrotate.d/pandora_agent
#Test if exist Pandora Server in this machine
if [ -d $PANDORA_BASE$PANDORA_TEMP/data_in ]
then
echo "You have a Pandora Server in this machine. Then don't delete "$PANDORA_TEMP
rm -Rf $PANDORA_BASE$PANDORA_TEMP/data_out 2> /dev/null
else
rm -Rf $PANDORA_BASE$PANDORA_TEMP 2> /dev/null
rm -Rf $PANDORA_BASE$TENTACLE_SERVER 2> /dev/null
fi
rm -Rf $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf 2> /dev/null
rm -Rf $PANDORA_BASE/etc/init.d/pandora_agent_daemon 2> /dev/null
rm -Rf $PANDORA_BASE/sbin/init.d/pandora_agent_daemon 2> /dev/null
rm -Rf $PANDORA_BASE/etc/rc.pandora_agent_daemon 2> /dev/null
rm -Rf $PANDORA_BASE/etc/rc?.d/S90pandora_agent_daemon 2> /dev/null
rm -Rf $PANDORA_BASE/sbin/rc?.d/S90pandora_agent_daemon 2> /dev/null
rm -Rf $PANDORA_BASE/etc/rc?.d/S90pandora_agent 2> /dev/null
rm -Rf $PANDORA_BASE/sbin/rc?.d/S90pandora_agent 2> /dev/null
rm -Rf $PANDORA_BASE/etc/rc.d/rc?.d/S90pandora_agent_daemon 2> /dev/null
rm -Rf $PANDORA_BASE/etc/rc.d/rc?.d/S90pandora_agent 2> /dev/null
rm -Rf $PANDORA_BASE/usr/local/etc/rc.d/pandora_agent 2> /dev/null
if [ $FAKEROOT -ne 1 ]
then
rm -Rf /etc/init.d/pandora_agent_daemon 2> /dev/null
rm -Rf /sbin/init.d/pandora_agent_daemon 2> /dev/null
rm -Rf /etc/rc.pandora_agent_daemon 2> /dev/null
rm -Rf /etc/rc?.d/S90pandora_agent_daemon 2> /dev/null
rm -Rf /sbin/rc?.d/S90pandora_agent_daemon 2> /dev/null
rm -Rf /etc/rc?.d/S90pandora_agent 2> /dev/null
rm -Rf /sbin/rc?.d/S90pandora_agent 2> /dev/null
rm -Rf /etc/rc.d/rc?.d/S90pandora_agent_daemon 2> /dev/null
rm -Rf /etc/rc.d/rc?.d/S90pandora_agent 2> /dev/null
rm -Rf /usr/local/etc/rc.d/pandora_agent 2> /dev/null
fi
rm -Rf $PANDORA_BASE$PANDORA_HOME 2> /dev/null
rm -Rf $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG 2> /dev/null
rm -Rf $PANDORA_BASE$TENTACLE 2> /dev/null
rm -Rf $PANDORA_BASE$PANDORA_MAN/{man1,cat1}/tentacle_client.1.gz 2> /dev/null
rm -Rf $PANDORA_BASE$PANDORA_MAN/{man1,cat1}/pandora_agent.1.gz 2> /dev/null
# Skip delete of /etc/pandora if exists configuration of a server or satellite
if [ ! -f $PANDORA_BASE/$PANDORA_CFG/pandora_server.conf -a ! -f $PANDORA_BASE/$PANDORA_CFG/satellite_server.conf ]
then
rm -Rf $PANDORA_BASE/$PANDORA_CFG 2> /dev/null
fi
if [ ! -z "$PANDORA_BASE" ]
then
echo "Please delete manually $PANDORA_BASE for complete uninstall"
fi
echo " "
echo "Done"
}
#
# install_perl_script [OPTIONS] SRCFILE DESTFILE
# Install perl script. If PANDORA_PERL_DECODED_PATH is set, path of the perl
# in shebang line is replaced with PANDORA_PERL_DECODED_PATH value.
# OPTIONS:
# -o OWNER owner of the installed script
# -g GROUP group of the installed script
# -m PREM mode of the installed script
#
install_perl_script () {
OWNER=""; GROUP=""; PERM=""
while :
do
case $1 in
-o) OWNER=$2;;
-g) GROUP=$2;;
-m) PERM=$2;;
*) break;;
esac
shift;shift
done
SRC="$1"
DEST="$2"
# do install
if echo $PANDORA_PERL_PATH | grep "/" > /dev/null && [ "$PANDORA_PERL_PATH" != "/usr/bin/perl" ]
then
sed -e "s:^#\!.*:#\!$PANDORA_PERL_PATH:g" $SRC > $DEST
else
cp $SRC $DEST
fi
# set owner, group and permissions
[ "$OWNER" ] && chown $OWNER $DEST 2>/dev/null
[ "$GROUP" ] && chgrp $GROUP $DEST 2>/dev/null
[ "$PERM" ] && chmod $PERM $DEST
}
install () {
OS_VERSION=`uname -r`
OLDFILENAMETMP=`date +"%Y-%m-%d"`
echo "Detecting Unix distribution: $OS_NAME version $OS_VERSION"
if [ -f $PANDORA_BASE$PANDORA_HOME ] && [ "$FORCE" = "0" ]
then
echo "Seems that default dir already exists. Please use --force-install to"
echo "force installer to install on $PANDORA_BASE$PANDORA_HOME"
exit
else
echo "Checking default dir $PANDORA_BASE$PANDORA_HOME..."
fi
if [ -f $PANDORA_BASE$PANDORA_BIN ] && [ "$FORCE" = "0" ]
then
echo "Seems that $PANDORA_BASE$PANDORA_BIN already exists. Please use --force-install to"
echo "force installer to reinstall overwriting it"
echo " "
exit
else
echo "Checking Pandora FMS Agent on $PANDORA_BASE$PANDORA_BIN...."
fi
# Alter dynamically the daemon launcher and setup the new path
# if PANDORA_BASE is customized.
if [ "$PANDORA_BASE" ] && [ $FAKEROOT -ne 1 ]
then
DAEMON_TEMP=pandora_agent_daemon_temp
# Backup the daemon script
cp -f "$DAEMON_SCRIPT" "${DAEMON_SCRIPT}.bak"
AGENT_CFG=$OS_NAME/pandora_agent.conf
AGENT_CFG_TEMP=$OS_NAME/pandora_agent.conf.temp
# Backup the configuration file
cp -f "$AGENT_CFG" "${AGENT_CFG}.bak"
if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ]
then
sed -e "\|^PATH=|s|=|=$PANDORA_BASE$PREFIX/bin:|" \
-e "s|/usr/local/etc/pandora|$PANDORA_BASE$PANDORA_CFG|g" \
-e "s|/usr/local/bin/pandora_agent|$PANDORA_BASE$PANDORA_BIN|g" \
$DAEMON_SCRIPT > $DAEMON_TEMP
mv $DAEMON_TEMP $DAEMON_SCRIPT
else
sed -e "\|^PATH=|s|=|=$PANDORA_BASE/usr/bin:|" \
-e "\|^PANDORA_PATH=|s|=|=$PANDORA_BASE|" \
-e "\|^LOGFILE=|s|=|=$PANDORA_BASE|" \
-e "\|^DAEMON=|s|=|=$PANDORA_BASE|" \
-e "\|^DAEMON_TENTACLE=|s|=|=$PANDORA_BASE|" \
-e "s/^PANDORA_USER=.*/PANDORA_USER=$PANDORA_USER/" \
$DAEMON_SCRIPT > $DAEMON_TEMP
mv $DAEMON_TEMP $DAEMON_SCRIPT
fi
sed -e "s|^temporal[ \t][ \t]*|temporal $PANDORA_BASE|" \
-e "s|^logfile[ \t][ \t]*|logfile $PANDORA_BASE|" \
$AGENT_CFG > $AGENT_CFG_TEMP
mv $AGENT_CFG_TEMP $AGENT_CFG
fi
echo "Creating Pandora FMS Agent home directory at $PANDORA_BASE$PANDORA_HOME"
if [ "$PANDORA_BASE" ]
then
mkdir -p $PANDORA_BASE 2> /dev/null
mkdir -p $PANDORA_BASE/var/log 2> /dev/null
mkdir -p $PANDORA_BASE/$PANDORA_MAN/man1 2> /dev/null
mkdir -p $PANDORA_BASE$PREFIX/bin 2> /dev/null
fi
mkdir -p $PANDORA_BASE$PANDORA_HOME 2> /dev/null
# Create directories based on PANDORA_BASE
mkdir -p $PANDORA_BASE/tmp 2> /dev/null
mkdir -p $PANDORA_BASE$PANDORA_TEMP/data_out 2> /dev/null
mkdir -p $PANDORA_BASE$PANDORA_CFG 2> /dev/null
mkdir -p $PANDORA_BASE$PANDORA_LOG_DIR 2> /dev/null
# Set the user the agent will run as
if [ "$PANDORA_USER" != "root" ]
then
sed -e "s/.*pandora_user .*/pandora_user $PANDORA_USER/" $AGENT_CFG > $AGENT_CFG_TEMP 2> /dev/null && \
mv $AGENT_CFG_TEMP $AGENT_CFG
chmod 755 pandora_agent_daemon
chown -R $PANDORA_USER $PANDORA_BASE 2>/dev/null
fi
# Create logfile
if [ ! -z "`touch $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG`" ]
then
echo "Seems to be a problem generating logfile ($PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG) please check it";
else
echo "Created logfile at $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG..."
fi
echo "$LOG_TIMESTAMP Pandora FMS installer has created this file at startup" > $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG
# Copying agent and securing it
echo "Copying Pandora FMS Agent to $PANDORA_BASE$PANDORA_BIN..."
install_perl_script -m 755 -o $PANDORA_USER -g 0 pandora_agent $PANDORA_BASE$PANDORA_BIN
install_perl_script -m 755 -o $PANDORA_USER -g 0 pandora_agent_exec $PANDORA_BASE$PANDORA_EXEC_BIN
install_perl_script -m 755 -o $PANDORA_USER -g 0 pandora_revent $PANDORA_BASE$PANDORA_REVENT_BIN
echo "Copying Pandora FMS Agent configuration file to $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf..."
if [ -f $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf ]
then
cp $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf.$OLDFILENAMETMP
echo "Backing up old configuration file to $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf.$OLDFILENAMETMP"
fi
echo "Copying Pandora FMS Agent plugins to $PANDORA_BASE$PANDORA_HOME/plugins..."
[ -d $PANDORA_BASE$PANDORA_HOME/plugins ] || mkdir -p $PANDORA_BASE$PANDORA_HOME/plugins >/dev/null 2>&1
for PLUGIN in plugins/*
do
if grep '^#!.*/perl' $PLUGIN >/dev/null 2>&1
then
install_perl_script $PLUGIN $PANDORA_BASE$PANDORA_HOME/$PLUGIN
else
cp $PLUGIN $PANDORA_BASE$PANDORA_HOME/plugins
fi
done
chmod -R 700 $PANDORA_BASE$PANDORA_HOME/plugins
PANDORA_BASE_REAL="$PANDORA_BASE"
[ $FAKEROOT -eq 1 ] && PANDORA_BASE_REAL=""
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/plugins $PANDORA_BASE$PANDORA_CFG
echo "Copying Pandora FMS Agent collections to $PANDORA_BASE$PANDORA_HOME/collections..."
cp -r collections $PANDORA_BASE$PANDORA_HOME
chmod -R 700 $PANDORA_BASE$PANDORA_HOME/collections
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG
if [ $WITHOUT_TENTACLE_SERVER -eq 0 ]
then
echo "Copying tentacle server to $PANDORA_BASE$TENTACLE_SERVER"
install_perl_script -m 755 -o $PANDORA_USER -g 0 tentacle_server $PANDORA_BASE$TENTACLE_SERVER
fi
echo "Copying tentacle client to $PANDORA_BASE$TENTACLE"
install_perl_script -m 755 -o $PANDORA_USER -g 0 tentacle_client $PANDORA_BASE$TENTACLE
echo "Installing the Pandora Agent and Tentacle Client manuals"
cp man/man1/tentacle_client.1.gz $PANDORA_BASE/$PANDORA_MAN/man1
chmod 644 $PANDORA_BASE/$PANDORA_MAN/man1/tentacle_client.1.gz
cp man/man1/pandora_agent.1.gz $PANDORA_BASE/$PANDORA_MAN/man1
chmod 644 $PANDORA_BASE/$PANDORA_MAN/man1/pandora_agent.1.gz
echo "Setting secure permissions and ownership for all Pandora FMS Agent files..."
chown -R $PANDORA_USER $PANDORA_BASE$PANDORA_HOME 2>/dev/null
chmod -R 700 $PANDORA_BASE$PANDORA_TEMP/data_out
chmod 711 $PANDORA_BASE$PANDORA_LOG_DIR
chmod 640 $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG
chown $PANDORA_USER:0 $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG 2>/dev/null
if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ]
then
chown $PANDORA_USER:daemon $PANDORA_BASE$PANDORA_TEMP 2>/dev/null
chmod -R 770 $PANDORA_BASE$PANDORA_TEMP
chmod 775 $PANDORA_BASE$PANDORA_TEMP
fi
echo "Copying default agent configuration to $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf"
cp $OS_NAME/pandora_agent.conf $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf
chmod 600 $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf
chown $PANDORA_USER $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf 2>/dev/null
echo "Linking start-up daemon script '$DAEMON_SCRIPT' on $OS_NAME";
if [ "$OS_NAME" = "Darwin" ]
then
# Specific service install on Darwin/macOSX
launchctl load -F Darwin/com.pandorafms.pandorafms.plist
echo "Start Pandora FMS service with 'launchctl start com.pandorafms.pandorafms'"
echo "This service has been scheduled to launch on each system startup"
else
DESTDIR=""
[ "$PANDORA_BASE" ] && [ $FAKEROOT -eq 1 ] && DESTDIR=$PANDORA_BASE
cp $DAEMON_SCRIPT $DESTDIR$PANDORA_STARTUP
chmod 755 $DESTDIR$PANDORA_STARTUP
chown root:0 $DESTDIR$PANDORA_STARTUP 2>/dev/null
RCDIRS=""
MSG=""
if [ "$OS_NAME" = "AIX" ]
then
RCDIRS=/etc/rc.d/rc2.d
MSG="Pandora FMS agent has been included in $DESTDIR/etc/rc.d/rc2.d/S90pandora_agent_daemon"
elif [ "$OS_NAME" = "HP-UX" ]
then
RCDIRS="/sbin/rc2.d /sbin/rc3.d"
MSG="Pandora FMS agent has been included in $DESTDIR/sbin/rcX.d/S90pandora_agent_daemon"
elif [ "$OS_NAME" = "SunOS" ]
then
RCDIRS=/etc/rc2.d
MSG="Pandora FMS agent has been included in $DESTDIR/etc/rc2.d/S90pandora_agent_daemon"
elif [ "$OS_NAME" = "Linux" ]
then
if [ -d /etc/rc.d/ ]
then
RCDIRS="/etc/rc.d/rc2.d /etc/rc.d/rc3.d"
else
RCDIRS="/etc/rc2.d /etc/rc3.d"
fi
fi
[ "$RCDIRS" ] && for RCDIR in $RCDIRS
do
[ $FAKEROOT -eq 1 ] && [ ! -d $DESTDIR$RCDIR ] && mkdir -p $DESTDIR$RCDIR >/dev/null 2>&1
ln -s $PANDORA_STARTUP $DESTDIR$RCDIR/S90pandora_agent 2> /dev/null
done
[ "$MSG" ] && echo "$MSG"
fi
if [ -d /etc/logrotate.d ]
then
[ -d $DESTDIR/etc/logrotate.d ] && mkdir -p $DESTDIR/etc/logrotate.d
echo "Creating logrotate.d entry for Pandora FMS log management"
sed -e "s|^/var/log/pandora/pandora_agent.log|$PANDORA_BASE_REAL$PANDORA_LOG_DIR/$PANDORA_LOG|" pandora_agent_logrotate \
> $DESTDIR/etc/logrotate.d/pandora_agent
else
echo "Please add a log rotation schedule manually to your log rotation daemon (if any)"
fi
echo "Done."
echo " "
echo "You have your startup script ready at $PANDORA_STARTUP"
echo " "
echo "Tentacle is the default transfer mode since 2.0 version."
echo " "
echo "If you want to use SSH, firstly you need to copy your public SSH keys "
echo " ($HOME/.ssh/id_dsa) under /home/pandora/.ssh/authorized_keys "
echo "on your Pandora FMS Server host"
echo " "
echo "You may need to install manually some additional required dependencies:"
echo "perl-Sys-Syslog"
echo " "
echo "You also need to setup your $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf config file"
echo " "
if [ "$OS_NAME" = "FreeBSD" ]
then
echo "Define 'pandora_agent_enable=\"YES\"' in /etc/rc.conf to enable the daemon."
elif [ "$OS_NAME" = "NetBSD" ]
then
echo "Define 'pandora_agent=\"YES\"' in /etc/rc.conf to enable the daemon."
else
echo "Check your startup configuration to be sure Pandora FMS Agent is ready "
echo "to start automatically when system restarts":
fi
# Restore the daemon script
cp -f "$DAEMON_SCRIPT.bak" "$DAEMON_SCRIPT" >/dev/null 2>&1
rm -f "$DAEMON_SCRIPT.bak" >/dev/null 2>&1
# Restore the configuration file
cp -f "$AGENT_CFG.bak" "$AGENT_CFG" >/dev/null 2>&1
rm -f "$AGENT_CFG.bak" >/dev/null 2>&1
}
if [ ! -f "pandora_agent" ]
then
echo " "
echo "Execute installer from the directory where you have your files. "
help
exit 1
fi
# Script banner at start
echo " "
echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2015 ArticaST"
echo "This program is licensed under GPL2 Terms. http://pandorafms.com"
echo " "
case "$MODE" in
'--force-install')
FORCE=1
install
exit
;;
'--install')
install
exit
;;
'--uninstall')
uninstall
exit
;;
*)
help
;;
esac

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.716(Build 171205)")
#define PANDORA_VERSION ("7.0NG.717(Build 180102)")
string pandora_path;
string pandora_dir;

View File

@ -1,345 +0,0 @@
/* Common functions to any Pandora program.
Copyright (C) 2006 Artica ST.
Written by Esteban Sanchez.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <iostream>
#include <cctype>
#include <string>
#include <algorithm>
#include "pandora.h"
#include "pandora_strutils.h"
using namespace std;
using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
<<<<<<< HEAD
#define PANDORA_VERSION ("7.0NG(Build 170406)")
=======
#define PANDORA_VERSION ("7.0NG(Build 170418)")
>>>>>>> develop
string pandora_path;
string pandora_dir;
bool pandora_debug;
bool pandora_log_disable;
string pandora_version = PANDORA_VERSION;
/**
* Parses a string and initialize the key and the value.
*
* The string should be in the format:
* - <code>key value</code>
* - <code>key "value with blankspaces"</code>
*/
void
Key_Value::parseLine (string str) {
int pos;
list<string> tokens;
list<string>::iterator iter;
string trimmedstr;
trimmedstr = trim (str);
/* Check if the string has " */
pos = trimmedstr.find ("\"");
if (pos == string::npos) {
stringtok (tokens, trimmedstr, " \t");
} else {
stringtok (tokens, trimmedstr, "\"");
}
/* Pick the first and the last value of the token list */
iter = tokens.begin ();
key = trim (*iter);
transform (key.begin(), key.end(), key.begin(), (int(*)(int)) tolower);
iter = tokens.end ();
iter--;
/* Check if the line has only one token */
if (iter != tokens.begin ()) {
value = trim (*iter);
} else {
value = "";
}
}
/**
* Parses a string by position and initialize the key and the value.
*/
void
Key_Value::parseLineByPosition (string str, int pos) {
string trimmedstr;
trimmedstr = trim (str);
key = trim (trimmedstr.substr (0, pos));
value = trim (trimmedstr.substr (pos));
}
/**
* Get the key of the object.
*
* @return The key
*/
string
Key_Value::getKey () {
return key;
}
/**
* Set the key of the object.
*
*/
void
Key_Value::setKey (const string key) {
this->key = key;
}
/**
* Get the value of the object.
*
* @return The value
*/
string
Key_Value::getValue () {
return value;
}
/**
* Set the value of the object.
*
* @return The value
*/
void
Key_Value::setValue (const string value) {
this->value = value;
}
void
pandoraWriteLog (string filename, string line) {
string buffer;
char str_time[25];
FILE *file;
string filepath;
SYSTEMTIME st;
GetLocalTime(&st);
sprintf (str_time, "%d-%02d-%02d %02d:%02d:%02d ", st.wYear, st.wMonth, st.wDay,
st.wHour, st.wMinute, st.wSecond);
buffer = (char *) str_time;
buffer += line;
filepath = pandora_dir + filename;
file = fopen (filepath.c_str (), "a+");
if (file != NULL) {
fprintf (file, "%s\n", buffer.c_str ());
fclose (file);
}
}
/**
* Write a message in the log file.
*
* The log file is used to write the output of errors and problems of the
* agent.
*
* @param format String output format (like printf).
* @param ... Variable argument list
*/
void
Pandora::pandoraLog (const char *format, ...) {
if (!pandora_log_disable) {
va_list args;
char msg[5000];
va_start (args, format);
vsprintf (msg, format, args);
va_end (args);
pandoraWriteLog ("pandora_agent.log", (char *) msg);
}
return;
}
/**
* Write a message in the debug file.
*
* The log file is used to write the output of debugging information of the
* agent.
*
* @param format String output format.
* @param ... Variable argument list
*/
void
Pandora::pandoraDebug (const char *format, ...) {
if (pandora_debug) {
va_list args;
char msg[5000];
va_start (args, format);
vsprintf (msg, format, args);
va_end (args);
pandoraWriteLog ("pandora_debug.log", (char *) msg);
}
return;
}
/**
* Secure free of a pointer.
*
* @param pointer pointer to free.
*/
void
Pandora::pandoraFree (void * pointer) {
if (pointer != NULL)
free (pointer);
return;
}
/**
* Set the installation directory of the application.
*
* This directory is the path to the directory which holds
* the binary file.
*
* @param dir The path to the directory.
*
* @see getPandoraInstallDir
*/
void
Pandora::setPandoraInstallDir (string dir) {
pandora_dir = dir;
}
/**
* Get the installation directory of the application.
*
* This directory is the path to the directory which holds
* the binary file.
*
* @return The path to the directory.
*
* @see setPandoraInstallDir
*/
string
Pandora::getPandoraInstallDir () {
return pandora_dir;
}
/**
* Set the installation path of the application.
*
* This the complete path to the binary file.
*
* @param path The path to the binary file.
*
* @see getPandoraInstallPath
*/
void
Pandora::setPandoraInstallPath (string path) {
pandora_path = path;
}
/**
* Get the installation path of the application.
*
* This the complete path to the binary file.
*
* @return The path.
*
* @see setPandoraInstallPath
*/
string
Pandora::getPandoraInstallPath () {
return pandora_path;
}
/**
* Set the debug flag.
*
* If the flag is true output wil be generated and XML files will not be deleted.
*
* @param dbg Turns the debug flag on/off.
*
* @see getPandoraDebug
* @see pandoraDebug
*/
void
Pandora::setPandoraDebug (bool dbg) {
pandora_debug = dbg;
}
/**
* Get the debug flag value.
*
* If the flag is truee output wil be generated and XML files will not be deleted.
*
* @see setPandoraDebug
* @see pandoraDebug
*/
bool
Pandora::getPandoraDebug () {
return pandora_debug;
}
/**
* Set the disable logfile flag.
*
* If the flag is true no logs will be written.
*
* @param dbg Turns the debug flag on/off.
*
*/
void
Pandora::setPandoraLogDisable (bool dbg) {
pandora_log_disable = dbg;
}
/**
* Get the version of the agent.
*
* @return The version.
*/
string
Pandora::getPandoraAgentVersion () {
return pandora_version;
}
bool
Pandora::is_enabled (string value) {
static string enabled_values[] = {"enabled", "1", "on", "yes", "si", "", "ok", "true", ""};
int i = 0;
if (value == "") {
return false;
}
while (enabled_values[i] != "") {
if (enabled_values[i] == value) {
return true;
}
i++;
}
return false;
}

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.716(Build 171205))"
VALUE "ProductVersion", "(7.0NG.717(Build 180102))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,28 +0,0 @@
1 VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080904E4"
BEGIN
VALUE "CompanyName", "Artica ST"
VALUE "FileDescription", "Pandora FMS Agent for Windows Platform"
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
<<<<<<< HEAD
VALUE "ProductVersion", "(7.0NG(Build 170406))"
=======
VALUE "ProductVersion", "(7.0NG(Build 170418))"
>>>>>>> develop
VALUE "FileVersion", "1.0.0.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x809, 1252
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.716-171205
Version: 7.0NG.717-180102
Architecture: all
Priority: optional
Section: admin

View File

@ -1,14 +0,0 @@
package: pandorafms-console
<<<<<<< HEAD
Version: 7.0NG-170406
=======
Version: 7.0NG-170418
>>>>>>> develop
Architecture: all
Priority: optional
Section: admin
Installed-Size: 42112
Maintainer: Artica ST <deptec@artica.es>
Homepage: http://pandorafms.org/
Depends: php5, php5-snmp, php5-gd, php5-mysql, php-db, php5-xmlrpc, php-gettext, php5-curl, graphviz, dbconfig-common, php5-ldap, mysql-client | virtual-mysql-client
Description: Pandora FMS is an Open Source monitoring tool. It monitor your systems and applications, and allows you to control the status of any element of them. The web console is the graphical user interface (GUI) to manage the pool and to generate reports and graphs from the Pandora FMS monitoring process.

View File

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

View File

@ -1,168 +0,0 @@
#!/bin/bash
#Pandora FMS- http:#pandorafms.com
# ==================================================
# Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
# Please see http:#pandorafms.org for full contribution list
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; version 2
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
<<<<<<< HEAD
pandora_version="7.0NG-170406"
=======
pandora_version="7.0NG-170418"
>>>>>>> develop
package_pear=0
package_pandora=1
for param in $@
do
if [ $param = "-h" -o $param = "--help" ]
then
echo "For only make packages of pear type +pear"
echo "For not make packages of pear type -pear"
exit 0
fi
if [ $param = "+pear" ]
then
package_pandora=0
fi
if [ $param = "-pear" ]
then
package_pear=0
fi
done
if [ $package_pandora -eq 1 ]
then
echo "Test if you have all the needed tools to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
if [ $? = 1 ]
then
echo "No found \"dpkg-deb\" aplication, please install."
exit 1
else
echo "Found \"dpkg-debs\"."
fi
fi
if [ $package_pear -eq 1 ]
then
whereis dh-make-pear | cut -d":" -f2 | grep dh-make-pear > /dev/null
if [ $? = 1 ]
then
echo " \"dh-make-pear\" aplication not found, please install."
exit 1
else
echo "Found \"dh-make-pear\"."
fi
whereis fakeroot | cut -d":" -f2 | grep fakeroot > /dev/null
if [ $? = 1 ]
then
echo " \"fakeroot\" aplication not found, please install."
exit 1
else
echo "Found \"fakeroot\"."
fi
fi
whereis dpkg-buildpackage | cut -d":" -f2 | grep dpkg-buildpackage > /dev/null
if [ $? = 1 ]
then
echo " \"dpkg-buildpackage\" aplication not found, please install."
exit 1
else
echo "Found \"dpkg-buildpackage\"."
fi
cd ..
echo "Make a \"temp_package\" temporary dir for job."
mkdir -p temp_package
if [ $package_pandora -eq 1 ]
then
mkdir -p temp_package/var/www/pandora_console
mkdir -p temp_package/etc/logrotate.d
echo "Make directory system tree for package."
cp -R $(ls | grep -v temp_package | grep -v DEBIAN ) temp_package/var/www/pandora_console
cp -R DEBIAN temp_package
cp -aRf pandora_console_logrotate_ubuntu temp_package/etc/logrotate.d/pandora_console
find temp_package/var/www/pandora_console -name ".svn" | xargs rm -Rf
rm -Rf temp_package/var/www/pandora_console/pandora_console.spec
chmod 755 -R temp_package/DEBIAN
touch temp_package/var/www/pandora_console/include/config.php
echo "Remove the SVN files and other temp files."
for item in `find temp_package`
do
echo -n "."
echo $item | grep "svn" > /dev/null
#last command success
if [ $? -eq 0 ]
then
rm -rf $item
fi
echo $item | grep "make_deb_package.sh" > /dev/null
#last command success
if [ $? -eq 0 ]
then
rm -rf $item
fi
done
echo "END"
echo "Calculate md5sum for md5sums package control file."
for item in `find temp_package`
do
echo -n "."
if [ ! -d $item ]
then
echo $item | grep "DEBIAN" > /dev/null
#last command success
if [ $? -eq 1 ]
then
md5=`md5sum $item | cut -d" " -f1`
#delete "temp_package" in the path
final_path=${item#temp_package}
echo $md5" "$final_path >> temp_package/DEBIAN/md5sums
fi
fi
done
echo "END"
echo "Make the package \"Pandorafms console\"."
dpkg-deb --build temp_package
mv temp_package.deb pandorafms.console_$pandora_version.deb
fi
if [ $package_pear -eq 1 ]
then
echo "Make the package \"php-xml-rpc\"."
cd temp_package
dh-make-pear --maintainer "Miguel de Dios <miguel.dedios@artica.es>" XML_RPC
cd php-xml-rpc-*
dpkg-buildpackage -rfakeroot
cd ..
mv php-xml-rpc*.deb ..
cd ..
fi
echo "Delete the \"temp_package\" temporary dir for job."
rm -Rf temp_package
echo "DONE: Package ready at: ../pandorafms.console_$pandora_version.deb"

View File

@ -140,14 +140,19 @@ function snmpBrowserWindow () {
opacity: 0.5,
background: "black"
},
width: 780,
height: 430
width: 920,
height: 500
});
}
// Set the form OID to the value selected in the SNMP browser
function setOID () {
if($('#snmp_browser_version').val() == '3'){
$('#text-snmp_oid').val($('#table1-0-1').text());
} else {
$('#text-snmp_oid').val($('#snmp_selected_oid').text());
}
// Close the SNMP browser
$('.ui-dialog-titlebar-close').trigger('click');

View File

@ -3,6 +3,11 @@ START TRANSACTION;
ALTER TABLE tsnmp_filter ADD unified_filters_id int(10) NOT NULL DEFAULT 0;
ALTER TABLE treport_content_template ADD COLUMN hide_no_data tinyint(1) DEFAULT 0;
ALTER TABLE treport_content ADD COLUMN hide_no_data tinyint(1) DEFAULT 0;
ALTER TABLE tgraph_source ADD COLUMN `order` int(10) NOT NULL default 0;
ALTER TABLE tgraph_source ADD COLUMN `field_order` int(10) NOT NULL default 0;
UPDATE tgraph_source c, (SELECT @n := 0) m SET c.field_order = @n := @n + 1;
ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0';
ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0';
ALTER TABLE tgraph ADD COLUMN `modules_series` tinyint(1) UNSIGNED NOT NULL default '0';
COMMIT;

View File

@ -0,0 +1,8 @@
START TRANSACTION;
ALTER TABLE `tlayout` ADD `is_favourite` int(1) NOT NULL DEFAULT 0;
SELECT max(unified_filters_id) INTO @max FROM tsnmp_filter;
UPDATE tsnmp_filter tsf,(SELECT @max:= @max) m SET tsf.unified_filters_id = @max:= @max + 1 where tsf.unified_filters_id=0;
COMMIT;

View File

@ -1234,6 +1234,7 @@ UPDATE tagente SET tagente.alias = tagente.nombre;
-- Table `tlayout`
-- ---------------------------------------------------------------------
ALTER TABLE tlayout ADD `background_color` varchar(50) NOT NULL default '#FFF';
ALTER TABLE tlayout ADD `is_favourite` int(1) NOT NULL DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `tlayout_data`
@ -1263,6 +1264,7 @@ UPDATE tagente_modulo SET cron_interval = '' WHERE cron_interval LIKE '% %';
ALTER TABLE tgraph ADD COLUMN `percentil` int(4) unsigned default '0';
ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0';
ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0';
ALTER TABLE tgraph ADD COLUMN `modules_series` tinyint(1) UNSIGNED NOT NULL default '0';
-- ---------------------------------------------------------------------
-- Table `tnetflow_filter`
@ -1435,7 +1437,7 @@ ALTER TABLE tserver_export MODIFY `name` varchar(600) BINARY NOT NULL default ''
-- ---------------------------------------------------------------------
ALTER TABLE tgraph_source ADD COLUMN id_server int(11) UNSIGNED NOT NULL default 0;
ALTER TABLE tgraph_source ADD COLUMN `order` int(10) NOT NULL default 0;
ALTER TABLE tgraph_source ADD COLUMN `field_order` int(10) NOT NULL default 0;
-- ---------------------------------------------------------------------
-- Table `tserver_export_data`
@ -1469,3 +1471,9 @@ INSERT INTO ttipo_modulo VALUES (25,'web_analysis', 8, 'Web analysis data', 'mod
-- Table `tdashboard`
-- ---------------------------------------------------------------------
ALTER TABLE `tdashboard` ADD COLUMN `cells_slideshow` TINYINT(1) NOT NULL default 0;
-- ---------------------------------------------------------------------
-- Table `tsnmp_filter`
-- ---------------------------------------------------------------------
SELECT max(unified_filters_id) INTO @max FROM tsnmp_filter;
UPDATE tsnmp_filter tsf,(SELECT @max:= @max) m SET tsf.unified_filters_id = @max:= @max + 1 where tsf.unified_filters_id=0;

View File

@ -106,10 +106,17 @@ if ($snmpwalk) {
}
if (array_key_exists(1,$data)) {
// Fixed for switch dell powerconnect
if(count($data) > 2) {
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = $data[0];
unset($data[0]);
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = implode(": ",$data);
} else {
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = $data[0];
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[1];
}
else {
} else {
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = '';
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[0];
}

View File

@ -1002,7 +1002,7 @@ if ($update_module || $create_module) {
$custom_string_2 = (string) get_parameter ('custom_string_2', $custom_string_2_default);
$custom_string_3 = (string) get_parameter ('custom_string_3', $custom_string_3_default);
$custom_integer_2 = (int) get_parameter ('custom_integer_2', $custom_integer_2_default);
$custom_integer_2 = (int) get_parameter ('custom_integer_2', 0);
// Get macros
$macros = (string) get_parameter ('macros');

View File

@ -502,27 +502,27 @@ if (($config['dbtype'] == 'oracle') && ($agents !== false)) {
}
// Prepare pagination
ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled", $offset);
ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
if ($agents !== false) {
echo "<table cellpadding='4' id='agent_list' cellspacing='4' width='100%' class='databox data'>";
echo "<th>".__('Agent name') . ' ' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=name&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
echo "</th>";
echo "<th title='".__('Remote agent configuration')."'>".__('R'). ' ' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=remote&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectRemoteUp)) . '</a>' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=remote&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectRemoteDown)) . '</a>';
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectRemoteUp)) . '</a>' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectRemoteDown)) . '</a>';
echo "</th>";
echo "<th>".__('OS'). ' ' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=os&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '</a>' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=os&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . '</a>';
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=os&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '</a>' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=os&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . '</a>';
echo "</th>";
echo "<th>".__('Type'). "</th>";
echo "<th>".__('Group'). ' ' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=group&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '</a>' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=group&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . '</a>';
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '</a>' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . '</a>';
echo "</th>";
echo "<th>" . __('Description') . "</th>";
echo "<th style='text-align:left'>" . __('Actions') . "</th>";
@ -697,7 +697,7 @@ if ($agents !== false) {
echo "</td>";
}
echo "</table>";
ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled", $offset);
ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
echo "<table width='100%'><tr><td align='right'>";
}
else {

View File

@ -1227,281 +1227,6 @@ function paint_graph_values(){
message_error_warning, message_error_critical);
}
}
//function use d3.js for paint graph
function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, error_w, error_c) {
//Check if they are numbers
if(isNaN(min_w)){ min_w = 0; };
if(isNaN(max_w)){ max_w = 0; };
if(isNaN(min_c)){ min_c = 0; };
if(isNaN(max_c)){ max_c = 0; };
//messages legend
var legend_normal = '<?php echo __("Normal Status");?>';
var legend_warning = '<?php echo __("Warning Status");?>';
var legend_critical = '<?php echo __("Critical Status");?>';
//remove elements
d3.select("#svg_dinamic rect").remove();
$("#text-max_warning").removeClass("input_error");
$("#text-max_critical").removeClass("input_error");
//if haven't errors
if (error_w == 0 && error_c == 0){
//parse element
min_w = parseFloat(min_w);
min_c = parseFloat(min_c);
max_w = parseFloat(max_w);
max_c = parseFloat(max_c);
//inicialize var
var range_min = 0;
var range_max = 0;
var range_max_min = 0;
var range_max_min = 0;
//Find the lowest possible value
if(min_w < 0 || min_c < 0){
if(min_w < min_c){
range_min = min_w - 100;
} else {
range_min = min_c - 100;
}
} else if (min_w > 0 || min_c > 0) {
if(min_w > min_c){
range_max_min = min_w;
} else {
range_max_min = min_c;
}
} else {
if(min_w < min_c){
range_min = min_w - 100;
} else {
range_min = min_c - 100;
}
}
//Find the maximum possible value
if(max_w > max_c){
range_max = max_w + 100 + range_max_min;
} else {
range_max = max_c + 100 + range_max_min;
}
//Controls whether the maximum = 0 is infinite
if((max_w == 0 || max_w == 0.00) && min_w != 0){
max_w = range_max;
}
if((max_c == 0 || max_c == 0.00) && min_c != 0){
max_c = range_max;
}
//Scale according to the position
position = 200 / (range_max-range_min);
//axes
var yScale = d3.scale.linear()
.domain([range_min, range_max])
.range([100, -100]);
var yAxis = d3.svg.axis()
.orient("left")
.scale(yScale);
//create svg
var svg = d3.select("#svg_dinamic");
//delete elements
svg.selectAll("g").remove();
svg.selectAll("rect").remove();
svg.selectAll("text").remove();
svg.append("g")
.attr("transform", "translate(0, 100)")
.call(yAxis);
//legend Normal text
svg.append("text")
.attr("x", 0)
.attr("y", -20)
.attr("fill", 'black')
.style("font-family", "arial")
.style("font-weight", "bold")
.style("font-size", 10)
.html(legend_normal)
.style("text-anchor", "first");
//legend Normal rect
svg.append("rect")
.attr("id", "legend_normal")
.attr("x", 72)
.attr("y", -30)
.attr("width", '10px')
.attr("height", '10px')
.style("fill", "#82B92E");
//legend Warning text
svg.append("text")
.attr("x", 91)
.attr("y", -20)
.attr("fill", 'black')
.style("font-family", "arial")
.style("font-weight", "bold")
.style("font-size", 10)
.html(legend_warning)
.style("text-anchor", "first");
//legend Warning rect
svg.append("rect")
.attr("id", "legend_warning")
.attr("x", 168)
.attr("y", -30)
.attr("width", '10px')
.attr("height", '10px')
.style("fill", "#ffd731");
//legend Critical text
svg.append("text")
.attr("x", 187)
.attr("y", -20)
.attr("fill", 'black')
.style("font-family", "arial")
.style("font-weight", "bold")
.style("font-size", 10)
.html(legend_critical)
.style("text-anchor", "first");
//legend critical rect
svg.append("rect")
.attr("id", "legend_critical")
.attr("x", 258)
.attr("y", -30)
.attr("width", '10px')
.attr("height", '10px')
.style("fill", "#fc4444");
//styles for number and axes
svg.selectAll("g .domain")
.style("stroke-width", 2)
.style("fill", "none")
.style("stroke", "black");
svg.selectAll("g .tick text")
.style("font-size", "9pt")
.style("font-weight", "initial");
//estatus normal
svg.append("rect")
.attr("id", "warning_rect")
.attr("x", 3)
.attr("y", 0)
.attr("width", '300px')
.attr("height", '200px')
.style("fill", "#82B92E");
//controls the inverse warning
if(inverse_w == 0){
svg.append("rect").transition()
.duration(600)
.attr("id", "warning_rect")
.attr("x", 3)
.attr("y", ((range_max - min_w) * position) - ((max_w - min_w) * position))
.attr("width", 300)
.attr("height", ((max_w - min_w) * position))
.style("fill", "#ffd731");
}
else {
svg.append("rect").transition()
.duration(600)
.attr("id", "warning_rect")
.attr("x", 3)
.attr("y", 200 - ((min_w -range_min) * position))
.attr("width", 300)
.attr("height", (min_w -range_min) * position)
.style("fill", "#ffd731");
svg.append("rect").transition()
.duration(600)
.attr("id", "warning_inverse_rect")
.attr("x", 3)
.attr("y", 0)
.attr("width", 300)
.attr("height", ((range_max - min_w) * position) - ((max_w - min_w) * position))
.style("fill", "#ffd731");
}
//controls the inverse critical
if(inverse_c == 0){
svg.append("rect").transition()
.duration(600)
.attr("id", "critical_rect")
.attr("x", 3)
.attr("y", ((range_max - min_c) * position) - ((max_c - min_c) * position))
.attr("width", 300)
.attr("height", ((max_c - min_c) * position))
.style("fill", "#fc4444");
}
else {
svg.append("rect").transition()
.duration(600)
.attr("id", "critical_rect")
.attr("x", 3)
.attr("y", 200 - ((min_c -range_min) * position))
.attr("width", 300)
.attr("height", (min_c -range_min) * position)
.style("fill", "#fc4444");
svg.append("rect").transition()
.duration(600)
.attr("id", "critical_inverse_rect")
.attr("x", 3)
.attr("y", 0)
.attr("width", 300)
.attr("height", ((range_max - min_c) * position) - ((max_c - min_c) * position))
.style("fill", "#fc4444");
}
}
else {
var message_error_warning = '<?php echo __("Please introduce a maximum warning higher than the minimun warning") ?>';
var message_error_critical = '<?php echo __("Please introduce a maximum critical higher than the minimun critical") ?>';
d3.select("#svg_dinamic rect").remove();
//create svg
var svg = d3.select("#svg_dinamic");
svg.selectAll("g").remove();
svg.selectAll("rect").remove();
svg.selectAll("text").remove();
//message error warning
if (error_w == 1) {
$("#text-max_warning").addClass("input_error");
svg.append("text")
.attr("x", -90)
.attr("y", 10)
.attr("fill", 'black')
.style("font-family", "arial")
.style("font-weight", "bold")
.style("font-size", 14)
.style("fill", "red")
.html(message_error_warning)
.style("text-anchor", "first");
}
//message error critical
if (error_c == 1) {
$("#text-max_critical").addClass("input_error");
svg.append("text")
.attr("x", -90)
.attr("y", 105)
.attr("fill", 'black')
.style("font-family", "arial")
.style("font-weight", "bold")
.style("font-size", 14)
.style("fill", "red")
.html(message_error_critical)
.style("text-anchor", "first");
}
}
}
/* End of relationship javascript */
/* ]]> */

View File

@ -414,14 +414,19 @@ function snmpBrowserWindow () {
opacity: 0.5,
background: "black"
},
width: 780,
height: 430
width: 920,
height: 500
});
}
// Set the form OID to the value selected in the SNMP browser
function setOID () {
if($('#snmp_browser_version').val() == '3'){
$('#text-snmp_oid').val($('#table1-0-1').text());
} else {
$('#text-snmp_oid').val($('#snmp_selected_oid').text());
}
// Close the SNMP browser
$('.ui-dialog-titlebar-close').trigger('click');

View File

@ -410,6 +410,7 @@ $table->data[1][0] = __('Module definition') . ui_print_help_icon("module_defini
$table->data[1][1] = __('No change').' '.html_print_radio_button_extended ("mode", -1, '', $mode, false, '', 'style="margin-right: 40px;"', true);
$table->data[1][1] .= __('Learning mode').' '.html_print_radio_button_extended ("mode", 1, '', $mode, false, '', 'style="margin-right: 40px;"', true);
$table->data[1][1] .= __('Normal mode').' '.html_print_radio_button_extended ("mode", 0, '', $mode, false, '', 'style="margin-right: 40px;"', true);
$table->data[1][1] .= __('Autodisable mode').' '.html_print_radio_button_extended ("mode", 2, '', $mode, false, '', 'style="margin-right: 40px;"', true);
// Status (Disabled / Enabled)
$table->data[2][0] = __('Status');

View File

@ -388,7 +388,7 @@ $table->data['edit0'][3] .= html_print_checkbox ("dynamic_two_tailed", 1, '', tr
$table->data['edit1'][0] = __('Warning status');
$table->data['edit1'][1] = '<table width="100%">';
$table->data['edit1'][1] .= '<tr>';
$table->data['edit1'][1] .= "<tr id='edit1-1-min'>";
$table->data['edit1'][1] .= '<td>';
$table->data['edit1'][1] .= '<em>' . __('Min.') . '</em>';
$table->data['edit1'][1] .= '</td>';
@ -397,7 +397,7 @@ $table->data['edit1'][1] = '<table width="100%">';
'min_warning', '', '', 5, 255, true);
$table->data['edit1'][1] .= '</td>';
$table->data['edit1'][1] .= '</tr>';
$table->data['edit1'][1] .= '<tr>';
$table->data['edit1'][1] .= "<tr id='edit1-1-max'>";
$table->data['edit1'][1] .= '<td>';
$table->data['edit1'][1] .= '<em>' . __('Max.') . '</em>';
$table->data['edit1'][1] .= '</td>';
@ -406,7 +406,7 @@ $table->data['edit1'][1] = '<table width="100%">';
'max_warning', '', '', 5, 255, true);
$table->data['edit1'][1] .= '</td>';
$table->data['edit1'][1] .= '</tr>';
$table->data['edit1'][1] .= '<tr>';
$table->data['edit1'][1] .= "<tr id='edit1-1-str'>";
$table->data['edit1'][1] .= '<td>';
$table->data['edit1'][1] .= '<em>' . __('Str.') . '</em>';
$table->data['edit1'][1] .= '</td>';
@ -434,8 +434,8 @@ $table->data['edit1'][1] .= '</table>';
$table->data['edit1'][2] = __('Critical status');
$table->data['edit1'][3] = '<table width="100%">';
$table->data['edit1'][3] .= '<tr>';
$table->data['edit1'][3] .= '<td>';
$table->data['edit1'][3] .= "<tr id='edit1-3-min'>";
$table->data['edit1'][3] .= "<td>";
$table->data['edit1'][3] .= '<em>' . __('Min.') . '</em>';
$table->data['edit1'][3] .= '</td>';
$table->data['edit1'][3] .= '<td align="right">';
@ -443,7 +443,7 @@ $table->data['edit1'][3] = '<table width="100%">';
'min_critical', '', '', 5, 255, true);
$table->data['edit1'][3] .= '</td>';
$table->data['edit1'][3] .= '</tr>';
$table->data['edit1'][3] .= '<tr>';
$table->data['edit1'][3] .= "<tr id='edit1-3-max'>";
$table->data['edit1'][3] .= '<td>';
$table->data['edit1'][3] .= '<em>' . __('Max.') . '</em>';
$table->data['edit1'][3] .= '</td>';
@ -452,7 +452,7 @@ $table->data['edit1'][3] = '<table width="100%">';
'max_critical', '', '', 5, 255, true);
$table->data['edit1'][3] .= '</td>';
$table->data['edit1'][3] .= '</tr>';
$table->data['edit1'][3] .= '<tr>';
$table->data['edit1'][3] .= "<tr id='edit1-3-str'>";
$table->data['edit1'][3] .= '<td>';
$table->data['edit1'][3] .= '<em>'.__('Str.').'</em>';
$table->data['edit1'][3] .= '</td>';
@ -807,6 +807,64 @@ $(document).ready (function () {
"tr#delete_table-edit13, " +
"tr#delete_table-edit14, " +
"tr#delete_table-edit15").show ();
switch($('#module_type').val()) {
case '3':
case '23':
case '33':
$("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max,#delete_table-edit15," +
"#delete_table-edit3-2,#delete_table-edit3-3,#delete_table-edit35").hide();
$("#edit1-1-str,#edit1-3-str").show();
break;
case '6':
case '7':
$("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show();
$("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," +
"#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," +
"#delete_table-edit5").hide();
break;
case '8':
case '9':
case '11':
$("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show();
$("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," +
"#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," +
"#delete_table-edit5").hide();
break;
case '10':
$("#edit1-1-str,#edit1-3-str").show();
$("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," +
"#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," +
"#delete_table-edit5").hide();
break;
case '15':
case '16':
case '18':
$("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show();
$("#edit1-1-str,#edit1-3-str,#delete_table-edit5").hide();
break;
case '17':
$("#edit1-1-str,#edit1-3-str").show();
$("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max,#delete_table-edit5").hide();
break;
case '1':
case '2':
case '4':
case '5':
case '21':
case '22':
case '24':
case '25':
case '30':
case '31':
case '32':
case '100':
$("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show();
$("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," +
"#delete_table-edit3-3,#delete_table-edit35").hide();
break;
default:
}
}
function clean_lists() {

View File

@ -338,7 +338,7 @@ if (is_array ($config['extensions'])) {
if($extension['godmode_menu']['name'] != 'DB Schema check' && $extension['godmode_menu']['name'] != 'DB interface'){
if($extension['godmode_menu']['name'] != __('DB Schema check') && $extension['godmode_menu']['name'] != __('DB interface')){
$extmenu = $extension['godmode_menu'];
}

View File

@ -382,277 +382,4 @@ $next_row++;
}
}
//function use d3.js for paint graph
function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, error_w, error_c) {
//Check if they are numbers
if(isNaN(min_w)){ min_w = 0; };
if(isNaN(max_w)){ max_w = 0; };
if(isNaN(min_c)){ min_c = 0; };
if(isNaN(max_c)){ max_c = 0; };
//messages legend
var legend_normal = '<?php echo __("Normal Status");?>';
var legend_warning = '<?php echo __("Warning Status");?>';
var legend_critical = '<?php echo __("Critical Status");?>';
//remove elements
d3.select("#svg_dinamic rect").remove();
$("#text-max_warning").removeClass("input_error");
$("#text-max_critical").removeClass("input_error");
//if haven't errors
if (error_w == 0 && error_c == 0){
//parse element
min_w = parseFloat(min_w);
min_c = parseFloat(min_c);
max_w = parseFloat(max_w);
max_c = parseFloat(max_c);
//inicialize var
var range_min = 0;
var range_max = 0;
var range_max_min = 0;
var range_max_min = 0;
//Find the lowest possible value
if(min_w < 0 || min_c < 0){
if(min_w < min_c){
range_min = min_w - 100;
} else {
range_min = min_c - 100;
}
} else if (min_w > 0 || min_c > 0) {
if(min_w > min_c){
range_max_min = min_w;
} else {
range_max_min = min_c;
}
} else {
if(min_w < min_c){
range_min = min_w - 100;
} else {
range_min = min_c - 100;
}
}
//Find the maximum possible value
if(max_w > max_c){
range_max = max_w + 100 + range_max_min;
} else {
range_max = max_c + 100 + range_max_min;
}
//Controls whether the maximum = 0 is infinite
if((max_w == 0 || max_w == 0.00) && min_w != 0){
max_w = range_max;
}
if((max_c == 0 || max_c == 0.00) && min_c != 0){
max_c = range_max;
}
//Scale according to the position
position = 200 / (range_max-range_min);
//axes
var yScale = d3.scale.linear()
.domain([range_min, range_max])
.range([100, -100]);
var yAxis = d3.svg.axis()
.orient("left")
.scale(yScale);
//create svg
var svg = d3.select("#svg_dinamic");
//delete elements
svg.selectAll("g").remove();
svg.selectAll("rect").remove();
svg.selectAll("text").remove();
svg.append("g")
.attr("transform", "translate(0, 100)")
.call(yAxis);
//legend Normal text
svg.append("text")
.attr("x", 0)
.attr("y", -20)
.attr("fill", 'black')
.style("font-family", "arial")
.style("font-weight", "bold")
.style("font-size", 10)
.html(legend_normal)
.style("text-anchor", "first");
//legend Normal rect
svg.append("rect")
.attr("id", "legend_normal")
.attr("x", 72)
.attr("y", -30)
.attr("width", '10px')
.attr("height", '10px')
.style("fill", "#82B92E");
//legend Warning text
svg.append("text")
.attr("x", 91)
.attr("y", -20)
.attr("fill", 'black')
.style("font-family", "arial")
.style("font-weight", "bold")
.style("font-size", 10)
.html(legend_warning)
.style("text-anchor", "first");
//legend Warning rect
svg.append("rect")
.attr("id", "legend_warning")
.attr("x", 168)
.attr("y", -30)
.attr("width", 10)
.attr("height", 10)
.style("fill", "#ffd731");
//legend Critical text
svg.append("text")
.attr("x", 187)
.attr("y", -20)
.attr("fill", 'black')
.style("font-family", "arial")
.style("font-weight", "bold")
.style("font-size", 10)
.html(legend_critical)
.style("text-anchor", "first");
//legend critical rect
svg.append("rect")
.attr("id", "legend_critical")
.attr("x", 258)
.attr("y", -30)
.attr("width", 10)
.attr("height", 10)
.style("fill", "#fc4444");
//styles for number and axes
svg.selectAll("g .domain")
.style("stroke-width", 2)
.style("fill", "none")
.style("stroke", "black");
svg.selectAll("g .tick text")
.style("font-size", "9pt")
.style("font-weight", "initial");
//estatus normal
svg.append("rect")
.attr("id", "warning_rect")
.attr("x", 3)
.attr("y", 0)
.attr("width", 300)
.attr("height", 200)
.style("fill", "#82B92E");
//controls the inverse warning
if(inverse_w == 0){
svg.append("rect").transition()
.duration(600)
.attr("id", "warning_rect")
.attr("x", 3)
.attr("y", ((range_max - min_w) * position) - ((max_w - min_w) * position))
.attr("width", 300)
.attr("height", ((max_w - min_w) * position))
.style("fill", "#ffd731");
}
else {
svg.append("rect").transition()
.duration(600)
.attr("id", "warning_rect")
.attr("x", 3)
.attr("y", 200 - ((min_w -range_min) * position))
.attr("width", 300)
.attr("height", (min_w -range_min) * position)
.style("fill", "#ffd731");
svg.append("rect").transition()
.duration(600)
.attr("id", "warning_inverse_rect")
.attr("x", 3)
.attr("y", 0)
.attr("width", 300)
.attr("height", ((range_max - min_w) * position) - ((max_w - min_w) * position))
.style("fill", "#ffd731");
}
//controls the inverse critical
if(inverse_c == 0){
svg.append("rect").transition()
.duration(600)
.attr("id", "critical_rect")
.attr("x", 3)
.attr("y", ((range_max - min_c) * position) - ((max_c - min_c) * position))
.attr("width", 300)
.attr("height", ((max_c - min_c) * position))
.style("fill", "#fc4444");
}
else {
svg.append("rect").transition()
.duration(600)
.attr("id", "critical_rect")
.attr("x", 3)
.attr("y", 200 - ((min_c -range_min) * position))
.attr("width", 300)
.attr("height", (min_c -range_min) * position)
.style("fill", "#fc4444");
svg.append("rect").transition()
.duration(600)
.attr("id", "critical_inverse_rect")
.attr("x", 3)
.attr("y", 0)
.attr("width", 300)
.attr("height", ((range_max - min_c) * position) - ((max_c - min_c) * position))
.style("fill", "#fc4444");
}
}
else {
var message_error_warning = '<?php echo __("Please introduce a maximum warning higher than the minimun warning") ?>';
var message_error_critical = '<?php echo __("Please introduce a maximum critical higher than the minimun critical") ?>';
d3.select("#svg_dinamic rect").remove();
//create svg
var svg = d3.select("#svg_dinamic");
svg.selectAll("g").remove();
svg.selectAll("rect").remove();
svg.selectAll("text").remove();
//message error warning
if (error_w == 1) {
$("#text-max_warning").addClass("input_error");
svg.append("text")
.attr("x", -90)
.attr("y", 10)
.attr("fill", 'black')
.style("font-family", "arial")
.style("font-weight", "bold")
.style("font-size", 14)
.style("fill", "red")
.html(message_error_warning)
.style("text-anchor", "first");
}
//message error critical
if (error_c == 1) {
$("#text-max_critical").addClass("input_error");
svg.append("text")
.attr("x", -90)
.attr("y", 105)
.attr("fill", 'black')
.style("font-family", "arial")
.style("font-weight", "bold")
.style("font-size", 14)
.style("fill", "red")
.html(message_error_critical)
.style("text-anchor", "first");
}
}
}
</script>

View File

@ -61,10 +61,10 @@ switch ($action) {
switch ($config["dbtype"]) {
case "mysql":
$items = db_get_all_rows_sql('
SELECT id_gs, `order`
SELECT id_gs, `field_order`
FROM tgraph_source
WHERE id_graph = ' . $id_graph . '
ORDER BY `order`');
ORDER BY `field_order`');
break;
}
@ -77,7 +77,7 @@ switch ($action) {
switch ($config["dbtype"]) {
case "mysql":
db_process_sql_update('tgraph_source',
array('`order`' => $order_temp),
array('`field_order`' => $order_temp),
array('id_gs' => $item['id_rc']));
break;
}
@ -89,10 +89,10 @@ switch ($action) {
switch ($config["dbtype"]) {
case "mysql":
$items = db_get_all_rows_sql('
SELECT id_gs, `order`
SELECT id_gs, `field_order`
FROM tgraph_source
WHERE id_graph = ' . $id_graph . '
ORDER BY `order`');
ORDER BY `field_order`');
break;
}
@ -106,7 +106,7 @@ switch ($action) {
foreach ($items as $item) {
//Remove the contents from the block to sort
if (array_search($item['id_gs'], $ids) === false) {
$temp[$item['order']] = $item['id_gs'];
$temp[$item['field_order']] = $item['id_gs'];
}
}
$items = $temp;
@ -142,7 +142,7 @@ switch ($action) {
case "mysql":
db_process_sql_update('tgraph_source',
array('`order`' => ($order + 1)),
array('`field_order`' => ($order + 1)),
array('id_gs' => $id));
break;
}
@ -166,7 +166,7 @@ if ($editGraph) {
WHERE t2.id_agente_modulo = t1.id_agent_module))
AS agent_name
FROM tgraph_source t1
WHERE t1.id_graph = " . $id_graph . " order by `order`");
WHERE t1.id_graph = " . $id_graph . " order by `field_order`");
$position_array = array();
$module_array = array();
$weight_array = array();
@ -183,7 +183,7 @@ if ($editGraph) {
$weight_array[] = $graphRow['weight'];
$label_array[] = $graphRow['label'];
$agent_array[] = $graphRow['agent_name'];
$position_array[] = $graphRow['order'];
$position_array[] = $graphRow['field_order'];
}
$graphInTgraph = db_get_row_sql("SELECT * FROM tgraph WHERE id_graph = " . $id_graph);
@ -280,9 +280,9 @@ if (defined("METACONSOLE")) {
else {
$table->data[0][0] = "<b>". __("Sort items") . "</b>";
}
$table->data[1][0] = __('Sort selected items from position: ');
$table->data[1][0] = __('Sort selected items');
$table->data[1][1] = html_print_select_style(
array('before' => __('Move before to'), 'after' => __('Move after to')), 'move_to',
array('before' => __('before to'), 'after' => __('after to')), 'move_to',
'', '', '', '', 0, true);
$table->data[1][2] = html_print_input_text_extended('position_to_sort', 1,
'text-position_to_sort', '', 3, 10, false, "only_numbers('position_to_sort');", '', true);

View File

@ -66,6 +66,9 @@ if ($edit_graph) {
$height = $graphInTgraph['height'];
$check = false;
$percentil = $graphInTgraph['percentil'];
$summatory_series = $graphInTgraph['summatory_series'];
$average_series = $graphInTgraph['average_series'];
$modules_series = $graphInTgraph['modules_series'];
if ($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
$stacked = CUSTOM_GRAPH_BULLET_CHART;
@ -84,6 +87,9 @@ else {
$stacked = 4;
$check = false;
$percentil = 0;
$summatory_series = 0;
$average_series = 0;
$modules_series = 0;
}
@ -177,6 +183,16 @@ echo "</div></td>";
echo "<tr><td class='datos2'><b>".__('Percentil')."</b></td>";
echo "<td class='datos2'>" . html_print_checkbox ("percentil", 1, $percentil, true) . "</td></tr>";
echo "<tr><td class='datos2'><b>".__('Add summatory series') .
ui_print_help_tip (__("Adds synthetic series to the graph, using all module
values to calculate the summation and/or average in each time interval.
This feature could be used instead of synthetic modules if you only want to see a graph."), true) . "</b></td>";
echo "<td class='datos2'>" . html_print_checkbox ("summatory_series", 1, $summatory_series, true) . "</td>
<td class='datos2'><b>".__('Add average series')."</b></td>";
echo "<td class='datos2'>" . html_print_checkbox ("average_series", 1, $average_series, true) . "</td></tr>";
echo "<tr><td class='datos2'><b>".__('Modules and series')."</b></td>";
echo "<td class='datos2'>" . html_print_checkbox ("modules_series", 1, $modules_series, true) . "</td></tr>";
echo "</table>";
if ($edit_graph) {
@ -195,6 +211,12 @@ echo '<script type="text/javascript">
}else{
$("#thresholdDiv").hide();
}
if(!$("#checkbox-summatory_series").is(":checked") && !$("#checkbox-average_series").is(":checked")){
$("#checkbox-modules_series").attr("disabled", true);
$("#checkbox-modules_series").attr("checked", false);
}
});
$("#stacked").change(function(){
@ -215,5 +237,23 @@ echo '<script type="text/javascript">
}
});
$("#checkbox-summatory_series").change(function() {
if($("#checkbox-summatory_series").is(":checked") && $("#checkbox-modules_series").is(":disabled")) {
$("#checkbox-modules_series").removeAttr("disabled");
} else if(!$("#checkbox-average_series").is(":checked")) {
$("#checkbox-modules_series").attr("disabled", true);
$("#checkbox-modules_series").attr("checked", false);
}
});
$("#checkbox-average_series").change(function() {
if($("#checkbox-average_series").is(":checked") && $("#checkbox-modules_series").is(":disabled")) {
$("#checkbox-modules_series").removeAttr("disabled");
} else if(!$("#checkbox-summatory_series").is(":checked")) {
$("#checkbox-modules_series").attr("disabled", true);
$("#checkbox-modules_series").attr("checked", false);
}
});
</script>';
?>

View File

@ -87,6 +87,9 @@ if ($add_graph) {
$period = get_parameter_post ("period");
$threshold = get_parameter('threshold');
$percentil = get_parameter ("percentil", 0);
$summatory_series = get_parameter ("summatory_series", 0);
$average_series = get_parameter ("average_series", 0);
$modules_series = get_parameter ("modules_series", 0);
if ($threshold == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
$stacked = $threshold;
@ -103,7 +106,10 @@ if ($add_graph) {
'private' => 0,
'id_group' => $idGroup,
'stacked' => $stacked,
'percentil' => $percentil
'percentil' => $percentil,
'summatory_series' => $summatory_series,
'average_series' => $average_series,
'modules_series' => $modules_series
);
if (trim($name) != "") {
@ -131,6 +137,9 @@ if ($update_graph) {
$period = get_parameter('period');
$stacked = get_parameter('stacked');
$percentil = get_parameter('percentil');
$summatory_series = get_parameter ("summatory_series");
$average_series = get_parameter ("average_series");
$modules_series = get_parameter ("modules_series");
$alerts = get_parameter('alerts');
$threshold = get_parameter('threshold');
@ -141,7 +150,10 @@ if ($update_graph) {
if (trim($name) != "") {
$success = db_process_sql_update('tgraph',
array('name' => $name, 'id_group' => $id_group, 'description' => $description, 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked, 'percentil' => $percentil ),
array('name' => $name, 'id_group' => $id_group, 'description' => $description,
'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked,
'percentil' => $percentil, 'summatory_series' => $summatory_series,
'average_series' => $average_series, 'modules_series' => $modules_series),
array('id_graph' => $id_graph));
if ($success !== false)
db_pandora_audit("Report management", "Update graph #$id_graph");
@ -180,8 +192,12 @@ if ($add_module) {
"')");
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
foreach($id_agent_modules as $id_agent_module)
$result = db_process_sql_insert('tgraph_source', array('id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight));
$order = db_get_row_sql("SELECT `field_order` from tgraph_source ORDER BY `field_order` DESC");
$order = $order['field_order'];
foreach($id_agent_modules as $id_agent_module){
$order++;
$result = db_process_sql_insert('tgraph_source', array('id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight, 'field_order' => $order));
}
}
else
$result = false;

View File

@ -18,12 +18,18 @@ global $config;
// Check user credentials
check_login ();
if (! check_acl ($config['id_user'], 0, "RW")) {
if (! check_acl ($config['id_user'], 0, "RR")) {
db_pandora_audit("ACL Violation",
"Trying to access Inventory Module Management");
require ("general/noaccess.php");
return;
}
$report_r = check_acl ($config['id_user'], 0, "RR");
$report_w = check_acl ($config['id_user'], 0, "RW");
$report_m = check_acl ($config['id_user'], 0, "RM");
$access = ($report_r == true) ? 'RR' : (($report_w == true) ? 'RW' : (($report_m == true) ? 'RM' : 'RR'));
require_once ('include/functions_container.php');
$delete_container = get_parameter('delete_container',0);
@ -72,13 +78,13 @@ $container = folder_get_folders();
$tree = folder_get_folders_tree_recursive($container);
echo folder_togge_tree_folders($tree);
echo "<div style='float: right;'>";
if($report_r && $report_w){
echo "<div style='float: right;'>";
echo '<form method="post" style="float:right;" action="index.php?sec=reporting&sec2=godmode/reporting/create_container">';
html_print_submit_button (__('Create container'), 'create', false, 'class="sub next" style="margin-right:5px;margin-top: 15px;"');
echo "</form>";
echo "</div>";
echo "</div>";
}
?>
<script type="text/javascript">
@ -102,7 +108,7 @@ echo "</div>";
}
$('div[class *= bullet]').css('margin-left','0');
$('div[class *= graph]').css('margin-left','0');
$('div[class = graph]').css('margin-left','0');
$('div[id *= gauge_]').css('width','100%');
$('select[id *= period_container_'+hash+']').change(function() {

View File

@ -34,10 +34,14 @@ $hack_metaconsole = '';
if (defined('METACONSOLE'))
$hack_metaconsole = '../../';
$buttons['visual_console_favorite'] = array('active' => false,
'text' => '<a href="index.php?sec=network&sec2=godmode/reporting/visual_console_favorite">' .
html_print_image ("images/list.png", true, array ("title" => __('Visual Favourite Console'))) .'</a>');
if (!defined('METACONSOLE')) {
ui_print_page_header(
__('Reporting') .' &raquo; ' . __('Visual Console'),
"images/op_reporting.png", false, "map_builder");
"images/op_reporting.png", false, "map_builder", false, $buttons);
}
$id_layout = (int) get_parameter ('id_layout');

View File

@ -2104,7 +2104,7 @@ if ($resultOperationDB !== null) {
$err.='';
break;
}
ui_print_result_message ($resultOperationDB, __('Successfull action'), __('Unsuccessfull action<br><br>'.$err));
ui_print_result_message ($resultOperationDB, __('Successfull action'), __('Unsuccessful action<br><br>'.$err));
}
switch ($activeTab) {

View File

@ -177,6 +177,9 @@ $table->data[5][1] .= '<span class="opt" style="visibility:hidden;">
value="modsize">' . __('Get default image size') .
'</button></span>';
$table->data[6][0] = __('Fovourite visual console');
$table->data[6][1] = html_print_checkbox('is_favourite', 0, $is_favourite, true);
if ($action == 'new') {
$textButtonSubmit = __('Save');
$classButtonSubmit = 'sub wand';
@ -204,10 +207,11 @@ $(document).ready (function () {
var metaconsole = null;
function is_metaconsole() {
if (metaconsole === null)
metaconsole = $("input[name='metaconsole']").val();
if (metaconsole != 0)
if (metaconsole != 0 && metaconsole != undefined)
return true;
else
return false;
@ -326,7 +330,9 @@ $(document).ready (function () {
var size_changer_state = false;
$("#background").change(function() {
$('#imagen2').attr('src', url_hack_metaconsole + 'images/console/background/'+$('#background').val());
$('#imagen2').width(230);
$('#imagen2').show();
});
@ -376,6 +382,22 @@ $(document).ready (function () {
$("#text-background_color").attachColorPicker();
if($("#checkbox-is_favourite").is(":checked")) {
$("#hidden-is_favourite_sent").val(1);
}
else{
$("#hidden-is_favourite_sent").val(0);
}
$("#checkbox-is_favourite").change(function(){
if($(this).is(":checked")) {
$("#hidden-is_favourite_sent").val(1);
}
else{
$("#hidden-is_favourite_sent").val(0);
}
});
});
</script>

View File

@ -375,7 +375,7 @@ function update_button_palette_callback() {
}
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', 70);
@ -503,7 +503,7 @@ function update_button_palette_callback() {
}
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', 70);
@ -679,7 +679,7 @@ function update_button_palette_callback() {
}
$("#image_" + idItem).attr('src', "images/spinner.gif");
if ((values['width'] == 0) || (values['height'] == 0)) {
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', 70);
@ -2807,7 +2807,7 @@ function createItem(type, values, id_data) {
// Do none
if(values['image'] != '' && values['image'] != 'none'){
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$image.attr('width', '70')
.attr('height', '70');
}
@ -2932,7 +2932,7 @@ function createItem(type, values, id_data) {
if(values['image'] != '' && values['image'] != 'none'){
// Do none
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$image.attr('width', '70')
.attr('height', '70');
}
@ -3030,8 +3030,7 @@ function createItem(type, values, id_data) {
if ((values['width'] == 0) || (values['height'] == 0)) {
// Do none
if(values['image'] != '' && values['image'] != 'none'){
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$image.attr('width', '70')
.attr('height', '70');
}
@ -3039,8 +3038,6 @@ function createItem(type, values, id_data) {
$image.attr('width', $('#preview > img')[0].naturalWidth)
.attr('height', $('#preview > img')[0].naturalHeight);
}
}
else{
$image.attr('width', '70')
@ -3166,7 +3163,7 @@ function createItem(type, values, id_data) {
if(values['image'] != '' && values['image'] != 'none'){
// Do none
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$image.attr('width', '70')
.attr('height', '70');
}
@ -3447,7 +3444,7 @@ function createItem(type, values, id_data) {
break;
case 'icon':
if ((values['width'] == 0) || (values['height'] == 0)) {
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
sizeStyle = 'width: ' + '70' + 'px; height: ' + '70' + 'px;';
imageSize = 'width="' + '70' + '" height="' + '70' + '"';
}

View File

@ -107,6 +107,7 @@ switch ($activeTab) {
$width = '';
$height = '';
$visualConsoleName = '';
$is_favourite = 0;
break;
case 'update':
@ -117,6 +118,7 @@ switch ($activeTab) {
$width = (int) get_parameter('width');
$height = (int) get_parameter('height');
$visualConsoleName = (string) get_parameter('name');
$is_favourite = (int) get_parameter('is_favourite_sent');
// ACL for the new visual console
//$vconsole_read_new = check_acl ($config['id_user'], $idGroup, "VR");
@ -137,7 +139,8 @@ switch ($activeTab) {
'background' => $background,
'background_color' => $background_color,
'width' => $width,
'height' => $height
'height' => $height,
'is_favourite' => $is_favourite
);
$error = $_FILES['background_image']['error'];
@ -268,6 +271,7 @@ switch ($activeTab) {
$background_color = $visualConsole['background_color'];
$width = $visualConsole['width'];
$height = $visualConsole['height'];
$is_favourite = $visualConsole['is_favourite'];
break;
}
break;
@ -296,7 +300,7 @@ switch ($activeTab) {
'flag' => true,
'message' => ui_print_result_message($result,
__('Successfully multiple delete.'),
__('Unsuccessfull multiple delete.'), '', true));
__('Unsuccessful multiple delete.'), '', true));
break;
case 'update':
//Update background

View File

@ -0,0 +1,123 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
require_once ($config['homedir'] . '/include/functions_visual_map.php');
// ACL for the general permission
$vconsoles_read = check_acl ($config['id_user'], 0, "VR");
$vconsoles_write = check_acl ($config['id_user'], 0, "VW");
$vconsoles_manage = check_acl ($config['id_user'], 0, "VM");
if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) {
db_pandora_audit("ACL Violation",
"Trying to access map builder");
require ("general/noaccess.php");
exit;
}
$buttons['map_builder'] = array('active' => false,
'text' => '<a href="index.php?sec=network&sec2=godmode/reporting/map_builder">' .
html_print_image ("images/visual_console.png", true, array ("title" => __('Visual Console'))) .'</a>');
if (!defined('METACONSOLE')) {
ui_print_page_header(
__('Reporting') .' &raquo; ' . __('Visual Favourite Console'),
"images/op_reporting.png", false, "map_builder", false, $buttons);
}
$search = (string) get_parameter("search","");
$ag_group = (int) get_parameter("ag_group",0);
$recursion = (int) get_parameter("recursion",0);
if(!is_metaconsole()){
echo "<form method='post'
action='index.php?sec=network&amp;sec2=godmode/reporting/visual_console_favorite'>";
} else {
echo "<form method='post'
action='index.php?sec=screen&sec2=screens/screens&action=visualmap'>";
}
echo "<ul class='form_flex'><li class='first_elements'>";
echo "<ul><li>";
echo __('Search') . '&nbsp;';
html_print_input_text ("search", $search, '', 50);
echo "</li><li>";
echo __('Group') . '&nbsp;';
$own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "AW"))
$return_all_group = false;
else
$return_all_group = true;
html_print_select_groups(false, "AR", $return_all_group, "ag_group",
$ag_group, 'this.form.submit();', '', 0, false,
false, true, '', false
);
echo "</li></ul></li><li class='second_elements'><ul><li>";
echo __('Group Recursion');
html_print_checkbox ("recursion", 1, $recursion, false, false, 'this.form.submit()');
echo "</li><li>";
echo "<input name='search_visual_console' type='submit' class='sub search' value='".__('Search')."'>";
echo "</li></ul></li></ul>";
echo "</form>";
$returnAllGroups = 0;
$filters = array();
if(!empty($search)){
$filters['name'] = io_safe_input($search);
}
if ($ag_group > 0) {
$ag_groups = array();
$ag_groups = (array)$ag_group;
if ($recursion) {
$ag_groups = groups_get_id_recursive($ag_group, true);
}
}
elseif($own_info['is_admin']){
$returnAllGroups = 1;
}
if($ag_group){
$filters['group'] = array_flip($ag_groups);
}
$favorite_array = visual_map_get_user_layouts ($config['id_user'],false,$filters,$returnAllGroups,true);
echo "<div id='is_favourite'>";
if($favorite_array == false){
ui_print_error_message(__('No data to show'));
}
else{
echo "<ul class='container'>";
foreach( $favorite_array as $favorite_k => $favourite_v ){
echo "<a href='index.php?sec=network&sec2=operation/visual_console/render_view&id=" . $favourite_v["id"] .
"' title='Visual console". $favourite_v["name"] ."' alt='". $favourite_v["name"] ."'><li>";
echo "<div class='icon_img'>";
echo html_print_image ("images/groups_small/" . groups_get_icon($favourite_v["id_group"]).".png",
true,
array ("style" => '')
);
echo "</div>";
echo "<div class='text'>";
echo $favourite_v["name"];
echo "</div>";
echo "</li></a>";
}
echo "</ul>";
}
echo "</div>";
?>

View File

@ -121,8 +121,8 @@ echo '<br />';
echo '<div style="font-family: lato, "Helvetica Neue", Helvetica, Arial, sans-serif; color: #515151;">';
echo __('Remote Management System');
echo '</div>';
echo '<a target="_blank" rel="noopener noreferrer" href="http://ehorus.com">';
echo 'http://ehorus.com';
echo '<a target="_blank" rel="noopener noreferrer" href="https://ehorus.com">';
echo 'https://ehorus.com';
echo '</a>';
echo '</div>';

View File

@ -188,7 +188,7 @@ $table->data[32][0] = __('Server logs directory') . ui_print_help_tip (__("Direc
$table->data[32][1] = html_print_input_text ('server_log_dir',
$config["server_log_dir"], '', 50, 255, true);
$table->data[33][0] = __('Log size limit in system logs viewer extension') . ui_print_help_tip (__("Maximun size to show in system log extension."), true);
$table->data[33][0] = __('Log size limit in system logs viewer extension') . ui_print_help_tip (__("Max size (in bytes) for the logs to be shown."), true);
$table->data[33][1] = html_print_input_text ('max_log_size',
$config["max_log_size"], '', 10, 255, true) . html_print_label(" x1000", "max_log_size", true);
@ -209,8 +209,8 @@ $table->data[34][0] = __('Allow create planned downtimes in the past') .
$table->data[34][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('past_planned_downtimes', 1, '', $config["past_planned_downtimes"], true).'&nbsp;&nbsp;';
$table->data[34][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('past_planned_downtimes', 0, '', $config["past_planned_downtimes"], true);
$table->data[35][0] = __('Limit parameters bulk') .
ui_print_help_tip(__('Your PHP environment is setted with %d max_input_vars. Maybe you must not set this value with upper values.', ini_get("max_input_vars")), true);
$table->data[35][0] = __('Limit for bulk operations') .
ui_print_help_tip(__('Your PHP environment is set to 1000 max_input_vars. This parameter should have the same value or lower.', ini_get("max_input_vars")), true);
$table->data[35][1] = html_print_input_text('limit_parameters_massive',
$config['limit_parameters_massive'], '', 10, 10, true);

View File

@ -561,6 +561,41 @@ html_print_table ($table_chars);
echo "</fieldset>";
//----------------------------------------------------------------------
//----------------------------------------------------------------------
// Visual Consoles
//----------------------------------------------------------------------
$table_vc = new stdClass();
$table_vc->width = '100%';
$table_vc->class = "databox filters";
$table_vc->style[0] = 'font-weight: bold';
$table_vc->size[0] = '50%';
$table_vc->data = array ();
$vc_favourite_view_array[0] = 'Classic view';
$vc_favourite_view_array[1] = 'View of favorites';
$table_vc->data[$row][0] = __('Type of view of visual consoles') .
ui_print_help_tip(__('Allows you to directly display the list of favorite visual consoles'), true);
$table_vc->data[$row][1] = html_print_select($vc_favourite_view_array, 'vc_favourite_view', $config["vc_favourite_view"], '', '', 0, true);
$row++;
$table_vc->data[$row][0] = __('Number of favorite visual consoles to show in the menu') .
ui_print_help_tip(__('If the number is 0 it will not show the pull-down menu and maximum 25 favorite consoles'), true);
//$table_vc->data[$row][1] = html_print_input_text ('vc_menu_items', $config["vc_menu_items"], '', 5, 5, true);
$table_vc->data[$row][1] = "<input type ='number' value=".$config["vc_menu_items"]." size='5' name='vc_menu_items' min='0' max='25'>";
$row++;
if (empty($config["vc_line_thickness"])) $config["vc_line_thickness"] = 2;
$table_vc->data[$row][0] = __('Default line thickness for the Visual Console') .
ui_print_help_tip(__('This interval will affect to the lines between elements on the Visual Console'), true);
$table_vc->data[$row][1] = html_print_input_text ('vc_line_thickness', $config["vc_line_thickness"], '', 5, 5, true);
echo "<fieldset>";
echo "<legend>" . __('Visual consoles configuration') . "</legend>";
html_print_table ($table_vc);
echo "</fieldset>";
//----------------------------------------------------------------------
// OTHER CONFIGURATION
//----------------------------------------------------------------------
@ -571,11 +606,6 @@ $table_other->style[0] = 'font-weight: bold;';
$table_other->size[0] = '50%';
$table_other->data = array ();
if (empty($config["vc_line_thickness"])) $config["vc_line_thickness"] = 2;
$table_other->data[$row][0] = __('Default line thickness for the Visual Console') . ui_print_help_tip(__('This interval will affect to the lines between elements on the Visual Console'), true);
$table_other->data[$row][1] = html_print_input_text ('vc_line_thickness', $config["vc_line_thickness"], '', 5, 5, true);
$row++;
// Enrique (27/01/2017) New feature: Show report info on top of reports
$table_other->data[$row][0] = __('Show report info with description') .
ui_print_help_tip(
@ -624,7 +654,7 @@ $table_other->data['custom_report_front-logo'][0] = __('Custom report front') .
$table_other->data['custom_report_front-logo'][1] = html_print_select(
$customLogos,
'custom_report_front_logo',
$config['custom_report_front_logo'],
io_safe_output($config['custom_report_front_logo']),
'showPreview()',
__('Default'),
'',

View File

@ -644,7 +644,7 @@ if ($create_alert || $update_alert) {
echo ui_print_help_icon ("snmp_alert_custom", true);
echo '</td><td class="datos">';
html_print_textarea ("custom_value", $custom_value, 2, $custom_value, 'style="width:400px;"');
html_print_textarea ("custom_value", 2, 2, $custom_value, 'style="width:400px;"');
echo '</td></tr>';

View File

@ -13,7 +13,6 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Check ACL
if (! check_acl ($config['id_user'], 0, "LW")) {
db_pandora_audit("ACL Violation",
@ -90,7 +89,7 @@ if ($update_filter > -2) {
$values = array(
'description' => $description,
'filter' => $filter,
'unified_filters_id' => 0);
'unified_filters_id' => $new_unified_id);
$result = db_process_sql_insert('tsnmp_filter', $values);
}
else {
@ -142,6 +141,7 @@ if ($edit_filter > -1) {
// Create/update form
if ($edit_filter > -2) {
$index = $index_post;
$table = new stdClass();
$table->data = array ();
$table->id = 'filter_table';
$table->width = '100%';
@ -150,8 +150,16 @@ if ($edit_filter > -2) {
$table->data[0][1] = html_print_input_text ('description', $description, '', 60, 100, true);
$table->data[1][0] = __('Filter');
if ($edit_filter > -1) {
$filters = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = (SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $edit_filter . ")");
$unified_filter = db_get_value_sql("SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter != 0 AND id_snmp_filter = " . $edit_filter);
if($unified_filter){
$filters = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = " . $unified_filter);
}
else{
$filters = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE id_snmp_filter = " . $edit_filter);
}
$j = 1;
foreach ($filters as $f) {
if ($j != 1) {
$table->data[$j][0] = "";
@ -203,6 +211,7 @@ else {
$aglomerate_result[$res['unified_filters_id']] = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = " . $res['unified_filters_id'] . " ORDER BY id_snmp_filter ASC");
}
$table = new stdClass();
$table->data = array ();
$table->head = array ();
$table->size = array ();

View File

@ -180,7 +180,7 @@ if ($create_user) {
$values["data_section"] = $dashboard;
} else if (io_safe_output($values['section']) == 'Visual console') {
$values["data_section"] = $visual_console;
} else if ($values['section'] == 'Other'){
} else if ($values['section'] == 'Other' || io_safe_output($values['section']) == 'External link'){
$values["data_section"] = get_parameter ('data_section');
}
@ -236,8 +236,6 @@ if ($create_user) {
case "postgresql":
$result = create_user($id, $password_new, $values);
if ($result) {
db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password&#x20;change',
'descripcion' => 'Access password updated','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time()));
$res = save_pass_history($id, $password_new);
}
break;
@ -306,7 +304,7 @@ if ($update_user) {
$values["data_section"] = $dashboard;
} else if (io_safe_output($values['section']) == 'Visual console') {
$values["data_section"] = $visual_console;
} else if ($values['section'] == 'Other'){
} else if ($values['section'] == 'Other' || io_safe_output($values['section']) == 'External link'){
$values["data_section"] = get_parameter ('data_section');
}
@ -358,6 +356,8 @@ if ($update_user) {
}
}
else {
db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password&#x20;change',
'descripcion' => 'Access password update failed','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time()));
ui_print_error_message (__('Passwords does not match'));
}
}
@ -570,6 +570,7 @@ $values = array (
'Group view'=>__('Group view'),
'Tactical view'=>__('Tactical view'),
'Alert detail' => __('Alert detail'),
'External link' => __('External link'),
'Other'=>__('Other'));
if (enterprise_installed() && !is_metaconsole()) {
$values['Dashboard'] = __('Dashboard');
@ -870,6 +871,11 @@ function show_data_section () {
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "none");
break;
case <?php echo "'" . 'External link' . "'"; ?>:
$("#text-data_section").css("display", "");
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "none");
break;
case <?php echo "'" . 'Other' . "'"; ?>:
$("#text-data_section").css("display", "");
$("#dashboard").css("display", "none");

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -478,10 +478,13 @@ if ($get_extended_event) {
if ($get_events_details) {
$event_ids = explode(',',get_parameter ('event_ids'));
$events = db_get_all_rows_filter ('tevento',
array ('id_evento' => $event_ids,
'order' => 'utimestamp ASC'),
array ('evento', 'utimestamp', 'estado', 'criticity', 'id_usuario'));
$events = db_get_all_rows_filter (
'tevento',
array ('id_evento' => $event_ids,'order' => 'utimestamp ASC'),
array ('evento', 'utimestamp', 'estado', 'criticity', 'id_usuario'),
'AND',
true
);
$out = '<table class="eventtable" style="width:100%;height:100%;padding:0px 0px 0px 0px; border-spacing: 0px; margin: 0px 0px 0px 0px;">';
$out .= '<tr style="font-size:0px; heigth: 0px; background: #ccc;"><td></td><td></td></tr>';

View File

@ -772,7 +772,7 @@ if ($list_modules) {
$table->head[5] = __('Status') . ' ' .
'<a href="' . $url . '&sort_field=status&amp;sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectStatusUp, "alt" => "up")) . '</a>' .
'<a href="' . $url . '&sort_field=status&amp;sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectStatusDown, "alt" => "down")) . '</a>';
$table->head[6] = __('Warn');
$table->head[6] = __('Thresholds');
$table->head[7] = __('Data');
$table->head[8] = __('Graph');
$table->head[9] = __('Last contact') . ' ' .

View File

@ -60,7 +60,6 @@ if ($update_snmp_translation) {
if ($delete_snmp_filter) {
$filter_id = get_parameter('filter_id');
html_debug($filter_id, true);
db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $filter_id));
return;

View File

@ -177,8 +177,9 @@ function process_user_login_remote ($login, $pass, $api = false) {
switch ($config["auth"]) {
// LDAP
case 'ldap':
if (ldap_process_user_login ($login, $pass) === false) {
$config["auth_error"] = "User not found in database or incorrect password";
$sr = ldap_process_user_login ($login, $pass);
if(!$sr) {
return false;
}
break;
@ -217,8 +218,8 @@ function process_user_login_remote ($login, $pass, $api = false) {
if ($config["auth"] === 'ldap') {
$login_user_attribute = $login;
if (($config['ldap_login_user_attr'] != 'name') && ($config['ldap_login_user_attr'] != null)) {
$login = get_ldap_login_attr($login);
if ($config['ldap_login_user_attr'] == 'mail') {
$login = $sr["mail"][0];
}
}
@ -329,18 +330,46 @@ function process_user_login_remote ($login, $pass, $api = false) {
}
}
// Create the user
$prepare_perms = prepare_permissions_groups_of_user_ldap($login_user_attribute, $pass,
array ('fullname' => $login_user_attribute, 'comments' => 'Imported from ' . $config['auth']),
false, defined('METACONSOLE'));
$permissions = array();
if($config['ldap_advanced_config']){
$i = 0;
if (!$prepare_perms) {
$config["auth_error"] = __("User not found in database
or incorrect password");
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
return false;
foreach ($ldap_adv_perms as $ldap_adv_perm) {
$attributes = $ldap_adv_perm['groups_ldap'];
foreach ($attributes as $attr) {
$attr = explode('=',$attr);
if(in_array($attr[1],$sr[$attr[0]])) {
$permissions[$i]["profile"] = $ldap_adv_perm['profile'];
$permissions[$i]["groups"] = $ldap_adv_perm['group'];
$permissions[$i]["tags"] = implode(",",$ldap_adv_perm['tags']);
$i++;
break;
}
}
}
} else {
$permissions[0]["profile"] = $config['default_remote_profile'];
$permissions[0]["groups"][] = $config['default_remote_group'];
$permissions[0]["tags"] = $config['default_assign_tags'];
}
if(empty($permissions)) {
$config["auth_error"] = __("User not found in database or incorrect password");
return false;
} else {
$user_info['fullname'] = $sr['cn'][0];
$user_info['email'] = $sr['mail'][0];
// Create the user
$create_user = create_user_and_permisions_ldap($login, $pass, $user_info, $permissions, defined('METACONSOLE'));
}
}
else {
$user_info = array ('fullname' => $login,
@ -689,139 +718,72 @@ function ldap_process_user_login ($login, $password) {
}
}
$correct_admin_bind = true;
if($config['ldap_function'] == 'local'){
$sr = local_ldap_search($config["ldap_server"], $config["ldap_port"], $config["ldap_version"],
io_safe_output($config["ldap_base_dn"]), $config['ldap_login_attr'],
io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'], io_safe_output($login));
if($sr) {
$user_dn = $sr["dn"][0];
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
if(!empty($ldap_base_dn)) {
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($user_dn), $password) ) {
@ldap_close ($ds);
return $sr;
}
} else {
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
@ldap_close ($ds);
return $sr;
}
}
}
} else {
// PHP LDAP function
if ($config['ldap_admin_login'] != "" && $config['ldap_admin_pass'] != "") {
if (!@ldap_bind($ds, io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'])) {
$correct_admin_bind = false;
}
}
if (!$correct_admin_bind) {
$config["auth_error"] = 'Admin ldap connection fail';
@ldap_close ($ds);
return false;
}
}
$dc = io_safe_output($config["ldap_base_dn"]);
#Search group of this user it belong.
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($login) . ")";
$justthese = array("objectclass=group");
$sr = ldap_search($ds, $dc, $filter, $justthese);
$sr = ldap_search($ds, io_safe_output($config["ldap_base_dn"]), $filter);
$memberof = ldap_get_entries($ds, $sr);
if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) {
@ldap_close ($ds);
return false;
}
else {
} else {
$memberof = $memberof[0];
}
unset($memberof["count"]);
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
$correct = false;
if(!empty($ldap_base_dn)) {
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($memberof['dn']), $password) ) {
$correct = true;
@ldap_close ($ds);
return $memberof;
}
}
else {
} else {
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
$correct = true;
@ldap_close ($ds);
return $memberof;
}
}
}
@ldap_close ($ds);
if ($correct) {
return true;
}
else {
$config["auth_error"] = 'User not found in database or incorrect password';
return false;
}
}
function get_ldap_login_attr ($login) {
global $config;
if (! function_exists ("ldap_connect")) {
$config["auth_error"] = __('Your installation of PHP does not support LDAP');
return false;
}
// Connect to the LDAP server
$ds = @ldap_connect ($config["ldap_server"], $config["ldap_port"]);
if (!$ds) {
$config["auth_error"] = 'Error connecting to LDAP server';
return false;
}
// Set the LDAP version
ldap_set_option ($ds, LDAP_OPT_PROTOCOL_VERSION, $config["ldap_version"]);
if ($config["ldap_start_tls"]) {
if (!@ldap_start_tls ($ds)) {
$config["auth_error"] = 'Could not start TLS for LDAP connection';
@ldap_close ($ds);
return false;
}
}
$id_user = $login;
switch ($config['ldap_login_user_attr']) {
case 'mail':
$dc = io_safe_output($config["ldap_base_dn"]);
$correct_admin_bind = true;
if ($config['ldap_admin_login'] != "" && $config['ldap_admin_pass'] != "") {
if (!@ldap_bind($ds, io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'])) {
$correct_admin_bind = false;
}
}
if (!$correct_admin_bind) {
$config["auth_error"] = 'Admin ldap connection fail';
@ldap_close ($ds);
return false;
}
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")";
$justthese = array("mail");
$sr = ldap_search($ds, $dc, $filter, $justthese);
$info = ldap_get_entries($ds, $sr);
if ($info["count"] == 0 && !isset($info[0]["mail"])) {
@ldap_close ($ds);
return $id_user;
}
else {
$info = $info[0];
}
$id_user = $info['mail'][0];
@ldap_close ($ds);
break;
}
return $id_user;
}
/**
@ -844,203 +806,6 @@ function is_user_blacklisted ($user) {
return false;
}
/**
* Check permissions in LDAP for prepare to create user in Pandora.
*
* @param string Login
* @param string Password
* @param string User Info
* @param string check_permissions Check if change permissions
*
* @return bool True if the login succeeds, false otherwise
*/
function prepare_permissions_groups_of_user_ldap ($id_user, $password,
$user_info, $check_permissions = false, $syncronize = false) {
global $config;
include_once($config['homedir'] . "/include/functions_html.php");
if (! function_exists ("ldap_connect")) {
return false;
}
// Do not allow blank passwords
if ($password == "") {
return false;
}
// Connect to the LDAP server
$ds = @ldap_connect ($config["ldap_server"], $config["ldap_port"]);
if (!$ds) {
return false;
}
// Set the LDAP version
ldap_set_option ($ds, LDAP_OPT_PROTOCOL_VERSION, $config["ldap_version"]);
if ($config["ldap_start_tls"]) {
if (!@ldap_start_tls ($ds)) {
@ldap_close ($ds);
return false;
}
}
$dc = io_safe_output($config["ldap_base_dn"]);
$correct_admin_bind = true;
if ($config['ldap_admin_login'] != "" && $config['ldap_admin_pass'] != "") {
if (!@ldap_bind($ds, io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'])) {
$correct_admin_bind = false;
}
}
if (!$correct_admin_bind) {
$config["auth_error"] = 'Admin ldap connection fail';
@ldap_close ($ds);
return false;
}
#Search group of this user it belong.
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")";
$justthese = array("objectclass=group");
$sr = ldap_search($ds, $dc, $filter, $justthese);
$memberof = ldap_get_entries($ds, $sr);
if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) {
@ldap_close ($ds);
return false;
}
else {
$memberof = $memberof[0];
}
unset($memberof["count"]);
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
$correct = false;
if(!empty($ldap_base_dn)) {
if (strlen($password) != 0 && @ldap_bind($ds, $memberof['dn'], $password) ) {
$correct = true;
}
}
else {
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
$correct = true;
}
}
if (!$correct) {
@ldap_close ($ds);
return false;
}
$permissions = array();
$i = 0;
$count_total = 0;
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
foreach ($ldap_adv_perms as $ldap_adv_perm) {
$groups = $ldap_adv_perm['groups_ldap'];
if ($groups[0] == '') {
$groups = array();
}
else {
$groups = $groups[0];
}
$count_ad_adv_perms = count(explode(",", $groups));
$tags_ids = array();
$tags = implode(",", $tags);
if ($tags == null) {
$tags = "";
}
foreach ($memberof as $member) {
$member_to_compare = str_replace($config['ldap_login_attr'] . "=", "", $member);
$member_to_compare = str_replace($id_user . ",", "", $member_to_compare);
$member_to_compare = str_replace("," . $dc, "", $member_to_compare);
if (($member_to_compare == $dc) && (empty($groups))) {
$count_total++;
}
else {
$member_to_compare = explode(",", $member_to_compare);
$groups = explode(",", $groups);
foreach ($groups as $g) {
if ($member_to_compare[0] == $g) {
$count_total++;
}
}
}
}
if ($count_total > 0) {
$profile_id = $ldap_adv_perm['profile'];
$id_grupos = $ldap_adv_perm['group'];
if (empty($profile_id)) {
@ldap_close ($ds);
return false;
}
$permissions[$i]["profile"] = $profile_id;
$permissions[$i]["groups"] = $id_grupos;
$permissions[$i]["tags"] = $tags;
}
$i++;
$count_total = 0;
$count_ad_adv_perms = 0;
}
if ( $check_permissions ) {
$result = check_permission_ldap ($id_user, $password, $user_info, $permissions, $syncronize);
@ldap_close ($ds);
return $result;
}
if (!is_user ($id_user)) {
if (($config['ldap_login_user_attr'] != 'name') && ($config['ldap_login_user_attr'] != null)) {
switch ($config['ldap_login_user_attr']) {
case 'mail':
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")";
$justthese = array("mail");
$sr = ldap_search($ds, $dc, $filter, $justthese);
$info = ldap_get_entries($ds, $sr);
if ($info["count"] == 0 && !isset($info[0]["mail"])) {
@ldap_close ($ds);
return false;
}
else {
$info = $info[0];
}
$id_user = $info['mail'][0];
$user_info['fullname'] = $id_user;
break;
}
}
$create_user = create_user_and_permisions_ldap($id_user, $password, $user_info, $permissions, $syncronize);
}
@ldap_close ($ds);
return $create_user;
}
/**
* Create progile with data obtaint from AD
*
@ -1070,6 +835,7 @@ function create_user_and_permisions_ldap ($id_user, $password, $user_info,
if ($user) {
if (!empty($permissions)) {
foreach ($permissions as $permission) {
$id_profile = $permission["profile"];
$id_groups = $permission["groups"];
$tags = $permission["tags"];
@ -1280,7 +1046,7 @@ function check_permission_ldap ($id_user, $password, $user_info,
}
foreach ($no_found as $new_profiles) {
#Add the missing permissions
//Add the missing permissions
profile_create_user_profile ($id_user,
$new_profiles["id_perfil"],
$new_profiles["id_grupo"], false,
@ -1341,6 +1107,64 @@ function delete_user_pass_ldap ($id_user) {
return;
}
function safe_output_accute($string) {
$no_allowed= array ("á","é","í","ó","ú","Á","É","Í","Ó","Ú","ñ","Ñ");
$allowed= array ("a","e","i","o","u","A","E","I","O","U","n","N");
$result = str_replace($no_allowed, $allowed ,$string);
return $result;
}
function local_ldap_search($ldap_host, $ldap_port=389, $ldap_version=3, $dn, $access_attr, $ldap_admin_user, $ldap_admin_pass, $user) {
global $config;
$filter = "";
if(!empty($access_attr) && !empty($user)){
$filter = " -s sub '(" . $access_attr . "=" . $user . ")' ";
}
$tls = "";
if($config["ldap_start_tls"]) {
$tls = " -ZZ ";
}
$ldap_host = " -h " . $ldap_host;
$ldap_port = " -p ". $ldap_port;
$ldap_version = " -P ". $ldap_version;
if(!empty($ldap_admin_user)){
$ldap_admin_user = " -D '". $ldap_admin_user."'";
}
if(!empty($ldap_admin_pass)){
$ldap_admin_pass = " -w " . $ldap_admin_pass;
}
$dn = " -b '". $dn ."'";
$shell_ldap_search = explode("\n", shell_exec('ldapsearch -LLL -o ldif-wrap=no -x' . $ldap_host . $ldap_port . $ldap_version . ' -E pr=10000/noprompt ' . $ldap_admin_user . $ldap_admin_pass . $dn . $filter . $tls . ' | grep -v "^#\|^$" | sed "s/:\+ /=>/g"'));
foreach($shell_ldap_search as $line) {
$values = explode("=>", $line);
if(!empty($values[0]) && !empty($values[1])) {
$user_attr[$values[0]][] = $values[1];
}
}
if (empty($user_attr)) {
return false;
}
$base64 = preg_match('/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $user_attr["dn"][0]);
if($base64){
$user_dn = safe_output_accute(base64_decode($user_attr["dn"][0]));
} else {
$user_dn = safe_output_accute($user_attr["dn"][0]);
}
if(strlen($user_dn) > 0) {
$user_attr["dn"][0]=$user_dn;
}
return $user_attr;
}
//Reference the global use authorization error to last auth error.
$config["auth_error"] = &$mysql_cache["auth_error"];
?>

View File

@ -222,6 +222,12 @@ class Tree {
$agent_search_filter = " AND LOWER(ta.alias) LIKE LOWER('%".$this->filter['searchAgent']."%')";
}
//Search hirearchy
$search_hirearchy = false;
if($this->filter['searchHirearchy']){
$search_hirearchy = true;
}
// Agent status filter
$agent_status_filter = "";
if (isset($this->filter['statusAgent'])
@ -344,16 +350,49 @@ class Tree {
$group_filter = "AND ta.id_grupo IN ($user_groups_str)";
}
if(!$search_hirearchy && (!empty($agent_search_filter) || !empty($module_search_filter))){
if(is_metaconsole()){
$query_agent_search = " SELECT DISTINCT(ta.id_grupo)
FROM tmetaconsole_agent ta
WHERE ta.disabled = 0
$agent_search_filter";
$id_groups_agents = db_get_all_rows_sql($query_agent_search);
}
else{
$query_agent_search = " SELECT DISTINCT(ta.id_grupo)
FROM tagente ta, tagente_modulo tam
WHERE tam.id_agente = ta.id_agente
AND ta.disabled = 0
$agent_search_filter
$module_search_filter";
$id_groups_agents = db_get_all_rows_sql($query_agent_search);
}
if($id_groups_agents != false){
foreach ($id_groups_agents as $key => $value) {
$id_groups_agents_array[] = $value['id_grupo'];
}
$user_groups_array = explode(",", $user_groups_str);
$user_groups_array = array_intersect($user_groups_array, $id_groups_agents_array);
$user_groups_str = implode("," , $user_groups_array);
}
else{
$user_groups_str = false;
}
}
switch ($type) {
// Get the agents of a group
case 'group':
if (empty($rootID) || $rootID == -1) {
// Strict acl specifications
/*if ($this->strictACL)
return false;*/
if(!$search_hirearchy && (!empty($agent_search_filter) || !empty($module_search_filter))){
$columns = 'tg.id_grupo AS id, tg.nombre AS name, tg.icon';
}
else{
$columns = 'tg.id_grupo AS id, tg.nombre AS name, tg.parent, tg.icon';
}
$order_fields = 'tg.nombre ASC, tg.id_grupo ASC';
if (! is_metaconsole()) {
@ -1180,6 +1219,7 @@ class Tree {
!empty($group['counters']['total']));
});
}
usort($groups, array("Tree", "cmpSortNames"));
return $groups;
}
@ -2646,9 +2686,10 @@ class Tree {
protected function getGroupCounters($group_id) {
global $config;
static $group_stats = false;
# Do not use the group stat cache when using tags or real time group stats.
if ($config['realtimestats'] == 1 || (isset($this->userGroups[$group_id]['tags']) && $this->userGroups[$group_id]['tags'] != "")) {
if ($config['realtimestats'] == 1 ||
(isset($this->userGroups[$group_id]['tags']) && $this->userGroups[$group_id]['tags'] != "") ||
!empty($this->filter['searchAgent']) ) {
return $this->getCounters($group_id);
}

View File

@ -22,8 +22,8 @@
/**
* Pandora build version and version
*/
$build_version = 'PC171205';
$pandora_version = 'v7.0NG.716';
$build_version = 'PC180102';
$pandora_version = 'v7.0NG.717';
// Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get();

View File

@ -1,292 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU 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 Config
*/
/**
* Pandora build version and version
*/
<<<<<<< HEAD
$build_version = 'PC170406';
=======
$build_version = 'PC170418';
>>>>>>> develop
$pandora_version = 'v7.0NG';
// Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get();
if (empty($script_tz)) {
date_default_timezone_set("Europe/Berlin");
ini_set("date.timezone", "Europe/Berlin");
}
else {
ini_set("date.timezone", $script_tz);
}
//home dir bad defined
if (!is_dir($config['homedir'])) {
$ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR;
$config['homedir'] = $ownDir;
$config["error"] = "homedir_bad_defined";
}
/* Help to debug problems. Override global PHP configuration */
global $develop_bypass;
if ($develop_bypass != 1) {
// error_reporting(E_ALL);
if (version_compare(PHP_VERSION, '5.3.0') >= 0)
{
error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE);
}
else
{
error_reporting(E_ALL & ~E_NOTICE);
}
ini_set("display_errors", 0);
ini_set("log_errors", 1);
ini_set("error_log", $config["homedir"]."/pandora_console.log");
}
else {
// Develop mode, show all notices and errors on Console (and log it)
if (version_compare(PHP_VERSION, '5.3.0') >= 0)
{
error_reporting(E_ALL & ~E_DEPRECATED);
}
else
{
error_reporting(E_ALL);
}
ini_set("display_errors", 1);
ini_set("log_errors", 1);
ini_set("error_log", $config["homedir"]."/pandora_console.log");
}
// Check if mysqli is available
if (!(isset($config["mysqli"]))) {
$config["mysqli"] = extension_loaded(mysqli);
}
$config['start_time'] = microtime (true);
$ownDir = dirname(__FILE__) . '/';
$ownDir = str_replace("\\", "/", $ownDir);
//Set by default the MySQL connection for DB, because in older Pandora have not
//this token in the config.php
if (!isset($config['dbtype'])) {
$config['dbtype'] = 'mysql';
}
if (!isset($config['dbport'])) {
switch ($config['dbtype']) {
case 'mysql':
$config['dbport'] = '3306';
break;
case 'postgresql':
$config['dbport'] = '5432';
break;
case 'oracle':
$config['dbport'] = '1521';
break;
}
}
require_once ($ownDir . 'constants.php');
require_once ($ownDir . 'functions_db.php');
require_once ($ownDir . 'functions.php');
db_select_engine();
$config['dbconnection'] = db_connect();
if (! defined ('EXTENSIONS_DIR'))
define ('EXTENSIONS_DIR', 'extensions');
if (! defined ('ENTERPRISE_DIR'))
define ('ENTERPRISE_DIR', 'enterprise');
require_once ($ownDir. 'functions_config.php');
// We need a timezone BEFORE calling config_process_config.
// If not we will get ugly warnings. Set Europe/Madrid by default
// Later will be replaced by the good one.
if (!defined('METACONSOLE')) {
if(!isset($config["homeurl"])){
$url = explode('/', $_SERVER['REQUEST_URI']);
$config["homeurl"] = $url[1];
$config["homeurl_static"] = $url[1];
$config["error"] = "homeurl_bad_defined";
return;
}
else{
$url = explode('/', $_SERVER['REQUEST_URI']);
if($config["homeurl"] != '/'.$url[1]){
$config["homeurl"] = '/'.$url[1];
$config["homeurl_static"] = '/'.$url[1];
$config["error"] = "homeurl_bad_defined";
return;
}
}
}
if (!isset($config["homeurl_static"])) {
$config["homeurl_static"] = $config["homeurl"];
}
else{
if($config["homeurl_static"] != $config["homeurl"]){
$config["error"] = "homeurl_bad_defined";
return;
}
}
date_default_timezone_set("Europe/Madrid");
config_process_config();
config_prepare_session();
require_once ($config["homedir"].'/include/load_session.php');
if(session_id() == '') {
$resultado = session_start();
}
// Set a the system timezone default
if ((!isset($config["timezone"])) OR ($config["timezone"] == "")) {
$config["timezone"] = "Europe/Berlin";
}
date_default_timezone_set($config["timezone"]);
require_once ($ownDir . 'streams.php');
require_once ($ownDir . 'gettext.php');
if (isset($_SERVER['REMOTE_ADDR'])) {
$config["remote_addr"] = $_SERVER['REMOTE_ADDR'];
}
else {
$config["remote_addr"] = null;
}
// Save the global values
$config["global_block_size"] = $config["block_size"];
$config["global_flash_charts"] = $config["flash_charts"];
if (isset ($config['id_user'])) {
config_user_set_custom_config();
}
// Check if inventory_changes_blacklist is setted, if not create it
if (!isset($config['inventory_changes_blacklist'])) {
$config['inventory_changes_blacklist'] = array();
}
//NEW UPDATE MANAGER URL
if (!isset($config['url_update_manager'])) {
config_update_value('url_update_manager',
'https://licensing.artica.es/pandoraupdate7/server.php');
}
if (defined('METACONSOLE')) {
enterprise_include_once('meta/include/functions_users_meta.php');
enterprise_hook('set_meta_user_language');
}
else
set_user_language();
require_once ($ownDir . 'functions_extensions.php');
$config['extensions'] = extensions_get_extensions ();
// Detect if enterprise extension is installed
// NOTICE: This variable (config[enterprise_installed] is used in several
// sections. Faking or forcing to 1 will make pandora fails.
if (file_exists ($config["homedir"] . '/' . ENTERPRISE_DIR . '/index.php')) {
$config['enterprise_installed'] = 1;
enterprise_include_once ('include/functions_enterprise.php');
}
else {
$config['enterprise_installed'] = 0;
}
// Function include_graphs_dependencies() it's called in the code below
require_once("include_graph_dependencies.php");
include_graphs_dependencies($config['homedir'] . '/');
// Updates autorefresh time
if (isset($_POST['vc_refr'])) {
config_update_value ('vc_refr', get_parameter('vc_refr', $config['vc_refr']));
}
//======= Autorefresh code =============================================
$select = db_process_sql("SELECT value FROM tconfig WHERE token='autorefresh_white_list'");
$autorefresh_list = json_decode($select[0]['value']);
$config['autorefresh_white_list'] = array();
$config['autorefresh_white_list'] = $autorefresh_list;
// Specific metaconsole autorefresh white list sections
if (defined('METACONSOLE')) {
$config['autorefresh_white_list'][] = 'monitoring/tactical';
$config['autorefresh_white_list'][] = 'monitoring/group_view';
$config['autorefresh_white_list'][] = 'operation/tree';
$config['autorefresh_white_list'][] = 'screens/screens';
}
//======================================================================
//======================================================================
// Update the $config['homeurl'] with the full url with the special
// 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":
if (!isset($config['quote_string'])) {
$config['db_quote_string'] = "'";
}
break;
}
//======================================================================
?>

View File

@ -738,7 +738,7 @@ function mysql_db_get_row_sql ($sql, $search_history_db = false) {
*
* @return mixed Array of the row or false in case of error.
*/
function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join = 'AND') {
function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join = 'AND', $historydb = false) {
if (empty ($fields)) {
$fields = '*';
}
@ -758,7 +758,7 @@ function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join
$sql = sprintf ('SELECT %s FROM %s %s', $fields, $table, $filter);
return db_get_row_sql ($sql);
return db_get_row_sql ($sql, $historydb);
}
/**

File diff suppressed because one or more lines are too long

View File

@ -1461,6 +1461,8 @@ function return_graphtype ($id_module_type) {
case 21:
case 18:
case 9:
case 31:
case 100:
return "boolean";
break;
case 24:

View File

@ -10061,4 +10061,32 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4) {
}
}
function api_set_metaconsole_synch($keys) {
if (defined('METACONSOLE')) {
$data['keys'] = array('customer_key'=>$keys);
foreach ($data['keys'] as $key => $value) {
db_process_sql_update(
'tupdate_settings',
array(db_escape_key_identifier('value') => $value),
array(db_escape_key_identifier('key') => $key));
}
// Validate update the license in nodes:
enterprise_include_once('include/functions_metaconsole.php');
list ($nodes_failed, $total_nodes) = metaconsole_update_all_nodes_license();
if ($nodes_failed === 0) {
echo __('Metaconsole and all nodes license updated');
}
else {
echo __('Metaconsole license updated but %d of %d node synchronization failed', $nodes_failed, $total_nodes);
}
}
else{
echo __('This function is only for metaconsole');
}
}
?>

View File

@ -351,6 +351,8 @@ function config_update_config () {
$error_update[] = __('Fallback to local authentication');
if (!config_update_value ('ldap_login_user_attr', get_parameter ('ldap_login_user_attr')))
$error_update[] = __('Login user attribute');
if (!config_update_value ('ldap_function', get_parameter ('ldap_function')))
$error_update[] = __('LDAP function');
if (isset($config['fallback_local_auth']) && $config['fallback_local_auth'] == 0) {
if (!config_update_value ('ldap_save_password', get_parameter ('ldap_save_password')))
@ -526,8 +528,13 @@ function config_update_config () {
if (!config_update_value ('vc_refr', get_parameter('vc_refr')))
$error_update[] = __('Default interval for refresh on Visual Console');
if (!config_update_value ('vc_favourite_view', (int) get_parameter('vc_favourite_view', 0)))
$error_update[] = __('Default line favourite_view for the Visual Console');
if (!config_update_value ('vc_menu_items', (int) get_parameter('vc_menu_items', 10)))
$error_update[] = __('Default line menu items for the Visual Console');
if (!config_update_value ('vc_line_thickness', (int) get_parameter('vc_line_thickness')))
$error_update[] = __('Default line thickness for the Visual Console');
if (!config_update_value ('agent_size_text_small', get_parameter('agent_size_text_small')))
$error_update[] = __('Agent size text');
if (!config_update_value ('agent_size_text_medium', get_parameter('agent_size_text_medium')))
@ -1371,6 +1378,10 @@ function config_process_config () {
config_update_value ( 'ldap_admin_pass', '');
}
if (!isset ($config['ldap_function'])) {
config_update_value ( 'ldap_function', 'local');
}
if (!isset ($config['fallback_local_auth'])) {
config_update_value ( 'fallback_local_auth', '0');
}

View File

@ -208,6 +208,13 @@ function folder_get_sibling($sibling) {
}
function ui_toggle_container($code, $name, $title = '', $hidden_default = true, $return = false, $group , $id_container, $parent = false) {
global $config;
$report_r = check_acl ($config['id_user'], 0, "RR");
$report_w = check_acl ($config['id_user'], 0, "RW");
$report_m = check_acl ($config['id_user'], 0, "RM");
$access = ($report_r == true) ? 'RR' : (($report_w == true) ? 'RW' : (($report_m == true) ? 'RM' : 'RR'));
// Generate unique Id
$uniqid = uniqid('');
@ -277,13 +284,17 @@ function ui_toggle_container($code, $name, $title = '', $hidden_default = true,
$data = array();
$data[0] = '<a href="javascript:" id="tgl_ctrl_'.$uniqid.'">' . html_print_image ($original, true, array ("title" => $title, "id" => "image_".$uniqid)) . '&nbsp;&nbsp;<b>'.$name.'</b></a>';
$data[1] = ui_print_group_icon($group,true);
if($report_r && $report_w){
$data[2] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/create_container&edit_container=1&id='.
$id_container .'">'.html_print_image("images/config.png", true).'</a>';
}
if($report_r && $report_w && $report_m){
if ($id_container !== '1'){
$data[2] .= '&nbsp;&nbsp;&nbsp;&nbsp' .'<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container&delete_container=1&id='
.$id_container.'" onClick="if (!confirm(\''.__('Are you sure?').'\'))
return false;">' . html_print_image("images/cross.png", true, array('alt' => __('Delete'), 'title' => __('Delete'))) . '</a>';
}
}
$table->data[] = $data;
$table->rowclass[] = '';

View File

@ -202,6 +202,11 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$sources = db_get_all_rows_field_filter('tgraph_source', 'id_graph',
$id_graph);
$series = db_get_all_rows_sql('SELECT summatory_series,average_series,modules_series FROM tgraph WHERE id_graph = '.$id_graph);
$summatory = $series[0]['summatory_series'];
$average = $series[0]['average_series'];
$modules_series = $series[0]['modules_series'];
$modules = array ();
$weights = array ();
$labels = array ();
@ -262,7 +267,10 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$percentil,
$from_interface,
$id_widget_dashboard,
$fullscale);
$fullscale,
$summatory,
$average,
$modules_series);
if ($return)
return $output;

View File

@ -416,12 +416,12 @@ function db_get_row ($table, $field_search, $condition, $fields = false) {
*
* @return mixed Array of the row or false in case of error.
*/
function db_get_row_filter($table, $filter, $fields = false, $where_join = 'AND') {
function db_get_row_filter($table, $filter, $fields = false, $where_join = 'AND', $historydb = false) {
global $config;
switch ($config["dbtype"]) {
case "mysql":
return mysql_db_get_row_filter($table, $filter, $fields, $where_join);
return mysql_db_get_row_filter($table, $filter, $fields, $where_join, $historydb);
break;
case "postgresql":
return postgresql_db_get_row_filter($table, $filter, $fields, $where_join);
@ -481,9 +481,6 @@ function db_get_all_rows_sql($sql, $search_history_db = false, $cache = true, $d
}
}
/**
*
* Returns the time the module is in unknown status (by events)
@ -493,7 +490,7 @@ function db_get_all_rows_sql($sql, $search_history_db = false, $cache = true, $d
* @param int $tend end of search
*
*/
function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend = false) {
function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend = false, $historydb = false) {
global $config;
if (!isset($id_agente_modulo)) {
@ -514,20 +511,19 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend
return false;
}
// Retrieve going unknown events in range
$query = "SELECT utimestamp,event_type FROM tevento WHERE id_agentmodule = " . $id_agente_modulo;
$query .= " AND event_type like 'going_%' ";
$query .= " AND utimestamp >= $tstart AND utimestamp <= $tend ";
$query .= " ORDER BY utimestamp ASC";
$events = db_get_all_rows_sql($query);
$events = db_get_all_rows_sql($query, $historydb);
if (! is_array($events)){
return false;
}
$last_status = 0; // normal
$last_status = $events[0]["event_type"] != "going_unknown" ? 1:0;
$return = array();
$i=0;
foreach ($events as $event) {
@ -555,6 +551,9 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend
}
}
}
if(!isset($return[0])){
return false;
}
return $return;
}
@ -573,6 +572,16 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend
*
* Note: All "unknown" data are marked as NULL
* Warning: Be careful with the amount of data, check your RAM size available
* We'll return a bidimensional array
* Structure returned: schema:
*
* uncompressed_data =>
* pool_id (int)
* utimestamp (start of current slice)
* data
* array
* datos
* utimestamp
*
*/
function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = false) {
@ -582,17 +591,6 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
return false;
}
if ((!isset($tstart)) || ($tstart === false)) {
// Return data from the begining
// Get first available utimestamp in active DB
$query_first_man_time = " SELECT utimestamp FROM tagente_datos ";
$query_first_man_time .= " WHERE id_agente_modulo = $id_agente_modulo";
$query_first_man_time .= " ORDER BY utimestamp ASC LIMIT 1";
$first_man_time = db_get_all_rows_sql( $query_first_man_time, false);
$tstart = $first_man_time[0]['utimestamp'];
}
if ((!isset($tend)) || ($tend === false)) {
// Return data until now
$tend = time();
@ -612,270 +610,263 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
}
$module_type = $module['id_tipo_modulo'];
$module_type_str = modules_get_type_name ($module_type);
if (strstr ($module_type_str, 'string') !== false) {
$table = "tagente_datos_string";
}
// Get first available utimestamp in active DB
$query = " SELECT utimestamp, datos FROM $table ";
$query .= " WHERE id_agente_modulo=$id_agente_modulo AND utimestamp < $tstart";
$query .= " ORDER BY utimestamp DESC LIMIT 1";
$ret = db_get_all_rows_sql( $query , $search_historydb);
if ( ( $ret === false ) || (( isset($ret[0]["utimestamp"]) && ($ret[0]["utimestamp"] > $tstart )))) {
// Value older than first retrieved from active DB
$search_historydb = true;
$ret = db_get_all_rows_sql( $query , $search_historydb);
if ($ret) {
$tstart = $ret[0]["utimestamp"];
$flag_async = false;
if(strstr ($module_type_str, 'async_data') !== false) {
$flag_async = true;
}
}
else {
$first_data["utimestamp"] = $ret[0]["utimestamp"];
$first_data["datos"] = $ret[0]["datos"];
if(strstr ($module_type_str, 'async_proc') !== false) {
$flag_async = true;
}
if ( ( $ret === false ) || (( isset($ret[0]["utimestamp"]) && ($ret[0]["utimestamp"] > $tstart )))) {
// No previous data. -> not init
// Avoid false unknown status
$first_data["utimestamp"] = time();
$result = modules_get_first_date($id_agente_modulo,$tstart);
$first_utimestamp = $result["first_utimestamp"];
$search_historydb = $result["search_historydb"];
if ($first_utimestamp === false) {
$first_data["utimestamp"] = $tstart;
$first_data["datos"] = false;
}
else {
$first_data["utimestamp"] = $ret[0]["utimestamp"];
$first_data["datos"] = $ret[0]["datos"];
$query = "SELECT datos,utimestamp FROM $table ";
$query .= " WHERE id_agente_modulo=$id_agente_modulo ";
$query .= " AND utimestamp=" . $first_utimestamp;
$data = db_get_all_rows_sql($query,$search_historydb);
if ($data === false) {
// first utimestamp not found in active database
// SEARCH HISTORY DB
$search_historydb = true;
$data = db_get_all_rows_sql($query,$search_historydb);
}
if ($data === false) { // Not init
$first_data["utimestamp"] = $tstart;
$first_data["datos"] = false;
}
else {
$first_data["utimestamp"] = $data[0]["utimestamp"];
$first_data["datos"] = $data[0]["datos"];
}
}
$query = " SELECT utimestamp, datos FROM $table ";
$query .= " WHERE id_agente_modulo=$id_agente_modulo AND utimestamp >= $tstart AND utimestamp <= $tend";
$query .= " ORDER BY utimestamp ASC";
// Retrieve all data from module in given range
$raw_data = db_get_all_rows_sql($query, $search_historydb);
if (($raw_data === false) && ($ret === false)) {
$module_interval = modules_get_interval ($id_agente_modulo);
if (($raw_data === false) && ( ($first_utimestamp < $tstart - (SECONDS_1DAY + 2*$module_interval)) ) ) {
// No data
return false;
}
// Retrieve going unknown events in range
$unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend);
$unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend, $search_historydb);
// Get the last event after inverval to know if graph start on unknown
$previous_unknown_events = db_get_row_filter (
'tevento',
array ('id_agentmodule' => $id_agente_modulo,
"utimestamp <= $tstart",
'order' => 'utimestamp DESC'
),
false,
'AND',
$search_historydb
);
//show graph if graph is inside unknown
if( $previous_unknown_events && $previous_unknown_events['event_type'] == 'going_unknown' &&
$unknown_events === false && $raw_data === false){
$last_inserted_value = $first_data["datos"];
$unknown_events[0]['time_from'] = $tstart+0.1;
}
//if time to is missing in last event force time to outside range time
if( $unknown_events && !isset($unknown_events[count($unknown_events) -1]['time_to']) ){
$unknown_events[count($unknown_events) -1]['time_to'] = $tend + $module_interval;
}
//if time to is missing in first event force time to outside range time
if ($first_data["datos"] === false && !$flag_async) {
$last_inserted_value = false;
}elseif( ($unknown_events && !isset($unknown_events[0]['time_from']) &&
$previous_unknown_events && $previous_unknown_events['event_type'] == 'going_unknown' && !$flag_async) ||
($first_utimestamp < $tstart - (SECONDS_1DAY + 2*$module_interval) && !$flag_async) ){
//$last_inserted_value = null;
$last_inserted_value = $first_data["datos"];
$unknown_events[0]['time_from'] = $tstart+0.1;
}
else{
$last_inserted_value = $first_data["datos"];
}
// Retrieve module_interval to build the template
$module_interval = modules_get_interval ($id_agente_modulo);
$slice_size = $module_interval;
// We'll return a bidimensional array
// Structure returned: schema:
//
// uncompressed_data =>
// pool_id (int)
// utimestamp (start of current slice)
// data
// array
// utimestamp
// datos
$return = array();
// Point current_timestamp to begin of the set and initialize flags
$current_timestamp = $tstart;
$last_inserted_value = $first_data["datos"];
$last_timestamp = $first_data["utimestamp"];
$data_found = 0;
$last_value = $first_data["datos"];
//reverse array data optimization
$raw_data = array_reverse($raw_data);
// Build template
$pool_id = 0;
$now = time();
$in_unknown_status = 0;
if (is_array($unknown_events)) {
if($unknown_events){
$current_unknown = array_shift($unknown_events);
}
while ( $current_timestamp < $tend ) {
$expected_data_generated = 0;
else{
$current_unknown = null;
}
if($raw_data){
$current_raw_data = array_pop($raw_data);
}
else{
$current_raw_data = null;
}
while ( $current_timestamp < $tend ) {
$return[$pool_id]["data"] = array();
$tmp_data = array();
$data_found = 0;
$current_timestamp_end = $current_timestamp + $slice_size;
if (is_array($unknown_events)) {
$i = 0;
while ($current_timestamp >= $unknown_events[$i]["time_to"] ) {
// Skip unknown events in past
array_splice($unknown_events, $i,1);
$i++;
if (!isset($unknown_events[$i])) {
break;
}
}
if (isset($current_unknown)) {
if (( $current_timestamp > $now) ||
( ($current_timestamp_end - $last_timestamp) >
(SECONDS_1DAY + 2 * $module_interval) ) ) {
// check if recovered from unknown status
if(is_array($unknown_events) && isset($current_unknown)) {
if ( (($current_timestamp+$slice_size) > $current_unknown["time_to"])
&& ($current_timestamp < $current_unknown["time_to"])
&& ($in_unknown_status == 1) ) {
// Recovered from unknown
$tmp_data["utimestamp"] = $last_timestamp + SECONDS_1DAY + 2 * $module_interval;
if ( ($current_unknown["time_to"] > $current_timestamp)
&& ($expected_data_generated == 0) ) {
// also add the "expected" data
$tmp_data["utimestamp"] = $current_timestamp;
if ($in_unknown_status == 1) {
$tmp_data["datos"] = null;
}
else {
//check not init
$tmp_data["datos"] = $last_value === false ? false : null;
//async not unknown
if($flag_async && $tmp_data["datos"] === null){
$tmp_data["datos"] = $last_inserted_value;
}
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$expected_data_generated = 1;
}
$tmp_data["utimestamp"] = $current_unknown["time_to"];
$tmp_data["datos"] = $last_inserted_value;
// debug purpose
//$tmp_data["obs"] = "event recovery data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$data_found = 1;
$in_unknown_status = 0;
}
if ( (($current_timestamp+$slice_size) > $current_unknown["time_from"])
&& (($current_timestamp+$slice_size) < $current_unknown["time_to"])
&& ($in_unknown_status == 0) ) {
// Add unknown state detected
if ( $current_unknown["time_from"] < ($current_timestamp+$slice_size)) {
if ( ($current_unknown["time_from"] > $current_timestamp)
&& ($expected_data_generated == 0) ) {
// also add the "expected" data
$tmp_data["utimestamp"] = $current_timestamp;
if ($in_unknown_status == 1) {
$tmp_data["datos"] = null;
}
else {
$tmp_data["datos"] = $last_inserted_value;
}
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$expected_data_generated = 1;
}
$tmp_data["utimestamp"] = $current_unknown["time_from"];
$tmp_data["datos"] = null;
// debug purpose
//$tmp_data["obs"] = "event data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$data_found = 1;
}
$in_unknown_status = 1;
}
if ( ($in_unknown_status == 0) && ($current_timestamp >= $current_unknown["time_to"]) ) {
$current_unknown = array_shift($unknown_events);
}
}
} // unknown events handle
}
// Search for data
$i=0;
if (is_array($raw_data)) {
foreach ($raw_data as $data) {
if ( ($data["utimestamp"] >= $current_timestamp)
&& ($data["utimestamp"] < ($current_timestamp+$slice_size)) ) {
// Data in block, push in, and remove from $raw_data (processed)
if ( ($data["utimestamp"] > $current_timestamp)
&& ($expected_data_generated == 0) ) {
// also add the "expected" data
$tmp_data["utimestamp"] = $current_timestamp;
if ($in_unknown_status == 1) {
$tmp_data["datos"] = null;
}
else {
$tmp_data["datos"] = $last_inserted_value;
}
//$tmp_data["obs"] = "expected data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$expected_data_generated = 1;
}
$tmp_data["utimestamp"] = intval($data["utimestamp"]);
$tmp_data["datos"] = $data["datos"];
// debug purpose
//$tmp_data["obs"] = "real data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$last_inserted_value = $data["datos"];
$last_timestamp = intval($data["utimestamp"]);
unset($raw_data[$i]);
$data_found = 1;
$in_unknown_status = 0;
}
elseif ($data["utimestamp"] > ($current_timestamp+$slice_size)) {
// Data in future, stop searching new ones
break;
}
}
$i++;
}
if ($data_found == 0) {
// No data found, lug the last_value until SECONDS_1DAY + 2*modules_get_interval
// UNKNOWN!
if (($current_timestamp > $now) || (($current_timestamp - $last_timestamp) > (SECONDS_1DAY + 2*$module_interval))) {
if (isset($last_inserted_value)) {
// unhandled unknown status control
$unhandled_time_unknown = $current_timestamp - (SECONDS_1DAY + 2*$module_interval) - $last_timestamp;
if ($unhandled_time_unknown > 0) {
// unhandled unknown status detected. Add to previous pool
$tmp_data["utimestamp"] = intval($last_timestamp) + (SECONDS_1DAY + 2*$module_interval);
$tmp_data["datos"] = null;
// debug purpose
//$tmp_data["obs"] = "unknown extra";
// add to previous pool if needed
if (isset($return[$pool_id-1])) {
array_push($return[$pool_id-1]["data"], $tmp_data);
}
}
}
$last_inserted_value = null;
array_push($return[$pool_id]["data"], $tmp_data);
}
//insert first slice data
$tmp_data["utimestamp"] = $current_timestamp;
if ($in_unknown_status == 1) {
$tmp_data["datos"] = null;
}
else {
$tmp_data["datos"] = $last_inserted_value;
}
// debug purpose
//$tmp_data["obs"] = "virtual data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
//insert raw data
while ( ($current_raw_data != null) &&
( ($current_timestamp_end >= $current_raw_data['utimestamp']) &&
($current_timestamp < $current_raw_data['utimestamp']) ) ) {
// Add unknown state detected
$tmp_data["utimestamp"] = $current_raw_data["utimestamp"];
$tmp_data["datos"] = $current_raw_data["datos"];
// debug purpose
//$tmp_data["obs"] = "real data";
array_push($return[$pool_id]["data"], $tmp_data);
$last_value = $current_raw_data["datos"];
$last_timestamp = $current_raw_data["utimestamp"];
if($raw_data){
$current_raw_data = array_pop($raw_data);
}
else{
$current_raw_data = null;
}
}
//unknown
$data_slices = $return[$pool_id]["data"];
if(!$flag_async){
while ( ($current_unknown != null) &&
( ( ($current_unknown['time_from'] != null) &&
($current_timestamp_end >= $current_unknown['time_from']) ) ||
($current_timestamp_end >= $current_unknown['time_to']) ) ) {
if( ( $current_timestamp <= $current_unknown['time_from']) &&
( $current_timestamp_end >= $current_unknown['time_from'] ) ){
// Add unknown state detected
$tmp_data["utimestamp"] = $current_unknown["time_from"];
$tmp_data["datos"] = null;
// debug purpose
//$tmp_data["obs"] = "event data unknown from";
array_push($return[$pool_id]["data"], $tmp_data);
$current_unknown["time_from"] = null;
}
if( ($current_timestamp <= $current_unknown['time_to']) &&
($current_timestamp_end >= $current_unknown['time_to'] ) ){
$tmp_data["utimestamp"] = $current_unknown["time_to"];
$i = count($data_slices) - 1;
while ($i >= 0) {
if($data_slices[$i]['utimestamp'] <= $current_unknown["time_to"]){
$tmp_data["datos"] =
$data_slices[$i]['datos'] == null
? $last_value
: $data_slices[$i]['datos'];
break;
}
$i--;
}
// debug purpose
//$tmp_data["obs"] = "event data unknown to";
array_push($return[$pool_id]["data"], $tmp_data);
if($unknown_events){
$current_unknown = array_shift($unknown_events);
}
else{
$current_unknown = null;
}
}
}
}
//sort current slice
usort(
$return[$pool_id]['data'],
function ($a, $b) {
if ($a['utimestamp'] == $b['utimestamp']) return 0;
return ($a['utimestamp'] < $b['utimestamp']) ? -1 : 1;
}
);
//put the last slice data like first element of next slice
$last_inserted_value = end($return[$pool_id]['data']);
$last_inserted_value = $last_inserted_value['datos'];
//increment
$pool_id++;
$current_timestamp += $slice_size;
$current_timestamp = $current_timestamp_end;
}
//slice to the end.
if($pool_id == 1){
$end_array = array();
$end_array['data'][0]['utimestamp'] = $tend;
$end_array['data'][0]['datos'] = $last_inserted_value;
//$end_array['data'][0]['obs'] = 'virtual data END';
array_push($return, $end_array);
}
return $return;
}

View File

@ -1261,7 +1261,7 @@ function events_get_group_events_steps ($begin, &$result, $id_group, $period, $d
function events_get_agent ($id_agent, $period, $date = 0,
$history = false, $show_summary_group = false, $filter_event_severity = false,
$filter_event_type = false, $filter_event_status = false, $filter_event_filter_search=false,
$id_group = false, $events_group = false, $id_agent_module = false, $events_module = false) {
$id_group = false, $events_group = false, $id_agent_module = false, $events_module = false, $id_server = false) {
global $config;
if (!is_numeric ($date)) {
@ -1365,6 +1365,10 @@ function events_get_agent ($id_agent, $period, $date = 0,
AND utimestamp <= %d ', $id_agent, $datelimit, $date);
}
if(is_metaconsole() && $id_server){
$sql_where.= " AND server_id = ".$id_server;
}
if($show_summary_group){
return events_get_events_grouped($sql_where, 0, 1000,
is_metaconsole(), false, false, $history);
@ -1570,18 +1574,6 @@ function events_check_event_filter_group ($id_filter) {
return false;
}
/**
* Return an array with all the possible macros in event responses
*
* @return array
*/
function events_get_macros() {
return array('_agent_address_' => __('Agent address'),
'_agent_id_' => __('Agent id'),
'_event_id_' => __('Event id'),
'_module_address_' => __('Module Agent address'),);
}
/**
* Get a event filter.
*
@ -1849,50 +1841,153 @@ function events_get_response_target($event_id, $response_id, $server_id, $histor
$event = db_get_row($event_table,'id_evento', $event_id);
$macros = array_keys(events_get_macros());
$target = io_safe_output($event_response['target']);
foreach($macros as $macro) {
$subst = '';
switch($macro) {
case '_agent_address_':
// Substitute each macro
if (strpos($target, '_agent_address_') !== false) {
if ($meta) {
$server = metaconsole_get_connection_by_id ($server_id);
metaconsole_connect($server);
}
$subst = agents_get_address($event['id_agente']);
$target = str_replace('_agent_address_', $event['id_agente'], $target);
if($meta) {
metaconsole_restore_db_force();
}
break;
case '_agent_id_':
$subst = $event['id_agente'];
break;
case '_event_id_':
$subst = $event['id_evento'];
break;
case '_module_address_':
}
if (strpos($target, '_agent_id_') !== false) {
$target = str_replace('_agent_id_', $event['id_agente'], $target);
}
if ((strpos($target, '_module_address_') !== false) ||
(strpos($target, '_module_name_') !== false))
{
if ($event['id_agentmodule'] !== 0) {
if($meta) {
$server = metaconsole_get_connection_by_id ($server_id);
metaconsole_connect($server);
}
$module = db_get_row("tagente_modulo",'id_agente_modulo', $event['id_agentmodule']);
if ($module['ip_target'] != false)
$subst = $module['ip_target'];
if (empty($module['ip_target'])) $module['ip_target'] = __('N/A');
$target = str_replace('_module_address_', $module['ip_target'], $target);
if (empty($module['nombre'])) $module['nombre'] = __('N/A');
$target = str_replace(
'_module_name_',
io_safe_output($module['nombre']),
$target
);
if($meta) {
metaconsole_restore_db_force();
}
break;
} else {
$target = str_replace('_module_address_', __('N/A'), $target);
$target = str_replace('_module_name_', __('N/A'), $target);
}
}
if (strpos($target, '_event_id_') !== false) {
$target = str_replace('_event_id_', $event['id_evento'], $target);
}
if (strpos($target, '_user_id_') !== false) {
if (!empty($event['id_usuario'])) {
$target = str_replace('_user_id_', $event['id_usuario'], $target);
} else {
$target = str_replace('_user_id_', __('N/A'), $target);
}
}
if (strpos($target, '_group_id_') !== false) {
$target = str_replace('_group_id_', $event['id_grupo'], $target);
}
if (strpos($target, '_group_name_') !== false) {
$target = str_replace(
'_group_name_',
groups_get_name($event['id_grupo'], true),
$target
);
}
if (strpos($target, '_event_utimestamp_') !== false) {
$target = str_replace('_event_utimestamp_', $event['utimestamp'], $target);
}
if (strpos($target, '_event_date_') !== false) {
$target = str_replace(
'_event_date_',
date ($config["date_format"], strtotime($event["timestamp"])),
$target
);
}
if (strpos($target, '_event_text_') !== false) {
$target = str_replace(
'_event_text_',
events_display_name($event['evento']),
$target
);
}
if (strpos($target, '_event_type_') !== false) {
$target = str_replace(
'_event_type_',
events_print_type_description($event['event_type'], true),
$target
);
}
if (strpos($target, '_alert_id_') !== false) {
$target = str_replace(
'_alert_id_',
empty($event['is_alert_am']) ? __('N/A') : $event['is_alert_am'],
$target
);
}
if (strpos($target, '_event_severity_id_') !== false) {
$target = str_replace('_event_severity_id_', $event['criticity'], $target);
}
if (strpos($target, '_event_severity_text_') !== false) {
$target = str_replace(
'_event_severity_text_',
get_priority_name($event['criticity']),
$target
);
}
if (strpos($target, '_module_id_') !== false) {
$target = str_replace('_module_id_', $event['id_agentmodule'], $target);
}
if (strpos($target, '_event_tags_') !== false) {
$target = str_replace('_event_tags_', $event['tags'], $target);
}
if (strpos($target, '_event_extra_id_') !== false) {
if (empty($event['id_extra'])) {
$target = str_replace('_event_extra_id_', __('N/A'), $target);
} else {
$target = str_replace('_event_extra_id_', $event['id_extra'], $target);
}
}
if (strpos($target, '_event_source_') !== false) {
$target = str_replace('_event_source_', $event['source'], $target);
}
if (strpos($target, '_event_instruction_') !== false) {
$target = str_replace(
'_event_instruction_',
events_display_instructions($event['event_type'], $event, false),
$target
);
}
if (strpos($target, '_owner_user_') !== false) {
if (empty($event['owner_user'])) {
$target = str_replace('_owner_user_', __('N/A'), $target);
} else {
$target = str_replace('_owner_user_', $event['owner_user'], $target);
}
}
if (strpos($target, '_event_status_') !== false) {
$event_st = events_display_status($event['estado']);
$target = str_replace('_event_status_', $event_st["title"], $target);
}
// Parse the event custom data
if (!empty($event['custom_data'])){
$custom_data = json_decode (base64_decode ($event['custom_data']));
foreach ($custom_data as $key => $value) {
$target = str_replace('_customdata_' . $key . '_', $value, $target);
}
$target = str_replace($macro,$subst,$target);
}
return $target;
}
@ -2185,68 +2280,11 @@ function events_page_details ($event, $server = "") {
$table_details->data[] = $data;
}
switch($event['event_type']) {
case 'going_unknown':
$data = array();
$data[0] = __('Instructions');
if ($event["unknown_instructions"] != '') {
$data[1] = str_replace("\n","<br>", io_safe_output($event["unknown_instructions"]));
}
else {
$data[1] = '<i>' . __('N/A') . '</i>';
}
$table_details->data[] = $data;
break;
case 'going_up_warning':
case 'going_down_warning':
$data = array();
$data[0] = __('Instructions');
if ($event["warning_instructions"] != '') {
$data[1] = str_replace("\n","<br>", io_safe_output($event["warning_instructions"]));
}
else {
$data[1] = '<i>' . __('N/A') . '</i>';
}
$table_details->data[] = $data;
break;
case 'going_up_critical':
case 'going_down_critical':
$data = array();
$data[0] = __('Instructions');
if ($event["critical_instructions"] != '') {
$data[1] = str_replace("\n","<br>", io_safe_output($event["critical_instructions"]));
}
else {
$data[1] = '<i>' . __('N/A') . '</i>';
}
$table_details->data[] = $data;
break;
case 'system':
$data = array();
if ($event["critical_instructions"] != '') {
$data[0] = __('Instructions');
$data[1] = str_replace("\n","<br>", io_safe_output($event["critical_instructions"]));
}
else {
if ($event["warning_instructions"] != '') {
$data[0] = __('Instructions');
$data[1] = str_replace("\n","<br>", io_safe_output($event["warning_instructions"]));
}
else {
if ($event["unknown_instructions"] != '') {
$data[0] = __('Instructions');
$data[1] = str_replace("\n","<br>", io_safe_output($event["unknown_instructions"]));
}
else {
$data[0] = __('Instructions');
$data[1] = '<i>' . __('N/A') . '</i>';
}
}
}
$data = array();
$data[0] = __('Instructions');
$data[1] = events_display_instructions ($event['event_type'], $events, true);
$table_details->data[] = $data;
break;
}
$data = array();
$data[0] = __('Extra id');
@ -2311,6 +2349,72 @@ function events_page_custom_data ($event) {
return $custom_data;
}
// Get the event name from tevento and display it in console
function events_display_name ($db_name = '') {
return io_safe_output(str_replace ( '&#x0a;' , '<br>' , $db_name));
}
// Get the image and status value of event
function events_display_status ($status) {
switch($status) {
case 0:
return array(
"img" => "images/star.png",
"title" => __('New event')
);
case 1:
return array(
"img" => "images/tick.png",
"title" => __('Event validated')
);
case 2:
return array(
"img" => "images/hourglass.png",
"title" => __('Event in process')
);
}
}
// Get the instruction of an event
// $event_type: Type of event
// $inst: Array with unknown warning and critical instructions
// $italic: Display N/A between italic html marks if instruction is not found
function events_display_instructions ($event_type = '', $inst, $italic = true) {
switch($event_type) {
case 'going_unknown':
if ($inst["unknown_instructions"] != '') {
return str_replace("\n","<br>", io_safe_output($inst["unknown_instructions"]));
}
break;
case 'going_up_warning':
case 'going_down_warning':
if ($inst["warning_instructions"] != '') {
return str_replace("\n","<br>", io_safe_output($inst["warning_instructions"]));
}
break;
case 'going_up_critical':
case 'going_down_critical':
if ($inst["critical_instructions"] != '') {
return str_replace("\n","<br>", io_safe_output($inst["critical_instructions"]));
}
break;
case 'system':
$data = array();
if ($inst["critical_instructions"] != '') {
return str_replace("\n","<br>", io_safe_output($inst["critical_instructions"]));
}
if ($inst["warning_instructions"] != '') {
return str_replace("\n","<br>", io_safe_output($inst["warning_instructions"]));
}
if ($inst["unknown_instructions"] != '') {
return str_replace("\n","<br>", io_safe_output($inst["unknown_instructions"]));
}
break;
}
$na_return = $italic ? '<i>' . __('N/A') . '</i>' : __('N/A');
return $na_return;
}
function events_page_general ($event) {
global $img_sev;
global $config;
@ -2337,8 +2441,7 @@ function events_page_general ($event) {
$data = array();
$data[0] = __('Event name');
$event["evento"] = str_replace ( '&#x0a;' , '<br>' , $event["evento"]);
$data[1] = io_safe_output($event["evento"]);
$data[1] = events_display_name ($event["evento"]);
$table_general->data[] = $data;
$data = array();
@ -2400,24 +2503,11 @@ function events_page_general ($event) {
$table_general->data[] = $data;
// Get Status
switch($event['estado']) {
case 0:
$img_st = "images/star.png";
$title_st = __('New event');
break;
case 1:
$img_st = "images/tick.png";
$title_st = __('Event validated');
break;
case 2:
$img_st = "images/hourglass.png";
$title_st = __('Event in process');
break;
}
$event_st = events_display_status ($event['estado']);
$data = array();
$data[0] = __('Status');
$data[1] = html_print_image($img_st,true).' '.$title_st;
$data[1] = html_print_image($event_st["img"],true).' '.$event_st["title"];
$table_general->data[] = $data;
// If event is validated, show who and when acknowleded it

View File

@ -573,14 +573,17 @@ function gis_get_agent_icon_map($idAgent, $state = false, $status = null) {
switch ($status) {
case 1:
case 4:
case 100:
//Critical (BAD or ALERT)
$state = ".bad";
break;
case 0:
case 300:
//Normal (OK)
$state = ".ok";
break;
case 2:
case 200:
//Warning
$state = ".warning";
break;

File diff suppressed because it is too large Load Diff

View File

@ -801,7 +801,7 @@ function html_print_extended_select_for_time ($name, $selected = '',
$readonly = false, $custom_fields = false,$style_icon = '') {
global $config;
$admin = is_user_admin($config['id_user']);
if($custom_fields){
$fields = $custom_fields;
} else {
@ -853,7 +853,7 @@ function html_print_extended_select_for_time ($name, $selected = '',
html_print_select ($fields, $uniq_name . '_select', $selected,"" . $script,
$nothing, $nothing_value, false, false, false, $class, $readonly, 'font-size: xx-small;'.$select_style);
// The advanced control is only for admins
if (is_user_admin($config['id_user'])) {
if ($admin) {
echo ' <a href="javascript:">' .
html_print_image('images/pencil.png', true,
array('class' => $uniq_name . '_toggler',

View File

@ -388,7 +388,7 @@ function __ ($string /*, variable arguments */) {
return $tranlateString;
}
}
elseif (enterprise_installed() &&
elseif (enterprise_installed &&
isset($config['translate_string_extension_installed']) &&
$config['translate_string_extension_installed'] == 1 &&
array_key_exists('translate_string.php', $extensions)) {

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