Merge branch 'develop' into ent-1536-macro-para-id-extra

This commit is contained in:
fermin831 2017-12-21 12:18:58 +01:00
commit 8e2616e642
121 changed files with 44942 additions and 59198 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-171218
Version: 7.0NG.717-171221
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-171218"
pandora_version="7.0NG.717-171221"
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 => '171218';
use constant AGENT_VERSION => '7.0NG.717';
use constant AGENT_BUILD => '171221';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

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 171218
%define version 7.0NG.717
%define release 171221
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 171218
%define version 7.0NG.717
%define release 171221
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="171218"
PI_VERSION="7.0NG.717"
PI_BUILD="171221"
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
{171218}
{171221}
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 171218)")
#define PANDORA_VERSION ("7.0NG.717(Build 171221)")
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 171218))"
VALUE "ProductVersion", "(7.0NG.717(Build 171221))"
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-171218
Version: 7.0NG.717-171221
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-171218"
pandora_version="7.0NG.717-171221"
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

@ -67,7 +67,7 @@ if ($snmpwalk) {
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.4.34.1.3", $tcp_port,
$server_to_exec);
// Build a [<interface id>] => [<interface ip>] array
if (!empty($snmp_int_ip)) {
foreach ($snmp_int_ip as $key => $value) {
@ -92,7 +92,7 @@ if ($snmpwalk) {
$snmpis = array_merge(($snmpis === false ? array() : $snmpis), ($ifxitems === false ? array() : $ifxitems));
$interfaces = array();
// We get here only the interface part of the MIB, not full mib
foreach($snmpis as $key => $snmp) {
@ -106,10 +106,17 @@ if ($snmpwalk) {
}
if (array_key_exists(1,$data)) {
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = $data[0];
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[1];
}
else {
// 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 {
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = '';
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[0];
}

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

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

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

@ -204,10 +204,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 +327,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();
});

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,18 +3030,15 @@ function createItem(type, values, id_data) {
if ((values['width'] == 0) || (values['height'] == 0)) {
// Do none
if(values['image'] != '' && values['image'] != 'none'){
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$image.attr('width', '70')
.attr('height', '70');
}
else{
$image.attr('width', $('#preview > img')[0].naturalWidth)
.attr('height', $('#preview > img')[0].naturalHeight);
}
}
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$image.attr('width', '70')
.attr('height', '70');
}
else{
$image.attr('width', $('#preview > img')[0].naturalWidth)
.attr('height', $('#preview > img')[0].naturalHeight);
}
}
else{
$image.attr('width', '70')
.attr('height', '70');
@ -3166,7 +3163,7 @@ function createItem(type, values, id_data) {
if(values['image'] != '' && values['image'] != 'none'){
// Do none
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$image.attr('width', '70')
.attr('height', '70');
}
@ -3447,7 +3444,7 @@ function createItem(type, values, id_data) {
break;
case 'icon':
if ((values['width'] == 0) || (values['height'] == 0)) {
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
sizeStyle = 'width: ' + '70' + 'px; height: ' + '70' + 'px;';
imageSize = 'width="' + '70' + '" height="' + '70' + '"';
}

View File

@ -296,7 +296,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

@ -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>';

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

View File

@ -22,8 +22,8 @@
/**
* Pandora build version and version
*/
$build_version = 'PC171218';
$pandora_version = 'v7.0NG.716';
$build_version = 'PC171221';
$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;
}
//======================================================================
?>

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

@ -208,7 +208,14 @@ function folder_get_sibling($sibling) {
}
function ui_toggle_container($code, $name, $title = '', $hidden_default = true, $return = false, $group , $id_container, $parent = false) {
// Generate unique Id
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('');
// Options
@ -277,12 +284,16 @@ 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 ($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>';
}
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

@ -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)) {
@ -1364,7 +1364,11 @@ function events_get_agent ($id_agent, $period, $date = 0,
$sql_where .= sprintf(' AND id_agente = %d AND utimestamp > %d
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_':
if ($meta) {
$server = metaconsole_get_connection_by_id ($server_id);
metaconsole_connect($server);
}
$subst = agents_get_address($event['id_agente']);
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($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($meta) {
metaconsole_restore_db_force();
}
break;
// Substitute each macro
if (strpos($target, '_agent_address_') !== false) {
if ($meta) {
$server = metaconsole_get_connection_by_id ($server_id);
metaconsole_connect($server);
}
$target = str_replace($macro,$subst,$target);
$target = str_replace('_agent_address_', $event['id_agente'], $target);
if($meta) {
metaconsole_restore_db_force();
}
}
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 (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();
}
} 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);
}
}
return $target;
}
@ -2185,69 +2280,12 @@ 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>';
}
}
}
$table_details->data[] = $data;
break;
}
$data = array();
$data[0] = __('Instructions');
$data[1] = events_display_instructions ($event['event_type'], $events, true);
$table_details->data[] = $data;
$data = array();
$data[0] = __('Extra id');
if ($event["id_extra"] != '') {
@ -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

@ -2168,6 +2168,9 @@ function graphic_combined_module ($module_list, $weight_list, $period,
//summatory and average series
if($stacked == CUSTOM_GRAPH_AREA || $stacked == CUSTOM_GRAPH_LINE) {
//Fix pdf label
$static_pdf = strpos($module_name_list[0], '<span style');
if($summatory && $average) {
foreach ($graph_values as $key => $value) {
$cont = count($value);
@ -2181,20 +2184,38 @@ function graphic_combined_module ($module_list, $weight_list, $period,
}
if(!$modules_series) {
if(is_null($percentil)) {
if(empty($percentil)) {
array_splice($module_name_list,0,count($module_name_list));
} else {
array_splice($module_name_list,0,count($module_name_list)-(count($module_name_list)/2));
}
array_unshift($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
array_unshift($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
} else {
if(is_null($percentil)) {
array_push($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
array_push($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
if($static_pdf === 0) {
array_unshift($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
array_unshift($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
} else {
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
array_unshift($module_name_list, __('summatory'));
array_unshift($module_name_list, __('average'));
}
} else {
if(empty($percentil)) {
if($static_pdf === 0) {
array_push($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
array_push($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
} else {
array_push($module_name_list, __('summatory'));
array_push($module_name_list, __('average'));
}
} else {
if($static_pdf === 0) {
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
} else {
array_splice($module_name_list,(count($module_name_list)/2),0, __('average'));
array_splice($module_name_list,(count($module_name_list)/2),0,__('summatory'));
}
}
}
@ -2209,17 +2230,32 @@ function graphic_combined_module ($module_list, $weight_list, $period,
}
if(!$modules_series) {
if(is_null($percentil)) {
if(empty($percentil)) {
array_splice($module_name_list,0,count($module_name_list));
} else {
array_splice($module_name_list,0,count($module_name_list)-(count($module_name_list)/2));
}
array_unshift($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
} else {
if(is_null($percentil)) {
array_push($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
if($static_pdf === 0) {
array_unshift($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
} else {
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
array_unshift($module_name_list, __('summatory'));
}
} else {
if(empty($percentil)) {
if($static_pdf === 0) {
array_push($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
} else {
array_push($module_name_list,__('summatory'));
}
} else {
if($static_pdf === 0) {
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
} else {
array_splice($module_name_list,(count($module_name_list)/2),0,__('summatory'));
}
}
}
@ -2234,17 +2270,32 @@ function graphic_combined_module ($module_list, $weight_list, $period,
}
if(!$modules_series) {
if(is_null($percentil)) {
if(empty($percentil)) {
array_splice($module_name_list,0,count($module_name_list));
} else {
array_splice($module_name_list,0,count($module_name_list)-(count($module_name_list)/2));
}
array_unshift($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
} else {
if(is_null($percentil)) {
array_push($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
if($static_pdf === 0) {
array_unshift($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
} else {
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
array_unshift($module_name_list,__('average'));
}
} else {
if(empty($percentil)) {
if($static_pdf === 0) {
array_push($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
} else {
array_push($module_name_list,__('average'));
}
} else {
if($static_pdf === 0) {
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
} else {
array_splice($module_name_list,(count($module_name_list)/2),0,__('average'));
}
}
}
}
@ -3888,7 +3939,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
$bottom = $datelimit + ($periodtime * $i);
if (! $graphic_type) {
if ($config['flash_charts']) {
$name = date('H:i:s', $bottom);
$name = date('H:i', $bottom);
}
else {
$name = date('H\h', $bottom);
@ -4499,11 +4550,11 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
}
function fullscale_data ( &$chart_data, &$chart_extra_data, &$long_index,
$series_type, $agent_module_id, $datelimit, $date,
$events = false, $show_events = false,
$show_unknown = false, $show_alerts = false,
$series_suffix = '', $percentil = false,
$flash_chart = true, $boolean_graph = false){
$series_type, $agent_module_id, $datelimit, $date,
$events = false, $show_events = false,
$show_unknown = false, $show_alerts = false,
$series_suffix = '', $percentil = false,
$flash_chart = true, $boolean_graph = false){
global $config;
global $max_value;
@ -4559,6 +4610,10 @@ function fullscale_data ( &$chart_data, &$chart_extra_data, &$long_index,
$chart_data[$event_date]["alert" . $series_suffix] = 1;
$chart_extra_data[count($chart_data)-1]['alerts'] = implode (',', $alert_ids[$event_date]);
}
else{
$chart_data[$event_date]["event" . $series_suffix] = NULL;
$chart_data[$event_date]["alert" . $series_suffix] = NULL;
}
$chart_data[$event_date]["sum" . $series_suffix] = $previous_data;
if($show_unknown) {

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

@ -500,7 +500,16 @@ function menu_add_extras(&$menu) {
$menu_extra['eventos']['sub']['godmode/events/events']['text'] = __('Administration events');
$menu_extra['reporting']['sub']['operation/reporting/reporting_viewer']['text'] = __('View reporting');
$menu_extra['reporting']['sub']['godmode/reporting/graph_builder']['text'] = __('Manage custom graphs');
$menu_extra['reporting']['sub']['godmode/reporting/graph_container']['text'] = __('View graph containers');
$menu_extra['reporting']['sub']['godmode/reporting/create_container']['text'] = __('Manage graph containers');
$menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_list']['text'] = __('View graph templates');
$menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_editor']['text'] = __('Manage graph templates');
$menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_item_editor']['text'] = __('Graph template items');
$menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_wizard']['text'] = __('Graph template wizard');
$menu_extra['reporting']['sub']['enterprise/dashboard/dashboard_replicate']['text'] = __('Copy dashboard');
if ($config['activate_gis'])

View File

@ -1572,14 +1572,18 @@ function reporting_event_report_module($report, $content,
$event_graph_by_user_validator = $event_filter['event_graph_by_user_validator'];
$event_graph_by_criticity = $event_filter['event_graph_by_criticity'];
$event_graph_validated_vs_unvalidated = $event_filter['event_graph_validated_vs_unvalidated'];
$id_server = false;
if(is_metaconsole()){
$id_server = metaconsole_get_id_server($content["server_name"]);
}
//data events
$data = reporting_get_module_detailed_event (
$content['id_agent_module'], $content['period'], $report["datetime"],
$show_summary_group, $filter_event_severity, $filter_event_type,
$filter_event_status, $filter_event_filter_search, $force_width_chart,
$event_graph_by_user_validator, $event_graph_by_criticity,
$event_graph_validated_vs_unvalidated, $ttl);
$event_graph_validated_vs_unvalidated, $ttl, $id_server);
if (empty($data)) {
$return['failed'] = __('No events');
@ -6513,7 +6517,13 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
$labels,
false,
false,
$graph["percentil"]
$graph["percentil"],
false,
false,
false,
$graph["summatory_series"],
$graph["average_series"],
$graph["modules_series"]
);
break;
case 'data':
@ -6803,7 +6813,7 @@ function reporting_get_module_detailed_event ($id_modules, $period = 0,
$filter_event_type = false, $filter_event_status = false,
$filter_event_filter_search = false, $force_width_chart = false,
$event_graph_by_user_validator = false, $event_graph_by_criticity = false,
$event_graph_validated_vs_unvalidated = false, $ttl = 1) {
$event_graph_validated_vs_unvalidated = false, $ttl = 1, $id_server = false) {
global $config;
@ -6826,8 +6836,8 @@ function reporting_get_module_detailed_event ($id_modules, $period = 0,
$event['data'] = events_get_agent (false, (int) $period, (int) $date,
$history, $show_summary_group, $filter_event_severity,
$filter_event_type, $filter_event_status, $filter_event_filter_search,
false, false, $id_module, true);
false, false, $id_module, true , $id_server);
//total_events
if(isset($event['data'])){
$event['total_events'] = count($event['data']);
@ -7797,6 +7807,10 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
$urls['monitor_not_init'] = $links['monitor_not_init'];
}
// Fixed width non interactive charts
$status_chart_width = $config["flash_charts"] == false
? 100 : $graph_width;
// Modules by status table
$table_mbs = html_get_predefined_table();
@ -7836,7 +7850,7 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
$table_mbs->colspan[count($table_mbs->data)][0] = 4;
$table_mbs->cellstyle[count($table_mbs->data)][0] = 'text-align: center;';
$tdata[0] = '<div id="outter_status_pie" style="height: ' . $graph_height . 'px">' .
'<div id="status_pie" style="margin: auto; width: ' . $graph_width . 'px;">' .
'<div id="status_pie" style="margin: auto; width: ' . $status_chart_width . 'px;">' .
graph_agent_status(false, $graph_width, $graph_height, true, true, $data_agents) .
'</div></div>';
$table_mbs->rowclass[] = '';

View File

@ -2874,7 +2874,16 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height) {
$table_sum->cellstyle[count($table_sum->data)][2] = 'text-align: center;';
if ($data["monitor_checks"] > 0) {
$tdata[0] = '<div style="margin: auto; width: ' . $graph_width . 'px;">' . graph_agent_status (false, $graph_width, $graph_height, true, true) . '</div>';
// Fixed width non interactive charts
$status_chart_width = $config["flash_charts"] == false
? 100 : $graph_width;
$tdata[0] =
'<div style="margin: auto; width: ' . $graph_width . 'px;">' .
'<div id="status_pie" style="margin: auto; width: ' . $graph_width . '">' .
graph_agent_status (false, $graph_width, $graph_height, true, true) .
'</div>' .
'</div>';
}
else {
$tdata[2] = html_print_image('images/image_problem_area_small.png', true, array('width' => $graph_width));

View File

@ -2300,6 +2300,8 @@ function ui_get_url_refresh ($params = false, $relative = true, $add_post = true
}
$url = htmlspecialchars ($url);
$url = io_safe_input ($url);
if (! $relative) {
return ui_get_full_url ($url);

View File

@ -169,14 +169,14 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup
} else {
// Admin.
if (is_user_admin($id_user)) {
$groups = db_get_all_rows_sql ("SELECT * FROM tgrupo");
$groups = db_get_all_rows_sql ("SELECT * FROM tgrupo ORDER BY nombre");
}
// Per-group permissions.
else {
$query = sprintf("SELECT tgrupo.*, tperfil.*, tusuario_perfil.tags FROM tgrupo, tusuario_perfil, tperfil
WHERE (tgrupo.id_grupo = tusuario_perfil.id_grupo OR tusuario_perfil.id_grupo = 0)
AND tusuario_perfil.id_perfil = tperfil.id_perfil
AND tusuario_perfil.id_usuario = '%s'", $id_user);
AND tusuario_perfil.id_usuario = '%s' ORDER BY nombre", $id_user);
$groups = db_get_all_rows_sql ($query);
// Get children groups.

View File

@ -528,24 +528,28 @@ function visual_map_print_item($mode = "read", $layoutData,
break;
case GROUP_ITEM:
$is_a_link_to_other_visualconsole = false;
if ($layoutData['id_layout_linked'] != 0) {
$is_a_link_to_other_visualconsole = true;
}
if ($is_a_link_to_other_visualconsole) {
if (empty($layout_data['id_metaconsole'])) {
$url = $config['homeurl'] . "index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure=" . $config["pure"] . "&amp;id=" . $layoutData["id_layout_linked"];
$is_a_link_to_other_visualconsole = false;
if ($layoutData['id_layout_linked'] != 0) {
$is_a_link_to_other_visualconsole = true;
}
if ($is_a_link_to_other_visualconsole) {
if (METACONSOLE == 1) {
$url = $config['homeurl'] . "index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&id_visualmap=".$layoutData["id_layout_linked"]."&refr=300";
}
else {
$url = $config['homeurl'] . "index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure=" . $config["pure"] . "&amp;id=" . $layoutData["id_layout_linked"];
}
}
else {
$url = "index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=1&id_visualmap=" . $layoutData["id_layout_linked"] . "&refr=0";
if (METACONSOLE == 1) {
$url = $config['homeurl'] .
'index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=0&ag_group='.$layoutData['id_group'].'&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status=-1&sort_field=&sort=none&pure=';
}
else {
$url = $config['homeurl'] .
'index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id='.$layoutData['id_group'];
}
}
}
else {
$url = $config['homeurl'] .
'index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=' .
$layoutData['id_group'];
}
break;
case LABEL:
if ($layoutData['id_layout_linked'] != 0) {

View File

@ -1607,6 +1607,12 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
// Adjust the overview plot to the width and position of the main plot
adjust_left_width_canvas(graph_id, 'overview_'+graph_id);
update_left_width_canvas(graph_id);
// Adjust overview when main chart is resized
$('#'+graph_id).resize(function(){
update_left_width_canvas(graph_id);
});
// Adjust linked graph to the width and position of the main plot
@ -2139,6 +2145,12 @@ function adjust_left_width_canvas(adapter_id, adapted_id) {
$('#'+adapted_id).css('margin-left', adapter_left_margin);
}
function update_left_width_canvas(graph_id) {
$('#overview_'+graph_id).width($('#'+graph_id).width() - 30);
$('#overview_'+graph_id).css('margin-left', $('#'+graph_id+' .yAxis .tickLabel').width());
}
function check_adaptions(graph_id) {
var classes = $('#'+graph_id).attr('class').split(' ');

View File

@ -48,7 +48,7 @@ div.img_title {
</style>
<body class="hlp_graphs">
<h1>INTERPRETING GHRAPHS IN PANDORA FMS</h1>
<h1>INTERPRETING GRAPHS IN PANDORA FMS</h1>
<p>In Pandora FMS, graphs represent the values a module has had during a given period.</p>

View File

@ -5,27 +5,52 @@
?>Event responses macros</h1>
<p>
The response target (command or URL) accepts macros to custom it.
The response target (command or URL) accepts macros to customize it.
<br><br>
The macros accepted are the following:
The accepted macros are:
<ul>
<li><b>Agent address:</b> _agent_address_</li>
<li><b>Agent id:</b> _agent_id_</li>
<li><b>Event id:</b> _event_id_</li>
<li><b>Agent ID:</b> _agent_id_</li>
<li><b>Event related alert ID:</b> _alert_id_</li>
<li><b>Date on which the event occurred:</b> _event_date_</li>
<li><b>Extra ID:</b> _event_extra_id_</li>
<li><b>Event ID:</b> _event_id_</li>
<li><b>Event instructions:</b> _event_instruction_</li>
<li><b>Event severity ID:</b> _event_severity_id_</li>
<li><b>Event severity (translated by Pandora console):</b> _event_severity_text_</li>
<li><b>Event source:</b> _event_source_</li>
<li><b>Event status (new, validated or event in process):</b> _event_status_</li>
<li><b>Event tags separated by commas:</b> _event_tags_</li>
<li><b>Full text of the event:</b> _event_text_</li>
<li><b>Event type (System, going into Unknown Status...):</b> _event_type_</li>
<li><b>Date on which the event occurred in utimestamp format:</b> _event_utimestamp_</li>
<li><b>Group ID:</b> _group_id_</li>
<li><b>Group name in database:</b> _group_name_</li>
<li><b>Event associated module address:</b> _module_address_</li>
<li><b>Event associated module ID:</b> _module_id_</li>
<li><b>Event associated module name:</b> _module_name_</li>
<li><b>Event owner user:</b> _owner_user_</li>
<li><b>User ID:</b> _user_id_</li>
</ul>
<h4>Custom fields</h4>
Custom event fields are also available in event response macros. They would
have <b>_customdata_*_</b> form where the asterisk (*) would have to be
replaced by the custom field key you want to use.
<h3>Basic use</h3>
In example, to ping the agent associated to the event:
For example, to ping the agent associated with the event:
<br><br>
Configure command like: <i>ping -c 5 _agent_address_</i>
Configure the command as follows: <i>ping -c 5 _agent_address_</i>
<br><br>
If there are configured parameters, is possible use it as macros too.
If there are configured parameters, it is possible to use them as macros, too.
<h3>Parameters macros</h3>
In example, to custom a URL with parameters:
For example, to customize a URL with parameters:
<br><br>
Configure parameters like: <i>User,Section</i>
Configure the parameters as follows: <i>User,Section</i>
<br><br>
And configure the URL like: <i>http://example.com/index.php?user=_User_&amp;section=_Section_</i>
And configure the URL like this: <i>http://example.com/index.php?user=_User_&amp;section=_Section_</i>
</p>

View File

@ -13,9 +13,34 @@ Las macros aceptadas son las siguientes:
<ul>
<li><b>Dirección del agente:</b> _agent_address_</li>
<li><b>Id del agente:</b> _agent_id_</li>
<li><b>Id de la alerta asociada al evento:</b> _alert_id_</li>
<li><b>Fecha en la que se produjo el evento:</b> _event_date_</li>
<li><b>Id extra:</b> _event_extra_id_</li>
<li><b>Id del evento:</b> _event_id_</li>
<li><b>Instrucciones del evento:</b> _event_instruction_</li>
<li><b>Id de la criticidad del evento:</b> _event_severity_id_</li>
<li><b>Gravedad del evento (traducido por la consola de Pandora):</b> _event_severity_text_</li>
<li><b>Procedencia del evento:</b> _event_source_</li>
<li><b>Estado del evento (Nuevo, validado o evento en proceso):</b> _event_status_</li>
<li><b>Etiquetas del evento separadas por comas:</b> _event_tags_</li>
<li><b>Texto completo del evento:</b> _event_text_</li>
<li><b>Tipo del evento (Sistema, Cambiando a estado desconocido...):</b> _event_type_</li>
<li><b>Fecha en la que se produjo el evento en formato utimestamp:</b> _event_utimestamp_</li>
<li><b>Id del grupo:</b> _group_id_</li>
<li><b>Nombre del grupo en base de datos:</b> _group_name_</li>
<li><b>Dirección del módulo asociado al evento:</b> _module_address_</li>
<li><b>Id del módulo asociado al evento:</b> _module_id_</li>
<li><b>Nombre del módulo asociado al evento:</b> _module_name_</li>
<li><b>Usuario propietario del evento:</b> _owner_user_</li>
<li><b>Id del usuario:</b> _user_id_</li>
</ul>
<h4>Campos personalizados</h4>
Los campos personalizados del evento también están disponibles en las macros de
respuestas de eventos. Tendrían la forma de <b>_customdata_*_</b> donde habría
que sustituir el asterisco (*) por la clave del campo personalizado que se desee
utilizar.
<h3>Uso b&aacute;sico</h3>
Por ejemplo, para hacer un ping al agente asociado al evento:
<br><br>

View File

@ -12,9 +12,34 @@
<ul>
<li><b>エージェントアドレス:</b> _agent_address_</li>
<li><b>エージェントID:</b> _agent_id_</li>
<li><b>Event related alert ID:</b> _alert_id_</li>
<li><b>Date on which the event occurred:</b> _event_date_</li>
<li><b>Extra ID:</b> _event_extra_id_</li>
<li><b>イベントID:</b> _event_id_</li>
<li><b>Event instructions:</b> _event_instruction_</li>
<li><b>Event severity ID:</b> _event_severity_id_</li>
<li><b>Event severity (translated by Pandora console):</b> _event_severity_text_</li>
<li><b>Event source:</b> _event_source_</li>
<li><b>Event status (new, validated or event in process):</b> _event_status_</li>
<li><b>Event tags separated by commas:</b> _event_tags_</li>
<li><b>Full text of the event:</b> _event_text_</li>
<li><b>Event type (System, going into Unknown Status...):</b> _event_type_</li>
<li><b>Date on which the event occurred in utimestamp format:</b> _event_utimestamp_</li>
<li><b>Group ID:</b> _group_id_</li>
<li><b>Group name in database:</b> _group_name_</li>
<li><b>Event associated module address:</b> _module_address_</li>
<li><b>Event associated module ID:</b> _module_id_</li>
<li><b>Event associated module name:</b> _module_name_</li>
<li><b>Event owner user:</b> _owner_user_</li>
<li><b>User ID:</b> _user_id_</li>
</ul>
<h4>Custom fields</h4>
Custom event fields are also available in event response macros. They would
have <b>_customdata_*_</b> form where the asterisk (*) would have to be
replaced by the custom field key you want to use.
<h3>基本的な利用方法</h3>
例として、イベントに関連付けしたエージェントへの ping を示します。
<br><br>

View File

@ -147,11 +147,11 @@ $(document).ready (function () {
$( "#license_error_msg_dialog" ).dialog({
dialogClass: "no-close",
closeOnEscape: false,
resizable: true,
resizable: false,
draggable: true,
modal: true,
height: 350,
width: 720,
height: 450,
width: 850,
overlay: {
opacity: 0.5,
background: "black"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -70,8 +70,8 @@
<body>
<div style='height: 10px'>
<?php
$version = '7.0NG.716';
$build = '171218';
$version = '7.0NG.717';
$build = '171221';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -1,987 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2012 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.
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Pandora FMS - Installation Wizard</title>
<meta http-equiv="expires" content="0">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="author" content="Pandora FMS Development Team">
<meta name="copyright" content="This is GPL software. Created by Sancho Lerena and many others">
<meta name="keywords" content="pandora, fms, monitoring, network, system, GPL, software">
<meta name="robots" content="index, follow">
<link rel="icon" href="images/pandora.ico" type="image/ico">
<link rel="stylesheet" href="include/styles/install.css" type="text/css">
</head>
<script type="text/javascript">
options_text = new Array('An existing Database','A new Database');
options_values = new Array('db_exist','db_new');
function ChangeDBDrop(causer) {
if (causer.value != 'db_exist') {
window.document.step2_form.drop.checked = 0;
window.document.step2_form.drop.disabled = 1;
}
else {
window.document.step2_form.drop.disabled = 0;
}
}
function ChangeDBAction(causer) {
var i = 0;
if (causer.value == 'oracle') {
window.document.step2_form.db_action.length = 1;
}
else {
window.document.step2_form.db_action.length = 2;
}
while (i < window.document.step2_form.db_action.length) {
window.document.step2_form.db_action.options[i].value = options_values[i];
window.document.step2_form.db_action.options[i].text = options_text[i];
i++;
}
window.document.step2_form.db_action.options[window.document.step2_form.db_action.length-1].selected=1;
ChangeDBDrop(window.document.step2_form.db_action);
}
function CheckDBhost(value){
if (( value != "localhost") && ( value != "127.0.0.1")) {
document.getElementById('tr_dbgrant').style["display"] = "block";
}
else {
document.getElementById('tr_dbgrant').style["display"] = "none";
}
}
</script>
<body>
<div style='height: 10px'>
<?php
$version = '7.0NG';
<<<<<<< HEAD
$build = '170406';
=======
$build = '170418';
>>>>>>> develop
$banner = "v$version Build $build";
error_reporting(0);
// ---------------
// Main page code
// ---------------
if (! isset($_GET["step"])) {
install_step1();
}
else {
$step = $_GET["step"];
switch ($step) {
case 11: install_step1_licence();
break;
case 2: install_step2();
break;
case 3: install_step3();
break;
case 4: install_step4();
break;
case 5: install_step5();
break;
}
}
?>
</div>
</body>
</html>
<?php
function check_extension ( $ext, $label ) {
echo "<tr><td>";
echo "<span class='arr'> $label </span>";
echo "</td><td>";
if (!extension_loaded($ext)) {
echo "<img src='images/dot_red.png'>";
return 1;
}
else {
echo "<img src='images/dot_green.png'>";
return 0;
}
echo "</td></tr>";
}
function check_include ( $ext, $label ) {
echo "<tr><td>";
echo "<span class='arr'> $label </span>";
echo "</td><td>";
if (!include($ext)) {
echo "<img src='images/dot_red.png'>";
return 1;
}
else {
echo "<img src='images/dot_green.png'>";
return 0;
}
echo "</td></tr>";
}
function check_exists ( $file, $label ) {
echo "<tr><td>";
echo "<span class='arr'> $label </span>";
echo "</td><td>";
if (!file_exists ($file)) {
echo " <img src='images/dot_red.png'>";
return 1;
}
else {
echo " <img src='images/dot_green.png'>";
return 0;
}
echo "</td></tr>";
}
function check_generic ( $ok, $label ) {
echo "<tr><td style='width:10%'>";
if ($ok == 0 ) {
echo " <img src='images/dot_red.png'>";
echo "<td>";
echo "<span class='arr'> $label </span>";
echo "</td>";
echo "</td></tr>";
return 1;
}
else {
echo " <img src='images/dot_green.png'>";
echo "<td>";
echo "<span class='arr'> $label </span>";
echo "</td>";
echo "</td></tr>";
return 0;
}
}
function check_writable ( $fullpath, $label ) {
echo "<tr><td style='width:10%;'>";
if (file_exists($fullpath))
if (is_writable($fullpath)) {
echo " <img style='margin-left:50px;' src='images/dot_green.png'>";
echo "<td>";
echo "<span class='arr'> $label </span>";
echo "</td>";
echo "</td></tr>";
return 0;
}
else {
echo " <img style='margin-left:50px;' src='images/dot_red.png'>";
echo "<td>";
echo "<span class='arr'> $label </span>";
echo "</td>";
echo "</td></tr>";
return 1;
}
else {
echo " <img style='margin-left:50px;' src='images/dot_red.png'>";
echo "<td>";
echo "<span class='arr'> $label </span>";
echo "</td>";
echo "</td></tr>";
return 1;
}
}
function check_variable ( $var, $value, $label, $mode ) {
echo "<tr><td>";
echo "<span class='arr'> $label </span>";
echo "</td><td>";
if ($mode == 1) {
if ($var >= $value) {
echo " <img src='images/dot_green.png'>";
return 0;
}
else {
echo " <img src='images/dot_red.png'>";
return 1;
}
}
elseif ($var == $value) {
echo " <img src='images/dot_green.png'>";
return 0;
}
else {
echo " <img src='images/dot_red.png'>";
return 1;
}
echo "</td></tr>";
}
function parse_mysql_dump($url) {
if (file_exists($url)) {
$file_content = file($url);
$query = "";
foreach($file_content as $sql_line) {
if (trim($sql_line) != "" && strpos($sql_line, "-- ") === false) {
$query .= $sql_line;
if(preg_match("/;[\040]*\$/", $sql_line)) {
if (!$result = mysql_query($query)) {
echo mysql_error(); //Uncomment for debug
echo "<i><br>$query<br></i>";
return 0;
}
$query = "";
}
}
}
return 1;
}
else
return 0;
}
function parse_mysqli_dump($connection, $url) {
if (file_exists($url)) {
$file_content = file($url);
$query = "";
foreach($file_content as $sql_line) {
if (trim($sql_line) != "" && strpos($sql_line, "-- ") === false) {
$query .= $sql_line;
if(preg_match("/;[\040]*\$/", $sql_line)) {
if (!$result = mysqli_query($connection, $query)) {
echo mysqli_error(); //Uncomment for debug
echo "<i><br>$query<br></i>";
return 0;
}
$query = "";
}
}
}
return 1;
}
else
return 0;
}
function random_name ($size) {
$temp = "";
for ($a=0;$a< $size;$a++)
$temp = $temp. chr(rand(122,97));
return $temp;
}
function print_logo_status ($step, $step_total) {
global $banner;
$header = "
<div id='logo_img' style='width: 100%;'>
<div style='width:100%; background-color:#333333;'>
<img src='images/logo_opensource.png' border='0'><br>
<span style='font-size: 9px;'>$banner</span>
</div>
</div>";
$header .= "
<div class='installation_step'>
<b>Install step $step of $step_total</b>
</div>";
return $header;
}
//
// This function adjusts path settings in pandora db for FreeBSD.
//
// All packages and configuration files except operating system's base files
// are installed under /usr/local in FreeBSD. So, path settings in pandora db
// for some programs should be changed from the Linux default.
//
function adjust_paths_for_freebsd($engine, $connection = false) {
$adjust_sql = array(
"update trecon_script set script = REPLACE(script,'/usr/share','/usr/local/share');",
"update tconfig set value = REPLACE(value,'/usr/bin','/usr/local/bin') where token='netflow_daemon' OR token='netflow_nfdump' OR token='netflow_nfexpire';",
"update talert_commands set command = REPLACE(command,'/usr/bin','/usr/local/bin');",
"update talert_commands set command = REPLACE(command,'/usr/share', '/usr/local/share');",
"update tplugin set execute = REPLACE(execute,'/usr/share','/usr/local/share');",
"update tevent_response set target = REPLACE(target,'/usr/share','/usr/local/share');",
"insert into tconfig (token, value) VALUES ('graphviz_bin_dir', '/usr/local/bin');"
);
for ($i = 0; $i < count ($adjust_sql); $i++) {
switch ($engine) {
case 'mysql':
$result = mysql_query($adjust_sql[$i]);
break;
case 'mysqli':
$result = mysqli_query($connection, $adjust_sql[$i]);
break;
case 'oracle':
//Delete the last semicolon from current query
$query = substr($adjust_sql[$i], 0, strlen($adjust_sql[$i]) - 1);
$sql = oci_parse($connection, $query);
$result = oci_execute($sql);
break;
case 'pgsql':
pg_send_query($connection, $adjust_sql[$i]);
$result = pg_get_result($connection);
break;
}
if (!$result) {
return 0;
}
}
return 1;
}
function install_step1() {
global $banner;
echo "
<div id='install_container'>
<div id='wizard'>
" . print_logo_status (1,6) . "
<div id='install_box'>
<h2>Welcome to Pandora FMS installation Wizard</h2>
<p>This wizard helps you to quick install Pandora FMS console and main database in your system.</p>
<p>In four steps, this installer will check all dependencies and will create your configuration, ready to use.</p>
<p>For more information, please refer to documentation.<br>
<i>Pandora FMS Development Team</i></p>
";
if (file_exists("include/config.php")) {
echo "<div class='warn'><b>Warning:</b> You already have a config.php file.
Configuration and database would be overwritten if you continued.</div>";
}
echo "<br>";
echo "<table width=100%>";
$writable = check_writable ( "include", "Checking if ./include is writable");
if (file_exists("include/config.php"))
$writable += check_writable ( "include/config.php", "Checking if include/config.php is writable");
echo "</table>";
echo "<div class='warn'><b>Warning:</b> This installer will <b>overwrite and destroy</b>
your existing Pandora FMS configuration and <b>Database</b>. Before continue,
please <b>be sure that you have no valuable Pandora FMS data in your Database</b>.<br>
</div>";
echo "<div class='info'><b>Upgrade</b>:
If you want to upgrade from Pandora FMS 4.x to 5.0 version, please use the migration tool inside /extras directory in this setup.
</div>";
echo "<br>";
if ($writable == 0) {
echo "<div style='text-align:right; width:100%;'>";
echo "<a id='step11' href='install.php?step=11'><button type='submit' class='btn_install_next'>Next</button></a>";
echo "</div>";
}
else {
echo "<div class='err'><b>ERROR:</b>You need to setup permissions to be able to write in ./include directory</div>";
}
echo "</div>";
echo "<div style='clear:both;'></div>";
echo "
</div>
<div id='foot_install'>
<i>Pandora FMS is an OpenSource Software project registered at
<a target='_new' href='http://pandora.sourceforge.net'>SourceForge</a></i>
</div>
</div>";
}
function install_step1_licence() {
echo "
<div id='install_container'>
<div id='wizard'>
" . print_logo_status (2,6) . "
<div id='install_box'>
<h2>GPL2 Licence terms agreement</h2>
<p>Pandora FMS is an OpenSource software project licensed under the GPL2 licence. Pandora FMS includes, as well, another software also licensed under LGPL and BSD licenses. Before continue, <i>you must accept the licence terms.</i>.
<p>For more information, please refer to our website at http://pandorafms.org and contact us if you have any kind of question about the usage of Pandora FMS</p>
<p>If you dont accept the licence terms, please, close your browser and delete Pandora FMS files.</p>
";
if (!file_exists("COPYING")) {
echo "<div class='warn'><b>Licence file 'COPYING' is not present in your distribution. This means you have some 'partial' Pandora FMS distribution. We cannot continue without accepting the licence file.</b>";
echo "</div>";
}
else {
echo "<form method=post action='install.php?step=2'>";
echo "<textarea name='gpl2' cols=52 rows=15 style='width: 100%;'>";
echo file_get_contents ("COPYING");
echo "</textarea>";
echo "<p>";
echo "<div style='text-align: right;'><button id='btn_accept' class='btn_install_next' type='submit'>Yes, I accept licence terms</button></div>";
}
echo "</div>";
echo "</div>
<div style='clear: both;height: 1px;'><!-- --></div>
<div id='foot_install'>
<i>Pandora FMS is an OpenSource Software project registered at
<a target='_new' href='http://pandora.sourceforge.net'>SourceForge</a></i>
</div>
</div>";
}
function install_step2() {
echo "
<div id='install_container'>
<div id='wizard'>
" . print_logo_status (3,6) . "
<div id='install_box'>";
echo "<h2>Checking software dependencies</h2>";
echo "<table border=0 width=230>";
$res = 0;
$res += check_variable(phpversion(),"5.2","PHP version >= 5.2",1);
$res += check_extension("gd","PHP GD extension");
$res += check_extension("ldap","PHP LDAP extension");
$res += check_extension("snmp","PHP SNMP extension");
$res += check_extension("session","PHP session extension");
$res += check_extension("gettext","PHP gettext extension");
$res += check_extension("mbstring","PHP Multibyte String");
$res += check_extension("zip","PHP Zip");
$res += check_extension("zlib","PHP Zlib extension");
$res += check_extension("json","PHP json extension");
$res += check_extension("curl","CURL (Client URL Library)");
$res += check_extension("filter","PHP filter extension");
$res += check_extension("calendar","PHP calendar extension");
if (PHP_OS == "FreeBSD") {
$res += check_exists ("/usr/local/bin/twopi","Graphviz Binary");
}
else if (PHP_OS == "NetBSD") {
$res += check_exists ("/usr/pkg/bin/twopi","Graphviz Binary");
}
else if ( substr(PHP_OS, 0, 3) == 'WIN' ) {
$res += check_exists ("..\\..\\..\\Graphviz\\bin\\twopi.exe", "Graphviz Binary");
}
else {
$res += check_exists ("/usr/bin/twopi","Graphviz Binary");
}
echo "<tr><td>";
echo "<span style='display: block; font-family: verdana,arial,sans;
font-size: 8.5pt;margin-top: 2px; font-weight: bolder;'>DB Engines</span>";
echo "</td><td>";
echo "</td></tr>";
check_extension("mysql", "PHP MySQL extension");
check_extension("mysqli", "PHP MySQL(mysqli) extension");
echo "</table>";
if ($res > 0) {
echo "
<div class='err'>You have some incomplete
dependencies. Please correct them or this installer
will not be able to finish your installation.
</div>
<div class='err'>
Remember, if you install any PHP module to comply
with these dependences, you <b>need to restart</b>
your HTTP/Apache server after it to use the new
modules.
</div>
<div style='text-align:right; width:100%;'>
Ignore it. <a id='step3' href='install.php?step=3' style='font-weight: bolder;'><button class='btn_install_next' type='submit'>Force install Step #3</button></a>
</div>";
}
else {
echo "<div style='text-align:right; width:100%;'>";
echo "<a id='step3' href='install.php?step=3'>
<button class='btn_install_next' type='submit'>Next</button></a>";
echo "</div>";
}
echo "</div>";
echo "<div style='clear: both;'><!-- --></div>";
echo "
</div>
<div style='clear: both;'><!-- --></div>
</div>
<div id='foot_install'>
<i>Pandora FMS is an OpenSource Software project registered at
<a target='_new' href='http://pandora.sourceforge.net'>SourceForge</a></i>
</div>
</div>";
}
function install_step3() {
$options = '';
if (extension_loaded("mysql")) {
$options .= "<option value='mysql'>MySQL</option>";
}
if (extension_loaded("mysqli")) {
$options .= "<option value='mysqli'>MySQL(mysqli)</option>";
}
$error = false;
if (empty($options)) {
$error = true;
}
echo "
<div id='install_container'>
<div id='wizard'>
" . print_logo_status (4,6) . "
<div id='install_box'>
<h2>Environment and database setup</h2>
<p>
This wizard will create your Pandora FMS database,
and populate it with all the data needed to run for the first time.
</p>
<p>
You need a privileged user to create database schema, this is usually <b>root</b> user.
Information about <b>root</b> user will not be used or stored anymore.
</p>
<p>
You can also deploy the scheme into an existing Database.
In this case you need a privileged Database user and password of that instance.
</p>
<p>
Now, please, complete all details to configure your database and environment setup.
</p>
<div class='warn'>
<b>Warning:</b> This installer will <b>overwrite and destroy</b> your existing
Pandora FMS configuration and <b>Database</b>. Before continue,
please <b>be sure that you have no valuable Pandora FMS data in your Database.</b>
<br><br>
</div>";
if (extension_loaded("oci8")) {
echo " <div class='warn'>For Oracle installation an existing Database with a privileged user is needed.</div>";
}
if (!$error) {
echo "<form method='post' name='step2_form' action='install.php?step=4'>";
}
echo "<table cellpadding=6 width=100% border=0 style='text-align: left;'>";
echo "<tr><td>";
echo "DB Engine<br>";
if ($error) {
echo "
<div class='warn'>
<b>Warning:</b> You haven't a any DB engine with PHP. Please check the previous step to DB engine dependencies.
</div>";
}
else {
echo "<select name='engine' onChange=\"ChangeDBAction(this)\">";
echo $options;
echo "</select>";
echo "<td>";
echo " Installation in <br>";
echo "<select name='db_action' onChange=\"ChangeDBDrop(this)\">";
echo "<option value='db_new'>A new Database</option>";
echo "<option value='db_exist'>An existing Database</option>";
echo "</select>";
}
echo " <tr><td>DB User with privileges<br>
<input class='login' type='text' name='user' value='root' size=20>
<td>DB Password for this user<br>
<input class='login' type='password' name='pass' value='' size=20>
<tr><td>DB Hostname<br>
<input class='login' type='text' name='host' value='localhost' onkeyup='CheckDBhost(this.value);'size=20>
<td>DB Name (pandora by default)<br>
<input class='login' type='text' name='dbname' value='pandora' size=20>
<tr>";
// the field dbgrant is only shown when the DB host is different from 127.0.0.1 or localhost
echo "<tr id='tr_dbgrant' style='display:none;'>
<td colspan=\"2\">DB Host Access <img style='cursor:help;' src='/pandora_console/images/tip.png' title='Ignored if DB Hostname is localhost or 127.0.0.1'/><br>
<input class='login' type='text' name='dbgrant' value='" . $_SERVER['SERVER_ADDR'] . "' size=20>
</td>
</tr>";
echo " <td valign=top>Drop Database if exists<br>
<input class='login' type='checkbox' name='drop' value=1>
</td>";
echo "<td>Full path to HTTP publication directory<br>
<span style='font-size: 9px'>For example /var/www/pandora_console/</span>
<br>
<input class='login' type='text' name='path' style='width: 240px;'
value='".dirname (__FILE__)."'>
<tr>";
if ($_SERVER['SERVER_ADDR'] == 'localhost' || $_SERVER['SERVER_ADDR'] == '127.0.0.1') {
echo "<td valign=top>
Drop Database if exists<br>
<input class='login' type='checkbox' name='drop' value=1>
";
} else {
echo "<td>";
}
echo "<td>URL path to Pandora FMS Console<br>
<span style='font-size: 9px'>For example '/pandora_console'</span>
</br>
<input class='login' type='text' name='url' style='width: 250px;'
value='".dirname ($_SERVER["SCRIPT_NAME"])."'>
</table>
";
if (!$error) {
echo "<div style='text-align:right; width:100%;'>";
echo "<a id='step4' href='install.php?step=4'>
<button class='btn_install_next' type='submit'>Next</button></a>";
echo "</div>";
}
echo "</div>";
echo "</form>";
echo "<div style='clear:both;'></div>";
echo "</div>
<div id='foot_install'>
<i>Pandora FMS is an OpenSource Software project registered at
<a target='_new' href='http://pandora.sourceforge.net'>SourceForge</a></i>
</div>
</div>";
}
function install_step4() {
$pandora_config = "include/config.php";
if ( (! isset($_POST["user"])) || (! isset($_POST["dbname"])) || (! isset($_POST["host"])) ||
(! isset($_POST["pass"])) || (!isset($_POST['engine'])) || (! isset($_POST["db_action"])) ) {
$dbpassword = "";
$dbuser = "";
$dbhost = "";
$dbname = "";
$engine = "";
$dbaction = "";
$dbgrant = "";
}
else {
$engine = $_POST['engine'];
$dbpassword = $_POST["pass"];
$dbuser = $_POST["user"];
$dbhost = $_POST["host"];
$dbaction = $_POST["db_action"];
if (isset($_POST["dbgrant"]) && $_POST["dbgrant"] != "")
$dbgrant = $_POST["dbgrant"];
else
$dbgrant = $_SERVER["SERVER_ADDR"];
if (isset($_POST["drop"]))
$dbdrop = $_POST["drop"];
else
$dbdrop = 0;
$dbname = $_POST["dbname"];
if (isset($_POST["url"]))
$url = $_POST["url"];
else
$url = "http://localhost";
if (isset($_POST["path"])) {
$path = $_POST["path"];
$path = str_replace("\\", "/", $path); // Windows compatibility
}
else
$path = "/var/www";
}
$everything_ok = 0;
$step1=0;
$step2=0;
$step3=0;
$step4=0; $step5=0; $step6=0; $step7=0;
echo "
<div id='install_container'>
<div id='wizard'>
" . print_logo_status(5,6) . "
<div id='install_box'>
<h2>Creating database and default configuration file</h2>
<table width='100%'>";
switch ($engine) {
case 'mysql':
if (! mysql_connect ($dbhost, $dbuser, $dbpassword)) {
check_generic ( 0, "Connection with Database");
}
else {
check_generic ( 1, "Connection with Database");
// Drop database if needed and don't want to install over an existing DB
if ($dbdrop == 1) {
mysql_query ("DROP DATABASE IF EXISTS `$dbname`");
}
// Create schema
if ($dbaction == 'db_new' || $dbdrop == 1) {
$step1 = mysql_query ("CREATE DATABASE `$dbname`");
check_generic ($step1, "Creating database '$dbname'");
}
else {
$step1 = 1;
}
if ($step1 == 1) {
$step2 = mysql_select_db($dbname);
check_generic ($step2, "Opening database '$dbname'");
$step3 = parse_mysql_dump("pandoradb.sql");
check_generic ($step3, "Creating schema");
$step4 = parse_mysql_dump("pandoradb_data.sql");
check_generic ($step4, "Populating database");
if (PHP_OS == "FreeBSD") {
$step_freebsd = adjust_paths_for_freebsd ($engine);
check_generic ($step_freebsd, "Adjusting paths in database for FreeBSD");
}
$random_password = random_name (8);
$host = $dbhost; // set default granted origin to the origin of the queries
if (($dbhost != 'localhost') && ($dbhost != '127.0.0.1'))
$host = $dbgrant; // if the granted origin is different from local machine, set the valid origin
$step5 = mysql_query ("GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host
IDENTIFIED BY '".$random_password."'");
mysql_query ("FLUSH PRIVILEGES");
check_generic ($step5, "Established privileges for user pandora. A new random password has been generated: <b>$random_password</b><div class='warn'>Please write it down, you will need to setup your Pandora FMS server, editing the </i>/etc/pandora/pandora_server.conf</i> file</div>");
$step6 = is_writable("include");
check_generic ($step6, "Write permissions to save config file in './include'");
$cfgin = fopen ("include/config.inc.php","r");
$cfgout = fopen ($pandora_config,"w");
$config_contents = fread ($cfgin, filesize("include/config.inc.php"));
$dbtype = 'mysql';
$config_new = '<?php
// Begin of automatic config file
$config["dbtype"] = "' . $dbtype . '"; //DB type (mysql, postgresql...in future others)
$config["dbname"]="'.$dbname.'"; // MySQL DataBase name
$config["dbuser"]="pandora"; // DB User
$config["dbpass"]="'.$random_password.'"; // DB Password
$config["dbhost"]="'.$dbhost.'"; // DB Host
$config["homedir"]="'.$path.'"; // Config homedir
/*
----------Attention--------------------
Please note that in certain installations:
- reverse proxy.
- web server in other ports.
- https
This variable might be dynamically altered.
But it is save as backup in the
$config["homeurl_static"]
for expecial needs.
----------Attention--------------------
*/
$config["homeurl"]="'.$url.'"; // Base URL
$config["homeurl_static"]="'.$url.'"; // Don\'t delete
// End of automatic config file
?>';
$step7 = fputs ($cfgout, $config_new);
$step7 = $step7 + fputs ($cfgout, $config_contents);
if ($step7 > 0)
$step7 = 1;
fclose ($cfgin);
fclose ($cfgout);
chmod ($pandora_config, 0600);
check_generic ($step7, "Created new config file at '".$pandora_config."'");
}
}
if (($step7 + $step6 + $step5 + $step4 + $step3 + $step2 + $step1) == 7) {
$everything_ok = 1;
}
break;
case 'mysqli':
$connection = mysqli_connect ($dbhost, $dbuser, $dbpassword);
if (mysqli_connect_error() > 0) {
check_generic ( 0, "Connection with Database");
}
else {
check_generic ( 1, "Connection with Database");
// Drop database if needed and don't want to install over an existing DB
if ($dbdrop == 1) {
mysqli_query ($connection, "DROP DATABASE IF EXISTS `$dbname`");
}
// Create schema
if ($dbaction == 'db_new' || $dbdrop == 1) {
$step1 = mysqli_query ($connection, "CREATE DATABASE `$dbname`");
check_generic ($step1, "Creating database '$dbname'");
}
else {
$step1 = 1;
}
if ($step1 == 1) {
$step2 = mysqli_select_db($connection, $dbname);
check_generic ($step2, "Opening database '$dbname'");
$step3 = parse_mysqli_dump($connection, "pandoradb.sql");
check_generic ($step3, "Creating schema");
$step4 = parse_mysqli_dump($connection, "pandoradb_data.sql");
check_generic ($step4, "Populating database");
if (PHP_OS == "FreeBSD") {
$step_freebsd = adjust_paths_for_freebsd ($engine, $connection);
check_generic ($step_freebsd, "Adjusting paths in database for FreeBSD");
}
$random_password = random_name (8);
$host = $dbhost; // set default granted origin to the origin of the queries
if (($dbhost != 'localhost') && ($dbhost != '127.0.0.1'))
$host = $dbgrant; // if the granted origin is different from local machine, set the valid origin
$step5 = mysqli_query ($connection, "GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host
IDENTIFIED BY '".$random_password."'");
mysqli_query ($connection, "FLUSH PRIVILEGES");
check_generic ($step5, "Established privileges for user pandora. A new random password has been generated: <b>$random_password</b><div class='warn'>Please write it down, you will need to setup your Pandora FMS server, editing the </i>/etc/pandora/pandora_server.conf</i> file</div>");
$step6 = is_writable("include");
check_generic ($step6, "Write permissions to save config file in './include'");
$cfgin = fopen ("include/config.inc.php","r");
$cfgout = fopen ($pandora_config,"w");
$config_contents = fread ($cfgin, filesize("include/config.inc.php"));
$dbtype = 'mysql';
$config_new = '<?php
// Begin of automatic config file
$config["dbtype"] = "' . $dbtype . '"; //DB type (mysql, postgresql...in future others)
$config["mysqli"] = true;
$config["dbname"]="'.$dbname.'"; // MySQL DataBase name
$config["dbuser"]="pandora"; // DB User
$config["dbpass"]="'.$random_password.'"; // DB Password
$config["dbhost"]="'.$dbhost.'"; // DB Host
$config["homedir"]="'.$path.'"; // Config homedir
/*
----------Attention--------------------
Please note that in certain installations:
- reverse proxy.
- web server in other ports.
- https
This variable might be dynamically altered.
But it is save as backup in the
$config["homeurl_static"]
for expecial needs.
----------Attention--------------------
*/
$config["homeurl"]="'.$url.'"; // Base URL
$config["homeurl_static"]="'.$url.'"; // Don\'t delete
// End of automatic config file
?>';
$step7 = fputs ($cfgout, $config_new);
$step7 = $step7 + fputs ($cfgout, $config_contents);
if ($step7 > 0)
$step7 = 1;
fclose ($cfgin);
fclose ($cfgout);
chmod ($pandora_config, 0600);
check_generic ($step7, "Created new config file at '".$pandora_config."'");
}
}
if (($step7 + $step6 + $step5 + $step4 + $step3 + $step2 + $step1) == 7) {
$everything_ok = 1;
}
break;
}
echo "</table>";
if ($everything_ok == 1) {
echo "<div style='text-align:right; width:100%;'>";
echo "<a id='step5' href='install.php?step=5'>
<button class='btn_install_next' type='submit'>Next</button></a>";
echo "</div>";
}
else {
$info = "<div class='err'><b>There were some problems.
Installation was not completed.</b>
<p>Please correct failures before trying again.
All database ";
if ($engine == 'oracle')
$info .= "objects ";
else
$info .= "schemes ";
$info .= "created in this step have been dropped. </p>
</div>";
echo $info;
switch ($engine) {
case 'mysql':
if (mysql_error() != "") {
echo "<div class='err'> <b>ERROR:</b> ". mysql_error().".</div>";
}
if ($step1 == 1) {
mysql_query ("DROP DATABASE $dbname");
}
break;
case 'mysqli':
if (mysqli_error($connection) != "") {
echo "<div class='err'> <b>ERROR:</b> ". mysqli_error($connection).".</div>";
}
if ($step1 == 1) {
mysqli_query ($connection, "DROP DATABASE $dbname");
}
break;
}
echo "</div>";
}
echo "</div>";
echo "<div style='clear: both;'></div>";
echo "
</div>
<div id='foot_install'>
<i>Pandora FMS is an Open Source Software project registered at
<a target='_new' href='http://pandora.sourceforge.net'>SourceForge</a></i>
</div>
</div>";
}
function install_step5() {
echo "
<div id='install_container'>
<div id='wizard'>
" . print_logo_status (6,6) . "
<div id='install_box'>
<h2>Installation complete</h2>
<p>For security, you now must manually delete this installer
('<i>install.php</i>') file before trying to access to your Pandora FMS console.
<p>You should also install Pandora FMS Servers before trying to monitor anything;
please read documentation on how to install it.</p>
<p>Default user is <b>'admin'</b> with password <b>'pandora'</b>,
please change it both as soon as possible.</p>
<p>Don't forget to check <a href='http://pandorafms.com'>http://pandorafms.com</a>
for updates.
<p>Select if you want to rename '<i>install.php</i>'.</p>
<form method='post' action='index.php'>
<button class='btn_install_next' type='submit' name='rn_file'>Yes, rename the file</button>
<input type='hidden' name='rename_file' value='1'>
</form>
<p><br><b><a id='access_pandora' href='index.php'><button class='btn_install_next' type='submit'>Click here to access to your Pandora FMS console</button></a>.</b>
</p>
</div>";
echo "</div>
<div id='foot_install'>
<i>Pandora FMS is an OpenSource Software project registered at
<a target='_new' href='http://pandora.sourceforge.net'>SourceForge</a></i>
</div>
</div>";
}
?>

View File

@ -328,5 +328,9 @@ class User {
public function getIdGroups ($access = "AR", $all = false) {
return array_keys(users_get_groups($this->user, $access, $all));
}
public function getInfo () {
return users_get_user_by_id($this->user);
}
}
?>

View File

@ -84,7 +84,8 @@ if (!is_object($user) && gettype($user) == 'object') {
$user->saveLogin();
$page = $system->getRequest('page', 'home');
$default_page = 'home';
$page = $system->getRequest('page');
$action = $system->getRequest('action');
// The logout action has priority
@ -242,7 +243,7 @@ switch ($action) {
default:
if (class_exists("Enterprise")) {
$enterprise = Enterprise::getInstance();
if ($page != "home") {
if (!empty($page) && $page != $default_page) {
$permission = $enterprise->checkEnterpriseACL($page);
if (!$permission) {
@ -259,6 +260,36 @@ switch ($action) {
}
}
}
if (empty($page)) {
$user_info = $user->getInfo();
$home_page = $system->safeOutput($user_info['section']);
$section_data = $user_info['data_section'];
switch ($home_page) {
case 'Event list':
$page = 'events';
break;
case 'Group view':
break;
case 'Alert detail':
$page = 'alerts';
break;
case 'Tactical view':
$page = 'tactical';
break;
case 'Dashboard':
$page = 'dashboard';
$id_dashboard = (int) db_get_value('id', 'tdashboard', 'name', $section_data);
$_GET['id_dashboard'] = $id_dashboard;
break;
case 'Visual console':
$page = 'visualmap';
$id_map = (int) db_get_value('id', 'tlayout', 'name', $section_data);
$_GET['id'] = $id_map;
break;
}
}
switch ($page) {
case 'home':

View File

@ -100,13 +100,16 @@ class Agent {
if ($this->id != 0) {
$agent_alias = (string) $this->agent['alias'];
$agents_filter = (string) $system->getRequest('agents_filter');
$agents_filter_q_param = empty($agents_filter) ? '' : '&agents_filter=' . $agents_filter;
$ui->createDefaultHeader(
sprintf('%s', $agent_alias),
$ui->createHeaderButton(
array('icon' => 'back',
'pos' => 'left',
'text' => __('Back'),
'href' => 'index.php?page=agents')));
'href' => 'index.php?page=agents' . $agents_filter_q_param)));
}
else {
$ui->createDefaultHeader(__("PandoraFMS: Agents"));
@ -195,10 +198,16 @@ class Agent {
$ui->contentGridAddCell($html, 'agent_details');
ob_start();
// Fixed width non interactive charts
$status_chart_width = $config["flash_charts"] == false ? 100 : 160;
$graph_width = $config["flash_charts"] == false ? 200 : 160;
$html = '<div class="agent_graphs">';
$html .= "<b>" . __('Modules by status') . "</b>";
$html .= graph_agent_status ($this->id, 160, 160, true);
$html .= '<div id="status_pie" style="margin: auto; width: ' . $status_chart_width . 'px;">';
$html .= graph_agent_status ($this->id, $graph_width, 160, true);
$html .= '</div>';
$graph_js = ob_get_clean();
$html = $graph_js . $html;

View File

@ -98,26 +98,41 @@ class Agents {
$system = System::getInstance();
$user = User::getInstance();
// Default
$filters = array(
'free_search' => '',
'status' => -1,
'group' => 0
);
$serialized_filters = (string) $system->getRequest('agents_filter');
if (!empty($serialized_filters)) {
$filters_unsafe = json_decode(base64_decode($serialized_filters, true), true);
if ($filters_unsafe) $filters = $system->safeInput($filters_unsafe);
}
$this->default_filters['group'] = true;
$this->default_filters['status'] = true;
$this->default_filters['free_search'] = true;
$this->free_search = $system->getRequest('free_search', '');
$this->free_search = $system->getRequest('free_search', $filters['free_search']);
if ($this->free_search != '') {
$this->default = false;
$this->default_filters['free_search'] = false;
$filters['free_search'] = $this->free_search;
}
$this->status = $system->getRequest('status', __("Status"));
$this->status = $system->getRequest('status', $filters['status']);
if (($this->status === __("Status")) || ($this->status == -1)) {
$this->status = -1;
}
else {
$this->default = false;
$this->default_filters['status'] = false;
$filters['status'] = (int) $this->status;
}
$this->group = (int)$system->getRequest('group', __("Group"));
$this->group = (int)$system->getRequest('group', $filters['group']);
if (!$user->isInGroup($this->acl, $this->group)) {
$this->group = 0;
}
@ -127,6 +142,12 @@ class Agents {
else {
$this->default = false;
$this->default_filters['group'] = false;
$filters['group'] = $this->group;
}
if (!empty($filters)) {
// Store the filter
$this->serializedFilters = base64_encode(json_encode($system->safeOutput($filters)));
}
}
@ -216,6 +237,7 @@ class Agents {
$agents = array();
$search_sql = '';
if (!empty($this->free_search)) {
$search_sql = " AND (
alias COLLATE utf8_general_ci LIKE '%" . $this->free_search . "%'
@ -306,9 +328,10 @@ class Agents {
$img_alert = agents_tree_view_alert_img ($agent["fired_count"]);
$serialized_filters_q_param = empty($this->serializedFilters) ? '' : '&agents_filter=' . $this->serializedFilters;
$row[0] = $row[__('Agent')] = '<span class="tiny" style="margin-right: 5px;">' . $img_status . '</span>' .
'<a class="ui-link" data-ajax="false" href="index.php?page=agent&id=' . $agent['id_agente'] . '">' . ui_print_truncate_text(io_safe_output($agent['alias']), 30, false) . '</a>';
'<a class="ui-link" data-ajax="false" href="index.php?page=agent&id=' . $agent['id_agente'] . $serialized_filters_q_param . '">' . ui_print_truncate_text($agent['alias'], 30, false) . '</a>';
//~ $row[1] = $row[__('Description')] = '<span class="small">' .
//~ ui_print_truncate_text($agent["description"], 'description', false, true) .
//~ '</span>';

View File

@ -54,6 +54,13 @@ class Home {
);
if (!$system->getConfig('metaconsole')) {
$items['alerts'] = array(
'name' => __('Alerts'),
'filename' => 'alerts.php',
'menu_item' => true,
'icon' => 'alerts'
);
$items['agents'] = array(
'name' => __('Agents'),
'filename' => 'agents.php',
@ -67,6 +74,19 @@ class Home {
'icon' => 'modules'
);
$items['networkmaps'] = array(
'name' => __('Networkmaps'),
'filename' => 'networkmaps.php',
'menu_item' => true,
'icon' => 'network_maps'
);
$items['visualmaps'] = array(
'name' => __('Visual consoles'),
'filename' => 'visualmaps.php',
'menu_item' => true,
'icon' => 'visual_console'
);
// Not in home
$items['agent'] = array(
'name' => __('Agent'),
@ -80,6 +100,19 @@ class Home {
'menu_item' => false,
'icon' => ''
);
$items['networkmap'] = array(
'name' => __('Networkmap'),
'filename' => 'networkmap.php',
'menu_item' => false,
'icon' => ''
);
$items['visualmap'] = array(
'name' => __('Visualmap'),
'filename' => 'visualmap.php',
'menu_item' => false,
'icon' => ''
);
}
$this->pagesItems = $items;

View File

@ -56,15 +56,61 @@ $user = $config['ehorus_user'];
$password = io_output_password($config['ehorus_pass']);
$curl_timeout = $config['ehorus_req_timeout'];
// Get the agent auth token
$token_path = '/agents/' . $ehorus_agent_id . '/token';
$base_url = 'https://' . $hostname . ':' . $port;
// Get the login auth token
$login_path = '/api/login';
$body = array(
'user' => $user,
'pass' => $password,
'exp' => 300 // 5 minutes
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://' . $hostname . ':' . $port . $token_path);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_URL, $base_url . $login_path);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $curl_timeout);
curl_setopt($ch, CURLOPT_USERPWD, $user . ':' . $password);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($body));
$result_login = curl_exec($ch);
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = false;
if ($result_login === false) {
$error = curl_error($ch);
}
curl_close($ch);
if ($error !== false || $http_status !== 200) {
if ($error !== false) {
// echo $error;
ui_print_error_message(__('There was an error retrieving an authorization token'));
}
else {
ui_print_error_message($http_status . ' ' . $result_login);
}
return;
}
$response_auth = array();
try {
$response_auth = json_decode($result_login, true);
}
catch (Exception $e) {
ui_print_error_message(__('There was an error processing the response'));
}
// Get the agent auth token
$token_path = '/api/agents/' . $ehorus_agent_id . '/token';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $base_url . $token_path);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $curl_timeout);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: JWT ' . $response_auth['token']));
$result_token = curl_exec($ch);
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
@ -94,9 +140,9 @@ catch (Exception $e) {
}
// Get agent info
$agent_path = '/agents/' . $ehorus_agent_id;
$agent_path = '/api/agents/' . $ehorus_agent_id;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://' . $hostname . ':' . $port . $agent_path);
curl_setopt($ch, CURLOPT_URL, $base_url . $agent_path);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $curl_timeout);

View File

@ -19,8 +19,8 @@ if (! isset($_SESSION['id_usuario'])) {
}
// Global & session management
require_once ('../../include/config.php');
require_once ($config['homedir'] . '/include/functions.php');
require_once('../../include/config.php');
require_once($config['homedir'] . '/include/functions.php');
check_login();

View File

@ -136,8 +136,14 @@ $data = array();
//$data[0] = reporting_tiny_stats ($agent, true, 'agent', '<div style="height: 5px;"></div>');
//$table_agent->rowspan[count($table_agent->data)][0] = 6;
// Fixed width non interactive charts
$status_chart_width = $config["flash_charts"] == false ? 100 : 150;
$graph_width = $config["flash_charts"] == false ? 200 : 150;
$data[0] = '<div style="margin: 0 auto 6px auto; width: 150px;">';
$data[0] .= graph_agent_status ($id_agente, 150, 120, true);
$data[0] .= '<div id="status_pie" style="margin: auto; width: ' . $status_chart_width . 'px;">';
$data[0] .= graph_agent_status ($id_agente, $graph_width, 120, true);
$data[0] .= '</div>';
$data[0] .= '<br>' . reporting_tiny_stats ($agent, true);
$data[0] .= ui_print_help_tip(__('Agent statuses are re-calculated by the server, they are not shown in real time.'), true);
$data[0] .= '</div>';
@ -467,7 +473,7 @@ if (!empty($network_interfaces)) {
$options = array(
"class" => "closed",
"style" => "vertical-align:righ; cursor:pointer;");
$table_interface->head[0] = html_print_image("images/go.png", true, $options) . "&nbsp;&nbsp;";
$table_interface->head[0] = html_print_image("images/graphmenu_arrow.png", true, $options) . "&nbsp;&nbsp;";
$table_interface->head[0] .= '<span style="vertical-align: middle;">' . __('Interface information') .' (SNMP)</span>';
$table_interface->head_colspan = array();
$table_interface->head_colspan[0] = 8;
@ -593,11 +599,11 @@ if (!empty($network_interfaces)) {
var arrow = $("#agent_interface_info").find("thead").find("img");
if (arrow.hasClass("closed")) {
arrow.removeClass("closed");
arrow.prop("src", "images/down.png");
arrow.prop("src", "images/arrow-down-white.png");
$("#agent_interface_info").find("tbody").show();
} else {
arrow.addClass("closed");
arrow.prop("src", "images/go.png");
arrow.prop("src", "images/graphmenu_arrow.png");
$("#agent_interface_info").find("tbody").hide();
}
})

View File

@ -139,7 +139,7 @@ $interface_traffic_modules = array(
}
// Get input parameters
$period = get_parameter ("period");
$period = get_parameter ("period", SECONDS_1DAY);
$width = (int) get_parameter("width", 555);
$height = (int) get_parameter("height", 245);
$start_date = (string) get_parameter("start_date", date("Y-m-d"));

View File

@ -139,15 +139,15 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
$draw_alerts = get_parameter("draw_alerts", 0);
if(isset($config['only_average'])){
if(isset($config['only_average']) && $config['only_average']){
$avg_only = 1;
}
else {
$avg_only = 0;
}
$show_other = get_parameter('show_other');
if (isset($show_other)) {
if (isset($show_other) && $show_other) {
$avg_only = $show_other;
}

View File

@ -100,7 +100,7 @@ echo '<ul class="mn">';
// QR code
echo '<li class="nomn">';
echo '<a href="javascript: show_dialog_qrcode();">';
echo '<img class="vc-qr" src="../../images/qrcode_icon.jpg"/>';
echo '<img class="vc-qr" src="../../images/qrcode_icon_2.jpg"/>';
echo '</a>';
echo '</li>';

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG.716
%define release 171218
%define version 7.0NG.717
%define release 171221
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -1,85 +0,0 @@
#
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG
<<<<<<< HEAD
%define release 170406
=======
%define release 170418
>>>>>>> develop
# User and Group under which Apache is running
%define httpd_name httpd
%define httpd_user apache
%define httpd_group apache
Summary: Pandora FMS Console
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Vendor: Artica ST <info@artica.es>
#Source0: %{name}-%{version}-%{revision}.tar.gz
Source0: %{name}-%{version}.tar.gz
URL: http://www.pandorafms.com
Group: Productivity/Networking/Web/Utilities
Packager: Sancho Lerena <slerena@artica.es>
Prefix: /var/www/html
BuildRoot: %{_tmppath}/%{name}
BuildArch: noarch
AutoReq: 0
Requires: %{httpd_name} >= 2.0.0
Requires: mod_php >= 5.2.0
Requires: php-gd, php-ldap, php-snmp, php-session, php-gettext
Requires: php-mysql, php-mbstring, php-zip, php-zlib, php-curl
Requires: xorg-x11-fonts-75dpi, xorg-x11-fonts-misc
Requires: graphviz
Provides: %{name}-%{version}
%description
The Web Console is a web application that allows to see graphical reports, state of every agent, also to access to the information sent by the agent, to see every monitored parameter and to see its evolution throughout the time, to form the different nodes, groups and users of the system. It is the part that interacts with the final user, and that will allows you to administer the system.
%prep
rm -rf $RPM_BUILD_ROOT
%setup -q -n pandora_console
%build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_console
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_console
rm $RPM_BUILD_ROOT%{prefix}/pandora_console/*.spec
rm $RPM_BUILD_ROOT%{prefix}/pandora_console/pandora_console_install
install -m 0644 pandora_console_logrotate_centos $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_console
%clean
rm -rf $RPM_BUILD_ROOT
%post
# Has an install already been done, if so we only want to update the files
# push install.php aside so that the console works immediately using existing
# configuration.
#
if [ -f %{prefix}/pandora_console/include/config.php ] ; then
mv %{prefix}/pandora_console/install.php %{prefix}/pandora_console/install.done
else
echo "Please, now, point your browser to http://your_IP_address/pandora_console/install.php and follow all the steps described on it."
fi
%preun
# Upgrading
if [ "$1" = "1" ]; then
exit 0
fi
%files
%defattr(0644,%{httpd_user},%{httpd_group},0755)
%docdir %{prefix}/pandora_console/docs
%{prefix}/pandora_console
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_console

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG.716
%define release 171218
%define version 7.0NG.717
%define release 171221
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -1,96 +0,0 @@
#
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG
<<<<<<< HEAD
%define release 170406
=======
%define release 170418
>>>>>>> develop
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2
%define httpd_user wwwrun
%define httpd_group www
# Evaluate PHP version
%define phpver_lt_430 %(out=`rpm -q --queryformat='%{VERSION}' php` 2>&1 >/dev/null || out=0 ; out=`echo $out | tr . : | sed s/://g` ; if [ $out -lt 430 ] ; then out=1 ; else out=0; fi ; echo $out)
Summary: Pandora FMS Console
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Vendor: Artica ST <info@artica.es>
Source0: %{name}-%{version}.tar.gz
URL: http://www.pandorafms.org
Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es>
Prefix: /srv/www/htdocs
BuildRoot: %{_tmppath}/%{name}
BuildArch: noarch
AutoReq: 0
Requires: apache2, apache2-mod_php5
Requires: php >= 4.3.0
Requires: php5-gd, php5-snmp, php5-json, php5-gettext
Requires: php5-mysql, php5-ldap, php5-mbstring, php5
Requires: graphviz, xorg-x11-fonts-core, graphviz-gd
Requires: php5-zip, php5-zlib, php5-curl
Provides: %{name}-%{version}
%description
Pandora FMS Console is a web application to manage Pandora FMS. Console allows to see graphical reports, state of every agent, also to access to the information sent by the agent, to see every monitored parameter and to see its evolution throughout the time, to form the different nodes, groups and users of the system. It is the part that interacts with the final user, and that will allows you to administer the system.
%prep
rm -rf $RPM_BUILD_ROOT
%setup -q -n pandora_console
%build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_console
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_console
if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_console/pandora_console.spec ] ; then
rm $RPM_BUILD_ROOT%{prefix}/pandora_console/pandora_console.spec
fi
%clean
rm -rf $RPM_BUILD_ROOT
%post
# Has an install already been done, if so we only want to update the files
# push install.php aside so that the console works immediately using existing
# configuration.
#
if [ -f %{prefix}/pandora_console/include/config.php ] ; then
mv %{prefix}/pandora_console/install.php %{prefix}/pandora_console/install.done
else
echo "Please, now, point your browser to http://your_IP_address/pandora_console/install.php and follow all the steps described on it."
fi
cp -aRf %{prefix}/pandora_console/pandora_console_logrotate_suse /etc/logrotate.d/pandora_console
%preun
# Upgrading
if [ "$1" = "1" ]; then
exit 0
fi
rm -Rf %{prefix}/pandora_console
%postun
# Upgrading
if [ "$1" = "1" ]; then
exit 0
fi
rm -Rf /etc/logrotate.d/pandora_console
%files
%defattr(0644,%{httpd_user},%{httpd_group},0755)
%docdir %{prefix}/pandora_console/docs
%{prefix}/pandora_console

View File

@ -9,7 +9,7 @@
# This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.716"
PI_VERSION="7.0NG.717"
FORCE=0
DESTDIR=""
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`

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