Merge branch 'develop' into '757-full-scale-graph-dev'
# Conflicts: # pandora_console/include/functions_graph.php
This commit is contained in:
commit
c0a4cd9df5
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.703, AIX version
|
||||
# Version 7.0NG.704, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.703, FreeBSD Version
|
||||
# Version 7.0NG.704, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.703, HP-UX Version
|
||||
# Version 7.0NG.704, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.703, GNU/Linux
|
||||
# Version 7.0NG.704, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.703, GNU/Linux
|
||||
# Version 7.0NG.704, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.703, Solaris Version
|
||||
# Version 7.0NG.704, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2010 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.703
|
||||
# Version 7.0NG.704
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.703, AIX version
|
||||
# Version 7.0NG.704, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.703
|
||||
# Version 7.0NG.704
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.703, HPUX Version
|
||||
# Version 7.0NG.704, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.703
|
||||
# Version 7.0NG.704
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.703
|
||||
# Version 7.0NG.704
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.703
|
||||
# Version 7.0NG.704
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.703, Solaris version
|
||||
# Version 7.0NG.704, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.703, AIX version
|
||||
# Version 7.0NG.704, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.703
|
||||
Version: 7.0NG.704-170605
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package: pandorafms-agent-unix
|
||||
<<<<<<< HEAD
|
||||
Version: 7.0NG-170406
|
||||
=======
|
||||
Version: 7.0NG-170418
|
||||
>>>>>>> develop
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
Installed-Size: 260
|
||||
Maintainer: Miguel de Dios <miguel.dedios@artica.es>
|
||||
Homepage: http://pandorafms.org/
|
||||
Depends: coreutils, perl, unzip
|
||||
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. It’s possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.703"
|
||||
pandora_version="7.0NG.704-170605"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -0,0 +1,132 @@
|
|||
#!/bin/bash
|
||||
|
||||
#Pandora FMS- http:#pandorafms.com
|
||||
# ==================================================
|
||||
# Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
# Please see http:#pandorafms.org for full contribution list
|
||||
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; version 2
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
<<<<<<< HEAD
|
||||
pandora_version="7.0NG-170406"
|
||||
=======
|
||||
pandora_version="7.0NG-170418"
|
||||
>>>>>>> develop
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
if [ $? = 1 ]
|
||||
then
|
||||
echo "No found \"dpkg-deb\" aplication, please install."
|
||||
exit 1
|
||||
else
|
||||
echo "Found \"dpkg-debs\"."
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
echo "Make a \"temp_package\" temp dir for job."
|
||||
|
||||
mkdir -p temp_package/usr
|
||||
mkdir -p temp_package/usr/share/pandora_agent/
|
||||
mkdir -p temp_package/usr/bin/
|
||||
mkdir -p temp_package/usr/sbin/
|
||||
mkdir -p temp_package/etc/pandora/plugins
|
||||
mkdir -p temp_package/etc/pandora/collections
|
||||
mkdir -p temp_package/etc/init.d/
|
||||
mkdir -p temp_package/lib/systemd/system/
|
||||
mkdir -p temp_package/var/log/pandora/
|
||||
mkdir -p temp_package/var/spool/pandora/data_out
|
||||
mkdir -p temp_package/usr/share/man/man1/
|
||||
mkdir -p temp_package/usr/share/pandora_agent/plugins
|
||||
mkdir -p temp_package/tmp
|
||||
mkdir -p temp_package/etc/logrotate.d/
|
||||
|
||||
echo "Make directory system tree for package."
|
||||
cp DEBIAN temp_package -R
|
||||
chmod 755 -R temp_package/DEBIAN
|
||||
|
||||
#Next lines is same to
|
||||
#cp -aRf * temp_package/usr/share/pandora_agent/
|
||||
#but don't copy recursive the temp_package into temp_package
|
||||
|
||||
for item in `ls | grep -v NT4 | grep -v AIX | grep -v FreeBSD | grep -v HP-UX | grep -v SunOS | grep -v temp_package`
|
||||
do
|
||||
#if [ \( $item != 'temp_package' \) -a \( $item != 'NT4' \) ]
|
||||
#then
|
||||
cp -aRf $item temp_package/usr/share/pandora_agent/
|
||||
#fi
|
||||
done
|
||||
cp -aRf tentacle_client temp_package/usr/bin/
|
||||
cp -aRf pandora_agent temp_package/usr/bin/
|
||||
cp -aRf pandora_agent_exec temp_package/usr/bin/pandora_agent_exec
|
||||
cp -aRf pandora_agent_daemon temp_package/etc/init.d/pandora_agent_daemon
|
||||
cp -aRf pandora_agent_daemon.service temp_package/lib/systemd/system/pandora_agent_daemon.service
|
||||
cp -aRf pandora_agent_logrotate temp_package/etc/logrotate.d/pandora_agent
|
||||
cp Linux/pandora_agent.conf temp_package/etc/pandora/
|
||||
|
||||
cp -aRf man/man1/* temp_package/usr/share/man/man1/
|
||||
|
||||
# Relocate plugins to the final dir and delete
|
||||
mv temp_package/usr/share/pandora_agent/plugins/* temp_package/etc/pandora/plugins
|
||||
|
||||
echo "Official plugins are placed on /etc/pandora/plugins" > temp_package/usr/share/pandora_agent/plugins/README
|
||||
|
||||
#Disabled, now the package overwrite the previous files.
|
||||
##Create a temp file for to update files of plugins dir but don't crush dir.
|
||||
##cp -aRf temp_package/usr/share/pandora_agent/plugins temp_package/tmp
|
||||
##rm -rf temp_package/usr/share/pandora_agent/plugins/*
|
||||
|
||||
echo "Remove the SVN files and other temp files."
|
||||
for item in `find temp_package`
|
||||
do
|
||||
echo -n "."
|
||||
echo $item | grep "svn" > /dev/null
|
||||
#last command success
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
rm -rf $item
|
||||
fi
|
||||
|
||||
echo $item | grep "make_deb_package.sh" > /dev/null
|
||||
#last command success
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
rm -rf $item
|
||||
fi
|
||||
done
|
||||
echo "END"
|
||||
|
||||
echo "Calcule md5sum for md5sums file control of package"
|
||||
for item in `find temp_package`
|
||||
do
|
||||
echo -n "."
|
||||
if [ ! -d $item ]
|
||||
then
|
||||
echo $item | grep "DEBIAN" > /dev/null
|
||||
#last command success
|
||||
if [ $? -eq 1 ]
|
||||
then
|
||||
md5=`md5sum $item | cut -d" " -f1`
|
||||
|
||||
#delete "temp_package" in the path
|
||||
final_path=${item#temp_package}
|
||||
echo $md5" "$final_path >> temp_package/DEBIAN/md5sums
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "END"
|
||||
|
||||
echo "Make the package \"Pandorafms console\"."
|
||||
dpkg-deb --build temp_package
|
||||
mv temp_package.deb pandorafms.agent_unix_$pandora_version.deb
|
||||
|
||||
echo "Delete the \"temp_package\" temp dir for job."
|
||||
rm -rf temp_package
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.703, GNU/Linux
|
||||
# Version 7.0NG.704, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.703, FreeBSD Version
|
||||
# Version 7.0NG.704, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.703, HP-UX Version
|
||||
# Version 7.0NG.704, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.703, GNU/Linux
|
||||
# Version 7.0NG.704, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -46,6 +46,12 @@ agent_name_cmd __rand__
|
|||
#Parent agent_name
|
||||
#parent_agent_name caprica
|
||||
|
||||
# By default, agent takes machine alias
|
||||
#agent_alias
|
||||
|
||||
# To define agent alias by specific command, define 'agent_alias_cmd'.
|
||||
#agent_alias_cmd
|
||||
|
||||
# Agent description
|
||||
#description This is a demo agent for Linux
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.703, GNU/Linux
|
||||
# Version 7.0NG.704, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.703, NetBSD Version
|
||||
# Version 7.0NG.704, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.703, Solaris Version
|
||||
# Version 7.0NG.704, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -40,8 +40,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.703';
|
||||
use constant AGENT_BUILD => '170517';
|
||||
use constant AGENT_VERSION => '7.0NG.704';
|
||||
use constant AGENT_BUILD => '170605';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -135,9 +135,10 @@ my %DefaultConf = (
|
|||
'interval' => 300,
|
||||
'debug' => 0,
|
||||
'agent_name' => '',
|
||||
'agent_alias' => hostname(),
|
||||
'agent_alias' => '',
|
||||
'ehorus_conf' => undef,
|
||||
'agent_name_cmd' => '',
|
||||
'agent_alias_cmd' => '',
|
||||
'description' => '',
|
||||
'group' => '',
|
||||
'group_id' => undef,
|
||||
|
@ -802,6 +803,23 @@ sub read_config (;$) {
|
|||
|
||||
# Module, plugin and collection definitions
|
||||
parse_conf_modules(\@file);
|
||||
|
||||
# If agent_alias_cmd is defined, agent_alias is set by command result.
|
||||
if ($Conf{'agent_alias'} eq '') {
|
||||
if ($Conf{'agent_alias_cmd'} ne '') {
|
||||
my $result = `$Conf{'agent_alias_cmd'}`;
|
||||
# Use only the first line.
|
||||
my ($temp_agent_alias, $remain2) = split(/\n/, $result);
|
||||
chomp ($temp_agent_alias);
|
||||
|
||||
# Remove white spaces of the first and last.
|
||||
$temp_agent_alias =~ s/^ *(.*?) *$/$1/;
|
||||
|
||||
$Conf{'agent_alias'} = $temp_agent_alias if ($temp_agent_alias ne '');
|
||||
} else {
|
||||
$Conf{'agent_alias'} = hostname();
|
||||
}
|
||||
}
|
||||
|
||||
# If agent_name_cmd is defined, agent_name is set by command result.
|
||||
if ($Conf{'agent_name'} eq '') {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.703
|
||||
%define release 1
|
||||
%define version 7.0NG.704
|
||||
%define release 170605
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -0,0 +1,145 @@
|
|||
#
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG
|
||||
<<<<<<< HEAD
|
||||
%define release 170406
|
||||
=======
|
||||
%define release 170418
|
||||
>>>>>>> develop
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
License: GPL
|
||||
Vendor: ArticaST <http://www.artica.es>
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
URL: http://pandorafms.org
|
||||
Group: System/Monitoring
|
||||
Packager: Sancho Lerena <slerena@artica.es>
|
||||
Prefix: /usr/share
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
||||
BuildArch: noarch
|
||||
Requires(pre): shadow-utils
|
||||
Requires(post): chkconfig /bin/ln
|
||||
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
|
||||
Requires: fileutils textutils unzip
|
||||
Requires: util-linux procps grep
|
||||
Requires: /sbin/ip /bin/awk
|
||||
Requires: perl perl(Sys::Syslog) perl(IO::Socket::SSL)
|
||||
# Required by plugins
|
||||
#Requires: sh-utils sed passwd net-tools rpm
|
||||
AutoReq: 0
|
||||
Provides: %{name}-%{version}
|
||||
|
||||
%description
|
||||
Pandora FMS agent for unix. Pandora FMS is an OpenSource full-featured monitoring software.
|
||||
|
||||
%prep
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%setup -q -n unix
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/bin/
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
|
||||
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
|
||||
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
|
||||
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
|
||||
|
||||
install -m 0644 pandora_agent_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_agent
|
||||
|
||||
if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec ] ; then
|
||||
rm $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec
|
||||
fi
|
||||
|
||||
%clean
|
||||
rm -Rf $RPM_BUILD_ROOT
|
||||
|
||||
%pre
|
||||
getent passwd pandora >/dev/null || \
|
||||
/usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora
|
||||
exit 0
|
||||
chown pandora:root /var/log/pandora
|
||||
|
||||
%post
|
||||
if [ ! -d /etc/pandora ] ; then
|
||||
mkdir -p /etc/pandora
|
||||
fi
|
||||
|
||||
if [ ! -f /usr/share/pandora_agent/pandora_agent.conf ] ; then
|
||||
cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/pandora/pandora_agent.conf ] ; then
|
||||
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
|
||||
else
|
||||
ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew
|
||||
fi
|
||||
|
||||
if [ ! -e /etc/pandora/plugins ]; then
|
||||
ln -s /usr/share/pandora_agent/plugins /etc/pandora
|
||||
fi
|
||||
|
||||
if [ ! -e /etc/pandora/collections ]; then
|
||||
ln -s /usr/share/pandora_agent/collections /etc/pandora
|
||||
fi
|
||||
|
||||
mkdir -p /var/spool/pandora/data_out
|
||||
if [ ! -d /var/log/pandora ]; then
|
||||
mkdir -p /var/log/pandora
|
||||
fi
|
||||
/sbin/chkconfig --add pandora_agent_daemon
|
||||
/sbin/chkconfig pandora_agent_daemon on
|
||||
|
||||
%preun
|
||||
|
||||
# Upgrading
|
||||
if [ "$1" = "1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
/sbin/chkconfig --del pandora_agent_daemon
|
||||
/etc/rc.d/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || :
|
||||
|
||||
# Remove symbolic links
|
||||
pushd /etc/pandora
|
||||
for f in pandora_agent.conf plugins collections
|
||||
do
|
||||
[ -L $f ] && rm -f $f
|
||||
done
|
||||
exit 0
|
||||
|
||||
%files
|
||||
%defattr(750,root,root)
|
||||
/usr/bin/pandora_agent
|
||||
|
||||
%defattr(755,pandora,root)
|
||||
%{prefix}/pandora_agent
|
||||
|
||||
%defattr(755,root,root)
|
||||
/usr/bin/pandora_agent_exec
|
||||
/usr/bin/tentacle_client
|
||||
/etc/rc.d/init.d/pandora_agent_daemon
|
||||
|
||||
%defattr(644,root,root)
|
||||
/usr/share/man/man1/pandora_agent.1.gz
|
||||
/usr/share/man/man1/tentacle_client.1.gz
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_agent
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.703
|
||||
%define release 1
|
||||
%define version 7.0NG.704
|
||||
%define release 170605
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -0,0 +1,142 @@
|
|||
#
|
||||
#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
|
||||
|
|
@ -69,6 +69,9 @@ pidof_pandora () {
|
|||
break
|
||||
fi
|
||||
done
|
||||
elif [ "$OS_NAME" = "AIX" ]; then
|
||||
# AIX
|
||||
PANDORA_PID=`ps -ef | grep "$DAEMON $PANDORA_PATH" | grep -v grep | awk '{ print $2 }'`
|
||||
else
|
||||
PANDORA_PID=`ps -Afw | grep "$DAEMON $PANDORA_PATH" | grep -v grep | awk '{ print $2 }'`
|
||||
fi
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.703"
|
||||
PI_BUILD="170517"
|
||||
PI_VERSION="7.0NG.704"
|
||||
PI_BUILD="170605"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -0,0 +1,557 @@
|
|||
#!/bin/sh
|
||||
|
||||
# **********************************************************************
|
||||
# Pandora FMS Agent Installer for Unix (generic installer)
|
||||
# (c) 2008-2015 Artica ST
|
||||
# (c) 2008-2010 Sancho Lerena <slerena@gmail.com>
|
||||
#
|
||||
# This is a generic installer for all Unix-like systems.(AIX, HP-UX, SunOS, Linux, FreeBSD, NetBSD)
|
||||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG"
|
||||
<<<<<<< HEAD
|
||||
PI_BUILD="170406"
|
||||
=======
|
||||
PI_BUILD="170418"
|
||||
>>>>>>> develop
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
||||
|
||||
PREFIX=/usr
|
||||
if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ]
|
||||
then
|
||||
PREFIX=/usr/local
|
||||
fi
|
||||
PANDORA_HOME=$PREFIX/share/pandora_agent
|
||||
PANDORA_BIN=$PREFIX/bin/pandora_agent
|
||||
PANDORA_EXEC_BIN=$PREFIX/bin/pandora_agent_exec
|
||||
PANDORA_REVENT_BIN=$PREFIX/bin/pandora_revent
|
||||
PANDORA_TEMP=/var/spool/pandora
|
||||
PANDORA_CFG=/etc/pandora
|
||||
PANDORA_LOG_DIR=/var/log/pandora
|
||||
PANDORA_LOG=pandora_agent.log
|
||||
TENTACLE=$PREFIX/bin/tentacle_client
|
||||
TENTACLE_SERVER=$PREFIX/bin/tentacle_server
|
||||
PANDORA_MAN=$PREFIX/share/man
|
||||
PANDORA_STARTUP=/etc/init.d/pandora_agent_daemon
|
||||
DAEMON_SCRIPT=pandora_agent_daemon
|
||||
PANDORA_USER="root"
|
||||
PANDORA_PERL_PATH="perl"
|
||||
WITHOUT_TENTACLE_SERVER=0
|
||||
FAKEROOT=0
|
||||
|
||||
# defaults for each platforms
|
||||
case $OS_NAME in
|
||||
AIX)
|
||||
PANDORA_STARTUP=/etc/rc.pandora_agent_daemon
|
||||
;;
|
||||
HP-UX)
|
||||
PANDORA_STARTUP=/sbin/init.d/pandora_agent_daemon
|
||||
;;
|
||||
FreeBSD)
|
||||
PANDORA_CFG=$PREFIX/etc/pandora
|
||||
PANDORA_MAN=$PREFIX/man
|
||||
PANDORA_STARTUP=$PREFIX/etc/rc.d/pandora_agent
|
||||
DAEMON_SCRIPT=$OS_NAME/pandora_agent
|
||||
PANDORA_PERL_PATH=/usr/local/bin/perl
|
||||
;;
|
||||
NetBSD)
|
||||
PANDORA_CFG=/usr/local/etc/pandora
|
||||
PANDORA_STARTUP=/etc/rc.d/pandora_agent
|
||||
DAEMON_SCRIPT=$OS_NAME/pandora_agent
|
||||
PANDORA_PERL_PATH=/usr/pkg/bin/perl
|
||||
;;
|
||||
esac
|
||||
|
||||
MODE=$1
|
||||
|
||||
# options
|
||||
while :
|
||||
do
|
||||
case "$2" in
|
||||
"--no-tentacle-server") WITHOUT_TENTACLE_SERVER=1;;
|
||||
"--fakeroot") FAKEROOT=1;;
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
PANDORA_BASE=`echo $2 | sed -e 's|/$||'`
|
||||
if [ "$3" != "" ]
|
||||
then
|
||||
PANDORA_USER=$3
|
||||
if [ -z "$PANDORA_BASE" ]
|
||||
then
|
||||
echo "When specifying a custom user the agent must be installed to a custom location where that user has write permissions!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
[ "$4" ] && PANDORA_PERL_PATH=$4
|
||||
|
||||
# Check for Perl 5.6.x or higher available
|
||||
PERL_VERSION=`$PANDORA_PERL_PATH -v | egrep 'v5.[6-9]|v5.[12][0-9]' | grep perl`
|
||||
|
||||
if [ -z "$PERL_VERSION" ]
|
||||
then
|
||||
echo "Perl 5.6.x or higher is not detected. This is required for Pandora FMS"
|
||||
echo "Detected: $PERL_VERSION "
|
||||
echo "Aborting install..."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ -z "`echo Linux HP-UX SunOS AIX Solaris Darwin BSD bsd FreeBSD NetBSD | grep \"$OS_NAME\"`" ]
|
||||
then
|
||||
echo "This system: '$OS_NAME' is not supported by this script"
|
||||
echo "Please make the install yourself as it's described in documentation"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# check for root to do the install
|
||||
if [ $FAKEROOT -ne 1 ] && [ -z "`id | grep \"uid=0(root)\"`" ]
|
||||
then
|
||||
echo "You need to be root to do the install. Please made a manual install"
|
||||
echo "if you want to install Pandora FMS agent without root"
|
||||
echo " "
|
||||
echo "Aborting install"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
help () {
|
||||
echo "Syntax":
|
||||
echo " "
|
||||
echo " ./pandora_agent_installer < --mode > [ --option ] [ destination_path ] [ user_to_run_as ] [custom_perl_path]"
|
||||
echo " "
|
||||
echo "Modes:"
|
||||
echo " "
|
||||
echo " --force-install To force installation if already installed on system"
|
||||
echo " --install To install Pandora FMS Agent on this system"
|
||||
echo " --uninstall To uninstall/remove Pandora FMS Agent on this System"
|
||||
echo " "
|
||||
echo "Option:"
|
||||
echo " "
|
||||
echo " --no-tentacle-server Skip tentacle server installation (by default tentalce server installed)"
|
||||
echo " --fakeroot treate \"destination_path\" as root directory"
|
||||
echo " "
|
||||
echo "Some exaples of how to use the installer:"
|
||||
echo " "
|
||||
echo " ./pandora_agent_installer --install"
|
||||
echo " ./pandora_agent_installer --install /opt/pandora"
|
||||
echo " ./pandora_agent_installer --install \"\" pandora"
|
||||
echo " ./pandora_agent_installer --install /opt/pandora root /opt/pandora/perl5/usr/local/bin/perl"
|
||||
echo " ./pandora_agent_installer --uninstall /opt/pandora"
|
||||
echo " "
|
||||
}
|
||||
|
||||
uninstall () {
|
||||
if [ "$OS_NAME" = "Darwin" ]
|
||||
then
|
||||
launchctl remove com.pandorafms.pandorafms
|
||||
rm /Library/LaunchDaemons/com.pandorafms.pandorafms.plist 2> /dev/null
|
||||
fi
|
||||
|
||||
echo "Removing Pandora FMS Agent..."
|
||||
rm -Rf $PANDORA_BASE$PANDORA_BIN 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE$PANDORA_EXEC_BIN 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE$PANDORA_REVENT_BIN 2> /dev/null
|
||||
rm -f $DESTDIR/etc/logrotate.d/pandora_agent
|
||||
|
||||
#Test if exist Pandora Server in this machine
|
||||
if [ -d $PANDORA_BASE$PANDORA_TEMP/data_in ]
|
||||
then
|
||||
echo "You have a Pandora Server in this machine. Then don't delete "$PANDORA_TEMP
|
||||
rm -Rf $PANDORA_BASE$PANDORA_TEMP/data_out 2> /dev/null
|
||||
else
|
||||
rm -Rf $PANDORA_BASE$PANDORA_TEMP 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE$TENTACLE_SERVER 2> /dev/null
|
||||
fi
|
||||
rm -Rf $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf 2> /dev/null
|
||||
|
||||
rm -Rf $PANDORA_BASE/etc/init.d/pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/sbin/init.d/pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/etc/rc.pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/etc/rc?.d/S90pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/sbin/rc?.d/S90pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/etc/rc?.d/S90pandora_agent 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/sbin/rc?.d/S90pandora_agent 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/etc/rc.d/rc?.d/S90pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/etc/rc.d/rc?.d/S90pandora_agent 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE/usr/local/etc/rc.d/pandora_agent 2> /dev/null
|
||||
if [ $FAKEROOT -ne 1 ]
|
||||
then
|
||||
rm -Rf /etc/init.d/pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf /sbin/init.d/pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf /etc/rc.pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf /etc/rc?.d/S90pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf /sbin/rc?.d/S90pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf /etc/rc?.d/S90pandora_agent 2> /dev/null
|
||||
rm -Rf /sbin/rc?.d/S90pandora_agent 2> /dev/null
|
||||
rm -Rf /etc/rc.d/rc?.d/S90pandora_agent_daemon 2> /dev/null
|
||||
rm -Rf /etc/rc.d/rc?.d/S90pandora_agent 2> /dev/null
|
||||
rm -Rf /usr/local/etc/rc.d/pandora_agent 2> /dev/null
|
||||
fi
|
||||
|
||||
rm -Rf $PANDORA_BASE$PANDORA_HOME 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE$TENTACLE 2> /dev/null
|
||||
|
||||
rm -Rf $PANDORA_BASE$PANDORA_MAN/{man1,cat1}/tentacle_client.1.gz 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE$PANDORA_MAN/{man1,cat1}/pandora_agent.1.gz 2> /dev/null
|
||||
|
||||
# Skip delete of /etc/pandora if exists configuration of a server or satellite
|
||||
if [ ! -f $PANDORA_BASE/$PANDORA_CFG/pandora_server.conf -a ! -f $PANDORA_BASE/$PANDORA_CFG/satellite_server.conf ]
|
||||
then
|
||||
rm -Rf $PANDORA_BASE/$PANDORA_CFG 2> /dev/null
|
||||
fi
|
||||
|
||||
if [ ! -z "$PANDORA_BASE" ]
|
||||
then
|
||||
echo "Please delete manually $PANDORA_BASE for complete uninstall"
|
||||
fi
|
||||
|
||||
echo " "
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
#
|
||||
# install_perl_script [OPTIONS] SRCFILE DESTFILE
|
||||
# Install perl script. If PANDORA_PERL_DECODED_PATH is set, path of the perl
|
||||
# in shebang line is replaced with PANDORA_PERL_DECODED_PATH value.
|
||||
# OPTIONS:
|
||||
# -o OWNER owner of the installed script
|
||||
# -g GROUP group of the installed script
|
||||
# -m PREM mode of the installed script
|
||||
#
|
||||
install_perl_script () {
|
||||
OWNER=""; GROUP=""; PERM=""
|
||||
while :
|
||||
do
|
||||
case $1 in
|
||||
-o) OWNER=$2;;
|
||||
-g) GROUP=$2;;
|
||||
-m) PERM=$2;;
|
||||
*) break;;
|
||||
esac
|
||||
shift;shift
|
||||
done
|
||||
SRC="$1"
|
||||
DEST="$2"
|
||||
|
||||
# do install
|
||||
if echo $PANDORA_PERL_PATH | grep "/" > /dev/null && [ "$PANDORA_PERL_PATH" != "/usr/bin/perl" ]
|
||||
then
|
||||
sed -e "s:^#\!.*:#\!$PANDORA_PERL_PATH:g" $SRC > $DEST
|
||||
else
|
||||
cp $SRC $DEST
|
||||
fi
|
||||
|
||||
# set owner, group and permissions
|
||||
[ "$OWNER" ] && chown $OWNER $DEST 2>/dev/null
|
||||
[ "$GROUP" ] && chgrp $GROUP $DEST 2>/dev/null
|
||||
[ "$PERM" ] && chmod $PERM $DEST
|
||||
}
|
||||
|
||||
install () {
|
||||
OS_VERSION=`uname -r`
|
||||
OLDFILENAMETMP=`date +"%Y-%m-%d"`
|
||||
|
||||
echo "Detecting Unix distribution: $OS_NAME version $OS_VERSION"
|
||||
if [ -f $PANDORA_BASE$PANDORA_HOME ] && [ "$FORCE" = "0" ]
|
||||
then
|
||||
echo "Seems that default dir already exists. Please use --force-install to"
|
||||
echo "force installer to install on $PANDORA_BASE$PANDORA_HOME"
|
||||
exit
|
||||
else
|
||||
echo "Checking default dir $PANDORA_BASE$PANDORA_HOME..."
|
||||
fi
|
||||
|
||||
if [ -f $PANDORA_BASE$PANDORA_BIN ] && [ "$FORCE" = "0" ]
|
||||
then
|
||||
echo "Seems that $PANDORA_BASE$PANDORA_BIN already exists. Please use --force-install to"
|
||||
echo "force installer to reinstall overwriting it"
|
||||
echo " "
|
||||
exit
|
||||
else
|
||||
echo "Checking Pandora FMS Agent on $PANDORA_BASE$PANDORA_BIN...."
|
||||
fi
|
||||
|
||||
# Alter dynamically the daemon launcher and setup the new path
|
||||
# if PANDORA_BASE is customized.
|
||||
if [ "$PANDORA_BASE" ] && [ $FAKEROOT -ne 1 ]
|
||||
then
|
||||
DAEMON_TEMP=pandora_agent_daemon_temp
|
||||
|
||||
# Backup the daemon script
|
||||
cp -f "$DAEMON_SCRIPT" "${DAEMON_SCRIPT}.bak"
|
||||
|
||||
AGENT_CFG=$OS_NAME/pandora_agent.conf
|
||||
AGENT_CFG_TEMP=$OS_NAME/pandora_agent.conf.temp
|
||||
|
||||
# Backup the configuration file
|
||||
cp -f "$AGENT_CFG" "${AGENT_CFG}.bak"
|
||||
|
||||
if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ]
|
||||
then
|
||||
sed -e "\|^PATH=|s|=|=$PANDORA_BASE$PREFIX/bin:|" \
|
||||
-e "s|/usr/local/etc/pandora|$PANDORA_BASE$PANDORA_CFG|g" \
|
||||
-e "s|/usr/local/bin/pandora_agent|$PANDORA_BASE$PANDORA_BIN|g" \
|
||||
$DAEMON_SCRIPT > $DAEMON_TEMP
|
||||
mv $DAEMON_TEMP $DAEMON_SCRIPT
|
||||
else
|
||||
sed -e "\|^PATH=|s|=|=$PANDORA_BASE/usr/bin:|" \
|
||||
-e "\|^PANDORA_PATH=|s|=|=$PANDORA_BASE|" \
|
||||
-e "\|^LOGFILE=|s|=|=$PANDORA_BASE|" \
|
||||
-e "\|^DAEMON=|s|=|=$PANDORA_BASE|" \
|
||||
-e "\|^DAEMON_TENTACLE=|s|=|=$PANDORA_BASE|" \
|
||||
-e "s/^PANDORA_USER=.*/PANDORA_USER=$PANDORA_USER/" \
|
||||
$DAEMON_SCRIPT > $DAEMON_TEMP
|
||||
mv $DAEMON_TEMP $DAEMON_SCRIPT
|
||||
fi
|
||||
|
||||
sed -e "s|^temporal[ \t][ \t]*|temporal $PANDORA_BASE|" \
|
||||
-e "s|^logfile[ \t][ \t]*|logfile $PANDORA_BASE|" \
|
||||
$AGENT_CFG > $AGENT_CFG_TEMP
|
||||
mv $AGENT_CFG_TEMP $AGENT_CFG
|
||||
fi
|
||||
echo "Creating Pandora FMS Agent home directory at $PANDORA_BASE$PANDORA_HOME"
|
||||
if [ "$PANDORA_BASE" ]
|
||||
then
|
||||
mkdir -p $PANDORA_BASE 2> /dev/null
|
||||
mkdir -p $PANDORA_BASE/var/log 2> /dev/null
|
||||
mkdir -p $PANDORA_BASE/$PANDORA_MAN/man1 2> /dev/null
|
||||
mkdir -p $PANDORA_BASE$PREFIX/bin 2> /dev/null
|
||||
fi
|
||||
|
||||
mkdir -p $PANDORA_BASE$PANDORA_HOME 2> /dev/null
|
||||
|
||||
# Create directories based on PANDORA_BASE
|
||||
|
||||
mkdir -p $PANDORA_BASE/tmp 2> /dev/null
|
||||
mkdir -p $PANDORA_BASE$PANDORA_TEMP/data_out 2> /dev/null
|
||||
mkdir -p $PANDORA_BASE$PANDORA_CFG 2> /dev/null
|
||||
mkdir -p $PANDORA_BASE$PANDORA_LOG_DIR 2> /dev/null
|
||||
|
||||
# Set the user the agent will run as
|
||||
if [ "$PANDORA_USER" != "root" ]
|
||||
then
|
||||
sed -e "s/.*pandora_user .*/pandora_user $PANDORA_USER/" $AGENT_CFG > $AGENT_CFG_TEMP 2> /dev/null && \
|
||||
mv $AGENT_CFG_TEMP $AGENT_CFG
|
||||
chmod 755 pandora_agent_daemon
|
||||
chown -R $PANDORA_USER $PANDORA_BASE 2>/dev/null
|
||||
fi
|
||||
|
||||
# Create logfile
|
||||
if [ ! -z "`touch $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG`" ]
|
||||
then
|
||||
echo "Seems to be a problem generating logfile ($PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG) please check it";
|
||||
else
|
||||
echo "Created logfile at $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG..."
|
||||
fi
|
||||
echo "$LOG_TIMESTAMP Pandora FMS installer has created this file at startup" > $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG
|
||||
|
||||
# Copying agent and securing it
|
||||
echo "Copying Pandora FMS Agent to $PANDORA_BASE$PANDORA_BIN..."
|
||||
install_perl_script -m 755 -o $PANDORA_USER -g 0 pandora_agent $PANDORA_BASE$PANDORA_BIN
|
||||
install_perl_script -m 755 -o $PANDORA_USER -g 0 pandora_agent_exec $PANDORA_BASE$PANDORA_EXEC_BIN
|
||||
install_perl_script -m 755 -o $PANDORA_USER -g 0 pandora_revent $PANDORA_BASE$PANDORA_REVENT_BIN
|
||||
|
||||
echo "Copying Pandora FMS Agent configuration file to $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf..."
|
||||
if [ -f $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf ]
|
||||
then
|
||||
cp $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf.$OLDFILENAMETMP
|
||||
echo "Backing up old configuration file to $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf.$OLDFILENAMETMP"
|
||||
fi
|
||||
|
||||
echo "Copying Pandora FMS Agent plugins to $PANDORA_BASE$PANDORA_HOME/plugins..."
|
||||
|
||||
[ -d $PANDORA_BASE$PANDORA_HOME/plugins ] || mkdir -p $PANDORA_BASE$PANDORA_HOME/plugins >/dev/null 2>&1
|
||||
for PLUGIN in plugins/*
|
||||
do
|
||||
if grep '^#!.*/perl' $PLUGIN >/dev/null 2>&1
|
||||
then
|
||||
install_perl_script $PLUGIN $PANDORA_BASE$PANDORA_HOME/$PLUGIN
|
||||
else
|
||||
cp $PLUGIN $PANDORA_BASE$PANDORA_HOME/plugins
|
||||
fi
|
||||
done
|
||||
chmod -R 700 $PANDORA_BASE$PANDORA_HOME/plugins
|
||||
|
||||
PANDORA_BASE_REAL="$PANDORA_BASE"
|
||||
[ $FAKEROOT -eq 1 ] && PANDORA_BASE_REAL=""
|
||||
|
||||
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/plugins $PANDORA_BASE$PANDORA_CFG
|
||||
|
||||
echo "Copying Pandora FMS Agent collections to $PANDORA_BASE$PANDORA_HOME/collections..."
|
||||
cp -r collections $PANDORA_BASE$PANDORA_HOME
|
||||
chmod -R 700 $PANDORA_BASE$PANDORA_HOME/collections
|
||||
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG
|
||||
|
||||
if [ $WITHOUT_TENTACLE_SERVER -eq 0 ]
|
||||
then
|
||||
echo "Copying tentacle server to $PANDORA_BASE$TENTACLE_SERVER"
|
||||
install_perl_script -m 755 -o $PANDORA_USER -g 0 tentacle_server $PANDORA_BASE$TENTACLE_SERVER
|
||||
fi
|
||||
|
||||
echo "Copying tentacle client to $PANDORA_BASE$TENTACLE"
|
||||
install_perl_script -m 755 -o $PANDORA_USER -g 0 tentacle_client $PANDORA_BASE$TENTACLE
|
||||
|
||||
echo "Installing the Pandora Agent and Tentacle Client manuals"
|
||||
cp man/man1/tentacle_client.1.gz $PANDORA_BASE/$PANDORA_MAN/man1
|
||||
chmod 644 $PANDORA_BASE/$PANDORA_MAN/man1/tentacle_client.1.gz
|
||||
cp man/man1/pandora_agent.1.gz $PANDORA_BASE/$PANDORA_MAN/man1
|
||||
chmod 644 $PANDORA_BASE/$PANDORA_MAN/man1/pandora_agent.1.gz
|
||||
|
||||
echo "Setting secure permissions and ownership for all Pandora FMS Agent files..."
|
||||
chown -R $PANDORA_USER $PANDORA_BASE$PANDORA_HOME 2>/dev/null
|
||||
chmod -R 700 $PANDORA_BASE$PANDORA_TEMP/data_out
|
||||
chmod 711 $PANDORA_BASE$PANDORA_LOG_DIR
|
||||
chmod 640 $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG
|
||||
chown $PANDORA_USER:0 $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG 2>/dev/null
|
||||
if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ]
|
||||
then
|
||||
chown $PANDORA_USER:daemon $PANDORA_BASE$PANDORA_TEMP 2>/dev/null
|
||||
chmod -R 770 $PANDORA_BASE$PANDORA_TEMP
|
||||
chmod 775 $PANDORA_BASE$PANDORA_TEMP
|
||||
fi
|
||||
|
||||
echo "Copying default agent configuration to $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf"
|
||||
|
||||
cp $OS_NAME/pandora_agent.conf $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf
|
||||
chmod 600 $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf
|
||||
chown $PANDORA_USER $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf 2>/dev/null
|
||||
|
||||
echo "Linking start-up daemon script '$DAEMON_SCRIPT' on $OS_NAME";
|
||||
|
||||
if [ "$OS_NAME" = "Darwin" ]
|
||||
then
|
||||
# Specific service install on Darwin/macOSX
|
||||
launchctl load -F Darwin/com.pandorafms.pandorafms.plist
|
||||
echo "Start Pandora FMS service with 'launchctl start com.pandorafms.pandorafms'"
|
||||
echo "This service has been scheduled to launch on each system startup"
|
||||
else
|
||||
DESTDIR=""
|
||||
[ "$PANDORA_BASE" ] && [ $FAKEROOT -eq 1 ] && DESTDIR=$PANDORA_BASE
|
||||
|
||||
cp $DAEMON_SCRIPT $DESTDIR$PANDORA_STARTUP
|
||||
chmod 755 $DESTDIR$PANDORA_STARTUP
|
||||
chown root:0 $DESTDIR$PANDORA_STARTUP 2>/dev/null
|
||||
|
||||
RCDIRS=""
|
||||
MSG=""
|
||||
if [ "$OS_NAME" = "AIX" ]
|
||||
then
|
||||
RCDIRS=/etc/rc.d/rc2.d
|
||||
MSG="Pandora FMS agent has been included in $DESTDIR/etc/rc.d/rc2.d/S90pandora_agent_daemon"
|
||||
elif [ "$OS_NAME" = "HP-UX" ]
|
||||
then
|
||||
RCDIRS="/sbin/rc2.d /sbin/rc3.d"
|
||||
MSG="Pandora FMS agent has been included in $DESTDIR/sbin/rcX.d/S90pandora_agent_daemon"
|
||||
elif [ "$OS_NAME" = "SunOS" ]
|
||||
then
|
||||
RCDIRS=/etc/rc2.d
|
||||
MSG="Pandora FMS agent has been included in $DESTDIR/etc/rc2.d/S90pandora_agent_daemon"
|
||||
elif [ "$OS_NAME" = "Linux" ]
|
||||
then
|
||||
if [ -d /etc/rc.d/ ]
|
||||
then
|
||||
RCDIRS="/etc/rc.d/rc2.d /etc/rc.d/rc3.d"
|
||||
else
|
||||
RCDIRS="/etc/rc2.d /etc/rc3.d"
|
||||
fi
|
||||
fi
|
||||
[ "$RCDIRS" ] && for RCDIR in $RCDIRS
|
||||
do
|
||||
[ $FAKEROOT -eq 1 ] && [ ! -d $DESTDIR$RCDIR ] && mkdir -p $DESTDIR$RCDIR >/dev/null 2>&1
|
||||
ln -s $PANDORA_STARTUP $DESTDIR$RCDIR/S90pandora_agent 2> /dev/null
|
||||
done
|
||||
[ "$MSG" ] && echo "$MSG"
|
||||
fi
|
||||
|
||||
if [ -d /etc/logrotate.d ]
|
||||
then
|
||||
[ -d $DESTDIR/etc/logrotate.d ] && mkdir -p $DESTDIR/etc/logrotate.d
|
||||
echo "Creating logrotate.d entry for Pandora FMS log management"
|
||||
sed -e "s|^/var/log/pandora/pandora_agent.log|$PANDORA_BASE_REAL$PANDORA_LOG_DIR/$PANDORA_LOG|" pandora_agent_logrotate \
|
||||
> $DESTDIR/etc/logrotate.d/pandora_agent
|
||||
else
|
||||
echo "Please add a log rotation schedule manually to your log rotation daemon (if any)"
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
echo " "
|
||||
echo "You have your startup script ready at $PANDORA_STARTUP"
|
||||
echo " "
|
||||
echo "Tentacle is the default transfer mode since 2.0 version."
|
||||
echo " "
|
||||
echo "If you want to use SSH, firstly you need to copy your public SSH keys "
|
||||
echo " ($HOME/.ssh/id_dsa) under /home/pandora/.ssh/authorized_keys "
|
||||
echo "on your Pandora FMS Server host"
|
||||
echo " "
|
||||
echo "You may need to install manually some additional required dependencies:"
|
||||
echo "perl-Sys-Syslog"
|
||||
echo " "
|
||||
echo "You also need to setup your $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf config file"
|
||||
echo " "
|
||||
if [ "$OS_NAME" = "FreeBSD" ]
|
||||
then
|
||||
echo "Define 'pandora_agent_enable=\"YES\"' in /etc/rc.conf to enable the daemon."
|
||||
elif [ "$OS_NAME" = "NetBSD" ]
|
||||
then
|
||||
echo "Define 'pandora_agent=\"YES\"' in /etc/rc.conf to enable the daemon."
|
||||
else
|
||||
echo "Check your startup configuration to be sure Pandora FMS Agent is ready "
|
||||
echo "to start automatically when system restarts":
|
||||
fi
|
||||
|
||||
# Restore the daemon script
|
||||
cp -f "$DAEMON_SCRIPT.bak" "$DAEMON_SCRIPT" >/dev/null 2>&1
|
||||
rm -f "$DAEMON_SCRIPT.bak" >/dev/null 2>&1
|
||||
|
||||
# Restore the configuration file
|
||||
cp -f "$AGENT_CFG.bak" "$AGENT_CFG" >/dev/null 2>&1
|
||||
rm -f "$AGENT_CFG.bak" >/dev/null 2>&1
|
||||
|
||||
}
|
||||
|
||||
if [ ! -f "pandora_agent" ]
|
||||
then
|
||||
echo " "
|
||||
echo "Execute installer from the directory where you have your files. "
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Script banner at start
|
||||
echo " "
|
||||
echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2015 ArticaST"
|
||||
echo "This program is licensed under GPL2 Terms. http://pandorafms.com"
|
||||
echo " "
|
||||
|
||||
|
||||
case "$MODE" in
|
||||
|
||||
'--force-install')
|
||||
FORCE=1
|
||||
install
|
||||
exit
|
||||
;;
|
||||
|
||||
'--install')
|
||||
install
|
||||
exit
|
||||
;;
|
||||
|
||||
'--uninstall')
|
||||
uninstall
|
||||
exit
|
||||
;;
|
||||
|
||||
*)
|
||||
help
|
||||
;;
|
||||
esac
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2014 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.703
|
||||
# Version 7.0NG.704
|
||||
|
||||
# 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
|
||||
|
|
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.703}
|
||||
{Pandora FMS Windows Agent v7.0NG.704}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{170517}
|
||||
{170605}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives
|
|||
{No}
|
||||
|
||||
Windows,Executable
|
||||
{<%AppName%>-Setup<%Ext%>}
|
||||
{<%AppName%>-<%Version%>-Setup<%Ext%>}
|
||||
|
||||
Windows,FileDescription
|
||||
{<%AppName%> <%Version%> Setup}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -368,7 +368,7 @@ Pandora_Module::getDataOutput (Pandora_Data *data) {
|
|||
}
|
||||
|
||||
if (this->has_limits) {
|
||||
if (value >= this->max || value <= this->min) {
|
||||
if (value > this->max || value < this->min) {
|
||||
pandoraLog ("The returned value was not in the interval on module %s",
|
||||
this->module_name.c_str ());
|
||||
throw Value_Error ();
|
||||
|
@ -1789,5 +1789,9 @@ Pandora_Module::getIntensiveMatch () {
|
|||
return this->intensive_match;
|
||||
}
|
||||
|
||||
bool
|
||||
Pandora_Module::getAsync () {
|
||||
return this->async;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace Pandora_Modules {
|
|||
MODULE_TCPCHECK, /**< The module checks whether a tcp port is open */
|
||||
MODULE_REGEXP, /**< The module searches a file for matches of a regular expression */
|
||||
MODULE_PLUGIN, /**< Plugin */
|
||||
MODULE_PING, /**< Ping module */
|
||||
MODULE_PING, /**< Ping module */
|
||||
MODULE_SNMPGET /**< SNMP get module */
|
||||
} Module_Kind;
|
||||
|
||||
|
@ -238,6 +238,7 @@ namespace Pandora_Modules {
|
|||
void setTimeout (int timeout);
|
||||
int getTimeout ();
|
||||
string getSave ();
|
||||
bool getAsync ();
|
||||
|
||||
virtual string getXml ();
|
||||
|
||||
|
|
|
@ -52,6 +52,17 @@ Pandora_Module_Proc::Pandora_Module_Proc (string name, string process_name)
|
|||
this->retries = 3;
|
||||
this->start_delay = 5000;
|
||||
this->retry_delay = 2000;
|
||||
this->thread = 0;
|
||||
}
|
||||
/**
|
||||
* Destroys a Pandora_Module_Service object.
|
||||
*/
|
||||
Pandora_Module_Proc::~Pandora_Module_Proc () {
|
||||
|
||||
// Close the thread if module is async
|
||||
if (this->thread) {
|
||||
TerminateThread(this->thread, 0);
|
||||
}
|
||||
}
|
||||
|
||||
string
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace Pandora_Modules {
|
|||
int retry_delay;
|
||||
public:
|
||||
Pandora_Module_Proc (string name, string process_name);
|
||||
~Pandora_Module_Proc ();
|
||||
|
||||
string getProcessName () const;
|
||||
string getStartCommand () const;
|
||||
|
|
|
@ -49,6 +49,16 @@ Pandora_Module_Service::Pandora_Module_Service (string name, string service_name
|
|||
this->thread = 0;
|
||||
this->watchdog = false;
|
||||
}
|
||||
/**
|
||||
* Destroys a Pandora_Module_Service object.
|
||||
*/
|
||||
Pandora_Module_Service::~Pandora_Module_Service () {
|
||||
|
||||
// Close the thread if module is async
|
||||
if (this->thread) {
|
||||
TerminateThread(this->thread, 0);
|
||||
}
|
||||
}
|
||||
|
||||
string
|
||||
Pandora_Module_Service::getServiceName () const {
|
||||
|
|
|
@ -36,6 +36,7 @@ namespace Pandora_Modules {
|
|||
bool watchdog;
|
||||
public:
|
||||
Pandora_Module_Service (string name, string service_name);
|
||||
~Pandora_Module_Service ();
|
||||
|
||||
void run ();
|
||||
string getServiceName () const;
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.703(Build 170517)")
|
||||
#define PANDORA_VERSION ("7.0NG.704(Build 170605)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -0,0 +1,345 @@
|
|||
/* Common functions to any Pandora program.
|
||||
Copyright (C) 2006 Artica ST.
|
||||
Written by Esteban Sanchez.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include "pandora.h"
|
||||
#include "pandora_strutils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
<<<<<<< HEAD
|
||||
#define PANDORA_VERSION ("7.0NG(Build 170406)")
|
||||
=======
|
||||
#define PANDORA_VERSION ("7.0NG(Build 170418)")
|
||||
>>>>>>> develop
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
bool pandora_debug;
|
||||
bool pandora_log_disable;
|
||||
string pandora_version = PANDORA_VERSION;
|
||||
|
||||
/**
|
||||
* Parses a string and initialize the key and the value.
|
||||
*
|
||||
* The string should be in the format:
|
||||
* - <code>key value</code>
|
||||
* - <code>key "value with blankspaces"</code>
|
||||
*/
|
||||
void
|
||||
Key_Value::parseLine (string str) {
|
||||
int pos;
|
||||
list<string> tokens;
|
||||
list<string>::iterator iter;
|
||||
string trimmedstr;
|
||||
|
||||
trimmedstr = trim (str);
|
||||
|
||||
/* Check if the string has " */
|
||||
pos = trimmedstr.find ("\"");
|
||||
if (pos == string::npos) {
|
||||
stringtok (tokens, trimmedstr, " \t");
|
||||
} else {
|
||||
stringtok (tokens, trimmedstr, "\"");
|
||||
}
|
||||
|
||||
/* Pick the first and the last value of the token list */
|
||||
iter = tokens.begin ();
|
||||
key = trim (*iter);
|
||||
transform (key.begin(), key.end(), key.begin(), (int(*)(int)) tolower);
|
||||
iter = tokens.end ();
|
||||
iter--;
|
||||
/* Check if the line has only one token */
|
||||
if (iter != tokens.begin ()) {
|
||||
value = trim (*iter);
|
||||
} else {
|
||||
value = "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a string by position and initialize the key and the value.
|
||||
*/
|
||||
void
|
||||
Key_Value::parseLineByPosition (string str, int pos) {
|
||||
string trimmedstr;
|
||||
|
||||
trimmedstr = trim (str);
|
||||
|
||||
key = trim (trimmedstr.substr (0, pos));
|
||||
value = trim (trimmedstr.substr (pos));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the key of the object.
|
||||
*
|
||||
* @return The key
|
||||
*/
|
||||
string
|
||||
Key_Value::getKey () {
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the key of the object.
|
||||
*
|
||||
*/
|
||||
void
|
||||
Key_Value::setKey (const string key) {
|
||||
this->key = key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of the object.
|
||||
*
|
||||
* @return The value
|
||||
*/
|
||||
string
|
||||
Key_Value::getValue () {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of the object.
|
||||
*
|
||||
* @return The value
|
||||
*/
|
||||
void
|
||||
Key_Value::setValue (const string value) {
|
||||
this->value = value;
|
||||
}
|
||||
|
||||
void
|
||||
pandoraWriteLog (string filename, string line) {
|
||||
string buffer;
|
||||
char str_time[25];
|
||||
FILE *file;
|
||||
string filepath;
|
||||
SYSTEMTIME st;
|
||||
|
||||
GetLocalTime(&st);
|
||||
sprintf (str_time, "%d-%02d-%02d %02d:%02d:%02d ", st.wYear, st.wMonth, st.wDay,
|
||||
st.wHour, st.wMinute, st.wSecond);
|
||||
|
||||
buffer = (char *) str_time;
|
||||
buffer += line;
|
||||
|
||||
filepath = pandora_dir + filename;
|
||||
|
||||
file = fopen (filepath.c_str (), "a+");
|
||||
if (file != NULL) {
|
||||
fprintf (file, "%s\n", buffer.c_str ());
|
||||
fclose (file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a message in the log file.
|
||||
*
|
||||
* The log file is used to write the output of errors and problems of the
|
||||
* agent.
|
||||
*
|
||||
* @param format String output format (like printf).
|
||||
* @param ... Variable argument list
|
||||
*/
|
||||
void
|
||||
Pandora::pandoraLog (const char *format, ...) {
|
||||
if (!pandora_log_disable) {
|
||||
va_list args;
|
||||
char msg[5000];
|
||||
|
||||
va_start (args, format);
|
||||
vsprintf (msg, format, args);
|
||||
va_end (args);
|
||||
|
||||
pandoraWriteLog ("pandora_agent.log", (char *) msg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a message in the debug file.
|
||||
*
|
||||
* The log file is used to write the output of debugging information of the
|
||||
* agent.
|
||||
*
|
||||
* @param format String output format.
|
||||
* @param ... Variable argument list
|
||||
*/
|
||||
void
|
||||
Pandora::pandoraDebug (const char *format, ...) {
|
||||
if (pandora_debug) {
|
||||
va_list args;
|
||||
char msg[5000];
|
||||
|
||||
va_start (args, format);
|
||||
vsprintf (msg, format, args);
|
||||
va_end (args);
|
||||
|
||||
pandoraWriteLog ("pandora_debug.log", (char *) msg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Secure free of a pointer.
|
||||
*
|
||||
* @param pointer pointer to free.
|
||||
*/
|
||||
void
|
||||
Pandora::pandoraFree (void * pointer) {
|
||||
if (pointer != NULL)
|
||||
free (pointer);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the installation directory of the application.
|
||||
*
|
||||
* This directory is the path to the directory which holds
|
||||
* the binary file.
|
||||
*
|
||||
* @param dir The path to the directory.
|
||||
*
|
||||
* @see getPandoraInstallDir
|
||||
*/
|
||||
void
|
||||
Pandora::setPandoraInstallDir (string dir) {
|
||||
pandora_dir = dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the installation directory of the application.
|
||||
*
|
||||
* This directory is the path to the directory which holds
|
||||
* the binary file.
|
||||
*
|
||||
* @return The path to the directory.
|
||||
*
|
||||
* @see setPandoraInstallDir
|
||||
*/
|
||||
string
|
||||
Pandora::getPandoraInstallDir () {
|
||||
return pandora_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the installation path of the application.
|
||||
*
|
||||
* This the complete path to the binary file.
|
||||
*
|
||||
* @param path The path to the binary file.
|
||||
*
|
||||
* @see getPandoraInstallPath
|
||||
*/
|
||||
void
|
||||
Pandora::setPandoraInstallPath (string path) {
|
||||
pandora_path = path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the installation path of the application.
|
||||
*
|
||||
* This the complete path to the binary file.
|
||||
*
|
||||
* @return The path.
|
||||
*
|
||||
* @see setPandoraInstallPath
|
||||
*/
|
||||
string
|
||||
Pandora::getPandoraInstallPath () {
|
||||
return pandora_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the debug flag.
|
||||
*
|
||||
* If the flag is true output wil be generated and XML files will not be deleted.
|
||||
*
|
||||
* @param dbg Turns the debug flag on/off.
|
||||
*
|
||||
* @see getPandoraDebug
|
||||
* @see pandoraDebug
|
||||
*/
|
||||
void
|
||||
Pandora::setPandoraDebug (bool dbg) {
|
||||
pandora_debug = dbg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the debug flag value.
|
||||
*
|
||||
* If the flag is truee output wil be generated and XML files will not be deleted.
|
||||
*
|
||||
* @see setPandoraDebug
|
||||
* @see pandoraDebug
|
||||
*/
|
||||
bool
|
||||
Pandora::getPandoraDebug () {
|
||||
return pandora_debug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the disable logfile flag.
|
||||
*
|
||||
* If the flag is true no logs will be written.
|
||||
*
|
||||
* @param dbg Turns the debug flag on/off.
|
||||
*
|
||||
*/
|
||||
void
|
||||
Pandora::setPandoraLogDisable (bool dbg) {
|
||||
pandora_log_disable = dbg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the version of the agent.
|
||||
*
|
||||
* @return The version.
|
||||
*/
|
||||
string
|
||||
Pandora::getPandoraAgentVersion () {
|
||||
return pandora_version;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Pandora::is_enabled (string value) {
|
||||
static string enabled_values[] = {"enabled", "1", "on", "yes", "si", "sí", "ok", "true", ""};
|
||||
int i = 0;
|
||||
|
||||
if (value == "") {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (enabled_values[i] != "") {
|
||||
if (enabled_values[i] == value) {
|
||||
return true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return false;
|
||||
}
|
|
@ -228,6 +228,15 @@ Pandora::Pandora_Agent_Conf::setFile (string *all_conf){
|
|||
key_values->push_back (kv);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*Check if is a agent_alias_cmd"*/
|
||||
pos = buffer.find("agent_alias_cmd");
|
||||
if (pos != string::npos){
|
||||
Key_Value kv;
|
||||
kv.parseLineByPosition(buffer, 15);
|
||||
key_values->push_back (kv);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*Check if is a collection*/
|
||||
pos = buffer.find("file_collection");
|
||||
|
|
|
@ -76,6 +76,7 @@ Pandora_Windows_Service::setValues (const char * svc_name,
|
|||
this->service_description = (char *) svc_description;
|
||||
execution_number = 0;
|
||||
this->modules = NULL;
|
||||
this->broker_modules = NULL;
|
||||
this->conf = NULL;
|
||||
this->interval = 60000;
|
||||
this->timestamp = 0;
|
||||
|
@ -105,6 +106,10 @@ Pandora_Windows_Service::~Pandora_Windows_Service () {
|
|||
if (this->modules != NULL) {
|
||||
delete this->modules;
|
||||
}
|
||||
|
||||
if (this->broker_modules != NULL) {
|
||||
delete this->broker_modules;
|
||||
}
|
||||
pandoraLog ("Pandora agent stopped");
|
||||
}
|
||||
|
||||
|
@ -136,10 +141,10 @@ Pandora_Windows_Service::pandora_init_broker (string file_conf) {
|
|||
|
||||
this->conf = Pandora::Pandora_Agent_Conf::getInstance ();
|
||||
this->conf->setFile (file_conf);
|
||||
if (this->modules != NULL) {
|
||||
delete this->modules;
|
||||
if (this->broker_modules != NULL) {
|
||||
delete this->broker_modules;
|
||||
}
|
||||
this->modules = new Pandora_Module_List (file_conf);
|
||||
this->broker_modules = new Pandora_Module_List (file_conf);
|
||||
|
||||
pandoraDebug ("Pandora broker agent started");
|
||||
}
|
||||
|
@ -208,9 +213,14 @@ Pandora_Windows_Service::check_broker_agents(string *all_conf){
|
|||
|
||||
void
|
||||
Pandora_Windows_Service::pandora_init () {
|
||||
pandora_init(true);
|
||||
}
|
||||
|
||||
void
|
||||
Pandora_Windows_Service::pandora_init (bool reload_modules) {
|
||||
string conf_file, interval, debug, disable_logfile, intensive_interval, util_dir, path, env;
|
||||
string udp_server_enabled, udp_server_port, udp_server_addr, udp_server_auth_addr;
|
||||
string agent_name, agent_name_cmd, agent_alias, pandora_agent;
|
||||
string agent_name, agent_name_cmd, agent_alias, agent_alias_cmd, pandora_agent;
|
||||
string proxy_mode, server_ip;
|
||||
string *all_conf;
|
||||
int pos, num;
|
||||
|
@ -224,7 +234,7 @@ Pandora_Windows_Service::pandora_init () {
|
|||
|
||||
this->conf = Pandora::Pandora_Agent_Conf::getInstance ();
|
||||
this->conf->setFile (all_conf);
|
||||
if (this->modules != NULL) {
|
||||
if (this->modules != NULL && reload_modules) {
|
||||
delete this->modules;
|
||||
}
|
||||
|
||||
|
@ -255,9 +265,40 @@ Pandora_Windows_Service::pandora_init () {
|
|||
this->setSleepTime (this->intensive_interval);
|
||||
|
||||
// Read modules
|
||||
this->modules = new Pandora_Module_List (conf_file);
|
||||
if (reload_modules) {
|
||||
this->modules = new Pandora_Module_List (conf_file);
|
||||
}
|
||||
delete []all_conf;
|
||||
|
||||
|
||||
// Get the agent alias.
|
||||
agent_alias = conf->getValue ("agent_alias");
|
||||
if (agent_alias == "") {
|
||||
agent_alias_cmd = conf->getValue ("agent_alias_cmd");
|
||||
if (agent_alias_cmd != "") {
|
||||
agent_alias_cmd = "cmd.exe /c \"" + agent_alias_cmd + "\"";
|
||||
static string temp_agent_alias = getAgentNameFromCmdExec(agent_alias_cmd);
|
||||
|
||||
// Delete new line and carriage return.
|
||||
pos = temp_agent_alias.find("\n");
|
||||
if(pos != string::npos) {
|
||||
temp_agent_alias.erase(pos, temp_agent_alias.size () - pos);
|
||||
}
|
||||
pos = temp_agent_alias.find("\r");
|
||||
if(pos != string::npos) {
|
||||
temp_agent_alias.erase(pos, temp_agent_alias.size () - pos);
|
||||
}
|
||||
|
||||
// Remove leading and trailing white spaces.
|
||||
temp_agent_alias = trim(temp_agent_alias);
|
||||
if (temp_agent_alias != "") {
|
||||
agent_alias = temp_agent_alias;
|
||||
}
|
||||
} else {
|
||||
agent_alias = Pandora_Windows_Info::getSystemName ();
|
||||
}
|
||||
}
|
||||
this->conf->setValue("agent_alias", agent_alias);
|
||||
|
||||
// Get the agent name.
|
||||
agent_name = conf->getValue ("agent_name");
|
||||
if (agent_name == "") {
|
||||
|
@ -299,13 +340,6 @@ Pandora_Windows_Service::pandora_init () {
|
|||
this->conf->setValue("agent_name", agent_name);
|
||||
}
|
||||
|
||||
// Get the agent alias.
|
||||
agent_alias = conf->getValue ("agent_alias");
|
||||
if (agent_alias == "") {
|
||||
agent_alias = Pandora_Windows_Info::getSystemName ();
|
||||
this->conf->setValue("agent_alias", agent_alias);
|
||||
}
|
||||
|
||||
pandora_agent = "PANDORA_AGENT=" + agent_name;
|
||||
putenv(pandora_agent.c_str());
|
||||
|
||||
|
@ -1834,19 +1868,19 @@ Pandora_Windows_Service::pandora_run_broker (string config) {
|
|||
|
||||
server_addr = conf->getValue ("server_ip");
|
||||
|
||||
if (this->modules != NULL) {
|
||||
this->modules->goFirst ();
|
||||
if (this->broker_modules != NULL) {
|
||||
this->broker_modules->goFirst ();
|
||||
|
||||
while (! this->modules->isLast ()) {
|
||||
while (! this->broker_modules->isLast ()) {
|
||||
Pandora_Module *module;
|
||||
|
||||
module = this->modules->getCurrentValue ();
|
||||
module = this->broker_modules->getCurrentValue ();
|
||||
|
||||
/* Check preconditions */
|
||||
if (module->evaluatePreconditions () == 0) {
|
||||
pandoraDebug ("Preconditions not matched for module %s", module->getName ().c_str ());
|
||||
module->setNoOutput ();
|
||||
this->modules->goNext ();
|
||||
this->broker_modules->goNext ();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1854,15 +1888,23 @@ Pandora_Windows_Service::pandora_run_broker (string config) {
|
|||
if (module->checkCron (module->getInterval (), atoi (conf->getValue ("interval").c_str())) == 0) {
|
||||
pandoraDebug ("Cron not matched for module %s", module->getName ().c_str ());
|
||||
module->setNoOutput ();
|
||||
this->modules->goNext ();
|
||||
this->broker_modules->goNext ();
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Check async */
|
||||
if (module->getAsync()) {
|
||||
pandoraDebug ("Forbidden async module %s in broker agents", module->getName ().c_str ());
|
||||
module->setNoOutput ();
|
||||
this->broker_modules->goNext ();
|
||||
continue;
|
||||
}
|
||||
|
||||
pandoraDebug ("Run %s", module->getName ().c_str ());
|
||||
module->run ();
|
||||
if (! module->hasOutput ()) {
|
||||
module->setNoOutput ();
|
||||
this->modules->goNext ();
|
||||
this->broker_modules->goNext ();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1875,7 +1917,7 @@ Pandora_Windows_Service::pandora_run_broker (string config) {
|
|||
intensive_match = module->evaluateIntensiveConditions ();
|
||||
if (intensive_match == module->getIntensiveMatch () && module->getTimestamp () + module->getInterval () * this->interval_sec > this->run_time) {
|
||||
module->setNoOutput ();
|
||||
this->modules->goNext ();
|
||||
this->broker_modules->goNext ();
|
||||
continue;
|
||||
}
|
||||
module->setIntensiveMatch (intensive_match);
|
||||
|
@ -1890,7 +1932,7 @@ Pandora_Windows_Service::pandora_run_broker (string config) {
|
|||
/* At least one module has data */
|
||||
data_flag = 1;
|
||||
|
||||
this->modules->goNext ();
|
||||
this->broker_modules->goNext ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1898,7 +1940,7 @@ Pandora_Windows_Service::pandora_run_broker (string config) {
|
|||
|
||||
// Send the XML
|
||||
if (!server_addr.empty ()) {
|
||||
this->sendXml (this->modules);
|
||||
this->sendXml (this->broker_modules);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2037,7 +2079,7 @@ Pandora_Windows_Service::pandora_run (int forced_run) {
|
|||
|
||||
/* Reload the original configuration */
|
||||
if (num != 0) {
|
||||
pandora_init ();
|
||||
pandora_init (false);
|
||||
}
|
||||
|
||||
/* Reset time reference if necessary */
|
||||
|
|
|
@ -42,6 +42,7 @@ namespace Pandora {
|
|||
private:
|
||||
Pandora_Agent_Conf *conf;
|
||||
Pandora_Module_List *modules;
|
||||
Pandora_Module_List *broker_modules;
|
||||
long execution_number;
|
||||
string agent_name;
|
||||
string alias;
|
||||
|
@ -98,6 +99,7 @@ namespace Pandora {
|
|||
void pandora_run (int forced_run);
|
||||
void pandora_run ();
|
||||
void pandora_init ();
|
||||
void pandora_init (bool reload_modules);
|
||||
|
||||
long interval;
|
||||
long interval_sec;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.703(Build 170517))"
|
||||
VALUE "ProductVersion", "(7.0NG.704(Build 170605))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
1 VERSIONINFO
|
||||
FILEVERSION 1,0,0,0
|
||||
PRODUCTVERSION 1,0,0,0
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "080904E4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Artica ST"
|
||||
VALUE "FileDescription", "Pandora FMS Agent for Windows Platform"
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
<<<<<<< HEAD
|
||||
VALUE "ProductVersion", "(7.0NG(Build 170406))"
|
||||
=======
|
||||
VALUE "ProductVersion", "(7.0NG(Build 170418))"
|
||||
>>>>>>> develop
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x809, 1252
|
||||
END
|
||||
END
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.703
|
||||
Version: 7.0NG.704-170605
|
||||
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
|
||||
Depends: php5.6 | php5, php5.6-snmp | php5-snmp, php5.6-gd | php5-gd, php5.6-mysql | php5-mysql, php-db, php5.6-xmlrpc | php5-xmlrpc, php-gettext, php5.6-curl | php5-curl, graphviz, dbconfig-common, php5.6-ldap | 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.
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package: pandorafms-console
|
||||
<<<<<<< HEAD
|
||||
Version: 7.0NG-170406
|
||||
=======
|
||||
Version: 7.0NG-170418
|
||||
>>>>>>> develop
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
Installed-Size: 42112
|
||||
Maintainer: Artica ST <deptec@artica.es>
|
||||
Homepage: http://pandorafms.org/
|
||||
Depends: php5, php5-snmp, php5-gd, php5-mysql, php-db, php5-xmlrpc, php-gettext, php5-curl, graphviz, dbconfig-common, php5-ldap, mysql-client | virtual-mysql-client
|
||||
Description: Pandora FMS is an Open Source monitoring tool. It monitor your systems and applications, and allows you to control the status of any element of them. The web console is the graphical user interface (GUI) to manage the pool and to generate reports and graphs from the Pandora FMS monitoring process.
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.703"
|
||||
pandora_version="7.0NG.704-170605"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -0,0 +1,168 @@
|
|||
#!/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"
|
|
@ -868,7 +868,7 @@ function resource_registration_extension_main() {
|
|||
echo "<form name='submit_plugin' method='post' enctype='multipart/form-data'>";
|
||||
echo '<table class="databox" id="table1" width="98%" border="0" cellpadding="4" cellspacing="4">';
|
||||
echo "<tr>";
|
||||
echo "<td colspan='2' class='datos'><input type='file' name='resource_upload' />";
|
||||
echo "<td colspan='2' class='datos'><input type='file' name='resource_upload' accept='.ptr'/>";
|
||||
echo "<td>" . __('Group filter: ') . "</td>";
|
||||
echo "<td>";
|
||||
html_print_select_groups(false, "AW", true, 'group');
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE tusuario add default_event_filter int(10) unsigned NOT NULL DEFAULT 0;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `treset_pass` (
|
||||
`id` bigint(10) unsigned NOT NULL auto_increment,
|
||||
`id_user` varchar(100) NOT NULL default '',
|
||||
`cod_hash` varchar(100) NOT NULL default '',
|
||||
`reset_time` int(10) unsigned NOT NULL default 0,
|
||||
PRIMARY KEY (`id`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
UPDATE tgis_map_connection SET conection_data = '{"type":"OSM","url":"http://tile.openstreetmap.org/${z}/${x}/${y}.png"}' where id_tmap_connection = 1;
|
||||
|
||||
ALTER TABLE tpolicy_modules MODIFY post_process double(24,15) default 0;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tcontainer` (
|
||||
`id_container` mediumint(4) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(100) NOT NULL default '',
|
||||
`parent` mediumint(4) unsigned NOT NULL default 0,
|
||||
`disabled` tinyint(3) unsigned NOT NULL default 0,
|
||||
`id_group` mediumint(8) unsigned NULL default 0,
|
||||
`description` TEXT NOT NULL,
|
||||
PRIMARY KEY (`id_container`),
|
||||
KEY `parent_index` (`parent`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `tcontainer` SET `name` = 'Default graph container';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tcontainer_item` (
|
||||
`id_ci` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_container` mediumint(4) unsigned NOT NULL default 0,
|
||||
`type` varchar(30) default 'simple_graph',
|
||||
`id_agent` int(10) unsigned NOT NULL default 0,
|
||||
`id_agent_module` bigint(14) unsigned NULL default NULL,
|
||||
`time_lapse` int(11) NOT NULL default 0,
|
||||
`id_graph` INTEGER UNSIGNED default 0,
|
||||
`only_average` tinyint (1) unsigned default 0 not null,
|
||||
`id_group` INT (10) unsigned NOT NULL DEFAULT 0,
|
||||
`id_module_group` INT (10) unsigned NOT NULL DEFAULT 0,
|
||||
`agent` varchar(100) NOT NULL default '',
|
||||
`module` varchar(100) NOT NULL default '',
|
||||
`id_tag` integer(10) unsigned NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id_ci`),
|
||||
FOREIGN KEY (`id_container`) REFERENCES tcontainer(`id_container`)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
COMMIT;
|
|
@ -1135,10 +1135,10 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
|
|||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 0);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 1);
|
||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '700');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '704');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tplanned_downtime_agents`
|
||||
|
@ -1246,6 +1246,12 @@ UPDATE treport_custom_sql SET `sql` = 'select (select tagente.alia
|
|||
UPDATE treport_custom_sql SET `sql` = 'select t1.alias as agent_name, t2.nombre as module_name, (select talert_templates.name from talert_templates where talert_templates.id = t3.id_alert_template) as template, (select group_concat(t02.name) from talert_template_module_actions as t01 inner join talert_actions as t02 on t01.id_alert_action = t02.id where t01.id_alert_template_module = t3.id group by t01.id_alert_template_module) as actions from tagente as t1 inner join tagente_modulo as t2 on t1.id_agente = t2.id_agente inner join talert_template_modules as t3 on t2.id_agente_modulo = t3.id_agent_module order by agent_name, module_name;'
|
||||
WHERE id = 3;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `treport_content`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE treport_content ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAULT '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmodule_relationship`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
@ -1259,6 +1265,7 @@ ALTER TABLE tlocal_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned
|
|||
-- ---------------------------------------------------------------------
|
||||
-- Table `tpolicy_module`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tpolicy_modules ADD COLUMN `ip_target`varchar(100) default '';
|
||||
ALTER TABLE tpolicy_modules ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
|
||||
ALTER TABLE tpolicy_modules ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
|
||||
|
||||
|
@ -1310,3 +1317,55 @@ DROP PROCEDURE addcol;
|
|||
-- Table `tconfig`
|
||||
-- ---------------------------------------------------------------------
|
||||
UPDATE `tconfig` SET `value` = 'login_logo_v7.png' where `token`='custom_logo_login';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tcontainer`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tcontainer` (
|
||||
`id_container` mediumint(4) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(100) NOT NULL default '',
|
||||
`parent` mediumint(4) unsigned NOT NULL default 0,
|
||||
`disabled` tinyint(3) unsigned NOT NULL default 0,
|
||||
`id_group` mediumint(8) unsigned NULL default 0,
|
||||
`description` TEXT NOT NULL,
|
||||
PRIMARY KEY (`id_container`),
|
||||
KEY `parent_index` (`parent`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `tcontainer` SET `name` = 'Default graph container';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tcontainer_item`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tcontainer_item` (
|
||||
`id_ci` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_container` mediumint(4) unsigned NOT NULL default 0,
|
||||
`type` varchar(30) default 'simple_graph',
|
||||
`id_agent` int(10) unsigned NOT NULL default 0,
|
||||
`id_agent_module` bigint(14) unsigned NULL default NULL,
|
||||
`time_lapse` int(11) NOT NULL default 0,
|
||||
`id_graph` INTEGER UNSIGNED default 0,
|
||||
`only_average` tinyint (1) unsigned default 0 not null,
|
||||
`id_group` INT (10) unsigned NOT NULL DEFAULT 0,
|
||||
`id_module_group` INT (10) unsigned NOT NULL DEFAULT 0,
|
||||
`agent` varchar(100) NOT NULL default '',
|
||||
`module` varchar(100) NOT NULL default '',
|
||||
`id_tag` integer(10) unsigned NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id_ci`),
|
||||
FOREIGN KEY (`id_container`) REFERENCES tcontainer(`id_container`)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE tusuario add default_event_filter int(10) unsigned NOT NULL DEFAULT 0;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `treset_pass` (
|
||||
`id` bigint(10) unsigned NOT NULL auto_increment,
|
||||
`id_user` varchar(100) NOT NULL default '',
|
||||
`cod_hash` varchar(100) NOT NULL default '',
|
||||
`reset_time` int(10) unsigned NOT NULL default 0,
|
||||
PRIMARY KEY (`id`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
UPDATE tgis_map_connection SET conection_data = '{"type":"OSM","url":"http://tile.openstreetmap.org/${z}/${x}/${y}.png"}' where id_tmap_connection = 1;
|
||||
|
||||
ALTER TABLE tpolicy_modules MODIFY post_process double(24,15) default 0;
|
||||
|
|
|
@ -185,7 +185,7 @@ echo "
|
|||
</div>";
|
||||
if($open){
|
||||
echo "<div class='modalgobutton gopandora'>
|
||||
<span class='modalokbuttontext'>About Enterprise</span>
|
||||
<span class='modalgobuttontext'>About Enterprise</span>
|
||||
</div>";
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,15 @@ if (!$config["MR"]) {
|
|||
|
||||
echo '<a class="white_bold footer" target="_blank" href="' . $config["homeurl"] . $license_file. '">';
|
||||
|
||||
echo sprintf(__('Pandora FMS %s - Build %s - MR %s', $pandora_version, $build_version, $config["MR"]));
|
||||
if($current_package == 0){
|
||||
$build_package_version = $build_version;
|
||||
}
|
||||
else{
|
||||
$build_package_version = $current_package;
|
||||
}
|
||||
|
||||
|
||||
echo sprintf(__('Pandora FMS %s - Build %s - MR %s', $pandora_version, $build_package_version, $config["MR"]));
|
||||
|
||||
echo '</a><br />';
|
||||
echo '<a class="white footer">'. __('Page generated at') . ' '. date('F j, Y h:i a'); //Always use timestamp here
|
||||
|
|
|
@ -239,7 +239,9 @@ config_check();
|
|||
$check_minor_release_available = db_check_minor_relase_available ();
|
||||
|
||||
if ($check_minor_release_available) {
|
||||
set_pandora_error_for_header('There are one or more minor releases waiting for update, there are required administrator permissions', 'minor release/s available');
|
||||
if (users_is_admin($config['id_user'])) {
|
||||
set_pandora_error_for_header('There are one or more minor releases waiting for update', 'minor release/s available');
|
||||
}
|
||||
}
|
||||
echo '<div id="alert_messages" style="display: none"></div>';
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ if (!empty ($page) && !empty ($sec)) {
|
|||
$login_body_style = '';
|
||||
// Overrides the default background with the defined by the user
|
||||
if (!empty($config['login_background'])) {
|
||||
$background_url = "../../images/backgrounds/" . $config['login_background'];
|
||||
$background_url = "images/backgrounds/" . $config['login_background'];
|
||||
$login_body_style = "style=\"background-image: url('$background_url');\"";
|
||||
}
|
||||
echo '<div id="login_body" ' . $login_body_style . '>';
|
||||
|
@ -73,7 +73,7 @@ echo '<div id="header_login">';
|
|||
echo '<div id="icon_custom_pandora">';
|
||||
if (defined ('PANDORA_ENTERPRISE')) {
|
||||
if(isset ($config['custom_logo'])){
|
||||
echo '<img src="images/custom_logo/' . $config['custom_logo'] .'" alt="pandora_console">';
|
||||
echo '<img src="enterprise/images/custom_logo/' . $config['custom_logo'] .'" alt="pandora_console">';
|
||||
}
|
||||
else{
|
||||
echo '<img src="images/custom_logo/logo_login_consola.png" alt="pandora_console">';
|
||||
|
@ -83,12 +83,19 @@ echo '<div id="header_login">';
|
|||
echo '<img src="images/custom_logo/pandora_logo_head_3.png" alt="pandora_console">';
|
||||
}
|
||||
echo '</div>';
|
||||
echo '<div id="list_icon_docs_support"><ul>';
|
||||
echo '<li><a href="http://wiki.pandorafms.com/" target="_blank"><img src="images/icono_docs.png" alt="docs pandora"></a></li>';
|
||||
echo '<li>' . __('Docs') . '</li>';
|
||||
echo '<li id="li_margin_left"><a href="https://pandorafms.com/monitoring-services/support/" target="_blank"><img src="images/icono_support.png" alt="support pandora"></a></li>';
|
||||
echo '<li>' . __('Support') . '</li>';
|
||||
echo '</ul></div>';
|
||||
|
||||
echo '<div id="list_icon_docs_support"><ul>';
|
||||
echo '<li><a href="http://wiki.pandorafms.com/" target="_blank"><img src="images/icono_docs.png" alt="docs pandora"></a></li>';
|
||||
echo '<li>' . __('Docs') . '</li>';
|
||||
if (defined ('PANDORA_ENTERPRISE')) {
|
||||
echo '<li id="li_margin_left"><a href="https://support.artica.es" target="_blank"><img src="images/icono_support.png" alt="support pandora"></a></li>';
|
||||
} else {
|
||||
echo '<li id="li_margin_left"><a href="https://pandorafms.com/monitoring-services/support/" target="_blank"><img src="images/icono_support.png" alt="support pandora"></a></li>';
|
||||
}
|
||||
echo '<li>' . __('Support') . '</li>';
|
||||
echo '</ul></div>';
|
||||
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="container_login">';
|
||||
|
@ -210,7 +217,18 @@ echo '<div class="login_page">';
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ($config['enterprise_installed']) {
|
||||
if ($config["reset_pass_option"]) {
|
||||
$reset_pass_link = 'reset_pass.php';
|
||||
// Reset password link
|
||||
echo '<div style="width:70%; height:40px; margin-right:auto; margin-left:auto; margin-top:20px; text-align:center;">';
|
||||
echo '<a style="color: white !important;" href="index.php?reset=true&first=true">' . __('Forgot your password?');
|
||||
echo '</a>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '</form></div>';
|
||||
echo '<div class="login_data">';
|
||||
echo '<div class ="text_banner_login">';
|
||||
|
@ -259,6 +277,63 @@ echo '</div>';
|
|||
echo '<div id="ver_num">'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '') . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
if ($process_error_message == '' && $mail != "") {
|
||||
echo '<div id="reset_correct" title="' . __('Password reset') . '">';
|
||||
echo '<div class="content_alert">';
|
||||
echo '<div class="icon_message_alert">';
|
||||
echo html_print_image('images/icono_logo_pandora.png', true, array("alt" => __('Password reset'), "border" => 0));
|
||||
echo '</div>';
|
||||
echo '<div class="content_message_alert">';
|
||||
echo '<div class="text_message_alert">';
|
||||
echo '<h1>' . __('INFO') . '</h1>';
|
||||
echo '<p>' . __('An email has been sent to your email address') . '</p>';
|
||||
echo '</div>';
|
||||
echo '<div class="button_message_alert">';
|
||||
html_print_submit_button("Ok", 'reset_correct_button', false);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
else if ($process_error_message != '') {
|
||||
echo '<div id="reset_correct" title="' . __('Password reset') . '">';
|
||||
echo '<div class="content_alert">';
|
||||
echo '<div class="icon_message_alert">';
|
||||
echo html_print_image('images/icono_stop.png', true, array("alt" => __('Password reset'), "border" => 0));
|
||||
echo '</div>';
|
||||
echo '<div class="content_message_alert">';
|
||||
echo '<div class="text_message_alert">';
|
||||
echo '<h1>' . __('ERROR') . '</h1>';
|
||||
echo '<p>' . $process_error_message . '</p>';
|
||||
echo '</div>';
|
||||
echo '<div class="button_message_alert">';
|
||||
html_print_submit_button("Ok", 'reset_correct_button', false);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
if ($correct_reset_pass_process != "") {
|
||||
echo '<div id="final_process_correct" title="' . __('Password reset') . '">';
|
||||
echo '<div class="content_alert">';
|
||||
echo '<div class="icon_message_alert">';
|
||||
echo html_print_image('images/icono_logo_pandora.png', true, array("alt" => __('Password reset'), "border" => 0));
|
||||
echo '</div>';
|
||||
echo '<div class="content_message_alert">';
|
||||
echo '<div class="text_message_alert">';
|
||||
echo '<h1>' . __('SUCCESS') . '</h1>';
|
||||
echo '<p>' . $correct_reset_pass_process . '</p>';
|
||||
echo '</div>';
|
||||
echo '<div class="button_message_alert">';
|
||||
html_print_submit_button("Ok", 'final_process_correct_button', false);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if (isset ($login_failed)) {
|
||||
echo '<div id="login_failed" title="' . __('Login failed') . '">';
|
||||
echo '<div class="content_alert">';
|
||||
|
@ -424,7 +499,6 @@ html_print_div(array('id' => 'forced_title_layer', 'class' => 'forced_title_laye
|
|||
draggable: false,
|
||||
modal: true,
|
||||
width: 600,
|
||||
height: 250,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
|
@ -512,5 +586,47 @@ html_print_div(array('id' => 'forced_title_layer', 'class' => 'forced_title_laye
|
|||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
$(document).ready (function () {
|
||||
$(function() {
|
||||
$("#reset_correct").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 220,
|
||||
width: 528,
|
||||
clickOutside: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#submit-reset_correct_button").click (function () {
|
||||
$("#reset_correct").dialog('close');
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready (function () {
|
||||
$(function() {
|
||||
$("#final_process_correct").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 220,
|
||||
width: 528,
|
||||
clickOutside: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#submit-final_process_correct_button").click (function () {
|
||||
$("#final_process_correct").dialog('close');
|
||||
});
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
|
|
@ -120,7 +120,7 @@ foreach ($fields as $field) {
|
|||
$data[2] = html_print_image('images/tick.png', true);
|
||||
}
|
||||
else {
|
||||
$data[2] = html_print_image('images/delete.png', true);
|
||||
$data[2] = html_print_image('images/icono_stop.png', true,array ('style' => 'width:21px;height:21px;'));
|
||||
}
|
||||
|
||||
$data[3] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configure_field&id_field='.$field['id_field'].'">' . html_print_image("images/config.png", true, array("alt" => __('Edit'), "title" => __('Edit'), "border" => '0')) . '</a>';
|
||||
|
|
|
@ -99,6 +99,7 @@ if ($agent_to_delete) {
|
|||
|
||||
if ($enable_agent) {
|
||||
$result = db_process_sql_update('tagente', array('disabled' => 0), array('id_agente' => $enable_agent));
|
||||
$alias = agents_get_alias($enable_agent);
|
||||
|
||||
if ($result) {
|
||||
// Update the agent from the metaconsole cache
|
||||
|
@ -106,10 +107,10 @@ if ($enable_agent) {
|
|||
$values = array('disabled' => 0);
|
||||
enterprise_hook ('agent_update_from_cache', array($enable_agent, $values));
|
||||
|
||||
db_pandora_audit("Agent management", 'Enable ' . $enable_agent);
|
||||
db_pandora_audit("Agent management", 'Enable ' . $alias);
|
||||
}
|
||||
else {
|
||||
db_pandora_audit("Agent management", 'Fail to enable ' . $enable_agent);
|
||||
db_pandora_audit("Agent management", 'Fail to enable ' . $alias);
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
|
@ -118,6 +119,7 @@ if ($enable_agent) {
|
|||
|
||||
if ($disable_agent) {
|
||||
$result = db_process_sql_update('tagente', array('disabled' => 1), array('id_agente' => $disable_agent));
|
||||
$alias = agents_get_alias($disable_agent);
|
||||
|
||||
if ($result) {
|
||||
// Update the agent from the metaconsole cache
|
||||
|
@ -125,10 +127,10 @@ if ($disable_agent) {
|
|||
$values = array('disabled' => 1);
|
||||
enterprise_hook ('agent_update_from_cache', array($disable_agent, $values));
|
||||
|
||||
db_pandora_audit("Agent management", 'Disable ' . $disable_agent);
|
||||
db_pandora_audit("Agent management", 'Disable ' . $alias);
|
||||
}
|
||||
else {
|
||||
db_pandora_audit("Agent management", 'Fail to disable ' . $disable_agent);
|
||||
db_pandora_audit("Agent management", 'Fail to disable ' . $alias);
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
|
|
|
@ -274,7 +274,6 @@ $table_simple->data[3][2] .= html_print_input_text ('dynamic_max', $dynamic_max,
|
|||
$table_simple->data[3][3] = '<span><em>'.__('Dynamic Threshold Two Tailed: ').'</em>';
|
||||
$table_simple->data[3][3] .= html_print_checkbox ("dynamic_two_tailed", 1, $dynamic_two_tailed, true, $disabledBecauseInPolicy);
|
||||
|
||||
|
||||
$table_simple->data[4][0] = __('Warning status').' ' . ui_print_help_icon ('warning_status', true);
|
||||
if (!modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[4][1] .= '<span id="minmax_warning"><em>'.__('Min. ').'</em>';
|
||||
|
@ -882,6 +881,9 @@ $(document).ready (function () {
|
|||
$('#dynamic_interval_select').change (function() {
|
||||
disabled_status(disabledBecauseInPolicy);
|
||||
});
|
||||
$('#dynamic_interval').change (function() {
|
||||
disabled_status(disabledBecauseInPolicy);
|
||||
});
|
||||
|
||||
disabled_two_tailed(disabledBecauseInPolicy);
|
||||
$('#checkbox-dynamic_two_tailed').change (function() {
|
||||
|
@ -929,7 +931,7 @@ $(document).ready (function () {
|
|||
|
||||
//readonly and add class input
|
||||
function disabled_status (disabledBecauseInPolicy) {
|
||||
if($('#dynamic_interval_select').val() != 0){
|
||||
if($('#dynamic_interval_select').val() != 0 && $('#dynamic_interval').val() != 0){
|
||||
$('#text-min_warning').prop('readonly', true);
|
||||
$('#text-min_warning').addClass('readonly');
|
||||
$('#text-max_warning').prop('readonly', true);
|
||||
|
@ -1206,18 +1208,19 @@ function validate_post_process() {
|
|||
//function paint graph
|
||||
function paint_graph_values(){
|
||||
//Parse integrer
|
||||
var min_w = parseInt($('#text-min_warning').val());
|
||||
var min_w = parseFloat($('#text-min_warning').val());
|
||||
if(min_w == '0.00'){ min_w = 0; }
|
||||
var max_w = parseInt($('#text-max_warning').val());
|
||||
var max_w = parseFloat($('#text-max_warning').val());
|
||||
if(max_w == '0.00'){ max_w = 0; }
|
||||
var min_c = parseInt($('#text-min_critical').val());
|
||||
var min_c = parseFloat($('#text-min_critical').val());
|
||||
if(min_c =='0.00'){ min_c = 0; }
|
||||
var max_c = parseInt($('#text-max_critical').val());
|
||||
var max_c = parseFloat($('#text-max_critical').val());
|
||||
if(max_c =='0.00'){ max_c = 0; }
|
||||
var inverse_w = $('input:checkbox[name=warning_inverse]:checked').val();
|
||||
if(!inverse_w){ inverse_w = 0; }
|
||||
var inverse_c = $('input:checkbox[name=critical_inverse]:checked').val();
|
||||
if(!inverse_c){ inverse_c = 0; }
|
||||
|
||||
//inicialiced error
|
||||
var error_w = 0;
|
||||
var error_c = 0;
|
||||
|
@ -1257,10 +1260,10 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
//if haven't errors
|
||||
if (error_w == 0 && error_c == 0){
|
||||
//parse element
|
||||
min_w = parseInt(min_w);
|
||||
min_c = parseInt(min_c);
|
||||
max_w = parseInt(max_w);
|
||||
max_c = parseInt(max_c);
|
||||
min_w = parseFloat(min_w);
|
||||
min_c = parseFloat(min_c);
|
||||
max_w = parseFloat(max_w);
|
||||
max_c = parseFloat(max_c);
|
||||
|
||||
//inicialize var
|
||||
var range_min = 0;
|
||||
|
|
|
@ -633,8 +633,6 @@ echo '</form>';
|
|||
if ($id_downtime > 0) {
|
||||
|
||||
echo "<td valign=top style='width:300px;padding-left:20px;'>";
|
||||
// Show available agents to include into downtime
|
||||
echo '<h4>' . __('Available agents') . ':</h4>';
|
||||
|
||||
$filter_group = (int) get_parameter("filter_group", 0);
|
||||
|
||||
|
@ -707,7 +705,8 @@ if ($id_downtime > 0) {
|
|||
echo "<br /><br />";
|
||||
html_print_submit_button (__('Filter by group'), '', false, 'class="sub next"',false);
|
||||
echo "</form>";
|
||||
|
||||
// Show available agents to include into downtime
|
||||
echo '<h4>' . __('Available agents') . ':</h4>';
|
||||
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
|
||||
|
||||
echo html_print_select ($agents, "id_agents[]", -1, '', _("Any"), -2, false, true, true, '', false, 'width: 180px;');
|
||||
|
|
|
@ -129,7 +129,8 @@ if (!$delete_template) {
|
|||
alerts_meta_print_header ();
|
||||
}
|
||||
else {
|
||||
ui_print_page_header (__('Alerts')." » ". __('Alert templates'), "images/gm_alerts.png", false, "alerts_config", true);
|
||||
//~ ui_print_page_header (__('Alerts')." » ". __('Alert templates'), "images/gm_alerts.png", false, "alerts_config", true);
|
||||
ui_print_page_header (__('Alerts')." » ". __('Alert templates'), "images/gm_alerts.png", false, "", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,9 +59,12 @@ if ($a_template !== false) {
|
|||
alerts_meta_print_header();
|
||||
}
|
||||
else {
|
||||
//~ ui_print_page_header (__('Alerts') .
|
||||
//~ ' » ' . __('Configure alert template'), "",
|
||||
//~ false, "alerts_config", true);
|
||||
ui_print_page_header (__('Alerts') .
|
||||
' » ' . __('Configure alert template'), "",
|
||||
false, "alerts_config", true);
|
||||
false, "", true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -126,7 +126,14 @@ if ($delete_group) {
|
|||
|
||||
if ($result) {
|
||||
$result = db_process_sql_update('tagente_modulo', array('id_module_group' => 0), array('id_module_group' => $id_group));
|
||||
|
||||
db_process_sql_update('tpolicy_modules', array('id_module_group' => 0), array('id_module_group' => $id_group));
|
||||
db_process_sql_update('tcontainer_item', array('id_module_group' => 0), array('id_module_group' => $id_group));
|
||||
db_process_sql_update('tnetwork_component', array('id_module_group' => 0), array('id_module_group' => $id_group));
|
||||
db_process_sql_update('treport_content', array('id_module_group' => 0), array('id_module_group' => $id_group));
|
||||
db_process_sql_update('tnetwork_map', array('id_module_group' => 0), array('id_module_group' => $id_group));
|
||||
db_process_sql_update('tlocal_component', array('id_module_group' => 0), array('id_module_group' => $id_group));
|
||||
db_process_sql_update('treport_content_template', array('id_module_group' => 0), array('id_module_group' => $id_group));
|
||||
|
||||
// A group with no modules can be deleted, to avoid a message error then do the follwing
|
||||
if ($result !== false)
|
||||
$result = true;
|
||||
|
|
|
@ -130,6 +130,11 @@ foreach ($agent_alerts as $alert) {
|
|||
$alerts[$alert['id']] = $name;
|
||||
}
|
||||
|
||||
$tags = tags_get_user_tags();
|
||||
$table->data['tags'][0] = __('Tags');
|
||||
$table->data['tags'][1] = html_print_select ($tags, 'tags[]',
|
||||
$tags_name, false, __('Any'), -1, true, true, true);
|
||||
|
||||
$table->data['operations'][0] = __('Operations');
|
||||
$table->data['operations'][1] = '<span class="with_modules'.(empty ($modules) ? ' invisible': '').'">';
|
||||
$table->data['operations'][1] .= html_print_checkbox ('copy_modules', 1, true, true);
|
||||
|
@ -282,12 +287,16 @@ $(document).ready (function () {
|
|||
}
|
||||
});
|
||||
|
||||
$("#tags").change(function() {
|
||||
$("#source_id_agent").trigger("change");
|
||||
});
|
||||
|
||||
$("#status_agents_destiny").change(function() {
|
||||
$("#destiny_id_group").trigger("change");
|
||||
});
|
||||
|
||||
$("#source_id_agent").change (function () {
|
||||
var id_agent = this.value;
|
||||
var id_agent = $("#source_id_agent").val();
|
||||
if (id_agent == 0) {
|
||||
$("#submit-go").attr("disabled", "disabled");
|
||||
|
||||
|
@ -302,6 +311,21 @@ $(document).ready (function () {
|
|||
return;
|
||||
}
|
||||
|
||||
var params = {
|
||||
"page" : "operation/agentes/ver_agente",
|
||||
"get_agent_modules_json" : 1,
|
||||
"get_id_and_name" : 1,
|
||||
"disabled" : 0,
|
||||
"id_agent" : id_agent
|
||||
};
|
||||
|
||||
var tags_to_search = $('#tags').val();
|
||||
if (tags_to_search != null) {
|
||||
if (tags_to_search[0] != -1) {
|
||||
params['tags'] = tags_to_search;
|
||||
}
|
||||
}
|
||||
|
||||
$("#submit-go").attr("disabled", false);
|
||||
|
||||
$("#modules_loading").show ();
|
||||
|
@ -313,12 +337,7 @@ $(document).ready (function () {
|
|||
var no_alerts;
|
||||
/* Get modules */
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/agentes/ver_agente",
|
||||
"get_agent_modules_json" : 1,
|
||||
"id_agent" : this.value,
|
||||
"disabled" : 0,
|
||||
"get_id_and_name" : 1
|
||||
},
|
||||
params,
|
||||
function (data, status) {
|
||||
if (data.length == 0) {
|
||||
no_modules = true;
|
||||
|
|
|
@ -444,7 +444,12 @@ $table->data['form_agents_1'][3] = __('Select all modules of this group') . ' '
|
|||
html_print_checkbox_extended ("force_group", 'group', '', '', false,
|
||||
'', 'style="margin-right: 40px;"', true);
|
||||
|
||||
|
||||
$tags = tags_get_user_tags();
|
||||
$table->rowstyle['form_modules_4'] = 'vertical-align: top;';
|
||||
$table->rowclass['form_modules_4'] = 'select_modules_row select_modules_row_2';
|
||||
$table->data['form_modules_4'][0] = __('Tags');
|
||||
$table->data['form_modules_4'][1] = html_print_select ($tags, 'tags[]',
|
||||
$tags_name, false, __('Any'), -1, true, true, true);
|
||||
|
||||
$table->rowclass['form_agents_2'] = 'select_agents_row';
|
||||
$table->data['form_agents_2'][0] = __('Status');
|
||||
|
@ -489,7 +494,12 @@ $table->data['form_modules_2'][2] .= html_print_select(
|
|||
$table->data['form_modules_2'][3] = html_print_select (array(), 'agents[]',
|
||||
$agents_select, false, __('None'), 0, true, true, false, '', false, 'width:100%');
|
||||
|
||||
|
||||
$tags = tags_get_user_tags();
|
||||
$table->rowstyle['form_agents_4'] = 'vertical-align: top;';
|
||||
$table->rowclass['form_agents_4'] = 'select_agents_row select_agents_row_2';
|
||||
$table->data['form_agents_4'][0] = __('Tags');
|
||||
$table->data['form_agents_4'][1] = html_print_select ($tags, 'tags[]',
|
||||
$tags_name, false, __('Any'), -1, true, true, true);
|
||||
|
||||
$table->rowstyle['form_agents_3'] = 'vertical-align: top;';
|
||||
$table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2';
|
||||
|
@ -544,6 +554,7 @@ $(document).ready (function () {
|
|||
.css('display', '<?php echo $modules_row?>');
|
||||
$(".select_agents_row")
|
||||
.css('display', '<?php echo $agents_row?>');
|
||||
$(".select_modules_row_2").css('display', 'none');
|
||||
|
||||
// Trigger change to refresh selection when change selection mode
|
||||
$("#agents_selection_mode").change (function() {
|
||||
|
@ -573,7 +584,7 @@ $(document).ready (function () {
|
|||
var params = {
|
||||
"page" : "operation/agentes/ver_agente",
|
||||
"get_agent_modules_json" : 1,
|
||||
"get_distinct_name" : 1,
|
||||
"get_id_and_name" : 1,
|
||||
"indexed" : 0,
|
||||
"privilege" : "AW"
|
||||
};
|
||||
|
@ -584,6 +595,13 @@ $(document).ready (function () {
|
|||
var status_module = $('#status_module').val();
|
||||
if (status_module != '-1')
|
||||
params['status_module'] = status_module;
|
||||
|
||||
var tags_to_search = $('#tags').val();
|
||||
if (tags_to_search != null) {
|
||||
if (tags_to_search[0] != -1) {
|
||||
params['tags'] = tags_to_search;
|
||||
}
|
||||
}
|
||||
|
||||
$("#module_loading").show ();
|
||||
$("tr#delete_table-edit1, tr#delete_table-edit2").hide ();
|
||||
|
@ -656,6 +674,7 @@ $(document).ready (function () {
|
|||
else if (selector == 'modules') {
|
||||
$(".select_agents_row").hide();
|
||||
$(".select_modules_row").show();
|
||||
$("#module_type").trigger("change");
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -714,6 +733,15 @@ $(document).ready (function () {
|
|||
$("#status_agents").change(function() {
|
||||
$("#groups_select").trigger("change");
|
||||
});
|
||||
|
||||
$("#tags").change(function() {
|
||||
selector = $("#form_edit input[name=selection_mode]:checked").val();
|
||||
$("#module_type").trigger("change");
|
||||
});
|
||||
$("#tags1").change(function() {
|
||||
selector = $("#form_edit input[name=selection_mode]:checked").val();
|
||||
$("#id_agents").trigger("change");
|
||||
});
|
||||
|
||||
$("#form_modules").submit(function() {
|
||||
var get_parameters_count = window.location.href.slice(
|
||||
|
|
|
@ -183,7 +183,7 @@ if ($update_agents) {
|
|||
|
||||
ui_print_result_message ($result !== false,
|
||||
__('Agents updated successfully') . '(' . $n_edited . ')',
|
||||
__('Agents cannot be updated'));
|
||||
__('Agents cannot be updated (maybe there was no field to update)'));
|
||||
}
|
||||
$id_group = 0;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
// Load global vars
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "PM")) {
|
||||
if (! check_acl ($config['id_user'], 0, "AW")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access massive module update");
|
||||
require ("general/noaccess.php");
|
||||
|
@ -110,6 +110,9 @@ if ($update) {
|
|||
$success += (int)$result;
|
||||
}
|
||||
}
|
||||
if ($success == 0) {
|
||||
$error_msg = __("Error updating the modules from a module type");
|
||||
}
|
||||
}
|
||||
else if ($force == 'group') {
|
||||
$agents_ = array_keys(agents_get_group_agents($group_select, false, 'none'));
|
||||
|
@ -129,6 +132,9 @@ if ($update) {
|
|||
$success += (int)$result;
|
||||
}
|
||||
}
|
||||
if ($success == 0) {
|
||||
$error_msg = __("Error updating the modules from an agent group");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -146,11 +152,14 @@ if ($update) {
|
|||
|
||||
}
|
||||
}
|
||||
if ($success == 0) {
|
||||
$error_msg = __("Error updating the modules (maybe there was no field to update)");
|
||||
}
|
||||
}
|
||||
|
||||
ui_print_result_message ($success > 0,
|
||||
__('Successfully updated') . "(" . $success . "/" . $count . ")",
|
||||
__('Could not be updated'));
|
||||
$error_msg);
|
||||
|
||||
$info = 'Modules: ' . json_encode($modules_) . ' Agents: ' . json_encode($agents_);
|
||||
if ($success > 0) {
|
||||
|
@ -303,6 +312,13 @@ $table->data['form_modules_3'][1] = html_print_select($status_list,
|
|||
'status_module', 'selected', '', __('All'), AGENT_MODULE_STATUS_ALL, true);
|
||||
$table->data['form_modules_3'][3] = '';
|
||||
|
||||
$tags = tags_get_user_tags();
|
||||
$table->rowstyle['form_modules_4'] = 'vertical-align: top;';
|
||||
$table->rowclass['form_modules_4'] = 'select_modules_row select_modules_row_2';
|
||||
$table->data['form_modules_4'][0] = __('Tags');
|
||||
$table->data['form_modules_4'][1] = html_print_select ($tags, 'tags[]',
|
||||
$tags_name, false, __('Any'), -1, true, true, true);
|
||||
|
||||
$table->rowstyle['form_modules_2'] = 'vertical-align: top;';
|
||||
$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
|
||||
$table->data['form_modules_2'][0] = __('Modules');
|
||||
|
@ -334,8 +350,12 @@ $table->data['form_agents_2'][1] = html_print_select($status_list,
|
|||
'status_agents', 'selected', '', __('All'), AGENT_STATUS_ALL, true);
|
||||
$table->data['form_agents_2'][3] = '';
|
||||
|
||||
|
||||
|
||||
$tags = tags_get_user_tags();
|
||||
$table->rowstyle['form_agents_4'] = 'vertical-align: top;';
|
||||
$table->rowclass['form_agents_4'] = 'select_agents_row select_agents_row_2';
|
||||
$table->data['form_agents_4'][0] = __('Tags');
|
||||
$table->data['form_agents_4'][1] = html_print_select ($tags, 'tags[]',
|
||||
$tags_name, false, __('Any'), -1, true, true, true);
|
||||
|
||||
$table->rowstyle['form_agents_3'] = 'vertical-align: top;';
|
||||
$table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2';
|
||||
|
@ -474,8 +494,10 @@ $table->data['edit2'][3] = html_print_select(
|
|||
|
||||
$table->data['edit3'][0] = __('Post process') .
|
||||
ui_print_help_icon ('postprocess', true);
|
||||
$table->data['edit3'][1] = html_print_input_text ('post_process', '',
|
||||
'', 10, 15, true);
|
||||
|
||||
$table->data['edit3'][1] = html_print_extended_select_for_post_process('post_process',
|
||||
0, '', 0, '', false, true, 'width:150px;', true);
|
||||
|
||||
$table->data['edit3'][2] = __('SMNP community');
|
||||
$table->data['edit3'][3] = html_print_input_text ('snmp_community', '',
|
||||
'', 10, 15, true);
|
||||
|
@ -533,7 +555,13 @@ $table->data['edit6'][0] = __('Export target');
|
|||
$targets2 = db_get_all_rows_sql ("SELECT id, name FROM tserver_export ORDER by name");
|
||||
if ($targets2 === false)
|
||||
$targets2 = array();
|
||||
$targets = array_merge(array(0 => __('None')), $targets2 );
|
||||
|
||||
$targets = array();
|
||||
$targets[0] = __('None');
|
||||
foreach ($targets2 as $t) {
|
||||
$targets[$t['id']] = $t['name'];
|
||||
}
|
||||
|
||||
$table->data['edit6'][1] = html_print_select ($targets, 'id_export', '','', __('No change'), '', true, false, false);
|
||||
$table->data['edit6'][2] = __('Unit');
|
||||
$table->data['edit6'][3] = html_print_input_text ('unit', '', '', 15, 60, true);
|
||||
|
@ -662,8 +690,10 @@ $(document).ready (function () {
|
|||
|
||||
clean_lists();
|
||||
|
||||
|
||||
$(".select_modules_row").css('display', '<?php echo $modules_row?>');
|
||||
$(".select_agents_row").css('display', '<?php echo $agents_row?>');
|
||||
$(".select_modules_row_2").css('display', 'none');
|
||||
|
||||
// Trigger change to refresh selection when change selection mode
|
||||
$("#agents_selection_mode").change (function() {
|
||||
|
@ -710,7 +740,7 @@ $(document).ready (function () {
|
|||
var params = {
|
||||
"page" : "operation/agentes/ver_agente",
|
||||
"get_agent_modules_json" : 1,
|
||||
"get_distinct_name" : 1,
|
||||
"get_id_and_name" : 1,
|
||||
"indexed" : 0
|
||||
};
|
||||
|
||||
|
@ -720,6 +750,13 @@ $(document).ready (function () {
|
|||
var status_module = $('#status_module').val();
|
||||
if (status_module != '-1')
|
||||
params['status_module'] = status_module;
|
||||
|
||||
var tags_to_search = $('#tags').val();
|
||||
if (tags_to_search != null) {
|
||||
if (tags_to_search[0] != -1) {
|
||||
params['tags'] = tags_to_search;
|
||||
}
|
||||
}
|
||||
|
||||
$("#module_loading").show ();
|
||||
$("tr#delete_table-edit1, tr#delete_table-edit0, tr#delete_table-edit2").hide ();
|
||||
|
@ -926,6 +963,7 @@ $(document).ready (function () {
|
|||
else if(selector == 'modules') {
|
||||
$(".select_agents_row").hide();
|
||||
$(".select_modules_row").show();
|
||||
$("#module_type").trigger("change");
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -957,7 +995,6 @@ $(document).ready (function () {
|
|||
|
||||
$("#groups_select").change (
|
||||
function () {
|
||||
|
||||
if (this.value < 0) {
|
||||
clean_lists();
|
||||
$(".select_agents_row_2").css('display', 'none');
|
||||
|
@ -1041,6 +1078,14 @@ $(document).ready (function () {
|
|||
}
|
||||
});
|
||||
|
||||
$("#tags").change(function() {
|
||||
selector = $("#form_edit input[name=selection_mode]:checked").val();
|
||||
$("#module_type").trigger("change");
|
||||
});
|
||||
$("#tags1").change(function() {
|
||||
selector = $("#form_edit input[name=selection_mode]:checked").val();
|
||||
$("#id_agents").trigger("change");
|
||||
});
|
||||
});
|
||||
|
||||
function disabled_status () {
|
||||
|
|
|
@ -674,7 +674,7 @@ echo '</form>';
|
|||
}
|
||||
|
||||
var processGet = function (params, callback) {
|
||||
return jQuery.get(ajaxPage, params, 'json')
|
||||
return jQuery.post(ajaxPage, params, 'json')
|
||||
.done(function (data, textStatus, jqXHR) {
|
||||
try {
|
||||
data = JSON.parse(data);
|
||||
|
|
|
@ -62,7 +62,7 @@ $options_plugins = array(
|
|||
'edit_plugins' => __('Bulk plugin edit')
|
||||
);
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "PM")) {
|
||||
if (! check_acl ($config['id_user'], 0, "AW")) {
|
||||
unset($options_modules['edit_modules']);
|
||||
}
|
||||
|
||||
|
|
|
@ -408,7 +408,9 @@ if (is_array ($config['extensions'])) {
|
|||
$sub["godmode/extensions"]["subtype"] = 'nolink';
|
||||
|
||||
$submenu = array_merge($menu_godmode["gextensions"]["sub"],$sub);
|
||||
$menu_godmode["gextensions"]["sub"] = $submenu;
|
||||
if($menu_godmode['gextensions']['sub'] != null){
|
||||
$menu_godmode["gextensions"]["sub"] = $submenu;
|
||||
}
|
||||
}
|
||||
|
||||
$menu_godmode["links"]["text"] = __('Links');
|
||||
|
|
|
@ -337,13 +337,13 @@ $next_row++;
|
|||
//function paint graph
|
||||
function paint_graph_values(){
|
||||
//Parse integrer
|
||||
var min_w = parseInt($('#text-min_warning').val());
|
||||
var min_w = parseFloat($('#text-min_warning').val());
|
||||
if(min_w == '0.00'){ min_w = 0; }
|
||||
var max_w = parseInt($('#text-max_warning').val());
|
||||
var max_w = parseFloat($('#text-max_warning').val());
|
||||
if(max_w == '0.00'){ max_w = 0; }
|
||||
var min_c = parseInt($('#text-min_critical').val());
|
||||
var min_c = parseFloat($('#text-min_critical').val());
|
||||
if(min_c =='0.00'){ min_c = 0; }
|
||||
var max_c = parseInt($('#text-max_critical').val());
|
||||
var max_c = parseFloat($('#text-max_critical').val());
|
||||
if(max_c =='0.00'){ max_c = 0; }
|
||||
var inverse_w = $('input:checkbox[name=warning_inverse]:checked').val();
|
||||
if(!inverse_w){ inverse_w = 0; }
|
||||
|
@ -388,10 +388,10 @@ $next_row++;
|
|||
//if haven't errors
|
||||
if (error_w == 0 && error_c == 0){
|
||||
//parse element
|
||||
min_w = parseInt(min_w);
|
||||
min_c = parseInt(min_c);
|
||||
max_w = parseInt(max_w);
|
||||
max_c = parseInt(max_c);
|
||||
min_w = parseFloat(min_w);
|
||||
min_c = parseFloat(min_c);
|
||||
max_w = parseFloat(max_w);
|
||||
max_c = parseFloat(max_c);
|
||||
|
||||
//inicialize var
|
||||
var range_min = 0;
|
||||
|
|
|
@ -0,0 +1,617 @@
|
|||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Load global variables
|
||||
global $config;
|
||||
|
||||
// Check user credentials
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "RW")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Inventory Module Management");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
require_once ('include/functions_container.php');
|
||||
require_once ($config['homedir'] . '/include/functions_custom_graphs.php');
|
||||
|
||||
$id_container = get_parameter('id',0);
|
||||
$offset = (int) get_parameter ('offset',0);
|
||||
|
||||
if (is_ajax()){
|
||||
$add_single = (bool) get_parameter('add_single',0);
|
||||
$add_custom = (bool) get_parameter('add_custom',0);
|
||||
$add_dynamic = (bool) get_parameter('add_dynamic',0);
|
||||
$id_container2 = get_parameter('id_container',0);
|
||||
|
||||
if($add_single){
|
||||
$id_agent = get_parameter('id_agent');
|
||||
$id_agent_module = get_parameter('id_agent_module');
|
||||
$time_lapse = get_parameter('time_lapse');
|
||||
$only_avg = (int) get_parameter('only_avg');
|
||||
|
||||
$values = array(
|
||||
'id_container' => $id_container2,
|
||||
'type' => "simple_graph",
|
||||
'id_agent' => $id_agent,
|
||||
'id_agent_module' => $id_agent_module,
|
||||
'time_lapse' => $time_lapse,
|
||||
'only_average' => $only_avg);
|
||||
|
||||
$id_item = db_process_sql_insert('tcontainer_item', $values);
|
||||
return;
|
||||
}
|
||||
|
||||
if($add_custom){
|
||||
$time_lapse = get_parameter('time_lapse');
|
||||
$id_custom = get_parameter('id_custom');
|
||||
|
||||
$values = array(
|
||||
'id_container' => $id_container2,
|
||||
'type' => "custom_graph",
|
||||
'time_lapse' => $time_lapse,
|
||||
'id_graph' => $id_custom);
|
||||
|
||||
$id_item = db_process_sql_insert('tcontainer_item', $values);
|
||||
return;
|
||||
}
|
||||
|
||||
if($add_dynamic) {
|
||||
$time_lapse = get_parameter('time_lapse');
|
||||
$group = get_parameter('group',0);
|
||||
$module_group= get_parameter('module_group',0);
|
||||
$agent_alias = get_parameter('agent_alias','');
|
||||
$module_name = get_parameter('module_name','');
|
||||
$tag = get_parameter('tag',0);
|
||||
|
||||
$values = array(
|
||||
'id_container' => $id_container2,
|
||||
'type' => "dynamic_graph",
|
||||
'time_lapse' => $time_lapse,
|
||||
'id_group' => $group,
|
||||
'id_module_group' => $module_group,
|
||||
'agent' => $agent_alias,
|
||||
'module' => $module_name,
|
||||
'id_tag' => $tag);
|
||||
|
||||
$id_item = db_process_sql_insert('tcontainer_item', $values);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$add_container = (bool) get_parameter ('add_container',0);
|
||||
$edit_container = (bool) get_parameter ('edit_container',0);
|
||||
$update_container = (bool) get_parameter ('update_container',0);
|
||||
$delete_item = (bool) get_parameter ('delete_item',0);
|
||||
|
||||
if ($edit_container) {
|
||||
$name = io_safe_input(get_parameter ('name',''));
|
||||
if (!empty($name)){
|
||||
$id_parent = get_parameter ('id_parent',0);
|
||||
$description = io_safe_input(get_parameter ('description',''));
|
||||
$id_group = get_parameter ('container_id_group',0);
|
||||
}else{
|
||||
$tcontainer = db_get_row_sql("SELECT * FROM tcontainer WHERE id_container = " . $id_container);
|
||||
$name = $tcontainer['name'];
|
||||
$id_parent = $tcontainer['parent'];
|
||||
$description = $tcontainer['description'];
|
||||
$id_group = $tcontainer['id_group'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($add_container){
|
||||
$values = array(
|
||||
'name' => $name,
|
||||
'description' => $description,
|
||||
'parent' => $id_parent,
|
||||
'id_group' => $id_group);
|
||||
$id_container = db_process_sql_insert('tcontainer', $values);
|
||||
}
|
||||
|
||||
if($update_container){
|
||||
if($id_container === $id_parent){
|
||||
$success = false;
|
||||
} else {
|
||||
$values = array(
|
||||
'name' => $name,
|
||||
'description' => $description,
|
||||
'parent' => $id_parent,
|
||||
'id_group' => $id_group);
|
||||
$success = db_process_sql_update('tcontainer', $values,array('id_container' => $id_container));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($delete_item){
|
||||
$id_item = get_parameter('id_item',0);
|
||||
$success = db_process_sql_delete('tcontainer_item', array('id_ci' => $id_item));
|
||||
}
|
||||
|
||||
$buttons['graph_container'] = array('active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container">' .
|
||||
html_print_image("images/graph-container.png", true, array ("title" => __('Graph container'))) . '</a>');
|
||||
|
||||
// Header
|
||||
ui_print_page_header (__('Create container'), "", false, "", false, $buttons);
|
||||
|
||||
if($add_container){
|
||||
ui_print_result_message($id_container, __('Container stored successfully'), __('There was a problem storing container'));
|
||||
}
|
||||
|
||||
if($update_container){
|
||||
ui_print_result_message($success, __("Update the container"), __("Bad update the container"));
|
||||
}
|
||||
|
||||
echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
|
||||
if($edit_container){
|
||||
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/create_container&edit_container=1&update_container=1&id=" . $id_container . "'>";
|
||||
} else {
|
||||
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/create_container&edit_container=1&add_container=1'>";
|
||||
}
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td class='datos' style='width: 12%;'><b>".__('Name')."</b></td>";
|
||||
if($id_container === '1'){
|
||||
echo "<td class='datos' style='width: 27%;'><input type='text' name='name' size='30' disabled='1'";
|
||||
} else {
|
||||
echo "<td class='datos' style='width: 27%;'><input type='text' name='name' size='30' ";
|
||||
}
|
||||
|
||||
if ($edit_container) {
|
||||
echo "value='" . io_safe_output($name) . "'";
|
||||
}
|
||||
echo "></td>";
|
||||
$own_info = get_user_info ($config['id_user']);
|
||||
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
||||
$return_all_groups = true;
|
||||
else
|
||||
$return_all_groups = false;
|
||||
|
||||
echo "<td style='width: 12%;'><b>".__('Group')."</b></td><td>";
|
||||
if($id_container === '1'){
|
||||
echo html_print_select_groups($config['id_user'], '', $return_all_groups, 'container_id_group', $id_group, '', '', '', true,false,true,'',true);
|
||||
} else {
|
||||
echo html_print_select_groups($config['id_user'], '', $return_all_groups, 'container_id_group', $id_group, '', '', '', true,false,true,'',false);
|
||||
}
|
||||
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td class='datos2'><b>".__('Description')."</b></td>";
|
||||
if($id_container === '1'){
|
||||
echo "<td class='datos2' colspan=3><textarea name='description' style='height:45px;' cols=95 rows=2 disabled>";
|
||||
} else {
|
||||
echo "<td class='datos2' colspan=3><textarea name='description' style='height:45px;' cols=95 rows=2>";
|
||||
}
|
||||
|
||||
if ($edit_container) {
|
||||
echo io_safe_output($description);
|
||||
}
|
||||
|
||||
echo "</textarea>";
|
||||
echo "</td></tr>";
|
||||
$container = folder_get_folders();
|
||||
$tree = folder_get_folders_tree_recursive($container);
|
||||
$containers_tree = folder_flatten_tree_folders($tree,0);
|
||||
$containers_tree = folder_get_select($containers_tree);
|
||||
|
||||
unset($containers_tree[$id_container]);
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td class='datos2'><b>".__("Parent container")."</b></td>";
|
||||
if($id_container === '1'){
|
||||
echo "<td class='datos2'>" . html_print_select ($containers_tree, "id_parent", $id_parent,
|
||||
'', __('none'), 0, true,'',false,'w130',true,'width: 195px','');
|
||||
} else {
|
||||
echo "<td class='datos2'>" . html_print_select ($containers_tree, "id_parent", $id_parent,
|
||||
'', __('none'), 0, true,'',false,'w130','','width: 195px','');
|
||||
}
|
||||
|
||||
|
||||
echo "</td></tr>";
|
||||
|
||||
|
||||
echo "</table>";
|
||||
|
||||
if ($edit_container) {
|
||||
if($id_container !== '1'){
|
||||
echo "<div style='width:100%'><input style='float:right;' type=submit name='store' disbaled class='sub upd' value='".__('Update')."'></div>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "<div style='width:100%'><input style='float:right;' type=submit name='store' class='sub next' value='".__('Create')."'></div>";
|
||||
}
|
||||
|
||||
echo "</form>";
|
||||
|
||||
echo "</br>";
|
||||
echo "</br>";
|
||||
echo "</br>";
|
||||
|
||||
if($edit_container){
|
||||
$period = SECONDS_15DAYS;
|
||||
$periods = array ();
|
||||
$periods[-1] = __('custom');
|
||||
$periods[SECONDS_1HOUR] = __('1 hour');
|
||||
$periods[SECONDS_2HOUR] = sprintf(__('%s hours'), '2 ');
|
||||
$periods[SECONDS_6HOURS] = sprintf(__('%s hours'), '6 ');
|
||||
$periods[SECONDS_12HOURS] = sprintf(__('%s hours'), '12 ');
|
||||
$periods[SECONDS_1DAY] = __('1 day');
|
||||
$periods[SECONDS_2DAY] = sprintf(__('%s days'), '2 ');
|
||||
$periods[SECONDS_5DAY] = sprintf(__('%s days'), '5 ');
|
||||
$periods[SECONDS_1WEEK] = __('1 week');
|
||||
$periods[SECONDS_15DAYS] = __('15 days');
|
||||
$periods[SECONDS_1MONTH] = __('1 month');
|
||||
|
||||
$single_table = "<table width='100%' cellpadding=4 cellspacing=4>";
|
||||
$single_table .= "<tr id='row_time_lapse' style='' class='datos'>";
|
||||
$single_table .= "<td style='font-weight:bold;width: 12%;'>";
|
||||
$single_table .= __('Time lapse');
|
||||
$single_table .= ui_print_help_tip(__('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '),true);
|
||||
$single_table .= "</td>";
|
||||
$single_table .= "<td>";
|
||||
$single_table .= html_print_extended_select_for_time('period_single', $period,
|
||||
'', '', '0', 10, true,false,true,'',false,$periods);
|
||||
$single_table .= "</td>";
|
||||
$single_table .= "</tr>";
|
||||
|
||||
$single_table .= "<tr id='row_agent' style='' class='datos'>";
|
||||
$single_table .= "<td style='font-weight:bold;width: 12%;'>";
|
||||
$single_table .= __('Agent');
|
||||
$single_table .= "</td>";
|
||||
$single_table .= "<td>";
|
||||
$params = array();
|
||||
|
||||
$params['show_helptip'] = false;
|
||||
$params['input_name'] = 'agent';
|
||||
$params['value'] = '';
|
||||
$params['return'] = true;
|
||||
|
||||
$params['javascript_is_function_select'] = true;
|
||||
$params['selectbox_id'] = 'id_agent_module';
|
||||
$params['add_none_module'] = true;
|
||||
$params['use_hidden_input_idagent'] = true;
|
||||
$params['hidden_input_idagent_id'] = 'hidden-id_agent';
|
||||
|
||||
|
||||
$single_table .= ui_print_agent_autocomplete_input($params);
|
||||
$single_table .= "</td>";
|
||||
$single_table .= "</tr>";
|
||||
|
||||
$single_table .= "<tr id='row_module' style='' class='datos'>";
|
||||
$single_table .= "<td style='font-weight:bold;width: 12%;'>";
|
||||
$single_table .= __('Module');
|
||||
$single_table .= "</td>";
|
||||
$single_table .= "<td>";
|
||||
if ($idAgent) {
|
||||
$single_table .= html_print_select_from_sql($sql_modules, 'id_agent_module', $idAgentModule, '', '', '0',true);
|
||||
} else {
|
||||
$single_table .= "<select style='max-width: 180px' id='id_agent_module' name='id_agent_module' disabled='disabled'>";
|
||||
$single_table .= "<option value='0'>";
|
||||
$single_table .= __('Select an Agent first');
|
||||
$single_table .= "</option>";
|
||||
$single_table .= "</select>";
|
||||
}
|
||||
$single_table .= "</td>";
|
||||
$single_table .= "</tr>";
|
||||
|
||||
$single_table .= "<tr id='row_only_avg' style='' class='datos'>";
|
||||
$single_table .= "<td style='font-weight:bold;'>";
|
||||
$single_table .= __('Only average');
|
||||
$single_table .= "</td>";
|
||||
$single_table .= "<td>";
|
||||
$single_table .= html_print_checkbox('only_avg', 1, true,true);
|
||||
$single_table .= "</td>";
|
||||
$single_table .= "</tr>";
|
||||
$single_table .= "<tr>";
|
||||
$single_table .= "<td >";
|
||||
$single_table .= "</td>";
|
||||
$single_table .= "<td style='float:right;'>";
|
||||
$single_table .= "<input style='float:right;' type=submit name='add_single' class='sub add' value='".__('Add item')."'>";
|
||||
$single_table .= "</td>";
|
||||
$single_table .= "</tr>";
|
||||
$single_table .= "</table>";
|
||||
|
||||
echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
|
||||
echo "<tr>";
|
||||
echo "<td>";
|
||||
echo ui_toggle($single_table,'Simple module graph', '', true, true);
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'custom_graph_table';
|
||||
$table->width = '100%';
|
||||
$table->cellspacing = 4;
|
||||
$table->cellpadding = 4;
|
||||
$table->class = 'dat';
|
||||
|
||||
$table->styleTable = 'font-weight: bold;';
|
||||
$table->style[0] = 'width: 12%';
|
||||
$table->data = array();
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Time lapse');
|
||||
$data[0] .= ui_print_help_tip(__('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '),true);
|
||||
$data[1] = html_print_extended_select_for_time('period_custom', $period,'', '', '0', 10, true,false,true,'',false,$periods);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Custom graph');
|
||||
|
||||
$list_custom_graphs = custom_graphs_get_user ($config['id_user'], false, true, "RR");
|
||||
|
||||
$graphs = array();
|
||||
foreach ($list_custom_graphs as $custom_graph) {
|
||||
$graphs[$custom_graph['id_graph']] = $custom_graph['name'];
|
||||
}
|
||||
|
||||
$data[1] = html_print_select($graphs, 'id_custom_graph',$idCustomGraph, '', __('None'), 0,true);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = array();
|
||||
$data[0] = "";
|
||||
$data[1] = "<input style='float:right;' type=submit name='add_custom' class='sub add' value='".__('Add item')."'>";
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
|
||||
echo "<tr>";
|
||||
echo "<td>";
|
||||
echo ui_toggle(html_print_table($table, true),'Custom graph', '', true, true);
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
|
||||
unset($table);
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'dynamic_rules_table';
|
||||
$table->width = '100%';
|
||||
$table->cellspacing = 4;
|
||||
$table->cellpadding = 4;
|
||||
$table->class = 'dat';
|
||||
|
||||
$table->styleTable = 'font-weight: bold;';
|
||||
$table->style[0] = 'width: 12%';
|
||||
$table->data = array();
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Time lapse');
|
||||
$data[0] .= ui_print_help_tip(__('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '),true);
|
||||
$data[1] = html_print_extended_select_for_time('period_dynamic', $period,'', '', '0', 10, true,false,true,'',false,$periods);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Group');
|
||||
$data[1] = html_print_select_groups($config['id_user'], 'RW', $return_all_groups, 'container_id_group', $id_group, '', '', '', true);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Module group');
|
||||
$data[1] = html_print_select_from_sql(
|
||||
"SELECT * FROM tmodule_group ORDER BY name",
|
||||
'combo_modulegroup', $modulegroup, '',__('All'),false,true);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Agent');
|
||||
$data[1] = html_print_input_text ('text_agent', $textAgent, '', 30, 100, true);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Module');
|
||||
$data[1] = html_print_input_text ('text_agent_module', $textModule, '', 30, 100, true);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Tag');
|
||||
$select_tags = tags_search_tag (false, false, true);
|
||||
$data[1] = html_print_select ($select_tags, 'tag',
|
||||
$tag, '', __('Any'), 0, true, false, false);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = array();
|
||||
$data[0] = "";
|
||||
$data[1] = "<input style='float:right;' type=submit name='add_dynamic' class='sub add' value='".__('Add item')."'>";
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
|
||||
echo "<tr>";
|
||||
echo "<td>";
|
||||
echo ui_toggle(html_print_table($table, true),'Dynamic rules for simple module graph', '', true, true);
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
|
||||
$total_item = db_get_all_rows_sql("SELECT count(*) FROM tcontainer_item WHERE id_container = " . $id_container);
|
||||
$result_item = db_get_all_rows_sql("SELECT * FROM tcontainer_item WHERE id_container = " . $id_container . " LIMIT 10 OFFSET ". $offset);
|
||||
|
||||
if(!$result_item){
|
||||
echo "<div class='nf'>".__('There are no defined item container')."</div>";
|
||||
} else {
|
||||
ui_pagination ($total_item[0]['count(*)'],false,$offset,10);
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox data';
|
||||
$table->id = 'item_table';
|
||||
$table->align = array ();
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('Agent/Module');
|
||||
$table->head[1] = __('Custom graph');
|
||||
$table->head[2] = __('Group');
|
||||
$table->head[3] = __('M.Group');
|
||||
$table->head[4] = __('Agent');
|
||||
$table->head[5] = __('Module');
|
||||
$table->head[6] = __('Tag');
|
||||
$table->head[7] = __('Delete');
|
||||
|
||||
$table->data = array ();
|
||||
|
||||
|
||||
foreach ($result_item as $item) {
|
||||
$data = array ();
|
||||
switch ($item['type']) {
|
||||
case 'simple_graph':
|
||||
$agent_alias = ui_print_truncate_text(agents_get_alias($item['id_agent'],20,false));
|
||||
$module_name = ui_print_truncate_text(modules_get_agentmodule_name($item['id_agent_module']),20,false);
|
||||
$module_name =
|
||||
$data[0] = $agent_alias . " / " .$module_name;
|
||||
$data[1] = '';
|
||||
$data[2] = '';
|
||||
$data[3] = '';
|
||||
$data[4] = '';
|
||||
$data[5] = '';
|
||||
$data[6] = '';
|
||||
break;
|
||||
|
||||
case 'custom_graph':
|
||||
$data[0] = '';
|
||||
$name = db_get_value_filter('name','tgraph',array('id_graph' => $item['id_graph']));
|
||||
$data[1] = ui_print_truncate_text(io_safe_output($name),35,false);
|
||||
$data[2] = '';
|
||||
$data[3] = '';
|
||||
$data[4] = '';
|
||||
$data[5] = '';
|
||||
$data[6] = '';
|
||||
break;
|
||||
|
||||
case 'dynamic_graph':
|
||||
$data[0] = '';
|
||||
$data[1] = '';
|
||||
|
||||
$data[2] = ui_print_group_icon($item['id_group'],true);
|
||||
if ($item['id_module_group'] === '0') {
|
||||
$data[3] = 'All';
|
||||
} else {
|
||||
$data[3] = io_safe_output(db_get_value_filter('name','tmodule_group',array('id_mg' => $item['id_module_group'])));
|
||||
|
||||
}
|
||||
$data[4] = io_safe_output($item['agent']);
|
||||
$data[5] = io_safe_output($item['module']);
|
||||
if ($item['id_tag'] === '0') {
|
||||
$data[6] = 'Any';
|
||||
} else {
|
||||
$data[6] = io_safe_output(db_get_value_filter('name','ttag',array('id_tag' => $item['id_tag'])));
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
$data[7] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/create_container&edit_container=1&delete_item=1&id_item='
|
||||
.$item['id_ci'].'&id='.$id_container.'" onClick="if (!confirm(\''.__('Are you sure?').'\'))
|
||||
return false;">' . html_print_image("images/cross.png", true, array('alt' => __('Delete'), 'title' => __('Delete'))) . '</a>';
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
html_print_table ($table);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
echo html_print_input_hidden('id_agent', 0);
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
$("input[name=add_single]").click (function () {
|
||||
var id_agent_module = $("#id_agent_module").val();
|
||||
if(id_agent_module !== '0'){
|
||||
var id_agent = $("#hidden-id_agent").attr('value');
|
||||
var time_lapse = $("#hidden-period_single").attr('value');
|
||||
var only_avg = $("#checkbox-only_avg").prop("checked");
|
||||
var id_container = <?php echo $id_container; ?>;
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "godmode/reporting/create_container",
|
||||
"add_single" : 1,
|
||||
"id_agent" : id_agent,
|
||||
"id_agent_module" : id_agent_module,
|
||||
"time_lapse" : time_lapse,
|
||||
"only_avg" : only_avg,
|
||||
"id_container" : id_container,
|
||||
},
|
||||
function (data, status) {
|
||||
var url = location.href.replace('&update_container=1', "");
|
||||
url = url.replace('&delete_item=1', "");
|
||||
location.href = url.replace('&add_container=1', "&id="+id_container);
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("input[name=add_custom]").click (function () {
|
||||
var id_custom = $("#id_custom_graph").val();
|
||||
if (id_custom !== '0'){
|
||||
var time_lapse = $("#hidden-period_custom").attr('value');
|
||||
var id_container = <?php echo $id_container; ?>;
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "godmode/reporting/create_container",
|
||||
"add_custom" : 1,
|
||||
"time_lapse" : time_lapse,
|
||||
"id_custom" : id_custom,
|
||||
"id_container" : id_container,
|
||||
},
|
||||
function (data, status) {
|
||||
var url = location.href.replace('&update_container=1', "");
|
||||
url = url.replace('&delete_item=1', "");
|
||||
location.href = url.replace('&add_container=1', "&id="+id_container);
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
$("input[name=add_dynamic]").click (function () {
|
||||
var agent_alias = $("#text-text_agent").val();
|
||||
var module_name = $("#text-text_agent_module").val();
|
||||
var time_lapse = $("#hidden-period_dynamic").attr('value');
|
||||
var group = $("#container_id_group1").val();
|
||||
var module_group = $("#combo_modulegroup").val();
|
||||
var tag = $("#tag").val();
|
||||
var id_container = <?php echo $id_container; ?>;
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "godmode/reporting/create_container",
|
||||
"add_dynamic" : 1,
|
||||
"time_lapse" : time_lapse,
|
||||
"group" : group,
|
||||
"module_group" : module_group,
|
||||
"agent_alias" : agent_alias,
|
||||
"module_name" : module_name,
|
||||
"tag" : tag,
|
||||
"id_container" : id_container,
|
||||
},
|
||||
function (data, status) {
|
||||
var url = location.href.replace('&update_container=1', "");
|
||||
url = url.replace('&delete_item=1', "");
|
||||
location.href = url.replace('&add_container=1', "&id="+id_container);
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
|
@ -0,0 +1,140 @@
|
|||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Load global variables
|
||||
global $config;
|
||||
|
||||
// Check user credentials
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "RW")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Inventory Module Management");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
require_once ('include/functions_container.php');
|
||||
|
||||
$delete_container = get_parameter('delete_container',0);
|
||||
|
||||
if ($delete_container){
|
||||
$id_container = get_parameter('id',0);
|
||||
$child = folder_get_all_child_container($id_container);
|
||||
|
||||
if($child){
|
||||
foreach ($child as $key => $value) {
|
||||
$parent = array(
|
||||
'parent' => 1);
|
||||
db_process_sql_update('tcontainer', $parent, array('id_container' => $value['id_container']));
|
||||
}
|
||||
}
|
||||
db_process_sql_delete('tcontainer', array('id_container' => $id_container));
|
||||
|
||||
}
|
||||
|
||||
$max_graph = $config['max_graph_container'];
|
||||
|
||||
$buttons['graph_list'] = array('active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs">' .
|
||||
html_print_image("images/list.png", true, array ("title" => __('Graph list'))) .'</a>');
|
||||
|
||||
$enterpriseEnable = false;
|
||||
if (enterprise_include_once('include/functions_reporting.php') !== ENTERPRISE_NOT_HOOK) {
|
||||
$enterpriseEnable = true;
|
||||
}
|
||||
|
||||
if ($enterpriseEnable) {
|
||||
$buttons = reporting_enterprise_add_template_graph_tabs($buttons);
|
||||
}
|
||||
|
||||
$subsection = reporting_enterprise_add_graph_template_subsection('', $buttons);
|
||||
reporting_enterprise_select_graph_template_tab();
|
||||
|
||||
$buttons['graph_container'] = array('active' => true,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container">' .
|
||||
html_print_image("images/graph-container.png", true, array ("title" => __('Graph container'))) . '</a>');
|
||||
// Header
|
||||
ui_print_page_header (__('Graph container'), "", false, "",false,$buttons);
|
||||
|
||||
$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>";
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get_graphs_container (id_container,hash,time){
|
||||
$.ajax({
|
||||
async:false,
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {"page" : "include/ajax/graph.ajax",
|
||||
"get_graphs_container" : 1,
|
||||
"id_container" : id_container,
|
||||
"hash" : hash,
|
||||
"time" : time,
|
||||
},
|
||||
success: function(data) {
|
||||
$("#div_"+hash).remove();
|
||||
$("#tgl_div_"+hash).prepend("<div id='div_"+hash+"' style='width: 100%;padding-left: 63px; padding-top: 7px;'>"+data+"</div>");
|
||||
|
||||
if($('div[class *= graph]').length == 0 && $('div[class *= bullet]').length == 0 && $('div[id *= gauge_]').length == 0){
|
||||
$("#div_"+hash).remove();
|
||||
}
|
||||
|
||||
$('div[class *= bullet]').css('margin-left','0');
|
||||
$('div[class *= graph]').css('margin-left','0');
|
||||
$('div[id *= gauge_]').css('width','100%');
|
||||
|
||||
$('select[id *= period_container_'+hash+']').change(function() {
|
||||
var id = $(this).attr("id");
|
||||
if(!/unit/.test(id)){
|
||||
var time = $('select[id *= period_container_'+hash+']').val();
|
||||
get_graphs_container(id_container,hash,time);
|
||||
}
|
||||
});
|
||||
|
||||
$('input[id *= period_container_'+hash+']').keypress(function(e) {
|
||||
if(e.which == 13) {
|
||||
var time = $('input[id *= hidden-period_container_'+hash+']').val();
|
||||
get_graphs_container(id_container,hash,time);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$(document).ready (function () {
|
||||
$('a[id *= tgl]').click(function(e) {
|
||||
var id = e.currentTarget.id;
|
||||
hash = id.replace("tgl_ctrl_","");
|
||||
var down = document.getElementById("image_"+hash).src;
|
||||
if (down.search("down") !== -1){
|
||||
var max_graph = "<?php echo $max_graph;?>";
|
||||
var id_container = $("#hidden-"+hash).val();
|
||||
get_graphs_container(id_container,hash,'0');
|
||||
} else {
|
||||
$("#div_"+hash).remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -65,7 +65,10 @@ switch ($activeTab) {
|
|||
reporting_enterprise_select_graph_template_tab($activeTab);
|
||||
break;
|
||||
}
|
||||
|
||||
$buttons['graph_container'] = array('active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container">' .
|
||||
html_print_image("images/graph-container.png", true, array ("title" => __('Graphs containers'))) .'</a>');
|
||||
|
||||
$delete_graph = (bool) get_parameter ('delete_graph');
|
||||
$view_graph = (bool) get_parameter ('view_graph');
|
||||
$id = (int) get_parameter ('id');
|
||||
|
|
|
@ -340,24 +340,28 @@ switch ($action) {
|
|||
$sql = $item['external_source'];
|
||||
$idCustom = $item['treport_custom_sql_id'];
|
||||
$header = $item['header_definition'];
|
||||
$historical_db = $item['historical_db'];
|
||||
$period = 0;
|
||||
break;
|
||||
case 'sql_graph_pie':
|
||||
$description = $item['description'];
|
||||
$sql = $item['external_source'];
|
||||
$idCustom = $item['treport_custom_sql_id'];
|
||||
$historical_db = $item['historical_db'];
|
||||
$period = 0;
|
||||
break;
|
||||
case 'sql_graph_vbar':
|
||||
$description = $item['description'];
|
||||
$sql = $item['external_source'];
|
||||
$idCustom = $item['treport_custom_sql_id'];
|
||||
$historical_db = $item['historical_db'];
|
||||
$period = 0;
|
||||
break;
|
||||
case 'sql_graph_hbar':
|
||||
$description = $item['description'];
|
||||
$sql = $item['external_source'];
|
||||
$idCustom = $item['treport_custom_sql_id'];
|
||||
$historical_db = $item['historical_db'];
|
||||
$period = 0;
|
||||
break;
|
||||
case 'url':
|
||||
|
@ -658,7 +662,6 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_netflow_filter" style="" class="datos">
|
||||
<td style="font-weight:bold;"><?php echo __('Filter');?></td>
|
||||
<td>
|
||||
|
@ -1463,10 +1466,19 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_historical_db_check" style="" class="datos">
|
||||
<td style="font-weight:bold;">
|
||||
<?php echo __('Query History Database'); ?>
|
||||
</td>
|
||||
<td style="">
|
||||
<?php
|
||||
html_print_checkbox('historical_db_check',1,$historical_db);?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_show_in_two_columns" style="" class="datos">
|
||||
<td style="font-weight:bold;"><?php echo __('Show in two columns');?></td>
|
||||
<td><?php html_print_checkbox('show_in_two_columns', 1, $show_in_two_columns, false,
|
||||
false, 'if ($(\'input[name=show_in_two_columns]\').is(\':checked\')) $(\'input[name=show_in_landscape]\').attr(\'checked\', false);');?></td>
|
||||
<td><?php html_print_checkbox('show_in_two_columns', 1, $show_in_two_columns);?></td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_sort" style="" class="datos">
|
||||
|
@ -2579,6 +2591,7 @@ function chooseType() {
|
|||
$("#row_exception_condition_value").hide();
|
||||
$("#row_exception_condition").hide();
|
||||
$("#row_show_in_two_columns").hide();
|
||||
$("#row_historical_db_check").hide();
|
||||
$("#row_show_in_landscape").hide();
|
||||
$('#row_hide_notinit_agents').hide();
|
||||
$("#row_module_group").hide();
|
||||
|
@ -2637,6 +2650,7 @@ function chooseType() {
|
|||
$("#row_event_graph_by_validated").show();
|
||||
|
||||
$("#row_filter_search").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'event_report_log':
|
||||
|
@ -2645,6 +2659,7 @@ function chooseType() {
|
|||
$("#row_period").show();
|
||||
$("#agents_row").show();
|
||||
$("#row_source").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'simple_graph':
|
||||
|
@ -2662,6 +2677,7 @@ function chooseType() {
|
|||
$("#row_show_in_two_columns").show();
|
||||
$("#row_show_in_landscape").show();
|
||||
$("#row_time_compare_overlapped").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'projection_graph':
|
||||
|
@ -2672,6 +2688,7 @@ function chooseType() {
|
|||
$("#row_estimate").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_show_in_landscape").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'prediction_date':
|
||||
|
@ -2681,6 +2698,7 @@ function chooseType() {
|
|||
$("#row_module").show();
|
||||
$("#row_interval").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'custom_graph':
|
||||
|
@ -2690,6 +2708,7 @@ function chooseType() {
|
|||
$("#row_custom_graph").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_show_in_landscape").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'SLA':
|
||||
|
@ -2701,6 +2720,7 @@ function chooseType() {
|
|||
$("#row_show_graph").show();
|
||||
$("#row_sort").show();
|
||||
$('#row_hide_notinit_agents').show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'availability_graph':
|
||||
|
@ -2708,6 +2728,7 @@ function chooseType() {
|
|||
$("#row_period").show();
|
||||
$("#sla_list").show();
|
||||
$("#row_working_time").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'module_histogram_graph':
|
||||
|
@ -2715,6 +2736,7 @@ function chooseType() {
|
|||
$("#row_period").show();
|
||||
$("#row_agent").show();
|
||||
$("#row_module").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'SLA_monthly':
|
||||
|
@ -2724,6 +2746,7 @@ function chooseType() {
|
|||
$("#sla_list").show();
|
||||
$("#row_working_time").show();
|
||||
$("#row_sort").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'SLA_services':
|
||||
|
@ -2740,6 +2763,7 @@ function chooseType() {
|
|||
$(".sla_list_sla_max_col").hide();
|
||||
$(".sla_list_sla_limit_col").hide();
|
||||
$("#sla_list").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'monitor_report':
|
||||
|
@ -2748,6 +2772,7 @@ function chooseType() {
|
|||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'avg_value':
|
||||
|
@ -2756,6 +2781,7 @@ function chooseType() {
|
|||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'max_value':
|
||||
|
@ -2764,6 +2790,7 @@ function chooseType() {
|
|||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'min_value':
|
||||
|
@ -2772,6 +2799,7 @@ function chooseType() {
|
|||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'sumatory':
|
||||
|
@ -2780,6 +2808,7 @@ function chooseType() {
|
|||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'historical_data':
|
||||
|
@ -2788,6 +2817,7 @@ function chooseType() {
|
|||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'agent_detailed':
|
||||
|
@ -2795,12 +2825,14 @@ function chooseType() {
|
|||
$("#row_agent").show();
|
||||
$("#row_period").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'text':
|
||||
$("#row_description").show();
|
||||
$("#row_text").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'sql':
|
||||
|
@ -2811,6 +2843,7 @@ function chooseType() {
|
|||
$("#row_custom_example").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").show();
|
||||
break;
|
||||
|
||||
case 'sql_graph_pie':
|
||||
|
@ -2819,6 +2852,8 @@ function chooseType() {
|
|||
$("#row_show_in_two_columns").show();
|
||||
$("#row_show_in_landscape").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").show();
|
||||
|
||||
break;
|
||||
|
||||
case 'sql_graph_hbar':
|
||||
|
@ -2827,6 +2862,7 @@ function chooseType() {
|
|||
$("#row_show_in_two_columns").show();
|
||||
$("#row_show_in_landscape").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").show();
|
||||
break;
|
||||
|
||||
case 'sql_graph_vbar':
|
||||
|
@ -2835,11 +2871,13 @@ function chooseType() {
|
|||
$("#row_show_in_two_columns").show();
|
||||
$("#row_show_in_landscape").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").show();
|
||||
break;
|
||||
|
||||
case 'url':
|
||||
$("#row_description").show();
|
||||
$("#row_url").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'database_serialized':
|
||||
|
@ -2851,6 +2889,7 @@ function chooseType() {
|
|||
$("#row_line_separator").show();
|
||||
$("#row_period").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
|
@ -2859,6 +2898,7 @@ function chooseType() {
|
|||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
|
@ -2867,6 +2907,7 @@ function chooseType() {
|
|||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
|
@ -2875,6 +2916,7 @@ function chooseType() {
|
|||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
|
@ -2883,6 +2925,7 @@ function chooseType() {
|
|||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'alert_report_module':
|
||||
|
@ -2891,6 +2934,7 @@ function chooseType() {
|
|||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'alert_report_group':
|
||||
|
@ -2899,6 +2943,7 @@ function chooseType() {
|
|||
$("#row_show_in_two_columns").show();
|
||||
$("#row_group").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'alert_report_agent':
|
||||
|
@ -2906,6 +2951,7 @@ function chooseType() {
|
|||
$("#row_agent").show();
|
||||
$("#row_period").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'event_report_group':
|
||||
|
@ -2924,6 +2970,7 @@ function chooseType() {
|
|||
$("#row_event_type").show();
|
||||
|
||||
$("#row_filter_search").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
|
||||
|
@ -2946,6 +2993,7 @@ function chooseType() {
|
|||
$('#agent_autocomplete').hide();
|
||||
$('#agent_autocomplete_events').show();
|
||||
$("#row_filter_search").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'event_report_module':
|
||||
|
@ -2966,6 +3014,7 @@ function chooseType() {
|
|||
$('#agent_autocomplete').hide();
|
||||
$('#agent_autocomplete_events').show();
|
||||
$("#row_filter_search").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'general':
|
||||
|
@ -2984,6 +3033,7 @@ function chooseType() {
|
|||
$("#row_period").hide();
|
||||
$("input[name='last_value']").prop("checked", true);
|
||||
}
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'availability':
|
||||
|
@ -2996,18 +3046,21 @@ function chooseType() {
|
|||
$("#row_show_resume").show();
|
||||
$("#row_working_time").show();
|
||||
$('#row_hide_notinit_agents').show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'group_report':
|
||||
$("#row_group").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_description").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'network_interfaces_report':
|
||||
$("#row_group").show();
|
||||
$("#row_description").show();
|
||||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'top_n':
|
||||
|
@ -3020,6 +3073,7 @@ function chooseType() {
|
|||
$("#row_show_resume").show();
|
||||
$("#row_show_graph").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'exception':
|
||||
|
@ -3040,6 +3094,7 @@ function chooseType() {
|
|||
$("#row_period").hide();
|
||||
$("input[name='last_value']").prop("checked", true);
|
||||
}
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'agent_module':
|
||||
|
@ -3049,6 +3104,7 @@ function chooseType() {
|
|||
$("#select_agent_modules").show();
|
||||
$("#agents_row").show();
|
||||
$("#modules_row").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'inventory_changes':
|
||||
|
@ -3065,6 +3121,7 @@ function chooseType() {
|
|||
$("#combo_group").change(function() {
|
||||
updateAgents($(this).val(), <?php echo '"' . ui_get_full_url(false, false, false, false) . '"'; ?>);
|
||||
});
|
||||
$("#row_historical_db_check").hide();
|
||||
|
||||
break;
|
||||
|
||||
|
@ -3099,18 +3156,22 @@ function chooseType() {
|
|||
|
||||
if (!$("#hidden-date_selected").val())
|
||||
updateInventoryDates(<?php echo '"' . ui_get_full_url(false, false, false, false) . '"'; ?>);
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'inventory_changes':
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'agent_configuration':
|
||||
$("#row_agent").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'group_configuration':
|
||||
$("#row_group").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'netflow_area':
|
||||
|
@ -3120,6 +3181,7 @@ function chooseType() {
|
|||
$("#row_max_values").show();
|
||||
$("#row_resolution").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'netflow_pie':
|
||||
|
@ -3129,6 +3191,7 @@ function chooseType() {
|
|||
$("#row_max_values").show();
|
||||
$("#row_resolution").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'netflow_data':
|
||||
|
@ -3138,6 +3201,7 @@ function chooseType() {
|
|||
$("#row_max_values").show();
|
||||
$("#row_resolution").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'netflow_summary':
|
||||
|
@ -3146,6 +3210,7 @@ function chooseType() {
|
|||
$("#row_period").show();
|
||||
$("#row_resolution").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'netflow_statistics':
|
||||
|
@ -3155,6 +3220,7 @@ function chooseType() {
|
|||
$("#row_max_values").show();
|
||||
$("#row_resolution").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
}
|
||||
switch (type) {
|
||||
|
|
|
@ -1124,6 +1124,7 @@ switch ($action) {
|
|||
$values['treport_custom_sql_id'] = get_parameter('id_custom');
|
||||
if ($values['treport_custom_sql_id'] == 0) {
|
||||
$values['external_source'] = get_parameter('sql');
|
||||
$values['historical_db'] = get_parameter('historical_db_check');
|
||||
}
|
||||
}
|
||||
else if ($values['type'] == 'url') {
|
||||
|
@ -1444,6 +1445,7 @@ switch ($action) {
|
|||
$values['treport_custom_sql_id'] = get_parameter('id_custom');
|
||||
if ($values['treport_custom_sql_id'] == 0) {
|
||||
$values['external_source'] = get_parameter('sql');
|
||||
$values['historical_db'] = get_parameter('historical_db_check');
|
||||
}
|
||||
}
|
||||
elseif ($values['type'] == 'url') {
|
||||
|
|
|
@ -1497,13 +1497,11 @@ function set_static_graph_status(idElement, image, status) {
|
|||
set_static_graph_status(idElement, image, data);
|
||||
|
||||
if($('#'+idElement+' table').css('float') == 'right' || $('#'+idElement+ ' table').css('float') == 'left'){
|
||||
$('#'+idElement+ ' img').css('margin-top', parseInt($('#'+idElement).css('height'))/2 - parseInt($('#'+idElement+ ' img').css('height'))/2);
|
||||
$('#'+idElement+ ' img').css('margin-top', parseInt($('#'+idElement).css('height'))/2 - parseInt($('#'+idElement+ ' img').css('height'))/2);
|
||||
}
|
||||
else{
|
||||
$('#'+idElement+ ' img').css('margin-left',parseInt($('#'+idElement).css('width'))/2 - parseInt($('#'+idElement+ ' img').css('width'))/2);
|
||||
$('#'+idElement+ ' img').css('margin-left', parseInt($('#'+idElement).css('width'))/2 - parseInt($('#'+idElement+ ' img').css('width'))/2);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1849,11 +1847,9 @@ function get_image_url(img_src) {
|
|||
});
|
||||
}
|
||||
|
||||
function set_color_line_status(lines, line, id_data, values) {
|
||||
function set_color_line_status(lines, id_data, values) {
|
||||
metaconsole = $("input[name='metaconsole']").val();
|
||||
|
||||
|
||||
|
||||
var parameter = Array();
|
||||
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
|
||||
parameter.push ({name: "action", value: "get_color_line"});
|
||||
|
@ -1875,7 +1871,6 @@ function set_color_line_status(lines, line, id_data, values) {
|
|||
"node_end": id_data,
|
||||
"color": color };
|
||||
|
||||
|
||||
lines.push(line);
|
||||
|
||||
refresh_lines(lines, 'background', true);
|
||||
|
@ -2250,7 +2245,7 @@ function createItem(type, values, id_data) {
|
|||
|
||||
lines.push(line);
|
||||
|
||||
set_color_line_status(lines, line, id_data, values);
|
||||
set_color_line_status(lines, id_data, values);
|
||||
|
||||
refresh_lines(lines, 'background', true);
|
||||
}
|
||||
|
@ -2446,7 +2441,7 @@ function updateDB_visual(type, idElement , values, event, top, left) {
|
|||
|
||||
if (typeof(values['parent']) != 'undefined' && values['parent'] > 0 ) {
|
||||
if (!found) {
|
||||
set_color_line_status(lines, line, idElement, values);
|
||||
set_color_line_status(lines, idElement, values);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2465,6 +2460,7 @@ function updateDB_visual(type, idElement , values, event, top, left) {
|
|||
refresh_lines(lines, 'background', true);
|
||||
break;
|
||||
}
|
||||
|
||||
refresh_lines(lines, 'background', true);
|
||||
draw_user_lines("", 0, 0, 0 , 0, 0, true);
|
||||
}
|
||||
|
@ -2601,9 +2597,19 @@ function updateDB(type, idElement , values, event) {
|
|||
url: get_url_ajax(),
|
||||
data: parameter,
|
||||
type: "POST",
|
||||
dataType: 'text',
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
updateDB_visual(type, idElement , values, event, top, left);
|
||||
if (data['correct']) {
|
||||
if (data['new_line']) {
|
||||
var line = {"id": idElement,
|
||||
"node_begin": values['parent'],
|
||||
"node_end": idElement,
|
||||
"color": '#cccccc' };
|
||||
|
||||
lines.push(line);
|
||||
}
|
||||
updateDB_visual(type, idElement , values, event, top, left);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -3175,7 +3181,6 @@ function unselectAll() {
|
|||
}
|
||||
|
||||
function click_button_toolbox(id) {
|
||||
unselectAll();
|
||||
switch (id) {
|
||||
case 'static_graph':
|
||||
toolbuttonActive = creationItem = 'static_graph';
|
||||
|
|
|
@ -141,6 +141,14 @@ foreach ($servers as $server) {
|
|||
//Only Pandora Administrator can delete servers
|
||||
if (check_acl ($config["id_user"], 0, "PM")) {
|
||||
$data[8] = '';
|
||||
|
||||
if ($server['type'] == 'recon') {
|
||||
$data[8] .= '<a href="index.php?sec=gservers&sec2=operation/servers/recon_view">';
|
||||
$data[8] .= html_print_image ('images/firts_task/icono_grande_reconserver.png', true,
|
||||
array('title' => __('Manage recon tasks'),'style' => 'width:21px;height:21px;'));
|
||||
$data[8] .= '</a> ';
|
||||
}
|
||||
|
||||
if ($server['type'] == 'data') {
|
||||
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_counts='.$server["id_server"].'">';
|
||||
$data[8] .= html_print_image ('images/target.png', true,
|
||||
|
|
|
@ -138,6 +138,9 @@ $table_other->data[10][1] = html_print_input_text ('big_operation_step_datos_pur
|
|||
$table_other->data[11][0] = __('Small Operation Step to purge old data') . ui_print_help_tip(__('The number of rows that are processed in a single query in deletion. Default is 1000. Increase to 3000-5000 in fast systems. Decrease to 500 or 250 on systems with locks.'), true);
|
||||
$table_other->data[11][1] = html_print_input_text ('small_operation_step_datos_purge', $config["small_operation_step_datos_purge"], '', 5, 5, true);
|
||||
|
||||
$table_other->data[12][0] = __('Graph container - Max. Items') . ui_print_help_tip(__('The number of graphs that are viewed in a container. Default is 10 .Increasing this number could lead to performance problems'), true);
|
||||
$table_other->data[12][1] = html_print_input_text ('max_graph_container', $config["max_graph_container"], '', 5, 5, true);
|
||||
|
||||
echo '<form id="form_setup" method="post">';
|
||||
echo "<fieldset>";
|
||||
echo "<legend>" . __('Database maintenance options') . "</legend>";
|
||||
|
|
|
@ -109,7 +109,6 @@ if (is_ajax ()) {
|
|||
break;
|
||||
|
||||
case 'pandora':
|
||||
case 'babel':
|
||||
case 'ad':
|
||||
case 'saml':
|
||||
case 'integria':
|
||||
|
|
|
@ -756,6 +756,26 @@ $table_other->data[$row][1] .= html_print_input_hidden ('interval_to_delete', ''
|
|||
//----------------------------------------------------------------------
|
||||
$row++;
|
||||
|
||||
$common_dividers = array(
|
||||
";" => ";",
|
||||
"," => ",",
|
||||
"|" => "|");
|
||||
$table_other->data[$row][0] = __('CSV divider');
|
||||
if ($config['csv_divider'] != ";" && $config['csv_divider'] != "," && $config['csv_divider'] != "|") {
|
||||
$table_other->data[$row][1] = html_print_input_text ('csv_divider', $config['csv_divider'], "", 20, 255, true);
|
||||
$table_other->data[$row][1] .= '<a id="csv_divider_custom" onclick="javascript: edit_csv_divider();">' .
|
||||
html_print_image('images/default_list.png', true, array('id' => 'select')) .
|
||||
"</a>";
|
||||
}
|
||||
else {
|
||||
$table_other->data[$row][1] = html_print_select ($common_dividers, 'csv_divider', $config['csv_divider'], "", '', '', true, false, false);
|
||||
$table_other->data[$row][1] .= '<a id="csv_divider_custom" onclick="javascript: edit_csv_divider();">' .
|
||||
html_print_image('images/pencil.png', true, array('id' => 'pencil')) .
|
||||
"</a>";
|
||||
}
|
||||
$row++;
|
||||
|
||||
|
||||
echo "<fieldset>";
|
||||
echo "<legend>" . __('Other configuration') . "</legend>";
|
||||
html_print_table ($table_other);
|
||||
|
@ -792,6 +812,27 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
|
|||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
||||
function edit_csv_divider () {
|
||||
if ($("#csv_divider_custom img").attr("id") == "pencil") {
|
||||
$("#csv_divider_custom img").attr("src", "images/default_list.png");
|
||||
$("#csv_divider_custom img").attr("id", "select");
|
||||
var value = $("#csv_divider").val();
|
||||
$("#csv_divider").replaceWith("<input id='text-csv_divider' name='csv_divider' type='text'>");
|
||||
$("#text-csv_divider").val(value);
|
||||
}
|
||||
else {
|
||||
$("#csv_divider_custom img").attr("src", "images/pencil.png");
|
||||
$("#csv_divider_custom img").attr("id", "pencil");
|
||||
$("#text-csv_divider").replaceWith("<select id='csv_divider' name='csv_divider'>");
|
||||
var o = new Option(";", ";");
|
||||
var o1 = new Option(",", ",");
|
||||
var o2 = new Option("|", "|");
|
||||
$("#csv_divider").append(o);
|
||||
$("#csv_divider").append(o1);
|
||||
$("#csv_divider").append(o2);
|
||||
}
|
||||
}
|
||||
|
||||
// Juanma (07/05/2014) New feature: Custom front page for reports
|
||||
function display_custom_report_front (show,table) {
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ $baseurl = ui_get_full_url(false, false, false, false);
|
|||
var click_on_the_file_below_to_begin = "<?php echo __('Click on the file below to begin.'); ?>\n";
|
||||
var updating = "<?php echo __('Updating'); ?>\n";
|
||||
var package_updated_successfully = "<?php echo __('Package updated successfully.'); ?>\n";
|
||||
var if_there_are_any_database_change = "<?php echo __('If there are any database change, it will be applied on the next login.'); ?>\n";
|
||||
var if_there_are_any_database_change = "<?php echo __('If there are any database change, it will be applied.'); ?>\n";
|
||||
var mr_available = "<?php echo __('Minor release available'); ?>\n";
|
||||
var package_available = "<?php echo __('New package available'); ?>\n";
|
||||
var mr_not_accepted = "<?php echo __('Minor release rejected. Changes will not apply.'); ?>\n";
|
||||
|
@ -62,6 +62,10 @@ $baseurl = ui_get_full_url(false, false, false, false);
|
|||
var text1_package_file = "<?php echo __('There is a new update available'); ?>\n";
|
||||
var text2_package_file = "<?php echo __('There is a new update available to apply. Do you want to start the update process?'); ?>\n";
|
||||
var applying_mr = "<?php echo __('Applying DB MR'); ?>\n";
|
||||
var cancel_button = "<?php echo __('Cancel'); ?>\n";
|
||||
var ok_button = "<?php echo __('Ok'); ?>\n";
|
||||
var apply_mr_button = "<?php echo __('Apply MR'); ?>\n";
|
||||
var apply_button = "<?php echo __('Apply'); ?>\n";
|
||||
</script>
|
||||
|
||||
<form id="form-offline_update" method="post" enctype="multipart/form-data" class="fileupload_form">
|
||||
|
@ -77,4 +81,4 @@ $baseurl = ui_get_full_url(false, false, false, false);
|
|||
|
||||
<script type="text/javascript">
|
||||
form_upload("<?php echo $baseurl; ?>");
|
||||
</script>
|
||||
</script>
|
|
@ -147,7 +147,7 @@ var open = "<?php echo $open;?>";
|
|||
if(open){
|
||||
$(document).ready(function() {
|
||||
$('body').append( "<div id='opacidad' style='position:fixed;background:black;opacity:0.6;z-index:1'></div>" );
|
||||
jQuery.get ("ajax.php",
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page": "general/alert_enterprise",
|
||||
"message":"infomodal"},
|
||||
|
|
|
@ -36,7 +36,7 @@ $buttons = array(
|
|||
'offline' => array(
|
||||
'active' => ($tab == 'offline') ? true : false,
|
||||
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=offline">' .
|
||||
html_print_image ("images/box.disabled.png", true, array ("title" => __('Offline update manager'))) .'</a>'),
|
||||
html_print_image ("images/box.png", true, array ("title" => __('Offline update manager'))) .'</a>'),
|
||||
'online' => array(
|
||||
'active' => ($tab == 'online') ? true : false,
|
||||
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online">' .
|
||||
|
|
|
@ -23,6 +23,7 @@ enterprise_hook('open_meta_frame');
|
|||
include_once($config['homedir'] . "/include/functions_profile.php");
|
||||
include_once($config['homedir'] . '/include/functions_users.php');
|
||||
include_once ($config['homedir'] . '/include/functions_groups.php');
|
||||
include_once ($config['homedir'] . '/include/functions_visual_map.php');
|
||||
|
||||
$meta = false;
|
||||
if(enterprise_installed() && defined("METACONSOLE")) {
|
||||
|
@ -30,6 +31,7 @@ if(enterprise_installed() && defined("METACONSOLE")) {
|
|||
}
|
||||
|
||||
$isFunctionSkins = enterprise_include_once ('include/functions_skins.php');
|
||||
enterprise_include_once ('include/functions_dashboard.php');
|
||||
|
||||
//Add the columns for the enterprise Pandora edition.
|
||||
$enterprise_include = false;
|
||||
|
@ -129,6 +131,9 @@ if ($new_user && $config['admin_can_add_user']) {
|
|||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||
$user_info['id_skin'] = '';
|
||||
}
|
||||
|
||||
$user_info['section'] = '';
|
||||
$user_info['data_section'] = '';
|
||||
//This attributes are inherited from global configuration
|
||||
$user_info['block_size'] = $config["block_size"];
|
||||
$user_info['flash_chart'] = $config["flash_charts"];
|
||||
|
@ -158,12 +163,27 @@ if ($create_user) {
|
|||
$values['comments'] = (string) get_parameter ('comments');
|
||||
$values['is_admin'] = (int) get_parameter ('is_admin', 0);
|
||||
$values['language'] = get_parameter ('language', 'default');
|
||||
$values['default_event_filter'] = (int) get_parameter('default_event_filter');
|
||||
$dashboard = get_parameter('dashboard', '');
|
||||
$visual_console = get_parameter('visual_console', '');
|
||||
|
||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||
$values['id_skin'] = (int) get_parameter ('skin', 0);
|
||||
}
|
||||
$values['block_size'] = (int) get_parameter ('block_size', $config["block_size"]);
|
||||
$values['flash_chart'] = (int) get_parameter ('flash_charts', $config["flash_charts"]);
|
||||
|
||||
$values['section'] = get_parameter ('section');
|
||||
if (($values['section'] == 'Event list') || ($values['section'] == 'Group view') || ($values['section'] == 'Alert detail') || ($values['section'] == 'Tactical view') || ($values['section'] == 'Default')) {
|
||||
$values["data_section"] = '';
|
||||
} else if ($values['section'] == 'Dashboard') {
|
||||
$values["data_section"] = $dashboard;
|
||||
} else if (io_safe_output($values['section']) == 'Visual console') {
|
||||
$values["data_section"] = $visual_console;
|
||||
} else if ($values['section'] == 'Other'){
|
||||
$values["data_section"] = get_parameter ('data_section');
|
||||
}
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$values['force_change_pass'] = 1;
|
||||
$values['last_pass_change'] = date ("Y/m/d H:i:s", get_system_time());
|
||||
|
@ -266,12 +286,28 @@ if ($update_user) {
|
|||
$values['comments'] = (string) get_parameter ('comments');
|
||||
$values['is_admin'] = get_parameter ('is_admin', 0 );
|
||||
$values['language'] = (string) get_parameter ('language');
|
||||
$values['default_event_filter'] = (int) get_parameter('default_event_filter');
|
||||
$dashboard = get_parameter('dashboard', '');
|
||||
$visual_console = get_parameter('visual_console', '');
|
||||
|
||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||
$values['id_skin'] = get_parameter ('skin', 0);
|
||||
}
|
||||
$values['block_size'] = get_parameter ('block_size', $config["block_size"]);
|
||||
$values['flash_chart'] = get_parameter ('flash_charts', $config["flash_charts"]);
|
||||
|
||||
|
||||
$values['section'] = get_parameter ('section');
|
||||
if (($values['section'] == 'Event list') || ($values['section'] == 'Group view') || ($values['section'] == 'Alert detail') || ($values['section'] == 'Tactical view') || ($values['section'] == 'Default')) {
|
||||
$values["data_section"] = '';
|
||||
} else if ($values['section'] == 'Dashboard') {
|
||||
$values["data_section"] = $dashboard;
|
||||
} else if (io_safe_output($values['section']) == 'Visual console') {
|
||||
$values["data_section"] = $visual_console;
|
||||
} else if ($values['section'] == 'Other'){
|
||||
$values["data_section"] = get_parameter ('data_section');
|
||||
}
|
||||
|
||||
if(enterprise_installed() && defined('METACONSOLE')) {
|
||||
$values['metaconsole_access'] = get_parameter ('metaconsole_access');
|
||||
$values['metaconsole_agents_manager'] = get_parameter ('metaconsole_agents_manager', '0');
|
||||
|
@ -282,6 +318,7 @@ if ($update_user) {
|
|||
$values["strict_acl"] = (bool)get_parameter ('strict_acl', false);
|
||||
$values["session_time"] = (int)get_parameter('session_time', 0);
|
||||
|
||||
|
||||
$res1 = update_user ($id, $values);
|
||||
|
||||
if ($config['user_can_update_password']) {
|
||||
|
@ -324,7 +361,8 @@ if ($update_user) {
|
|||
' Phone: ' . $values['phone'] . ' Comments: ' . $values['comments'] .
|
||||
' Is_admin: ' . $values['is_admin'] .
|
||||
' Language: ' . $values['language'] .
|
||||
' Block size: ' . $values['block_size'] . ' Flash Chats: ' . $values['flash_chart'];
|
||||
' Block size: ' . $values['block_size'] . ' Flash Chats: ' . $values['flash_chart'] .
|
||||
' Section: ' . $values['section'];
|
||||
|
||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||
$info .= ' Skin: ' . $values['id_skin'];
|
||||
|
@ -512,15 +550,59 @@ if (!$meta) {
|
|||
}
|
||||
}
|
||||
|
||||
$table->data[11][0] = __('Interactive charts'). ' ' .ui_print_help_tip(__('Whether to use Javascript or static PNG graphs'), true) ;
|
||||
$table->data[11][0] = __('Interactive charts').' '.ui_print_help_tip(__('Whether to use Javascript or static PNG graphs'), true) ;
|
||||
$values = array(-1 => __('Use global conf'), 1 => __('Yes'), 0 => __('No'));
|
||||
$table->data[11][1] = html_print_select($values, 'flash_charts',
|
||||
$user_info["flash_chart"], '', '', -1, true, false, false);
|
||||
$table->data[12][0] = __('Block size for pagination');
|
||||
$table->data[12][1] = html_print_input_text ('block_size', $user_info["block_size"], '', 5, 5, true);
|
||||
|
||||
$table->data[12][0] = __('Home screen').
|
||||
ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type sec=estado&sec2=operation/agentes/estado_agente to show agent detail view'), true);
|
||||
$values = array (
|
||||
'Default' =>__('Default'),
|
||||
'Visual console'=>__('Visual console'),
|
||||
'Event list'=>__('Event list'),
|
||||
'Group view'=>__('Group view'),
|
||||
'Tactical view'=>__('Tactical view'),
|
||||
'Alert detail' => __('Alert detail'),
|
||||
'Other'=>__('Other'));
|
||||
if (enterprise_installed()) {
|
||||
$values['Dashboard'] = __('Dashboard');
|
||||
}
|
||||
$table->data[12][1] = html_print_select($values, 'section', io_safe_output($user_info["section"]), 'show_data_section();', '', -1, true, false, false);
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$dashboards = dashboard_get_dashboards();
|
||||
$dashboards_aux = array();
|
||||
if ($dashboards === false) {
|
||||
$dashboards = array('None'=>'None');
|
||||
}
|
||||
else {
|
||||
foreach ($dashboards as $key => $dashboard) {
|
||||
$dashboards_aux[$dashboard['name']] = $dashboard['name'];
|
||||
}
|
||||
}
|
||||
$table->data[12][1] .= html_print_select ($dashboards_aux, 'dashboard', $user_info["data_section"], '', '', '', true);
|
||||
}
|
||||
|
||||
$layouts = visual_map_get_user_layouts ($config['id_user'], true);
|
||||
$layouts_aux = array();
|
||||
if ($layouts === false) {
|
||||
$layouts_aux = array('None'=>'None');
|
||||
}
|
||||
else {
|
||||
foreach ($layouts as $layout) {
|
||||
$layouts_aux[$layout] = $layout;
|
||||
}
|
||||
}
|
||||
|
||||
$table->data[12][1] .= html_print_select ($layouts_aux, 'visual_console', $user_info["data_section"], '', '', '', true);
|
||||
$table->data[12][1] .= html_print_input_text ('data_section', $user_info["data_section"], '', 60, 255, true, false);
|
||||
|
||||
$table->data[13][0] = __('Block size for pagination');
|
||||
$table->data[13][1] = html_print_input_text ('block_size', $user_info["block_size"], '', 5, 5, true);
|
||||
|
||||
if ($id == $config['id_user']) {
|
||||
$table->data[12][1] .= html_print_input_hidden('quick_language_change', 1, true);
|
||||
$table->data[13][1] .= html_print_input_hidden('quick_language_change', 1, true);
|
||||
}
|
||||
|
||||
if (enterprise_installed() && defined('METACONSOLE')) {
|
||||
|
@ -528,28 +610,34 @@ if (enterprise_installed() && defined('METACONSOLE')) {
|
|||
if (isset($user_info["metaconsole_access"])) {
|
||||
$user_info_metaconsole_access = $user_info["metaconsole_access"];
|
||||
}
|
||||
$table->data[12][0] = __('Metaconsole access'). ' ' .ui_print_help_icon ('meta_access', true);
|
||||
$table->data[13][0] = __('Metaconsole access'). ' ' .ui_print_help_icon ('meta_access', true);
|
||||
$metaconsole_accesses = array('basic' => __('Basic'),
|
||||
'advanced' => __('Advanced'));
|
||||
$table->data[12][1] = html_print_select($metaconsole_accesses,
|
||||
$table->data[13][1] = html_print_select($metaconsole_accesses,
|
||||
'metaconsole_access', $user_info_metaconsole_access,
|
||||
'','',-1,true, false, false);
|
||||
}
|
||||
|
||||
$table->data[13][0] = __('Not Login');
|
||||
$table->data[13][0] .= ui_print_help_tip(__('The user with not login set only can access to API.'), true);
|
||||
$table->data[13][1] = html_print_checkbox('not_login', 1, $user_info["not_login"], true);
|
||||
|
||||
$table->data[14][0] = __('Strict ACL');
|
||||
$table->data[14][0] .= ui_print_help_tip(__('With this option enabled, the user will can access to accurate information. It is not recommended for admin users because performance could be affected'), true);
|
||||
$table->data[14][1] = html_print_checkbox('strict_acl', 1, $user_info["strict_acl"], true);
|
||||
$table->data[14][0] = __('Not Login');
|
||||
$table->data[14][0] .= ui_print_help_tip(__('The user with not login set only can access to API.'), true);
|
||||
$table->data[14][1] = html_print_checkbox('not_login', 1, $user_info["not_login"], true);
|
||||
|
||||
$table->data[15][0] = __('Session Time');
|
||||
$table->data[15][0] .= ui_print_help_tip(__('This is defined in minutes, If you wish a permanent session should putting -1 in this field.'), true);
|
||||
$table->data[15][1] = html_print_input_text ('session_time', $user_info["session_time"], '', 5, 5, true);
|
||||
|
||||
|
||||
$event_filter_data = db_get_all_rows_sql('SELECT id_name, id_filter FROM tevent_filter');
|
||||
$event_filter = array();
|
||||
$event_filter[0] = __('None');
|
||||
foreach ($event_filter_data as $filter) {
|
||||
$event_filter[$filter['id_filter']] = $filter['id_name'];
|
||||
}
|
||||
$table->data[16][0] = __('Default event filter');
|
||||
$table->data[16][1] = html_print_select ($event_filter, 'default_event_filter', $user_info["default_event_filter"], '','', __('None'), true, false, false);
|
||||
|
||||
if($meta) {
|
||||
enterprise_include('include/functions_metaconsole.php');
|
||||
enterprise_include_once ('include/functions_metaconsole.php');
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Enable agents managment');
|
||||
$data[1] = html_print_checkbox('metaconsole_agents_manager', 1, $user_info["metaconsole_agents_manager"], true);
|
||||
|
@ -738,6 +826,56 @@ $(document).ready (function () {
|
|||
|
||||
$('input:radio[name="is_admin"]').trigger('change');
|
||||
$('#checkbox-metaconsole_agents_manager').trigger('change');
|
||||
|
||||
show_data_section();
|
||||
});
|
||||
|
||||
function show_data_section () {
|
||||
section = $("#section").val();
|
||||
|
||||
switch (section) {
|
||||
case <?php echo "'" . 'Dashboard' . "'"; ?>:
|
||||
$("#text-data_section").css("display", "none");
|
||||
$("#dashboard").css("display", "");
|
||||
$("#visual_console").css("display", "none");
|
||||
break;
|
||||
case <?php echo "'" . 'Visual console' . "'"; ?>:
|
||||
$("#text-data_section").css("display", "none");
|
||||
$("#dashboard").css("display", "none");
|
||||
$("#visual_console").css("display", "");
|
||||
break;
|
||||
case <?php echo "'" . 'Event list' . "'"; ?>:
|
||||
$("#text-data_section").css("display", "none");
|
||||
$("#dashboard").css("display", "none");
|
||||
$("#visual_console").css("display", "none");
|
||||
break;
|
||||
case <?php echo "'" . 'Group view' . "'"; ?>:
|
||||
$("#text-data_section").css("display", "none");
|
||||
$("#dashboard").css("display", "none");
|
||||
$("#visual_console").css("display", "none");
|
||||
break;
|
||||
case <?php echo "'" . 'Tactical view' . "'"; ?>:
|
||||
$("#text-data_section").css("display", "none");
|
||||
$("#dashboard").css("display", "none");
|
||||
$("#visual_console").css("display", "none");
|
||||
break;
|
||||
case <?php echo "'" . 'Alert detail' . "'"; ?>:
|
||||
$("#text-data_section").css("display", "none");
|
||||
$("#dashboard").css("display", "none");
|
||||
$("#visual_console").css("display", "none");
|
||||
break;
|
||||
case <?php echo "'" . 'Other' . "'"; ?>:
|
||||
$("#text-data_section").css("display", "");
|
||||
$("#dashboard").css("display", "none");
|
||||
$("#visual_console").css("display", "none");
|
||||
break;
|
||||
case <?php echo "'" . 'Default' . "'"; ?>:
|
||||
$("#text-data_section").css("display", "none");
|
||||
$("#dashboard").css("display", "none");
|
||||
$("#visual_console").css("display", "none");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 429 B |
Binary file not shown.
After Width: | Height: | Size: 483 B |
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 235 B |
Binary file not shown.
After Width: | Height: | Size: 284 B |
|
@ -17,13 +17,6 @@ global $config;
|
|||
// Login check
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "LW")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Alert Management");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once ('include/functions_agents.php');
|
||||
require_once ('include/functions_alerts.php');
|
||||
$isFunctionPolicies = enterprise_include ('include/functions_policies.php');
|
||||
|
@ -48,6 +41,13 @@ if ($get_agent_alerts_simple) {
|
|||
echo json_encode (false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "LW")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Alert Management");
|
||||
echo json_encode (false);
|
||||
return;
|
||||
}
|
||||
|
||||
require_once ('include/functions_agents.php');
|
||||
require_once ('include/functions_alerts.php');
|
||||
|
@ -73,6 +73,12 @@ if ($get_agent_alerts_simple) {
|
|||
}
|
||||
|
||||
if ($enable_alert) {
|
||||
if (! check_acl ($config['id_user'], 0, "LW")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Alert Management");
|
||||
return false;
|
||||
}
|
||||
|
||||
$id_alert = (int) get_parameter ('id_alert');
|
||||
|
||||
$result = alerts_agent_module_disable ($id_alert, false);
|
||||
|
@ -84,6 +90,11 @@ if ($enable_alert) {
|
|||
}
|
||||
|
||||
if ($disable_alert) {
|
||||
if (! check_acl ($config['id_user'], 0, "LW")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Alert Management");
|
||||
return false;
|
||||
}
|
||||
$id_alert = (int) get_parameter ('id_alert');
|
||||
|
||||
$result = alerts_agent_module_disable ($id_alert, true);
|
||||
|
@ -95,6 +106,11 @@ if ($disable_alert) {
|
|||
}
|
||||
|
||||
if ($get_actions_module) {
|
||||
if (! check_acl ($config['id_user'], 0, "LW")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Alert Management");
|
||||
return false;
|
||||
}
|
||||
$id_module = get_parameter ('id_module');
|
||||
|
||||
if (empty($id_module))
|
||||
|
@ -107,6 +123,11 @@ if ($get_actions_module) {
|
|||
}
|
||||
|
||||
if ($show_update_action_menu) {
|
||||
if (! check_acl ($config['id_user'], 0, "LW")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Alert Management");
|
||||
return false;
|
||||
}
|
||||
$id_agent_module = (int) get_parameter ('id_agent_module');
|
||||
$id_module_action = (int) get_parameter ('id_module_action');
|
||||
$id_agent = (int) get_parameter ('id_agent');
|
||||
|
|
|
@ -302,7 +302,7 @@ if ($get_extended_event) {
|
|||
$tabs .= "<li><a href='#extended_event_comments_page' id='link_comments'>".html_print_image('images/pencil.png',true)."<span style='position:relative;top:-6px;left:5px;margin-right:10px;'>".__('Comments')."</span></a></li>";
|
||||
|
||||
if (!$readonly &&
|
||||
(tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'],$childrens_ids))) {
|
||||
((tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'],$childrens_ids)))) {
|
||||
$tabs .= "<li><a href='#extended_event_responses_page' id='link_responses'>".html_print_image('images/event_responses_col.png',true)."<span style='position:relative;top:-6px;left:3px;margin-right:10px;'>".__('Responses')."</span></a></li>";
|
||||
}
|
||||
if ($event['custom_data'] != '') {
|
||||
|
@ -335,9 +335,9 @@ if ($get_extended_event) {
|
|||
$img_sev = "images/status_sets/default/severity_major.png";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (!$readonly &&
|
||||
(tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'],$childrens_ids))) {
|
||||
((tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'],$childrens_ids)))) {
|
||||
$responses = events_page_responses($event, $childrens_ids);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -18,6 +18,7 @@ require_once('include/functions_graph.php');
|
|||
$save_custom_graph = (bool) get_parameter('save_custom_graph');
|
||||
$print_custom_graph = (bool) get_parameter('print_custom_graph');
|
||||
$print_sparse_graph = (bool) get_parameter('print_sparse_graph');
|
||||
$get_graphs = (bool)get_parameter('get_graphs_container');
|
||||
|
||||
if ($save_custom_graph) {
|
||||
$return = array();
|
||||
|
@ -111,4 +112,232 @@ if ($print_sparse_graph) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ($get_graphs){
|
||||
$id_container = get_parameter('id_container',0);
|
||||
//config token max_graph
|
||||
$max_graph = $config['max_graph_container'];
|
||||
$result_items = db_get_all_rows_sql("SELECT * FROM tcontainer_item WHERE id_container = " . $id_container);
|
||||
if (!empty($result_items)){
|
||||
$hash = get_parameter('hash',0);
|
||||
$period = get_parameter('time',0);
|
||||
|
||||
$periods = array ();
|
||||
$periods[1] = __('none');
|
||||
$periods[SECONDS_1HOUR] = __('1 hour');
|
||||
$periods[SECONDS_2HOUR] = sprintf(__('%s hours'), '2 ');
|
||||
$periods[SECONDS_6HOURS] = sprintf(__('%s hours'), '6 ');
|
||||
$periods[SECONDS_12HOURS] = sprintf(__('%s hours'), '12 ');
|
||||
$periods[SECONDS_1DAY] = __('1 day');
|
||||
$periods[SECONDS_2DAY] = sprintf(__('%s days'), '2 ');
|
||||
$periods[SECONDS_5DAY] = sprintf(__('%s days'), '5 ');
|
||||
$periods[SECONDS_1WEEK] = __('1 week');
|
||||
$periods[SECONDS_15DAYS] = __('15 days');
|
||||
$periods[SECONDS_1MONTH] = __('1 month');
|
||||
|
||||
$table = '';
|
||||
$single_table = "<table width='100%' cellpadding=4 cellspacing=4>";
|
||||
$single_table .= "<tr id='row_time_lapse' style='' class='datos'>";
|
||||
$single_table .= "<td style='font-weight:bold;width: 12%;'>";
|
||||
$single_table .= __('Time container lapse');
|
||||
// $single_table .= ui_print_help_tip(__('This is the range, or period of time over which the report renders the information for this report type. For example, a week means data from a week ago from now. '),true);
|
||||
$single_table .= "</td>";
|
||||
$single_table .= "<td>";
|
||||
$single_table .= html_print_extended_select_for_time('period_container_'.$hash, $period,
|
||||
'', '', '0', 10, true,'font-size: 9pt;width: 130px;',true,'',false,$periods,'vertical-align: middle;');
|
||||
$single_table .= "</td>";
|
||||
$single_table .= "</tr>";
|
||||
$single_table .= "</table>";
|
||||
|
||||
$table .= $single_table;
|
||||
$contador = $config['max_graph_container'];
|
||||
foreach ($result_items as $key => $value) {
|
||||
$table .= "</br>";
|
||||
if($period > 1){
|
||||
$value['time_lapse'] = $period;
|
||||
}
|
||||
switch ($value['type']) {
|
||||
case 'simple_graph':
|
||||
if ($contador > 0) {
|
||||
$sql_modulo = db_get_all_rows_sql("SELECT nombre, id_agente FROM
|
||||
tagente_modulo WHERE id_agente_modulo = ". $value['id_agent_module']);
|
||||
$sql_alias = db_get_all_rows_sql("SELECT alias from tagente
|
||||
WHERE id_agente = ". $sql_modulo[0]['id_agente']);
|
||||
$table .= "<div style='width: 800px'><h4>AGENT " .$sql_alias[0]['alias']." MODULE ".$sql_modulo[0]['nombre']."</h4><hr></div>";
|
||||
$table .= grafico_modulo_sparse(
|
||||
$value['id_agent_module'],
|
||||
$value['time_lapse'],
|
||||
0,
|
||||
800,
|
||||
300,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
$value['only_average'],
|
||||
false,
|
||||
0,
|
||||
'',
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
false,
|
||||
ui_get_full_url(false, false, false, false),
|
||||
1,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
1,
|
||||
'white',
|
||||
null,
|
||||
false,
|
||||
false,
|
||||
'area');
|
||||
$contador --;
|
||||
}
|
||||
// $table .= "</br>";
|
||||
break;
|
||||
case 'custom_graph':
|
||||
if ($contador > 0) {
|
||||
$graph = db_get_all_rows_field_filter('tgraph', 'id_graph',$value['id_graph']);
|
||||
|
||||
$sources = db_get_all_rows_field_filter('tgraph_source', 'id_graph',$value['id_graph']);
|
||||
$modules = array ();
|
||||
$weights = array ();
|
||||
$labels = array ();
|
||||
foreach ($sources as $source) {
|
||||
array_push ($modules, $source['id_agent_module']);
|
||||
array_push ($weights, $source['weight']);
|
||||
if ($source['label'] != ''){
|
||||
$item['type'] = 'custom_graph';
|
||||
$item['id_agent'] = agents_get_module_id($source['id_agent_module']);
|
||||
$item['id_agent_module'] = $source['id_agent_module'];
|
||||
$labels[$source['id_agent_module']] = reporting_label_macro($item, $source['label']);
|
||||
}
|
||||
}
|
||||
|
||||
$homeurl = ui_get_full_url(false, false, false, false);
|
||||
$graph_conf = db_get_row('tgraph', 'id_graph', $value['id_graph']);
|
||||
|
||||
if($graph_conf['stacked'] == 4 || $graph_conf['stacked'] == 9){
|
||||
$height = 50;
|
||||
} else if ($graph_conf['stacked'] == 5){
|
||||
$height = 200;
|
||||
} else {
|
||||
$height = 300;
|
||||
}
|
||||
$table .= "<div style='width: 800px'><h4>CUSTOM GRAPH ".$graph[0]['name']."</h4><hr></div>";
|
||||
$table .= graphic_combined_module($modules,
|
||||
$weights,
|
||||
$value['time_lapse'],
|
||||
800,
|
||||
$height,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
$graph_conf['stacked'],
|
||||
0,
|
||||
false,
|
||||
$homeurl,
|
||||
1,
|
||||
false,
|
||||
false,
|
||||
'white',
|
||||
array(),
|
||||
array(),
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
$labels,
|
||||
false,
|
||||
false,
|
||||
null,
|
||||
false);
|
||||
$contador --;
|
||||
}
|
||||
break;
|
||||
case 'dynamic_graph':
|
||||
$alias = " AND alias like '%".io_safe_output($value['agent'])."%'";
|
||||
|
||||
if($value['id_group'] === '0'){
|
||||
$id_group = "";
|
||||
} else {
|
||||
$id_group = " AND id_grupo = ".$value['id_group'];
|
||||
}
|
||||
|
||||
if($value['id_module_group'] === '0'){
|
||||
$id_module_group = "";
|
||||
} else {
|
||||
$id_module_group = " AND id_module_group = ".$value['id_module_group'];
|
||||
}
|
||||
|
||||
if($value['id_tag'] === '0'){
|
||||
$tag = "";
|
||||
$id_tag = "";
|
||||
} else {
|
||||
$tag = " INNER JOIN ttag_module ON ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo ";
|
||||
$id_tag = " AND ttag_module.id_tag = ".$value['id_tag'];
|
||||
}
|
||||
|
||||
$module_name = " AND nombre like '%".io_safe_output($value['module'])."%'";
|
||||
|
||||
$id_agent_module = db_get_all_rows_sql("SELECT tagente_modulo.id_agente_modulo FROM tagente_modulo
|
||||
". $tag . "WHERE 1=1" . $id_module_group . $module_name .
|
||||
" AND id_agente IN (SELECT id_agente FROM tagente WHERE 1=1" .$alias.$id_group.")"
|
||||
. $id_tag);
|
||||
|
||||
foreach ($id_agent_module as $key2 => $value2) {
|
||||
if ($contador > 0) {
|
||||
$sql_modulo2 = db_get_all_rows_sql("SELECT nombre, id_agente FROM
|
||||
tagente_modulo WHERE id_agente_modulo = ". $value2['id_agente_modulo']);
|
||||
|
||||
$sql_alias2 = db_get_all_rows_sql("SELECT alias from tagente
|
||||
WHERE id_agente = ". $sql_modulo2[0]['id_agente']);
|
||||
|
||||
$table .= "<div style='width: 800px'><h4>AGENT " .$sql_alias2[0]['alias']." MODULE ".$sql_modulo2[0]['nombre']."</h4><hr></div>";
|
||||
|
||||
$table .= grafico_modulo_sparse(
|
||||
$value2['id_agente_modulo'],
|
||||
$value['time_lapse'],
|
||||
0,
|
||||
800,
|
||||
300,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
$value['only_average'],
|
||||
false,
|
||||
0,
|
||||
'',
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
false,
|
||||
ui_get_full_url(false, false, false, false),
|
||||
1,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
1,
|
||||
'white',
|
||||
null,
|
||||
false,
|
||||
false,
|
||||
'area');
|
||||
$contador --;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
$table .= "</br>";
|
||||
echo $table;
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue