Merge branch 'develop' into ent-1536-macro-para-id-extra
Conflicts resolved: pandora_console/include/help/en/help_alert_config.php pandora_console/include/help/en/help_alert_macros.php pandora_console/include/help/es/help_alert_config.php pandora_console/include/help/es/help_alert_macros.php pandora_console/include/help/ja/help_alert_config.php pandora_console/include/help/ja/help_alert_macros.php
|
@ -54,6 +54,18 @@ AGENT_WIN_FILE="$CODEHOME/pandora_agents/win32/pandora.cc"
|
|||
AGENT_WIN_MPI_FILE="$CODEHOME/pandora_agents/win32/installer/pandora.mpi"
|
||||
AGENT_WIN_RC_FILE="$CODEHOME/pandora_agents/win32/versioninfo.rc"
|
||||
SATELLITE_FILE="$PANDHOME_ENT/satellite_server/satellite_server.pl"
|
||||
PERL_PLUGIN_FILES="$PANDHOME_ENT/pandora_plugins/NGINX/nginx_requests_queued.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Sybase/sybase_plugin.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/MarkLogic/pandora_marklogic.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Apache/pandora_apache.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Oracle/Database/pandora_oracle.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/OpenNebula/pandora_opennebula.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Nutanix/pandora_nutanix.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/MTL/pandora_mtl.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Informix/informix.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Ruckus/ruckus.pl \
|
||||
$PANDHOME_ENT/pandora_server/util/plugins/vmware-plugin.pl"
|
||||
PLUGIN_LIB_FILE="$CODEHOME/pandora_server/lib/PandoraFMS/PluginTools.pm"
|
||||
|
||||
# Update version in spec files
|
||||
function update_spec_version {
|
||||
|
@ -87,6 +99,14 @@ function update_installer_version {
|
|||
sed -i -e "/^PI_VERSION/s/=.*/=\"$VERSION\"/" -e "/^PI_BUILD/s/=.*/=\"$BUILD\"/" "$FILE"
|
||||
}
|
||||
|
||||
# Update version in Perl files
|
||||
function update_perl_version {
|
||||
FILE=$1
|
||||
|
||||
sed -i -e "s/my\s\s*\$pandora_version\s*=.*/my \$pandora_version = \"$VERSION\";/" "$FILE"
|
||||
sed -i -e "s/my\s\s*\$pandora_build\s*=.*/my \$pandora_build = \"$BUILD\";/" "$FILE"
|
||||
}
|
||||
|
||||
# Spec files
|
||||
for file in $SPEC_FILES; do
|
||||
echo "Updating spec file $file..."
|
||||
|
@ -105,6 +125,12 @@ for file in $INSTALLER_FILES; do
|
|||
update_installer_version $file
|
||||
done
|
||||
|
||||
# Perl plugins files
|
||||
for file in $PERL_PLUGIN_FILES; do
|
||||
echo "Updating plugin file $file..."
|
||||
update_perl_version $file
|
||||
done
|
||||
|
||||
# Pandora Server
|
||||
echo "Updating Pandora Server version..."
|
||||
sed -i -e "s/my\s\s*\$pandora_version\s*=.*/my \$pandora_version = \"$VERSION\";/" "$SERVER_FILE"
|
||||
|
@ -116,6 +142,9 @@ sed -i -e "s/my\s\s*\$version\s*=.*/my \$version = \"$VERSION PS$BUILD\";/" "$SE
|
|||
sed -i -e "s/\s*\#\s*\Version.*/\# Version $VERSION/" "$SERVER_CONF_FILE"
|
||||
sed -i -e "s/\s*\!define PRODUCT_VERSION.*/\!define PRODUCT_VERSION \"$VERSION\"/" "$SERVER_WIN_MPI_OPEN_FILE"
|
||||
sed -i -e "s/\s*\!define PRODUCT_VERSION.*/\!define PRODUCT_VERSION \"$VERSION\"/" "$SERVER_WIN_MPI_ENT_FILE"
|
||||
echo "Updateing Pandora PluginTools version..."
|
||||
sed -i -e "s/my\s\s*\$pandora_version\s*=.*/my \$pandora_version = \"$VERSION\";/" "$PLUGIN_LIB_FILE"
|
||||
sed -i -e "s/my\s\s*\$pandora_build\s*=.*/my \$pandora_build = \"$BUILD\";/" "$PLUGIN_LIB_FILE"
|
||||
|
||||
# Pandora Satellite Server
|
||||
echo "Updating Pandora Satellite Server version..."
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, AIX version
|
||||
# Version 7.0NG.716, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, FreeBSD Version
|
||||
# Version 7.0NG.716, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, HP-UX Version
|
||||
# Version 7.0NG.716, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, GNU/Linux
|
||||
# Version 7.0NG.716, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, GNU/Linux
|
||||
# Version 7.0NG.716, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, Solaris Version
|
||||
# Version 7.0NG.716, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2010 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.715
|
||||
# Version 7.0NG.716
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.715, AIX version
|
||||
# Version 7.0NG.716, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.715
|
||||
# Version 7.0NG.716
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.715, HPUX Version
|
||||
# Version 7.0NG.716, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715
|
||||
# Version 7.0NG.716
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715
|
||||
# Version 7.0NG.716
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715
|
||||
# Version 7.0NG.716
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.715, Solaris version
|
||||
# Version 7.0NG.716, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, AIX version
|
||||
# Version 7.0NG.716, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.715-171120
|
||||
Version: 7.0NG.716-171218
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.715-171120"
|
||||
pandora_version="7.0NG.716-171218"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, GNU/Linux
|
||||
# Version 7.0NG.716, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, FreeBSD Version
|
||||
# Version 7.0NG.716, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, HP-UX Version
|
||||
# Version 7.0NG.716, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, GNU/Linux
|
||||
# Version 7.0NG.716, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, GNU/Linux
|
||||
# Version 7.0NG.716, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, NetBSD Version
|
||||
# Version 7.0NG.716, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.715, Solaris Version
|
||||
# Version 7.0NG.716, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -40,8 +40,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.715';
|
||||
use constant AGENT_BUILD => '171120';
|
||||
use constant AGENT_VERSION => '7.0NG.716';
|
||||
use constant AGENT_BUILD => '171218';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -1244,7 +1244,11 @@ sub check_collections () {
|
|||
|
||||
# Delete old collections if there are no broker agents
|
||||
if ($BrokerEnabled == 0) {
|
||||
opendir (DIR, "$ConfDir/collections") || return;
|
||||
if(!opendir (DIR, "$ConfDir/collections")){
|
||||
log_message ('Collection', "Could not open dir $ConfDir/collections");
|
||||
return;
|
||||
}
|
||||
|
||||
while (defined (my $file_name = readdir(DIR))) {
|
||||
next if ($file_name eq '.' || $file_name eq '..');
|
||||
|
||||
|
@ -1252,8 +1256,14 @@ sub check_collections () {
|
|||
$file_name =~ s/\.md5$//;
|
||||
|
||||
if (! defined ($Collections{$file_name})) {
|
||||
rmrf ("$ConfDir/collections/$file_name");
|
||||
unlink ("$ConfDir/collections/$file_name.md5");
|
||||
if(opendir (DIR_check, "$ConfDir/collections/$file_name")){
|
||||
closedir (DIR_check);
|
||||
rmrf ("$ConfDir/collections/$file_name");
|
||||
unlink ("$ConfDir/collections/$file_name.md5");
|
||||
}
|
||||
else {
|
||||
log_message ('Collection', "Could not open dir $ConfDir/collections/$file_name");
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir (DIR);
|
||||
|
@ -1272,7 +1282,11 @@ sub check_collections () {
|
|||
|
||||
# Get remote md5
|
||||
error ("File '$Conf{'temporal'}/$collection_md5_file' already exists as a symlink and could not be removed: $!.") if (-l "$Conf{'temporal'}/$collection_md5_file" && !unlink("$Conf{'temporal'}/$collection_md5_file"));
|
||||
next unless (recv_file ($collection_md5_file, $Conf{'server_path_md5'}) == 0);
|
||||
if(recv_file ($collection_md5_file, $Conf{'server_path_md5'}) != 0){
|
||||
log_message ('Collection', "Could not write $collection_md5_file on " . $Conf{'server_path_md5'});
|
||||
next;
|
||||
}
|
||||
|
||||
open (MD5_FILE, "< $Conf{'temporal'}/$collection_md5_file") || error ("Could not open file '$Conf{'temporal'}/$collection_md5_file' for reading: $!.");
|
||||
my $remote_collection_md5 = <MD5_FILE>;
|
||||
close (MD5_FILE);
|
||||
|
@ -1284,13 +1298,20 @@ sub check_collections () {
|
|||
$local_collection_md5 = <MD5_FILE>;
|
||||
close MD5_FILE;
|
||||
}
|
||||
else{
|
||||
log_message ('Collection', "Could not open dir $ConfDir/collections/$collection_md5_file");
|
||||
next;
|
||||
}
|
||||
|
||||
# Check for changes
|
||||
$local_collection_md5 = $remote_collection_md5 unless defined ($local_collection_md5);
|
||||
next if ($local_collection_md5 eq $remote_collection_md5);
|
||||
|
||||
# Download and unzip
|
||||
next unless (recv_file ($collection_file, $Conf{'server_path_zip'}) == 0);
|
||||
if(recv_file ($collection_md5_file, $Conf{'server_path_md5'}) != 0){
|
||||
log_message ('Collection', "Could not write $collection_file on " . $Conf{'server_path_zip'});
|
||||
next;
|
||||
}
|
||||
rmrf ("$ConfDir/collections/$collection");
|
||||
`unzip -d "$ConfDir/collections/$collection" "$Conf{'temporal'}/$collection_file" 2>$DevNull`;
|
||||
unlink ("$Conf{'temporal'}/$collection_file");
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.715
|
||||
%define release 171120
|
||||
%define version 7.0NG.716
|
||||
%define release 171218
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.715
|
||||
%define release 171120
|
||||
%define version 7.0NG.716
|
||||
%define release 171218
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.715"
|
||||
PI_BUILD="171120"
|
||||
PI_VERSION="7.0NG.716"
|
||||
PI_BUILD="171218"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2014 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.715
|
||||
# (c) 2006-2017 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.716
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
@ -21,6 +21,13 @@ server_ip $ServerIP$
|
|||
server_path /var/spool/pandora/data_in
|
||||
temporal "%ProgramFiles%\pandora_agent\temp"
|
||||
|
||||
# Group assigned for this agent (descriptive, p.e: Servers)
|
||||
group $GroupName$
|
||||
|
||||
# If set to 1 allows the agent to be configured via the web console
|
||||
# (only works on enterprise version). Set to 0 to disable it
|
||||
remote_config 0
|
||||
|
||||
#include "C:\Archivos de programa\pandora_agent\pandora_agent_alt.conf"
|
||||
#broker_agent name_agent
|
||||
|
||||
|
@ -43,15 +50,10 @@ agent_name_cmd __rand__
|
|||
|
||||
# address: Enforce to server a ip address to this agent
|
||||
# You can also try to detect the first IP using "auto", for example
|
||||
|
||||
address auto
|
||||
|
||||
# or setting a fixed IP address, like for example:
|
||||
#address 192.168.36.73
|
||||
|
||||
# Group assigned for this agent (descriptive, p.e: Servers)
|
||||
group Servers
|
||||
|
||||
# This limits operation if temporal dir has not enough free disk.
|
||||
#temporal_min_size 1024
|
||||
|
||||
|
@ -80,10 +82,6 @@ server_port 41121
|
|||
# Debug mode renames XML in the temp folder and continues running
|
||||
# debug 1
|
||||
|
||||
# If set to 1 allows the agent to be configured via the web console
|
||||
# (only works on enterprise version). Set to 0 to disable it
|
||||
remote_config 0
|
||||
|
||||
# XML encoding (ISO-8859-1 by default). Most windows servers experience problems when you set to UTF-8. Other special codepages may be specified here.
|
||||
#encoding ISO-8859-1
|
||||
|
||||
|
@ -102,6 +100,10 @@ xml_buffer 1
|
|||
# Agent mode: Learn (default), No-learn, Autodisable
|
||||
# agent_mode autodisable
|
||||
|
||||
# EHorus configuration file default full path.
|
||||
#It try to find the EKID and set it like a custom field.
|
||||
ehorus_conf "C:\Program Files\ehorus_agent\ehorus_agent.conf"
|
||||
|
||||
# Secondary server configuration
|
||||
# ==============================
|
||||
|
||||
|
@ -127,74 +129,166 @@ xml_buffer 1
|
|||
#process_firefox_stop killall firefox
|
||||
#service_messenger 1
|
||||
|
||||
###############################################
|
||||
# Module Definition
|
||||
# Check online documentation and module library at http://pandorafms.org
|
||||
# =================
|
||||
|
||||
# Get Network information using Agent plugin
|
||||
module_plugin cscript //B "%ProgramFiles%\Pandora_Agent\util\nettraffic.vbs"
|
||||
|
||||
# Get disk occupation (percent)
|
||||
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent.vbs"
|
||||
|
||||
# External inventory plugin
|
||||
module_begin
|
||||
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\software_installed.vbs"
|
||||
module_interval 288
|
||||
# 288 x 5min = 24 hr, one execution per day, using module_interval <factor>
|
||||
module_end
|
||||
|
||||
# CPU Load
|
||||
|
||||
# CPU Load using WMI
|
||||
module_begin
|
||||
module_name CPU Load
|
||||
module_type generic_data
|
||||
#module_wmiquery SELECT LoadPercentage FROM Win32_Processor
|
||||
#module_wmicolumn LoadPercentage
|
||||
module_cpuusage all
|
||||
module_description CPU Load (%)
|
||||
module_unit %
|
||||
module_min_warning 80
|
||||
module_wmiquery SELECT LoadPercentage FROM Win32_Processor
|
||||
module_wmicolumn LoadPercentage
|
||||
module_max 100
|
||||
module_min 0
|
||||
module_description User CPU Usage (%)
|
||||
module_min_warning 70
|
||||
module_max_warning 90
|
||||
module_min_critical 91
|
||||
module_max_critical 100
|
||||
module_unit %
|
||||
module_group System
|
||||
module_end
|
||||
|
||||
# Number processes
|
||||
# Basic info about TCP Connection
|
||||
module_begin
|
||||
module_name Number processes
|
||||
module_type generic_data
|
||||
module_exec tasklist | gawk "NR > 3 {print$0}" | wc -l
|
||||
module_description Number of processes running
|
||||
module_min_warning 175
|
||||
module_max_warning 249
|
||||
module_min_critical 250
|
||||
module_max_critical 300
|
||||
module_name TCP_Connections
|
||||
module_type generic_data
|
||||
module_exec netstat -an | find /c /v "estab"
|
||||
module_description Total number of TCP connections active
|
||||
module_group Networking
|
||||
module_end
|
||||
|
||||
# Example plugin to retrieve drive usage
|
||||
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent_used.vbs"
|
||||
|
||||
# Example plugin to retrieve memory usage
|
||||
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\mem_percent_used.vbs"
|
||||
|
||||
# Example plugin to retrieve network usage
|
||||
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\network.vbs"
|
||||
|
||||
## Windows inventory module (This information will be displayed only in enterprise version)
|
||||
## Please check the WMI is healthy before activate this functionality
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cpuinfo.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\moboinfo.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\diskdrives.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cdromdrives.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\videocardinfo.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\ifaces.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\monitors.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\printers.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\raminfo.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\software_installed.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\userslogged.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productkey.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productID.vbs"
|
||||
#module_crontab * 12-15 * * 1
|
||||
#module_end
|
||||
|
||||
#########################################
|
||||
# EXAMPLES #
|
||||
#########################################
|
||||
|
||||
# Example: get Network information using Agent plugin
|
||||
#module_plugin cscript //B "%ProgramFiles%\Pandora_Agent\util\nettraffic.vbs"
|
||||
|
||||
# External inventory plugin
|
||||
#module_begin
|
||||
#module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\software_installed.vbs"
|
||||
#module_interval 288
|
||||
## 288 x 5min = 24 hr, one execution per day, using module_interval <factor>
|
||||
#module_end
|
||||
|
||||
# Free Memory
|
||||
module_begin
|
||||
module_name FreeMemory
|
||||
module_type generic_data
|
||||
module_freepercentmemory
|
||||
module_unit %
|
||||
module_description Free memory (%).
|
||||
module_min_warning 21
|
||||
module_max_warning 30
|
||||
module_min_critical 0
|
||||
module_max_critical 20
|
||||
module_end
|
||||
#module_begin
|
||||
#module_name FreeMemory
|
||||
#module_type generic_data
|
||||
#module_freepercentmemory
|
||||
#module_description Free memory (%).
|
||||
#module_min_warning 21
|
||||
#module_max_warning 30
|
||||
#module_min_critical 0
|
||||
#module_max_critical 20
|
||||
#module_end
|
||||
|
||||
# Log events
|
||||
#module_begin
|
||||
#module_name System Events (TermService)
|
||||
#module_type async_string
|
||||
#module_logevent
|
||||
#module_description Log Events coming from Terminal Service
|
||||
#module_source System
|
||||
#module_application TermService
|
||||
#module_end
|
||||
|
||||
module_begin
|
||||
module_name Security Events (Invalid Login)
|
||||
module_type async_string
|
||||
module_description Security log events for invalid login attempt
|
||||
module_logevent
|
||||
module_source Security
|
||||
module_eventcode 529
|
||||
module_end
|
||||
#module_begin
|
||||
#module_name Security Events (Invalid Login)
|
||||
#module_type async_string
|
||||
#module_description Security log events for invalid login attempt
|
||||
#module_logevent
|
||||
#module_source Security
|
||||
#module_eventcode 529
|
||||
#module_end
|
||||
|
||||
# Check if Dhcp service is enabled
|
||||
#module_begin
|
||||
#module_name DHCP Enabled
|
||||
#module_type generic_proc
|
||||
#module_service Dhcp
|
||||
#module_description Check DCHP service enabled
|
||||
#module_end
|
||||
|
||||
#Antivirus monitoring
|
||||
#This modules checks the antivirus is running on your system, if there is and antivirus
|
||||
|
@ -207,72 +301,51 @@ module_end
|
|||
#module_description Last update for Antivirus Signature file
|
||||
#module_end
|
||||
|
||||
## Windows inventory module (This information will be displayed only in enterprise version)
|
||||
## Please check the WMI is healthy before activate this functionality
|
||||
# Number processes
|
||||
#module_begin
|
||||
#module_name Number processes
|
||||
#module_type generic_data
|
||||
#module_exec tasklist | gawk "NR > 3 {print$0}" | wc -l
|
||||
#module_description Number of processes running
|
||||
#module_min_warning 175
|
||||
#module_max_warning 249
|
||||
#module_min_critical 250
|
||||
#module_max_critical 300
|
||||
#module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cpuinfo.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
# Example plugin to retrieve drive usage
|
||||
#module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df.vbs"
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\moboinfo.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
# Free space on disk C: (%)
|
||||
#module_begin
|
||||
#module_name FreeDiskC
|
||||
#module_type generic_data
|
||||
#module_freepercentdisk C:
|
||||
#module_description Free space on drive C: (%)
|
||||
#module_min_warning 31
|
||||
#module_max_warning 40
|
||||
#module_min_critical 0
|
||||
#module_max_critical 30
|
||||
#module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\diskdrives.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
# CPU usage percentage
|
||||
#module_begin
|
||||
#module_name CPUUse
|
||||
#module_type generic_data
|
||||
#module_cpuusage all
|
||||
#module_description CPU# usage
|
||||
#module_min_warning 70
|
||||
#module_max_warning 90
|
||||
#module_min_critical 91
|
||||
#module_max_critical 100
|
||||
#module_end
|
||||
|
||||
# Free space on disk D: (%)
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cdromdrives.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\videocardinfo.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\ifaces.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\monitors.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\printers.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\raminfo.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\software_installed.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\userslogged.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productkey.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# module_begin
|
||||
# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productID.vbs"
|
||||
# module_crontab * 12-15 * * 1
|
||||
# module_name FreeDiskD
|
||||
# module_type generic_data
|
||||
# module_freepercentdisk D:
|
||||
# module_description Free space on drive D: (%)
|
||||
# module_end
|
||||
|
||||
## Plugin example for custom fields (version, architecture, IP, IPv6, MAC)
|
||||
|
@ -281,10 +354,9 @@ module_end
|
|||
# module_crontab * 12-15 * * 1
|
||||
# module_end
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
# This samples below need to be reconfigured and uncommented. Please read documentation
|
||||
# on how to setup pandora fms windows agent at http://wiki.pandorafms.com
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
# Example plugin to retrieve last 5 min events in log4x format
|
||||
# module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\logevent_log4x.vbs" Aplicacion System 300
|
||||
|
||||
# Sample on how to get a value from registry
|
||||
# This returns the last time user launch microsoft Windows update
|
||||
#module_begin
|
||||
|
@ -391,11 +463,11 @@ module_end
|
|||
#module_description Postcondition test module
|
||||
#module_end
|
||||
|
||||
#Example of when module_native_encoding is necessary
|
||||
#Dont uncomment module_native_encoding tag to see the difference
|
||||
# Example of native encoding.
|
||||
#module_begin
|
||||
#module_name Accent_example
|
||||
#module_name Written Accent
|
||||
#module_type generic_data_string
|
||||
#module_exec echo Bordón
|
||||
#module_native_encoding OEM
|
||||
#module_end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.715}
|
||||
{Pandora FMS Windows Agent v7.0NG.716}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{171120}
|
||||
{171218}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.715(Build 171120)")
|
||||
#define PANDORA_VERSION ("7.0NG.716(Build 171218)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.715(Build 171120))"
|
||||
VALUE "ProductVersion", "(7.0NG.716(Build 171218))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.715-171120
|
||||
Version: 7.0NG.716-171218
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.715-171120"
|
||||
pandora_version="7.0NG.716-171218"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -259,80 +259,60 @@ function extension_db_check_tables_differences($connection_test,
|
|||
$field_system = $fields_system[$name_field];
|
||||
|
||||
$diff = array_diff($field_test, $field_system);
|
||||
|
||||
if (!empty($diff)) {
|
||||
foreach ($diff as $config_field => $value) {
|
||||
switch ($config_field) {
|
||||
case 'type':
|
||||
ui_print_error_message(
|
||||
__('Unsuccessful the field %s in the table %s must be set the type with %s.',
|
||||
$name_field, $table, $value));
|
||||
ui_print_info_message(
|
||||
__('You can execute this SQL query for to fix.') . "<br />" .
|
||||
'<pre>' .
|
||||
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $value . ";" .
|
||||
'</pre>'
|
||||
);
|
||||
break;
|
||||
case 'null':
|
||||
ui_print_error_message(
|
||||
__('Unsuccessful the field %s in the table %s must be null: (%s).',
|
||||
$name_field, $table, $value));
|
||||
$info_message = "";
|
||||
$error_message = "";
|
||||
if($diff['type']){
|
||||
$error_message .= "Unsuccessful the field ".$name_field." in the table ".$table." must be set the type with ".$diff['type']."<br>";
|
||||
}
|
||||
|
||||
if($diff['null']){
|
||||
$error_message .= "Unsuccessful the field $name_field in the table $table must be null: (".$diff['null'].").<br>";
|
||||
}
|
||||
|
||||
if($diff['default']){
|
||||
$error_message .= "Unsuccessful the field $name_field in the table $table must be set ".$diff['default']." as default value.<br>";
|
||||
}
|
||||
|
||||
if($field_test['null'] == "YES" || !isset($field_test['null']) || $field_test['null'] == ""){
|
||||
$null_defect = " NULL";
|
||||
}
|
||||
else{
|
||||
$null_defect = " NOT NULL";
|
||||
}
|
||||
|
||||
if(!isset($field_test['default']) || $field_test['default'] == ""){
|
||||
$default_value = "";
|
||||
}
|
||||
else{
|
||||
$default_value = " DEFAULT ".$field_test['default'];
|
||||
}
|
||||
|
||||
if($diff['type'] || $diff['null'] || $diff['default']){
|
||||
$info_message .= "ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . $null_defect . $default_value.";";
|
||||
}
|
||||
|
||||
if($diff['key']){
|
||||
$error_message .= "Unsuccessful the field $name_field in the table $table must be set the key as defined in the SQL file.<br>";
|
||||
$info_message .= "<br><br>Please check the SQL file for to know the kind of key needed.";
|
||||
}
|
||||
|
||||
if($diff['extra']){
|
||||
$error_message .= "Unsuccessful the field $name_field in the table $table must be set as defined in the SQL file.<br>";
|
||||
$info_message .= "<br><br>Please check the SQL file for to know the kind of extra config needed.";
|
||||
}
|
||||
|
||||
ui_print_error_message(
|
||||
__($error_message));
|
||||
|
||||
if ($value == "YES") {
|
||||
ui_print_info_message(
|
||||
__('You can execute this SQL query for to fix.') . "<br />" .
|
||||
'<pre>' .
|
||||
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . " NULL;" .
|
||||
'</pre>'
|
||||
);
|
||||
}
|
||||
else {
|
||||
ui_print_info_message(
|
||||
__('You can execute this SQL query for to fix.') . "<br />" .
|
||||
'<pre>' .
|
||||
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . " NOT NULL;" .
|
||||
'</pre>'
|
||||
);
|
||||
}
|
||||
ui_print_info_message(
|
||||
__($info_message));
|
||||
|
||||
break;
|
||||
case 'key':
|
||||
ui_print_error_message(
|
||||
__('Unsuccessful the field %s in the table %s must be set the key as defined in the SQL file.',
|
||||
$name_field, $table));
|
||||
ui_print_info_message(
|
||||
__('Please check the SQL file for to know the kind of key needed.'));
|
||||
break;
|
||||
case 'default':
|
||||
if($field_test['null'] == "YES" || !isset($field_test['null']) || $field_test['null'] == ""){
|
||||
$null_defect = " NULL";
|
||||
}
|
||||
else{
|
||||
$null_defect = " NOT NULL";
|
||||
}
|
||||
ui_print_error_message(
|
||||
__('Unsuccessful the field %s in the table %s must be set %s as default value.',
|
||||
$name_field, $table, $value));
|
||||
ui_print_info_message(
|
||||
__('You can execute this SQL query for to fix.') . "<br />" .
|
||||
'<pre>' .
|
||||
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . $null_defect . " DEFAULT " . $value . ";" .
|
||||
'</pre>'
|
||||
);
|
||||
break;
|
||||
case 'extra':
|
||||
ui_print_error_message(
|
||||
__('Unsuccessful the field %s in the table %s must be set as defined in the SQL file.',
|
||||
$name_field, $table));
|
||||
ui_print_info_message(
|
||||
__('Please check the SQL file for to know the kind of extra config needed.'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($correct_fields) {
|
||||
ui_print_success_message(
|
||||
|
@ -366,4 +346,4 @@ function extension_db_status_execute_sql_file($url, $connection) {
|
|||
|
||||
extensions_add_godmode_function('extension_db_status');
|
||||
extensions_add_godmode_menu_option(__('DB Schema check'), 'DM', 'gextensions', null, "v1r1", 'gdbman');
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -69,9 +69,9 @@ function pandoralogs_extension_main () {
|
|||
|
||||
ui_print_page_header (__("System logfile viewer"), "images/extensions.png", false, "", true, "" );
|
||||
|
||||
echo "<p>" . __('This tool is used just to view your Pandora FMS system logfiles directly from console') . "</p>";
|
||||
echo "<p>" . __('Use this tool to view your Pandora FMS logfiles directly on the console') . "</p>";
|
||||
|
||||
echo "<p>" . __('You can control the size information to show in general setup (Log size limit in view extension), actually ') . $config['max_log_size'] * 1000 . "B" . "</p>";
|
||||
echo "<p>" . __('You can choose the amount of information shown in general setup (Log size limit in system logs viewer extension), ' . $config['max_log_size'] * 1000 . 'B at the moment') . "</p>";
|
||||
|
||||
$logs_directory = (!empty($config["server_log_dir"])) ? io_safe_output($config["server_log_dir"]) : "/var/log/pandora";
|
||||
|
||||
|
|
|
@ -140,14 +140,19 @@ function snmpBrowserWindow () {
|
|||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 780,
|
||||
height: 430
|
||||
width: 920,
|
||||
height: 500
|
||||
});
|
||||
}
|
||||
|
||||
// Set the form OID to the value selected in the SNMP browser
|
||||
function setOID () {
|
||||
$('#text-snmp_oid').val($('#snmp_selected_oid').text());
|
||||
|
||||
if($('#snmp_browser_version').val() == '3'){
|
||||
$('#text-snmp_oid').val($('#table1-0-1').text());
|
||||
} else {
|
||||
$('#text-snmp_oid').val($('#snmp_selected_oid').text());
|
||||
}
|
||||
|
||||
// Close the SNMP browser
|
||||
$('.ui-dialog-titlebar-close').trigger('click');
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE tsnmp_filter ADD unified_filters_id int(10) NOT NULL DEFAULT 0;
|
||||
ALTER TABLE treport_content_template ADD COLUMN hide_no_data tinyint(1) DEFAULT 0;
|
||||
ALTER TABLE tgraph_source ADD COLUMN `field_order` int(10) NOT NULL default 0;
|
||||
UPDATE tgraph_source c, (SELECT @n := 0) m SET c.field_order = @n := @n + 1;
|
||||
|
||||
ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0';
|
||||
ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0';
|
||||
ALTER TABLE tgraph ADD COLUMN `modules_series` tinyint(1) UNSIGNED NOT NULL default '0';
|
||||
|
||||
COMMIT;
|
|
@ -728,6 +728,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
|
|||
`lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0',
|
||||
`lapse` int(11) UNSIGNED NOT NULL default '300',
|
||||
`visual_format` tinyint(1) UNSIGNED NOT NULL default '0',
|
||||
`hide_no_data` tinyint(1) default 0,
|
||||
PRIMARY KEY(`id_rc`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -1262,6 +1263,7 @@ UPDATE tagente_modulo SET cron_interval = '' WHERE cron_interval LIKE '% %';
|
|||
ALTER TABLE tgraph ADD COLUMN `percentil` int(4) unsigned default '0';
|
||||
ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0';
|
||||
ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0';
|
||||
ALTER TABLE tgraph ADD COLUMN `modules_series` tinyint(1) UNSIGNED NOT NULL default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tnetflow_filter`
|
||||
|
@ -1433,6 +1435,7 @@ ALTER TABLE tserver_export MODIFY `name` varchar(600) BINARY NOT NULL default ''
|
|||
-- ---------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE tgraph_source ADD COLUMN id_server int(11) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE tgraph_source ADD COLUMN `field_order` int(10) NOT NULL default 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tserver_export_data`
|
||||
|
|
|
@ -388,6 +388,12 @@ config_check();
|
|||
$do_refresh = false;
|
||||
}
|
||||
}
|
||||
|
||||
$new_dashboard = get_parameter('new_dashboard',0);
|
||||
|
||||
if ($_GET['sec2'] == 'enterprise/dashboard/main_dashboard' && $new_dashboard) {
|
||||
$do_refresh = false;
|
||||
}
|
||||
|
||||
if ($do_refresh) {
|
||||
?>
|
||||
|
|
|
@ -542,7 +542,7 @@ if (!empty($interfaces_list)) {
|
|||
$table->data[0][1] = '';
|
||||
$table->data[0][2] = '<b>'.__('Modules').'</b>';
|
||||
|
||||
$table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:200px;');
|
||||
$table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px;');
|
||||
$table->data[1][1] = html_print_image('images/darrowright.png', true);
|
||||
$table->data[1][2] = html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
|
||||
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);
|
||||
|
|
|
@ -232,7 +232,7 @@ if ($create_agent) {
|
|||
if ($id_agente !== false) {
|
||||
// Create custom fields for this agent
|
||||
foreach ($field_values as $key => $value) {
|
||||
db_process_sql_insert ('tagent_custom_data',
|
||||
$update_custom = db_process_sql_insert ('tagent_custom_data',
|
||||
array('id_field' => $key, 'id_agent' => $id_agente,
|
||||
'description' => $value));
|
||||
}
|
||||
|
@ -735,13 +735,17 @@ if ($update_agent) { // if modified some agent paramenter
|
|||
|
||||
if ($old_value === false) {
|
||||
// Create custom field if not exist
|
||||
db_process_sql_insert ('tagent_custom_data',
|
||||
$update_custom = db_process_sql_insert ('tagent_custom_data',
|
||||
array('id_field' => $key,'id_agent' => $id_agente, 'description' => $value));
|
||||
}
|
||||
else {
|
||||
db_process_sql_update ('tagent_custom_data',
|
||||
$update_custom = db_process_sql_update ('tagent_custom_data',
|
||||
array('description' => $value),
|
||||
array('id_field' => $key,'id_agent' => $id_agente));
|
||||
|
||||
if($update_custom == 1){
|
||||
$update_custom_result = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -799,14 +803,16 @@ if ($update_agent) { // if modified some agent paramenter
|
|||
WHERE id_group = ".$group_old);
|
||||
|
||||
$result = db_process_sql_update ('tagente', $values, array ('id_agente' => $id_agente));
|
||||
if ($result == false) {
|
||||
|
||||
|
||||
if ($result == false && $update_custom_result == false) {
|
||||
ui_print_error_message(
|
||||
__('There was a problem updating the agent'));
|
||||
}
|
||||
else {
|
||||
// Update the agent from the metaconsole cache
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
enterprise_hook ('agent_update_from_cache', array($id_agente, $values));
|
||||
enterprise_hook ('agent_update_from_cache', array($id_agente, $values,$server_name));
|
||||
|
||||
if ($old_interval != $intervalo) {
|
||||
enterprise_hook('config_agents_update_config_interval', array($id_agente, $intervalo));
|
||||
|
|
|
@ -24,6 +24,7 @@ $sortField = get_parameter('sort_field');
|
|||
$sort = get_parameter('sort', 'none');
|
||||
$recursion = (bool) get_parameter('recursion',false);
|
||||
$disabled = get_parameter('disabled', 0);
|
||||
$os = get_parameter('os', 0);
|
||||
|
||||
if ($ag_group == -1 )
|
||||
$ag_group = (int) get_parameter ("ag_group", -1);
|
||||
|
@ -66,6 +67,14 @@ $agent_to_delete = (int)get_parameter('borrar_agente');
|
|||
$enable_agent = (int)get_parameter('enable_agent');
|
||||
$disable_agent = (int)get_parameter('disable_agent');
|
||||
|
||||
if($disable_agent != 0){
|
||||
$server_name = db_get_row_sql('select server_name from tagente where id_agente = '.$disable_agent);
|
||||
}
|
||||
elseif ($enable_agent != 0) {
|
||||
$server_name = db_get_row_sql('select server_name from tagente where id_agente = '.$enable_agent);
|
||||
}
|
||||
|
||||
|
||||
$result = null;
|
||||
|
||||
if ($agent_to_delete) {
|
||||
|
@ -105,7 +114,7 @@ if ($enable_agent) {
|
|||
// Update the agent from the metaconsole cache
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
$values = array('disabled' => 0);
|
||||
enterprise_hook ('agent_update_from_cache', array($enable_agent, $values));
|
||||
enterprise_hook ('agent_update_from_cache', array($enable_agent, $values,$server_name));
|
||||
|
||||
db_pandora_audit("Agent management", 'Enable ' . $alias);
|
||||
}
|
||||
|
@ -125,7 +134,7 @@ if ($disable_agent) {
|
|||
// Update the agent from the metaconsole cache
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
$values = array('disabled' => 1);
|
||||
enterprise_hook ('agent_update_from_cache', array($disable_agent, $values));
|
||||
enterprise_hook ('agent_update_from_cache', array($disable_agent, $values,$server_name));
|
||||
|
||||
db_pandora_audit("Agent management", 'Disable ' . $alias);
|
||||
}
|
||||
|
@ -163,6 +172,20 @@ html_print_select($fields,"disabled",$disabled,'this.form.submit()');
|
|||
|
||||
echo "</td>";
|
||||
|
||||
echo "<td>";
|
||||
echo __('Operative System') . ' ';
|
||||
|
||||
$pre_fields = db_get_all_rows_sql('select distinct(tagente.id_os),tconfig_os.description from tagente,tconfig_os where tagente.id_os = tconfig_os.id_os');
|
||||
$fields = array();
|
||||
|
||||
foreach ($pre_fields as $key => $value) {
|
||||
$fields[$value['id_os']] = $value['description'];
|
||||
}
|
||||
|
||||
html_print_select($fields,"os",$os,'this.form.submit()','All',0);
|
||||
|
||||
echo "</td>";
|
||||
|
||||
echo "<td>";
|
||||
echo __('Recursion') . ' ';
|
||||
html_print_checkbox ("recursion", 1, $recursion, false, false, 'this.form.submit()');
|
||||
|
@ -171,6 +194,8 @@ echo "</td><td>";
|
|||
echo __('Search') . ' ';
|
||||
html_print_input_text ("search", $search, '', 12);
|
||||
|
||||
echo ui_print_help_tip(__('Search filter by alias, name, description, IP address or custom fields content'), true);
|
||||
|
||||
echo "</td><td>";
|
||||
echo "<input name='srcbutton' type='submit' class='sub search' value='".__('Search')."'>";
|
||||
echo "</form>";
|
||||
|
@ -296,20 +321,26 @@ if ($search != "") {
|
|||
}else{
|
||||
$search_sql = " AND ( nombre " . $order_collation . "
|
||||
LIKE LOWER('%$search%') OR alias " . $order_collation . "
|
||||
LIKE LOWER('%$search%')) ";
|
||||
LIKE LOWER('%$search%') OR comentarios " . $order_collation . " LIKE LOWER('%$search%')
|
||||
OR EXISTS (SELECT * FROM tagent_custom_data
|
||||
WHERE id_agent = id_agente AND description LIKE '%$search%'))";
|
||||
}
|
||||
}
|
||||
|
||||
if ($disabled == 1)
|
||||
{
|
||||
$search_sql = " AND disabled = ". $disabled . $search_sql;
|
||||
$search_sql .= " AND disabled = ". $disabled . $search_sql;
|
||||
}
|
||||
else {
|
||||
if ($disabled == 0) {
|
||||
$search_sql = " AND disabled = 0" . $search_sql;
|
||||
$search_sql .= " AND disabled = 0" . $search_sql;
|
||||
}
|
||||
}
|
||||
|
||||
if($os != 0){
|
||||
$search_sql .= " AND id_os = " . $os;
|
||||
}
|
||||
|
||||
// Show only selected groups
|
||||
if ($ag_group > 0) {
|
||||
|
||||
|
@ -471,27 +502,27 @@ if (($config['dbtype'] == 'oracle') && ($agents !== false)) {
|
|||
}
|
||||
|
||||
// Prepare pagination
|
||||
ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled", $offset);
|
||||
ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
|
||||
|
||||
if ($agents !== false) {
|
||||
|
||||
echo "<table cellpadding='4' id='agent_list' cellspacing='4' width='100%' class='databox data'>";
|
||||
echo "<th>".__('Agent name') . ' ' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=name&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
||||
echo "</th>";
|
||||
echo "<th title='".__('Remote agent configuration')."'>".__('R'). ' ' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=remote&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectRemoteUp)) . '</a>' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=remote&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectRemoteDown)) . '</a>';
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectRemoteUp)) . '</a>' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectRemoteDown)) . '</a>';
|
||||
echo "</th>";
|
||||
echo "<th>".__('OS'). ' ' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=os&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '</a>' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=os&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . '</a>';
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=os&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '</a>' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=os&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . '</a>';
|
||||
echo "</th>";
|
||||
echo "<th>".__('Type'). "</th>";
|
||||
echo "<th>".__('Group'). ' ' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=group&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '</a>' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=group&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . '</a>';
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '</a>' .
|
||||
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . '</a>';
|
||||
echo "</th>";
|
||||
echo "<th>" . __('Description') . "</th>";
|
||||
echo "<th style='text-align:left'>" . __('Actions') . "</th>";
|
||||
|
@ -666,7 +697,7 @@ if ($agents !== false) {
|
|||
echo "</td>";
|
||||
}
|
||||
echo "</table>";
|
||||
ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled", $offset);
|
||||
ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
|
||||
echo "<table width='100%'><tr><td align='right'>";
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -291,7 +291,7 @@ if (modules_is_string_type($id_module_type) || $edit) {
|
|||
$table_simple->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
$table_simple->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true, $disabledBecauseInPolicy);
|
||||
if (!modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[4][2] = '<svg id="svg_dinamic" width="350px" height="200px" style="padding:40px; padding-left: 100px; margin-bottom: 60px;"></svg>';
|
||||
$table_simple->data[4][2] = '<svg id="svg_dinamic" width="800" height="300"> </svg>';
|
||||
$table_simple->colspan[4][2] = 2;
|
||||
$table_simple->rowspan[4][2] = 3;
|
||||
}
|
||||
|
@ -590,8 +590,7 @@ $table_advanced->colspan[10][1] = 6;
|
|||
if (isset($id_agente) && $moduletype == MODULE_DATA) {
|
||||
$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"]));
|
||||
if ($has_remote_conf) {
|
||||
$table_advanced->data[11][0] = __('Cron from') .
|
||||
ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
|
||||
$table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true);
|
||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
|
||||
$table_advanced->colspan[11][1] = 6;
|
||||
|
||||
|
@ -600,8 +599,7 @@ if (isset($id_agente) && $moduletype == MODULE_DATA) {
|
|||
$table_advanced->colspan[12][1] = 6;
|
||||
}
|
||||
else {
|
||||
$table_advanced->data[11][0] = __('Cron from') .
|
||||
ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
|
||||
$table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true);
|
||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, true);
|
||||
$table_advanced->colspan[11][1] = 6;
|
||||
|
||||
|
@ -611,8 +609,7 @@ if (isset($id_agente) && $moduletype == MODULE_DATA) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
$table_advanced->data[11][0] = __('Cron from') .
|
||||
ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
|
||||
$table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true);
|
||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
|
||||
$table_advanced->colspan[11][1] = 6;
|
||||
|
||||
|
@ -1202,294 +1199,34 @@ function paint_graph_values(){
|
|||
//inicialiced error
|
||||
var error_w = 0;
|
||||
var error_c = 0;
|
||||
//if haven't error
|
||||
if(max_w == 0 || max_w > min_w){
|
||||
if(max_c == 0 || max_c > min_c){
|
||||
paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, error_w, error_c);
|
||||
} else {
|
||||
error_c = 1;
|
||||
paint_graph_status(0,0,0,0,0,0, error_w, error_c);
|
||||
}
|
||||
} else {
|
||||
error_w = 1;
|
||||
paint_graph_status(0,0,0,0,0,0, error_w, error_c);
|
||||
}
|
||||
}
|
||||
|
||||
//function use d3.js for paint graph
|
||||
function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, error_w, error_c) {
|
||||
|
||||
//Check if they are numbers
|
||||
if(isNaN(min_w)){ min_w = 0; };
|
||||
if(isNaN(max_w)){ max_w = 0; };
|
||||
if(isNaN(min_c)){ min_c = 0; };
|
||||
if(isNaN(max_c)){ max_c = 0; };
|
||||
|
||||
//messages legend
|
||||
var legend_normal = '<?php echo __("Normal Status");?>';
|
||||
var legend_warning = '<?php echo __("Warning Status");?>';
|
||||
var legend_critical = '<?php echo __("Critical Status");?>';
|
||||
|
||||
//remove elements
|
||||
d3.select("#svg_dinamic rect").remove();
|
||||
$("#text-max_warning").removeClass("input_error");
|
||||
$("#text-max_critical").removeClass("input_error");
|
||||
|
||||
//if haven't errors
|
||||
if (error_w == 0 && error_c == 0){
|
||||
//parse element
|
||||
min_w = parseFloat(min_w);
|
||||
min_c = parseFloat(min_c);
|
||||
max_w = parseFloat(max_w);
|
||||
max_c = parseFloat(max_c);
|
||||
|
||||
//inicialize var
|
||||
var range_min = 0;
|
||||
var range_max = 0;
|
||||
var range_max_min = 0;
|
||||
var range_max_min = 0;
|
||||
|
||||
//Find the lowest possible value
|
||||
if(min_w < 0 || min_c < 0){
|
||||
if(min_w < min_c){
|
||||
range_min = min_w - 100;
|
||||
} else {
|
||||
range_min = min_c - 100;
|
||||
}
|
||||
} else if (min_w > 0 || min_c > 0) {
|
||||
if(min_w > min_c){
|
||||
range_max_min = min_w;
|
||||
} else {
|
||||
range_max_min = min_c;
|
||||
}
|
||||
//messages error
|
||||
var message_error_warning = '<?php echo __("Please introduce a maximum warning higher than the minimun warning") ?>';
|
||||
var message_error_critical = '<?php echo __("Please introduce a maximum critical higher than the minimun critical") ?>';
|
||||
|
||||
//if haven't error
|
||||
if(max_w == 0 || max_w > min_w){
|
||||
if(max_c == 0 || max_c > min_c){
|
||||
paint_graph_status(min_w, max_w, min_c, max_c, inverse_w,
|
||||
inverse_c, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical);
|
||||
} else {
|
||||
if(min_w < min_c){
|
||||
range_min = min_w - 100;
|
||||
} else {
|
||||
range_min = min_c - 100;
|
||||
}
|
||||
error_c = 1;
|
||||
paint_graph_status(0,0,0,0,0,0, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical);
|
||||
}
|
||||
|
||||
//Find the maximum possible value
|
||||
if(max_w > max_c){
|
||||
range_max = max_w + 100 + range_max_min;
|
||||
} else {
|
||||
range_max = max_c + 100 + range_max_min;
|
||||
}
|
||||
|
||||
//Controls whether the maximum = 0 is infinite
|
||||
if((max_w == 0 || max_w == 0.00) && min_w != 0){
|
||||
max_w = range_max;
|
||||
}
|
||||
if((max_c == 0 || max_c == 0.00) && min_c != 0){
|
||||
max_c = range_max;
|
||||
}
|
||||
|
||||
//Scale according to the position
|
||||
position = 200 / (range_max-range_min);
|
||||
|
||||
//axes
|
||||
var yScale = d3.scale.linear()
|
||||
.domain([range_min, range_max])
|
||||
.range([100, -100]);
|
||||
|
||||
var yAxis = d3.svg.axis()
|
||||
.orient("left")
|
||||
.scale(yScale);
|
||||
|
||||
//create svg
|
||||
var svg = d3.select("#svg_dinamic");
|
||||
//delete elements
|
||||
svg.selectAll("g").remove();
|
||||
svg.selectAll("rect").remove();
|
||||
svg.selectAll("text").remove();
|
||||
svg.append("g")
|
||||
.attr("transform", "translate(0, 100)")
|
||||
.call(yAxis);
|
||||
|
||||
//legend Normal text
|
||||
svg.append("text")
|
||||
.attr("x", 0)
|
||||
.attr("y", -20)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 10)
|
||||
.html(legend_normal)
|
||||
.style("text-anchor", "first");
|
||||
|
||||
//legend Normal rect
|
||||
svg.append("rect")
|
||||
.attr("id", "legend_normal")
|
||||
.attr("x", 72)
|
||||
.attr("y", -30)
|
||||
.attr("width", '10px')
|
||||
.attr("height", '10px')
|
||||
.style("fill", "#82B92E");
|
||||
|
||||
//legend Warning text
|
||||
svg.append("text")
|
||||
.attr("x", 91)
|
||||
.attr("y", -20)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 10)
|
||||
.html(legend_warning)
|
||||
.style("text-anchor", "first");
|
||||
|
||||
//legend Warning rect
|
||||
svg.append("rect")
|
||||
.attr("id", "legend_warning")
|
||||
.attr("x", 168)
|
||||
.attr("y", -30)
|
||||
.attr("width", '10px')
|
||||
.attr("height", '10px')
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
//legend Critical text
|
||||
svg.append("text")
|
||||
.attr("x", 187)
|
||||
.attr("y", -20)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 10)
|
||||
.html(legend_critical)
|
||||
.style("text-anchor", "first");
|
||||
|
||||
//legend critical rect
|
||||
svg.append("rect")
|
||||
.attr("id", "legend_critical")
|
||||
.attr("x", 258)
|
||||
.attr("y", -30)
|
||||
.attr("width", '10px')
|
||||
.attr("height", '10px')
|
||||
.style("fill", "#fc4444");
|
||||
|
||||
//styles for number and axes
|
||||
svg.selectAll("g .domain")
|
||||
.style("stroke-width", 2)
|
||||
.style("fill", "none")
|
||||
.style("stroke", "black");
|
||||
|
||||
svg.selectAll("g .tick text")
|
||||
.style("font-size", "9pt")
|
||||
.style("font-weight", "initial");
|
||||
|
||||
//estatus normal
|
||||
svg.append("rect")
|
||||
.attr("id", "warning_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 0)
|
||||
.attr("width", '300px')
|
||||
.attr("height", '200px')
|
||||
.style("fill", "#82B92E");
|
||||
|
||||
//controls the inverse warning
|
||||
if(inverse_w == 0){
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", ((range_max - min_w) * position) - ((max_w - min_w) * position))
|
||||
.attr("width", 300)
|
||||
.attr("height", ((max_w - min_w) * position))
|
||||
.style("fill", "#ffd731");
|
||||
}
|
||||
else {
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 200 - ((min_w -range_min) * position))
|
||||
.attr("width", 300)
|
||||
.attr("height", (min_w -range_min) * position)
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_inverse_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 0)
|
||||
.attr("width", 300)
|
||||
.attr("height", ((range_max - min_w) * position) - ((max_w - min_w) * position))
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
}
|
||||
//controls the inverse critical
|
||||
if(inverse_c == 0){
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", ((range_max - min_c) * position) - ((max_c - min_c) * position))
|
||||
.attr("width", 300)
|
||||
.attr("height", ((max_c - min_c) * position))
|
||||
.style("fill", "#fc4444");
|
||||
}
|
||||
else {
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 200 - ((min_c -range_min) * position))
|
||||
.attr("width", 300)
|
||||
.attr("height", (min_c -range_min) * position)
|
||||
.style("fill", "#fc4444");
|
||||
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_inverse_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 0)
|
||||
.attr("width", 300)
|
||||
.attr("height", ((range_max - min_c) * position) - ((max_c - min_c) * position))
|
||||
.style("fill", "#fc4444");
|
||||
}
|
||||
}
|
||||
else {
|
||||
var message_error_warning = '<?php echo __("Please introduce a maximum warning higher than the minimun warning") ?>';
|
||||
var message_error_critical = '<?php echo __("Please introduce a maximum critical higher than the minimun critical") ?>';
|
||||
|
||||
d3.select("#svg_dinamic rect").remove();
|
||||
//create svg
|
||||
var svg = d3.select("#svg_dinamic");
|
||||
svg.selectAll("g").remove();
|
||||
svg.selectAll("rect").remove();
|
||||
svg.selectAll("text").remove();
|
||||
//message error warning
|
||||
if (error_w == 1) {
|
||||
$("#text-max_warning").addClass("input_error");
|
||||
svg.append("text")
|
||||
.attr("x", -90)
|
||||
.attr("y", 10)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 14)
|
||||
.style("fill", "red")
|
||||
.html(message_error_warning)
|
||||
.style("text-anchor", "first");
|
||||
}
|
||||
//message error critical
|
||||
if (error_c == 1) {
|
||||
$("#text-max_critical").addClass("input_error");
|
||||
svg.append("text")
|
||||
.attr("x", -90)
|
||||
.attr("y", 105)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 14)
|
||||
.style("fill", "red")
|
||||
.html(message_error_critical)
|
||||
.style("text-anchor", "first");
|
||||
}
|
||||
|
||||
} else {
|
||||
error_w = 1;
|
||||
paint_graph_status(0,0,0,0,0,0, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical);
|
||||
}
|
||||
}
|
||||
|
||||
/* End of relationship javascript */
|
||||
|
||||
/* ]]> */
|
||||
|
|
|
@ -414,14 +414,19 @@ function snmpBrowserWindow () {
|
|||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 780,
|
||||
height: 430
|
||||
width: 920,
|
||||
height: 500
|
||||
});
|
||||
}
|
||||
|
||||
// Set the form OID to the value selected in the SNMP browser
|
||||
function setOID () {
|
||||
$('#text-snmp_oid').val($('#snmp_selected_oid').text());
|
||||
|
||||
if($('#snmp_browser_version').val() == '3'){
|
||||
$('#text-snmp_oid').val($('#table1-0-1').text());
|
||||
} else {
|
||||
$('#text-snmp_oid').val($('#snmp_selected_oid').text());
|
||||
}
|
||||
|
||||
// Close the SNMP browser
|
||||
$('.ui-dialog-titlebar-close').trigger('click');
|
||||
|
|
|
@ -132,8 +132,8 @@ $form_filter .= "</tr>";
|
|||
$form_filter .= "<tr>";
|
||||
$form_filter .= "<td style='font-weight: bold;'>".__('Enabled / Disabled')."</td><td>";
|
||||
$ed_list = array ();
|
||||
$ed_list[0] = __('Enable');
|
||||
$ed_list[1] = __('Disable');
|
||||
$ed_list[0] = __('Enabled');
|
||||
$ed_list[1] = __('Disabled');
|
||||
$form_filter .= html_print_select ($ed_list, 'enabledisable', $enabledisable, '', __('All'), -1, true);
|
||||
$form_filter .= "</td><td style='font-weight: bold;'>".__('Standby')."</td><td>";
|
||||
$sb_list = array ();
|
||||
|
|
|
@ -30,15 +30,15 @@ $default = (int) get_parameter('default', 0);
|
|||
|
||||
|
||||
if ($default != 0) {
|
||||
$event_fields = io_safe_input('evento,id_agente,estado,timestamp');
|
||||
$fields_selected = explode (',', $event_fields);
|
||||
//$event_fields = io_safe_input('evento,id_agente,estado,timestamp');
|
||||
$fields_selected = explode (',', $config['event_fields']);
|
||||
}
|
||||
else if ($update != '') {
|
||||
$fields_selected = (array)get_parameter('fields_selected');
|
||||
|
||||
if ($fields_selected[0] == '') {
|
||||
$event_fields = io_safe_input('evento,id_agente,estado,timestamp');
|
||||
$fields_selected = explode (',', $event_fields);
|
||||
//$event_fields = io_safe_input('evento,id_agente,estado,timestamp');
|
||||
$fields_selected = explode (',', $config['event_fields']);
|
||||
}
|
||||
else {
|
||||
$event_fields = implode (',', $fields_selected);
|
||||
|
@ -130,7 +130,7 @@ $event = array();
|
|||
|
||||
echo '<h3>'.__('Show event fields');
|
||||
echo ' <a href="index.php?sec=geventos&sec2=godmode/events/events§ion=fields&default=1">';
|
||||
html_print_image ('images/clean.png', false, array ('title' => __('Load default event fields'), 'onclick' => "if (! confirm ('" . __('Default event fields will be loaded. Do you want to continue?') ."')) return false"));
|
||||
html_print_image ('images/clean.png', false, array ('title' => __('Load the fields from previous events'), 'onclick' => "if (! confirm ('" . __('Event fields will be loaded. Do you want to continue?') ."')) return false"));
|
||||
echo '</a></h3>';
|
||||
|
||||
$table = new stdClass();
|
||||
|
|
|
@ -128,7 +128,7 @@ $table->data[4][1] .= html_print_input_text ('str_warning', $str_warning,
|
|||
$table->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
$table->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true);
|
||||
|
||||
$table->data[4][2] = '<svg id="svg_dinamic" width="350" height="200" style="padding:40px; padding-left: 100px; margin-bottom: 60px;"> </svg>';
|
||||
$table->data[4][2] = '<svg id="svg_dinamic" width="800" height="300"> </svg>';
|
||||
$table->colspan[4][2] = 2;
|
||||
$table->rowspan[4][2] = 3;
|
||||
|
||||
|
@ -349,294 +349,37 @@ $next_row++;
|
|||
if(!inverse_w){ inverse_w = 0; }
|
||||
var inverse_c = $('input:checkbox[name=critical_inverse]:checked').val();
|
||||
if(!inverse_c){ inverse_c = 0; }
|
||||
|
||||
//inicialiced error
|
||||
var error_w = 0;
|
||||
var error_c = 0;
|
||||
//if haven't error
|
||||
if(max_w == 0 || max_w > min_w){
|
||||
if(max_c == 0 || max_c > min_c){
|
||||
paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, error_w, error_c);
|
||||
} else {
|
||||
error_c = 1;
|
||||
paint_graph_status(0,0,0,0,0,0, error_w, error_c);
|
||||
}
|
||||
} else {
|
||||
error_w = 1;
|
||||
paint_graph_status(0,0,0,0,0,0, error_w, error_c);
|
||||
}
|
||||
}
|
||||
|
||||
//function use d3.js for paint graph
|
||||
function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, error_w, error_c) {
|
||||
|
||||
//Check if they are numbers
|
||||
if(isNaN(min_w)){ min_w = 0; };
|
||||
if(isNaN(max_w)){ max_w = 0; };
|
||||
if(isNaN(min_c)){ min_c = 0; };
|
||||
if(isNaN(max_c)){ max_c = 0; };
|
||||
|
||||
//messages legend
|
||||
var legend_normal = '<?php echo __("Normal Status");?>';
|
||||
var legend_warning = '<?php echo __("Warning Status");?>';
|
||||
var legend_critical = '<?php echo __("Critical Status");?>';
|
||||
|
||||
//remove elements
|
||||
d3.select("#svg_dinamic rect").remove();
|
||||
$("#text-max_warning").removeClass("input_error");
|
||||
$("#text-max_critical").removeClass("input_error");
|
||||
|
||||
//if haven't errors
|
||||
if (error_w == 0 && error_c == 0){
|
||||
//parse element
|
||||
min_w = parseFloat(min_w);
|
||||
min_c = parseFloat(min_c);
|
||||
max_w = parseFloat(max_w);
|
||||
max_c = parseFloat(max_c);
|
||||
|
||||
//inicialize var
|
||||
var range_min = 0;
|
||||
var range_max = 0;
|
||||
var range_max_min = 0;
|
||||
var range_max_min = 0;
|
||||
|
||||
//Find the lowest possible value
|
||||
if(min_w < 0 || min_c < 0){
|
||||
if(min_w < min_c){
|
||||
range_min = min_w - 100;
|
||||
} else {
|
||||
range_min = min_c - 100;
|
||||
}
|
||||
} else if (min_w > 0 || min_c > 0) {
|
||||
if(min_w > min_c){
|
||||
range_max_min = min_w;
|
||||
} else {
|
||||
range_max_min = min_c;
|
||||
}
|
||||
//messages error
|
||||
var message_error_warning = '<?php echo __("Please introduce a maximum warning higher than the minimun warning") ?>';
|
||||
var message_error_critical = '<?php echo __("Please introduce a maximum critical higher than the minimun critical") ?>';
|
||||
|
||||
//if haven't error
|
||||
if(max_w == 0 || max_w > min_w){
|
||||
if(max_c == 0 || max_c > min_c){
|
||||
paint_graph_status(min_w, max_w, min_c, max_c, inverse_w,
|
||||
inverse_c, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical);
|
||||
} else {
|
||||
if(min_w < min_c){
|
||||
range_min = min_w - 100;
|
||||
} else {
|
||||
range_min = min_c - 100;
|
||||
}
|
||||
error_c = 1;
|
||||
paint_graph_status(0,0,0,0,0,0, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical);
|
||||
}
|
||||
|
||||
//Find the maximum possible value
|
||||
if(max_w > max_c){
|
||||
range_max = max_w + 100 + range_max_min;
|
||||
} else {
|
||||
range_max = max_c + 100 + range_max_min;
|
||||
}
|
||||
|
||||
//Controls whether the maximum = 0 is infinite
|
||||
if((max_w == 0 || max_w == 0.00) && min_w != 0){
|
||||
max_w = range_max;
|
||||
}
|
||||
if((max_c == 0 || max_c == 0.00) && min_c != 0){
|
||||
max_c = range_max;
|
||||
}
|
||||
|
||||
//Scale according to the position
|
||||
position = 200 / (range_max-range_min);
|
||||
|
||||
//axes
|
||||
var yScale = d3.scale.linear()
|
||||
.domain([range_min, range_max])
|
||||
.range([100, -100]);
|
||||
|
||||
var yAxis = d3.svg.axis()
|
||||
.orient("left")
|
||||
.scale(yScale);
|
||||
|
||||
//create svg
|
||||
var svg = d3.select("#svg_dinamic");
|
||||
//delete elements
|
||||
svg.selectAll("g").remove();
|
||||
svg.selectAll("rect").remove();
|
||||
svg.selectAll("text").remove();
|
||||
svg.append("g")
|
||||
.attr("transform", "translate(0, 100)")
|
||||
.call(yAxis);
|
||||
|
||||
//legend Normal text
|
||||
svg.append("text")
|
||||
.attr("x", 0)
|
||||
.attr("y", -20)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 10)
|
||||
.html(legend_normal)
|
||||
.style("text-anchor", "first");
|
||||
|
||||
//legend Normal rect
|
||||
svg.append("rect")
|
||||
.attr("id", "legend_normal")
|
||||
.attr("x", 72)
|
||||
.attr("y", -30)
|
||||
.attr("width", '10px')
|
||||
.attr("height", '10px')
|
||||
.style("fill", "#82B92E");
|
||||
|
||||
//legend Warning text
|
||||
svg.append("text")
|
||||
.attr("x", 91)
|
||||
.attr("y", -20)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 10)
|
||||
.html(legend_warning)
|
||||
.style("text-anchor", "first");
|
||||
|
||||
//legend Warning rect
|
||||
svg.append("rect")
|
||||
.attr("id", "legend_warning")
|
||||
.attr("x", 168)
|
||||
.attr("y", -30)
|
||||
.attr("width", 10)
|
||||
.attr("height", 10)
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
//legend Critical text
|
||||
svg.append("text")
|
||||
.attr("x", 187)
|
||||
.attr("y", -20)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 10)
|
||||
.html(legend_critical)
|
||||
.style("text-anchor", "first");
|
||||
|
||||
//legend critical rect
|
||||
svg.append("rect")
|
||||
.attr("id", "legend_critical")
|
||||
.attr("x", 258)
|
||||
.attr("y", -30)
|
||||
.attr("width", 10)
|
||||
.attr("height", 10)
|
||||
.style("fill", "#fc4444");
|
||||
|
||||
//styles for number and axes
|
||||
svg.selectAll("g .domain")
|
||||
.style("stroke-width", 2)
|
||||
.style("fill", "none")
|
||||
.style("stroke", "black");
|
||||
|
||||
svg.selectAll("g .tick text")
|
||||
.style("font-size", "9pt")
|
||||
.style("font-weight", "initial");
|
||||
|
||||
//estatus normal
|
||||
svg.append("rect")
|
||||
.attr("id", "warning_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 0)
|
||||
.attr("width", 300)
|
||||
.attr("height", 200)
|
||||
.style("fill", "#82B92E");
|
||||
|
||||
//controls the inverse warning
|
||||
if(inverse_w == 0){
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", ((range_max - min_w) * position) - ((max_w - min_w) * position))
|
||||
.attr("width", 300)
|
||||
.attr("height", ((max_w - min_w) * position))
|
||||
.style("fill", "#ffd731");
|
||||
}
|
||||
else {
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 200 - ((min_w -range_min) * position))
|
||||
.attr("width", 300)
|
||||
.attr("height", (min_w -range_min) * position)
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_inverse_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 0)
|
||||
.attr("width", 300)
|
||||
.attr("height", ((range_max - min_w) * position) - ((max_w - min_w) * position))
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
}
|
||||
//controls the inverse critical
|
||||
if(inverse_c == 0){
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", ((range_max - min_c) * position) - ((max_c - min_c) * position))
|
||||
.attr("width", 300)
|
||||
.attr("height", ((max_c - min_c) * position))
|
||||
.style("fill", "#fc4444");
|
||||
}
|
||||
else {
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 200 - ((min_c -range_min) * position))
|
||||
.attr("width", 300)
|
||||
.attr("height", (min_c -range_min) * position)
|
||||
.style("fill", "#fc4444");
|
||||
|
||||
svg.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_inverse_rect")
|
||||
.attr("x", 3)
|
||||
.attr("y", 0)
|
||||
.attr("width", 300)
|
||||
.attr("height", ((range_max - min_c) * position) - ((max_c - min_c) * position))
|
||||
.style("fill", "#fc4444");
|
||||
}
|
||||
}
|
||||
else {
|
||||
var message_error_warning = '<?php echo __("Please introduce a maximum warning higher than the minimun warning") ?>';
|
||||
var message_error_critical = '<?php echo __("Please introduce a maximum critical higher than the minimun critical") ?>';
|
||||
|
||||
d3.select("#svg_dinamic rect").remove();
|
||||
//create svg
|
||||
var svg = d3.select("#svg_dinamic");
|
||||
svg.selectAll("g").remove();
|
||||
svg.selectAll("rect").remove();
|
||||
svg.selectAll("text").remove();
|
||||
//message error warning
|
||||
if (error_w == 1) {
|
||||
$("#text-max_warning").addClass("input_error");
|
||||
svg.append("text")
|
||||
.attr("x", -90)
|
||||
.attr("y", 10)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 14)
|
||||
.style("fill", "red")
|
||||
.html(message_error_warning)
|
||||
.style("text-anchor", "first");
|
||||
}
|
||||
//message error critical
|
||||
if (error_c == 1) {
|
||||
$("#text-max_critical").addClass("input_error");
|
||||
svg.append("text")
|
||||
.attr("x", -90)
|
||||
.attr("y", 105)
|
||||
.attr("fill", 'black')
|
||||
.style("font-family", "arial")
|
||||
.style("font-weight", "bold")
|
||||
.style("font-size", 14)
|
||||
.style("fill", "red")
|
||||
.html(message_error_critical)
|
||||
.style("text-anchor", "first");
|
||||
}
|
||||
|
||||
} else {
|
||||
error_w = 1;
|
||||
paint_graph_status(0,0,0,0,0,0, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
@ -32,6 +32,7 @@ require_once($config['homedir'] . "/include/functions_modules.php");
|
|||
require_once($config['homedir'] . "/include/functions_groups.php");
|
||||
|
||||
$editGraph = (bool) get_parameter('edit_graph', 0);
|
||||
$action = get_parameter('action', '');
|
||||
|
||||
if (isset ($_GET["get_agent"])) {
|
||||
$id_agent = $_POST["id_agent"];
|
||||
|
@ -39,6 +40,122 @@ if (isset ($_GET["get_agent"])) {
|
|||
$chunkdata = $_POST["chunk"];
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'sort_items':
|
||||
$resultOperationDB = null;
|
||||
$position_to_sort = (int)get_parameter('position_to_sort', 1);
|
||||
$ids_serialize = (string)get_parameter('ids_items_to_sort', '');
|
||||
$move_to = (string)get_parameter('move_to', 'after');
|
||||
|
||||
$countItems = db_get_sql('
|
||||
SELECT COUNT(id_gs)
|
||||
FROM tgraph_source
|
||||
WHERE id_graph = ' . $id_graph);
|
||||
|
||||
if (($countItems < $position_to_sort) || ($position_to_sort < 1)) {
|
||||
$resultOperationDB = false;
|
||||
}
|
||||
else if (!empty($ids_serialize)) {
|
||||
$ids = explode('|', $ids_serialize);
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$items = db_get_all_rows_sql('
|
||||
SELECT id_gs, `field_order`
|
||||
FROM tgraph_source
|
||||
WHERE id_graph = ' . $id_graph . '
|
||||
ORDER BY `field_order`');
|
||||
break;
|
||||
}
|
||||
|
||||
if ($items === false) $items = array();
|
||||
|
||||
|
||||
// Clean the repeated order values
|
||||
$order_temp = 1;
|
||||
foreach ($items as $item) {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
db_process_sql_update('tgraph_source',
|
||||
array('`field_order`' => $order_temp),
|
||||
array('id_gs' => $item['id_rc']));
|
||||
break;
|
||||
}
|
||||
|
||||
$order_temp++;
|
||||
}
|
||||
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$items = db_get_all_rows_sql('
|
||||
SELECT id_gs, `field_order`
|
||||
FROM tgraph_source
|
||||
WHERE id_graph = ' . $id_graph . '
|
||||
ORDER BY `field_order`');
|
||||
break;
|
||||
}
|
||||
|
||||
if ($items === false) $items = array();
|
||||
|
||||
|
||||
|
||||
$temp = array();
|
||||
|
||||
$temp = array();
|
||||
foreach ($items as $item) {
|
||||
//Remove the contents from the block to sort
|
||||
if (array_search($item['id_gs'], $ids) === false) {
|
||||
$temp[$item['field_order']] = $item['id_gs'];
|
||||
}
|
||||
}
|
||||
$items = $temp;
|
||||
|
||||
|
||||
|
||||
$sorted_items = array();
|
||||
foreach ($items as $pos => $id_unsort) {
|
||||
if ($pos == $position_to_sort) {
|
||||
if ($move_to == 'after') {
|
||||
$sorted_items[] = $id_unsort;
|
||||
}
|
||||
|
||||
foreach ($ids as $id) {
|
||||
$sorted_items[] = $id;
|
||||
}
|
||||
|
||||
if ($move_to != 'after') {
|
||||
$sorted_items[] = $id_unsort;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sorted_items[] = $id_unsort;
|
||||
}
|
||||
}
|
||||
|
||||
$items = $sorted_items;
|
||||
|
||||
|
||||
|
||||
foreach ($items as $order => $id) {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
|
||||
db_process_sql_update('tgraph_source',
|
||||
array('`field_order`' => ($order + 1)),
|
||||
array('id_gs' => $id));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$resultOperationDB = true;
|
||||
}
|
||||
else {
|
||||
$resultOperationDB = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($editGraph) {
|
||||
$graphRows = db_get_all_rows_sql("SELECT t1.*,
|
||||
(SELECT t3.alias
|
||||
|
@ -49,7 +166,8 @@ if ($editGraph) {
|
|||
WHERE t2.id_agente_modulo = t1.id_agent_module))
|
||||
AS agent_name
|
||||
FROM tgraph_source t1
|
||||
WHERE t1.id_graph = " . $id_graph);
|
||||
WHERE t1.id_graph = " . $id_graph . " order by `field_order`");
|
||||
$position_array = array();
|
||||
$module_array = array();
|
||||
$weight_array = array();
|
||||
$agent_array = array();
|
||||
|
@ -65,6 +183,7 @@ if ($editGraph) {
|
|||
$weight_array[] = $graphRow['weight'];
|
||||
$label_array[] = $graphRow['label'];
|
||||
$agent_array[] = $graphRow['agent_name'];
|
||||
$position_array[] = $graphRow['field_order'];
|
||||
}
|
||||
|
||||
$graphInTgraph = db_get_row_sql("SELECT * FROM tgraph WHERE id_graph = " . $id_graph);
|
||||
|
@ -81,11 +200,13 @@ if ($editGraph) {
|
|||
if (count($module_array) > 0) {
|
||||
echo "<table width='100%' cellpadding=4 cellpadding=4 class='databox filters'>";
|
||||
echo "<tr>
|
||||
<th>".__('P.')."</th>
|
||||
<th>".__('Agent')."</th>
|
||||
<th>".__('Module')."</th>
|
||||
<th>".__('Label')."</th>
|
||||
<th>".__('Weight')."</th>
|
||||
<th>".__('Delete')."</th>";
|
||||
<th>".__('Delete')."</th>
|
||||
<th>".__('Sort')."</th>";
|
||||
$color = 0;
|
||||
for ($a = 0; $a < count($module_array); $a++) {
|
||||
// Calculate table line color
|
||||
|
@ -98,7 +219,8 @@ if (count($module_array) > 0) {
|
|||
$color = 1;
|
||||
}
|
||||
|
||||
echo "<tr><td class='$tdcolor'>" . $agent_array[$a] . "</td>";
|
||||
echo "<tr><td class='$tdcolor'>$position_array[$a]</td>";
|
||||
echo "<td class='$tdcolor'>" . $agent_array[$a] . "</td>";
|
||||
echo "<td class='$tdcolor'>";
|
||||
echo modules_get_agentmodule_name ($module_array[$a])."</td>";
|
||||
|
||||
|
@ -126,11 +248,55 @@ if (count($module_array) > 0) {
|
|||
echo "<td class='$tdcolor' align=''>";
|
||||
echo "<a href='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&tab=graph_editor&delete_module=1&id=". $id_graph ."&delete=" . $idgs_array[$a] . "'>".html_print_image('images/cross.png', true, array ('title' => __('Delete')))."</a>";
|
||||
|
||||
echo "</td></tr>";
|
||||
echo "</td>";
|
||||
|
||||
echo "<td>";
|
||||
|
||||
echo html_print_checkbox_extended('sorted_items[]', $idgs_array[$a], false, false, '', 'class="selected_check"', true);
|
||||
|
||||
echo "</td>";
|
||||
|
||||
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->colspan[0][0] = 3;
|
||||
$table->size = array();
|
||||
$table->size[0] = '25%';
|
||||
$table->size[1] = '25%';
|
||||
$table->size[2] = '25%';
|
||||
$table->size[3] = '25%';
|
||||
if (defined("METACONSOLE")) {
|
||||
$table->class = "databox data";
|
||||
$table->head[0] = __("Sort items");
|
||||
$table->head_colspan[0] = 4;
|
||||
$table->headstyle[0] = 'text-align: center';
|
||||
}
|
||||
else {
|
||||
$table->data[0][0] = "<b>". __("Sort items") . "</b>";
|
||||
}
|
||||
$table->data[1][0] = __('Sort selected items');
|
||||
$table->data[1][1] = html_print_select_style(
|
||||
array('before' => __('before to'), 'after' => __('after to')), 'move_to',
|
||||
'', '', '', '', 0, true);
|
||||
$table->data[1][2] = html_print_input_text_extended('position_to_sort', 1,
|
||||
'text-position_to_sort', '', 3, 10, false, "only_numbers('position_to_sort');", '', true);
|
||||
$table->data[1][2] .= html_print_input_hidden('ids_items_to_sort', '', true);
|
||||
$table->data[1][3] = html_print_submit_button(__('Sort'), 'sort_submit', false, 'class="sub upd"', true);
|
||||
$table->data[1][4] = html_print_input_hidden('action', 'sort_items', true);
|
||||
|
||||
echo "<form action='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&tab=graph_editor&edit_graph=1&id=".$id_graph."' method='post' onsubmit='return added_ids_sorted_items_to_hidden_input();'>";
|
||||
html_print_table($table);
|
||||
echo "</form>";
|
||||
|
||||
echo "<br>";
|
||||
|
||||
|
||||
//Configuration form
|
||||
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
|
||||
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&tab=graph_editor&add_module=1&edit_graph=1&id=" . $id_graph . "'>";
|
||||
|
@ -217,4 +383,28 @@ function filterByGroup(idGroup) {
|
|||
"json"
|
||||
);
|
||||
}
|
||||
|
||||
function added_ids_sorted_items_to_hidden_input() {
|
||||
var ids = '';
|
||||
var first = true;
|
||||
|
||||
$("input.selected_check:checked").each(function(i, val) {
|
||||
if (!first)
|
||||
ids = ids + '|';
|
||||
first = false;
|
||||
|
||||
ids = ids + $(val).val();
|
||||
});
|
||||
|
||||
$("input[name='ids_items_to_sort']").val(ids);
|
||||
|
||||
if (ids == '') {
|
||||
alert("<?php echo __("Please select any item to order");?>");
|
||||
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -66,6 +66,9 @@ if ($edit_graph) {
|
|||
$height = $graphInTgraph['height'];
|
||||
$check = false;
|
||||
$percentil = $graphInTgraph['percentil'];
|
||||
$summatory_series = $graphInTgraph['summatory_series'];
|
||||
$average_series = $graphInTgraph['average_series'];
|
||||
$modules_series = $graphInTgraph['modules_series'];
|
||||
|
||||
if ($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
|
||||
$stacked = CUSTOM_GRAPH_BULLET_CHART;
|
||||
|
@ -84,6 +87,9 @@ else {
|
|||
$stacked = 4;
|
||||
$check = false;
|
||||
$percentil = 0;
|
||||
$summatory_series = 0;
|
||||
$average_series = 0;
|
||||
$modules_series = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -177,6 +183,16 @@ echo "</div></td>";
|
|||
echo "<tr><td class='datos2'><b>".__('Percentil')."</b></td>";
|
||||
echo "<td class='datos2'>" . html_print_checkbox ("percentil", 1, $percentil, true) . "</td></tr>";
|
||||
|
||||
echo "<tr><td class='datos2'><b>".__('Add summatory series') .
|
||||
ui_print_help_tip (__("Adds synthetic series to the graph, using all module
|
||||
values to calculate the summation and/or average in each time interval.
|
||||
This feature could be used instead of synthetic modules if you only want to see a graph."), true) . "</b></td>";
|
||||
echo "<td class='datos2'>" . html_print_checkbox ("summatory_series", 1, $summatory_series, true) . "</td>
|
||||
<td class='datos2'><b>".__('Add average series')."</b></td>";
|
||||
echo "<td class='datos2'>" . html_print_checkbox ("average_series", 1, $average_series, true) . "</td></tr>";
|
||||
echo "<tr><td class='datos2'><b>".__('Modules and series')."</b></td>";
|
||||
|
||||
echo "<td class='datos2'>" . html_print_checkbox ("modules_series", 1, $modules_series, true) . "</td></tr>";
|
||||
echo "</table>";
|
||||
|
||||
if ($edit_graph) {
|
||||
|
@ -195,6 +211,12 @@ echo '<script type="text/javascript">
|
|||
}else{
|
||||
$("#thresholdDiv").hide();
|
||||
}
|
||||
|
||||
if(!$("#checkbox-summatory_series").is(":checked") && !$("#checkbox-average_series").is(":checked")){
|
||||
$("#checkbox-modules_series").attr("disabled", true);
|
||||
$("#checkbox-modules_series").attr("checked", false);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("#stacked").change(function(){
|
||||
|
@ -214,6 +236,24 @@ echo '<script type="text/javascript">
|
|||
$("#thresholdDiv").hide();
|
||||
}
|
||||
});
|
||||
|
||||
$("#checkbox-summatory_series").change(function() {
|
||||
if($("#checkbox-summatory_series").is(":checked") && $("#checkbox-modules_series").is(":disabled")) {
|
||||
$("#checkbox-modules_series").removeAttr("disabled");
|
||||
} else if(!$("#checkbox-average_series").is(":checked")) {
|
||||
$("#checkbox-modules_series").attr("disabled", true);
|
||||
$("#checkbox-modules_series").attr("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
$("#checkbox-average_series").change(function() {
|
||||
if($("#checkbox-average_series").is(":checked") && $("#checkbox-modules_series").is(":disabled")) {
|
||||
$("#checkbox-modules_series").removeAttr("disabled");
|
||||
} else if(!$("#checkbox-summatory_series").is(":checked")) {
|
||||
$("#checkbox-modules_series").attr("disabled", true);
|
||||
$("#checkbox-modules_series").attr("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
</script>';
|
||||
?>
|
||||
|
|
|
@ -87,6 +87,9 @@ if ($add_graph) {
|
|||
$period = get_parameter_post ("period");
|
||||
$threshold = get_parameter('threshold');
|
||||
$percentil = get_parameter ("percentil", 0);
|
||||
$summatory_series = get_parameter ("summatory_series", 0);
|
||||
$average_series = get_parameter ("average_series", 0);
|
||||
$modules_series = get_parameter ("modules_series", 0);
|
||||
|
||||
if ($threshold == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
|
||||
$stacked = $threshold;
|
||||
|
@ -103,7 +106,10 @@ if ($add_graph) {
|
|||
'private' => 0,
|
||||
'id_group' => $idGroup,
|
||||
'stacked' => $stacked,
|
||||
'percentil' => $percentil
|
||||
'percentil' => $percentil,
|
||||
'summatory_series' => $summatory_series,
|
||||
'average_series' => $average_series,
|
||||
'modules_series' => $modules_series
|
||||
);
|
||||
|
||||
if (trim($name) != "") {
|
||||
|
@ -131,6 +137,9 @@ if ($update_graph) {
|
|||
$period = get_parameter('period');
|
||||
$stacked = get_parameter('stacked');
|
||||
$percentil = get_parameter('percentil');
|
||||
$summatory_series = get_parameter ("summatory_series");
|
||||
$average_series = get_parameter ("average_series");
|
||||
$modules_series = get_parameter ("modules_series");
|
||||
$alerts = get_parameter('alerts');
|
||||
$threshold = get_parameter('threshold');
|
||||
|
||||
|
@ -141,7 +150,10 @@ if ($update_graph) {
|
|||
if (trim($name) != "") {
|
||||
|
||||
$success = db_process_sql_update('tgraph',
|
||||
array('name' => $name, 'id_group' => $id_group, 'description' => $description, 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked, 'percentil' => $percentil ),
|
||||
array('name' => $name, 'id_group' => $id_group, 'description' => $description,
|
||||
'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked,
|
||||
'percentil' => $percentil, 'summatory_series' => $summatory_series,
|
||||
'average_series' => $average_series, 'modules_series' => $modules_series),
|
||||
array('id_graph' => $id_graph));
|
||||
if ($success !== false)
|
||||
db_pandora_audit("Report management", "Update graph #$id_graph");
|
||||
|
@ -179,10 +191,14 @@ if ($add_module) {
|
|||
implode("','", $id_modules).
|
||||
"')");
|
||||
|
||||
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
|
||||
foreach($id_agent_modules as $id_agent_module)
|
||||
$result = db_process_sql_insert('tgraph_source', array('id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight));
|
||||
}
|
||||
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
|
||||
$order = db_get_row_sql("SELECT `field_order` from tgraph_source ORDER BY `field_order` DESC");
|
||||
$order = $order['field_order'];
|
||||
foreach($id_agent_modules as $id_agent_module){
|
||||
$order++;
|
||||
$result = db_process_sql_insert('tgraph_source', array('id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight, 'field_order' => $order));
|
||||
}
|
||||
}
|
||||
else
|
||||
$result = false;
|
||||
}
|
||||
|
|
|
@ -1976,7 +1976,7 @@ function set_static_graph_status(idElement, image, status) {
|
|||
data: parameter,
|
||||
success: function (data) {
|
||||
set_static_graph_status(idElement, image, data);
|
||||
if(values['show_statistics'] == 1){
|
||||
if(data['show_statistics'] == 1){
|
||||
if($('#'+idElement+' table').css('float') == 'right' || $('#'+idElement+ ' table').css('float') == 'left'){
|
||||
$('#'+idElement+ ' img').css('margin-top', parseInt($('#'+idElement).css('height'))/2 - parseInt($('#'+idElement+ ' img').css('height'))/2);
|
||||
}
|
||||
|
|
|
@ -180,6 +180,7 @@ ui_require_javascript_file ('encode_decode_base64');
|
|||
tinyMCE.init({
|
||||
mode : "exact",
|
||||
elements: "text-label",
|
||||
convert_urls: false,
|
||||
theme : "advanced",
|
||||
<?php
|
||||
if ($config['style'] == 'pandora_legacy') {
|
||||
|
|
|
@ -106,6 +106,18 @@ if (is_ajax ()) {
|
|||
$row['name'] = __('Login attribute');
|
||||
$row['control'] = html_print_input_text ('ldap_login_attr', $config['ldap_login_attr'], '', 60, 100, true);
|
||||
$table->data['ldap_login_attr'] = $row;
|
||||
|
||||
// Admin LDAP login
|
||||
$row = array();
|
||||
$row['name'] = __('Admin LDAP login');
|
||||
$row['control'] = html_print_input_text ('ldap_admin_login', $config['ldap_admin_login'], '', 60, 100, true);
|
||||
$table->data['ldap_admin_login'] = $row;
|
||||
|
||||
// Admin LDAP password
|
||||
$row = array();
|
||||
$row['name'] = __('Admin LDAP password');
|
||||
$row['control'] = html_print_input_password ('ldap_admin_pass', $config['ldap_admin_pass'], $alt = '', 60, 100, true);
|
||||
$table->data['ldap_admin_pass'] = $row;
|
||||
break;
|
||||
|
||||
case 'pandora':
|
||||
|
|
|
@ -188,7 +188,7 @@ $table->data[32][0] = __('Server logs directory') . ui_print_help_tip (__("Direc
|
|||
$table->data[32][1] = html_print_input_text ('server_log_dir',
|
||||
$config["server_log_dir"], '', 50, 255, true);
|
||||
|
||||
$table->data[33][0] = __('Log size limit in system logs viewer extension') . ui_print_help_tip (__("Maximun size to show in system log extension."), true);
|
||||
$table->data[33][0] = __('Log size limit in system logs viewer extension') . ui_print_help_tip (__("Max size (in bytes) for the logs to be shown."), true);
|
||||
$table->data[33][1] = html_print_input_text ('max_log_size',
|
||||
$config["max_log_size"], '', 10, 255, true) . html_print_label(" x1000", "max_log_size", true);
|
||||
|
||||
|
@ -209,8 +209,8 @@ $table->data[34][0] = __('Allow create planned downtimes in the past') .
|
|||
$table->data[34][1] = __('Yes').' '.html_print_radio_button ('past_planned_downtimes', 1, '', $config["past_planned_downtimes"], true).' ';
|
||||
$table->data[34][1] .= __('No').' '.html_print_radio_button ('past_planned_downtimes', 0, '', $config["past_planned_downtimes"], true);
|
||||
|
||||
$table->data[35][0] = __('Limit parameters bulk') .
|
||||
ui_print_help_tip(__('Your PHP environment is setted with %d max_input_vars. Maybe you must not set this value with upper values.', ini_get("max_input_vars")), true);
|
||||
$table->data[35][0] = __('Limit for bulk operations') .
|
||||
ui_print_help_tip(__('Your PHP environment is set to 1000 max_input_vars. This parameter should have the same value or lower.', ini_get("max_input_vars")), true);
|
||||
$table->data[35][1] = html_print_input_text('limit_parameters_massive',
|
||||
$config['limit_parameters_massive'], '', 10, 10, true);
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ $update_filter = (int) get_parameter ('update_filter', -2);
|
|||
$delete_filter = (int) get_parameter ('delete_filter', -1);
|
||||
$description = (string) get_parameter ('description', '');
|
||||
$filter = (string) get_parameter ('filter', '');
|
||||
$index_post = (int) get_parameter('index_post', 0);
|
||||
|
||||
// Create/update header
|
||||
if ($edit_filter > -2) {
|
||||
|
@ -44,9 +45,35 @@ else {// Overview header
|
|||
|
||||
// Create/update filter
|
||||
if ($update_filter > -2) {
|
||||
// UPDATE
|
||||
if ($update_filter > -1) {
|
||||
$values = array('description' => $description, 'filter' => $filter);
|
||||
$result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $update_filter));
|
||||
$new_unified_id = (db_get_value_sql("SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $update_filter));
|
||||
$elements = get_parameter('elements', array());
|
||||
|
||||
$elements = explode(",", $elements);
|
||||
foreach ($elements as $e) {
|
||||
$filter = get_parameter('filter_' . $e);
|
||||
$values = array('description' => $description, 'filter' => $filter, 'unified_filters_id' => $new_unified_id);
|
||||
$result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $e));
|
||||
}
|
||||
if (count($elements) == 1) {
|
||||
$new_unified_id = (db_get_value_sql("SELECT MAX(unified_filters_id) FROM tsnmp_filter")) + 1;
|
||||
|
||||
$filter = get_parameter('filter_' . $elements[0]);
|
||||
$values = array('description' => $description, 'filter' => $filter, 'unified_filters_id' => $new_unified_id);
|
||||
$result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $elements[0]));
|
||||
}
|
||||
for ($i = 1; $i < $index_post; $i++) {
|
||||
$filter = get_parameter('filter_' . $i);
|
||||
if ($filter != "") {
|
||||
$values = array(
|
||||
'description' => $description,
|
||||
'filter' => $filter,
|
||||
'unified_filters_id' => $new_unified_id);
|
||||
$result = db_process_sql_insert('tsnmp_filter', $values);
|
||||
}
|
||||
}
|
||||
|
||||
if ($result === false) {
|
||||
ui_print_error_message (__('There was a problem updating the filter'));
|
||||
}
|
||||
|
@ -54,11 +81,29 @@ if ($update_filter > -2) {
|
|||
ui_print_success_message (__('Successfully updated'));
|
||||
}
|
||||
}
|
||||
// CREATE
|
||||
else {
|
||||
$values = array(
|
||||
'description' => $description,
|
||||
'filter' => $filter);
|
||||
$result = db_process_sql_insert('tsnmp_filter', $values);
|
||||
$new_unified_id = (db_get_value_sql("SELECT MAX(unified_filters_id) FROM tsnmp_filter")) + 1;
|
||||
|
||||
if ($index_post == 1) {
|
||||
$filter = get_parameter('filter_0');
|
||||
$values = array(
|
||||
'description' => $description,
|
||||
'filter' => $filter,
|
||||
'unified_filters_id' => 0);
|
||||
$result = db_process_sql_insert('tsnmp_filter', $values);
|
||||
}
|
||||
else {
|
||||
for ($i = 0; $i < $index_post; $i++) {
|
||||
$filter = get_parameter('filter_' . $i);
|
||||
$values = array(
|
||||
'description' => $description,
|
||||
'filter' => $filter,
|
||||
'unified_filters_id' => $new_unified_id);
|
||||
$result = db_process_sql_insert('tsnmp_filter', $values);
|
||||
}
|
||||
}
|
||||
|
||||
if ($result === false) {
|
||||
ui_print_error_message (__('There was a problem creating the filter'));
|
||||
}
|
||||
|
@ -68,7 +113,15 @@ if ($update_filter > -2) {
|
|||
}
|
||||
}
|
||||
else if ($delete_filter > -1) { // Delete
|
||||
$result = db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $delete_filter));
|
||||
$unified_id_to_delete = (db_get_value_sql("SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $delete_filter));
|
||||
|
||||
if ($unified_id_to_delete == 0) {
|
||||
$result = db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $delete_filter));
|
||||
}
|
||||
else {
|
||||
$result = db_process_sql_delete('tsnmp_filter', array('unified_filters_id' => $unified_id_to_delete));
|
||||
}
|
||||
|
||||
if ($result === false) {
|
||||
ui_print_error_message (__('There was a problem deleting the filter'));
|
||||
}
|
||||
|
@ -88,19 +141,50 @@ if ($edit_filter > -1) {
|
|||
|
||||
// Create/update form
|
||||
if ($edit_filter > -2) {
|
||||
$index = $index_post;
|
||||
$table->data = array ();
|
||||
$table->id = 'filter_table';
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
$table->data[0][0] = __('Description');
|
||||
$table->data[0][1] = html_print_input_text ('description', $description, '', 60, 100, true);
|
||||
$table->data[1][0] = __('Filter');
|
||||
$table->data[1][1] = html_print_input_text ('filter', $filter, '', 60, 100, true);
|
||||
$table->data[1][1] .= ui_print_help_tip (__("This field contains a substring, could be part of a IP address, a numeric OID, or a plain substring") . SEPARATOR_COLUMN, true);
|
||||
|
||||
if ($edit_filter > -1) {
|
||||
$filters = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = (SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $edit_filter . ")");
|
||||
$j = 1;
|
||||
foreach ($filters as $f) {
|
||||
if ($j != 1) {
|
||||
$table->data[$j][0] = "";
|
||||
}
|
||||
$table->data[$j][1] = html_print_input_text ('filter_' . $f['id_snmp_filter'], $f['filter'], '', 60, 100, true);
|
||||
if ($j == 1) {
|
||||
$table->data[$j][1] .= ui_print_help_tip (__("This field contains a substring, could be part of a IP address, a numeric OID, or a plain substring") . SEPARATOR_COLUMN, true);
|
||||
}
|
||||
else {
|
||||
$table->data[$j][1] .= html_print_image('images/cross.png', true, array('id' => 'delete_filter_' . $f['id_snmp_filter'], 'alt' => __('Click to remove the filter')));
|
||||
}
|
||||
$j++;
|
||||
$index++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$table->data[1][1] = html_print_input_text ('filter_' . $index, $filter, '', 60, 100, true);
|
||||
$table->data[1][1] .= ui_print_help_tip (__("This field contains a substring, could be part of a IP address, a numeric OID, or a plain substring") . SEPARATOR_COLUMN, true);
|
||||
}
|
||||
$index++;
|
||||
echo '<form action="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters" method="post">';
|
||||
html_print_input_hidden ('update_filter', $edit_filter);
|
||||
html_print_input_hidden ('index_post', $index);
|
||||
if ($edit_filter > -1) {
|
||||
$filters_to_post = array();
|
||||
foreach ($filters as $fil) {
|
||||
$filters_to_post[] = $fil['id_snmp_filter'];
|
||||
}
|
||||
html_print_input_hidden ('elements', implode(",", $filters_to_post));
|
||||
}
|
||||
html_print_table ($table);
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_image('images/add.png', false, array('id' => 'add_filter', 'alt' => __('Click to add new filter'), 'title' => __('Click to add new filter'), 'style' => 'float:left;'));
|
||||
if ($edit_filter > -1) {
|
||||
html_print_submit_button (__('Update'), 'submit_button', false, 'class="sub upd"');
|
||||
}
|
||||
|
@ -112,13 +196,13 @@ if ($edit_filter > -2) {
|
|||
// Overview
|
||||
}
|
||||
else {
|
||||
$result = db_get_all_rows_in_table ("tsnmp_filter");
|
||||
if ($result === false) {
|
||||
$result = array ();
|
||||
require_once ($config['homedir'] . "/general/firts_task/snmp_filters.php");
|
||||
return;
|
||||
$result_unified = db_get_all_rows_sql("SELECT DISTINCT(unified_filters_id) FROM tsnmp_filter ORDER BY unified_filters_id ASC");
|
||||
|
||||
$aglomerate_result = array();
|
||||
foreach ($result_unified as $res) {
|
||||
$aglomerate_result[$res['unified_filters_id']] = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = " . $res['unified_filters_id'] . " ORDER BY id_snmp_filter ASC");
|
||||
}
|
||||
|
||||
|
||||
$table->data = array ();
|
||||
$table->head = array ();
|
||||
$table->size = array ();
|
||||
|
@ -133,16 +217,43 @@ else {
|
|||
$table->head[2] = __('Action');
|
||||
$table->size[2] = "50px";
|
||||
$table->align[2] = 'center';
|
||||
|
||||
foreach ($result as $row) {
|
||||
$data = array ();
|
||||
$data[0] = '<a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&edit_filter='.$row['id_snmp_filter'].'">' . $row['description'] . '</a>';
|
||||
$data[1] = $row['filter'];
|
||||
$data[2] = '<a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&edit_filter='.$row['id_snmp_filter'].'">' .
|
||||
html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '</a>' .
|
||||
' <a onclick="if (confirm(\'' . __('Are you sure?') . '\')) return true; else return false;" href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&delete_filter='.$row['id_snmp_filter'].'">' .
|
||||
html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . '</a>';
|
||||
array_push ($table->data, $data);
|
||||
|
||||
foreach ($aglomerate_result as $ind => $row) {
|
||||
if ($ind == 0) {
|
||||
foreach ($row as $r) {
|
||||
$data = array ();
|
||||
$data[0] = '<a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&edit_filter='.$r['id_snmp_filter'].'">' . $r['description'] . '</a>';
|
||||
$data[1] = $r['filter'];
|
||||
$data[2] = '<a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&edit_filter='.$r['id_snmp_filter'].'">' .
|
||||
html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '</a>' .
|
||||
' <a onclick="if (confirm(\'' . __('Are you sure?') . '\')) return true; else return false;" href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&delete_filter='.$r['id_snmp_filter'].'">' .
|
||||
html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . '</a>';
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$ind2 = 0;
|
||||
$compose_filter = array();
|
||||
$compose_id = "";
|
||||
$compose_action = "";
|
||||
foreach ($row as $i => $r) {
|
||||
if ($ind2 == 0) {
|
||||
$compose_id = '<a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&edit_filter='.$r['id_snmp_filter'].'">' . $r['description'] . '</a>';
|
||||
$compose_action = '<a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&edit_filter='.$r['id_snmp_filter'].'">' .
|
||||
html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '</a>' .
|
||||
' <a onclick="if (confirm(\'' . __('Are you sure?') . '\')) return true; else return false;" href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&delete_filter='.$r['id_snmp_filter'].'">' .
|
||||
html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . '</a>';
|
||||
$ind2++;
|
||||
}
|
||||
$compose_filter[] = $r['filter'];
|
||||
}
|
||||
$data = array ();
|
||||
$data[0] = $compose_id;
|
||||
$data[1] = implode(" AND ", $compose_filter);
|
||||
$data[2] = $compose_action;
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!empty ($table->data)) {
|
||||
|
@ -157,3 +268,45 @@ else {
|
|||
echo '</form></div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
var id = "<?php echo $index; ?>";
|
||||
var homeurl = "<?php echo $config['homeurl']; ?>";
|
||||
|
||||
$(document).ready (function () {
|
||||
$('#add_filter').click(function(e) {
|
||||
$('#filter_table').append('<tr id="filter_table-' + id + '" style="" class="datos"><td id="filter_table-' + id + '-0" style="" class="datos "></td><td id="filter_table-' + id + '-1" style="" class="datos "><input type="text" name="filter_' + id + '" value="" id="text-filter_' + id + '" size="60" maxlength="100"><img src="' + homeurl + 'images/cross.png" onclick="delete_this_row(' + id + ');" data-title="Click to delete the filter" data-use_title_for_force_title="1" class="forced_title" alt="Click to delete the filter"></td></tr>');
|
||||
|
||||
id++;
|
||||
|
||||
$('#hidden-index_post').val(id);
|
||||
});
|
||||
|
||||
$('[id^=delete_filter_]').click(function(e) {
|
||||
var elem_id = this.id;
|
||||
var id_array = elem_id.split("delete_filter_");
|
||||
var id = id_array[1];
|
||||
|
||||
params = {};
|
||||
params['page'] = "include/ajax/snmp.ajax";
|
||||
params['delete_snmp_filter'] = 1;
|
||||
params['filter_id'] = id;
|
||||
|
||||
jQuery.ajax ({
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "html",
|
||||
success: function(data){
|
||||
var elem = $('#hidden-elements').val();
|
||||
$('#hidden-elements').val(elem - 1);
|
||||
$('#' + elem_id).parent().parent().remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function delete_this_row (id_row) {
|
||||
$('#filter_table-' + id_row).remove();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -180,7 +180,7 @@ if ($create_user) {
|
|||
$values["data_section"] = $dashboard;
|
||||
} else if (io_safe_output($values['section']) == 'Visual console') {
|
||||
$values["data_section"] = $visual_console;
|
||||
} else if ($values['section'] == 'Other'){
|
||||
} else if ($values['section'] == 'Other' || io_safe_output($values['section']) == 'External link'){
|
||||
$values["data_section"] = get_parameter ('data_section');
|
||||
}
|
||||
|
||||
|
@ -304,7 +304,7 @@ if ($update_user) {
|
|||
$values["data_section"] = $dashboard;
|
||||
} else if (io_safe_output($values['section']) == 'Visual console') {
|
||||
$values["data_section"] = $visual_console;
|
||||
} else if ($values['section'] == 'Other'){
|
||||
} else if ($values['section'] == 'Other' || io_safe_output($values['section']) == 'External link'){
|
||||
$values["data_section"] = get_parameter ('data_section');
|
||||
}
|
||||
|
||||
|
@ -334,6 +334,8 @@ if ($update_user) {
|
|||
else {
|
||||
$res2 = update_user_password ($id, $password_new);
|
||||
if ($res2) {
|
||||
db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password change',
|
||||
'descripcion' => 'Access password updated','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time()));
|
||||
$res3 = save_pass_history($id, $password_new);
|
||||
}
|
||||
ui_print_result_message ($res1 || $res2,
|
||||
|
@ -345,6 +347,8 @@ if ($update_user) {
|
|||
$res2 = update_user_password ($id, $password_new);
|
||||
if ($res2) {
|
||||
$res3 = save_pass_history($id, $password_new);
|
||||
db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password change',
|
||||
'descripcion' => 'Access password updated','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time()));
|
||||
}
|
||||
ui_print_result_message ($res1 || $res2,
|
||||
__('User info successfully updated'),
|
||||
|
@ -352,6 +356,8 @@ if ($update_user) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password change',
|
||||
'descripcion' => 'Access password update failed','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time()));
|
||||
ui_print_error_message (__('Passwords does not match'));
|
||||
}
|
||||
}
|
||||
|
@ -564,6 +570,7 @@ $values = array (
|
|||
'Group view'=>__('Group view'),
|
||||
'Tactical view'=>__('Tactical view'),
|
||||
'Alert detail' => __('Alert detail'),
|
||||
'External link' => __('External link'),
|
||||
'Other'=>__('Other'));
|
||||
if (enterprise_installed() && !is_metaconsole()) {
|
||||
$values['Dashboard'] = __('Dashboard');
|
||||
|
@ -864,6 +871,11 @@ function show_data_section () {
|
|||
$("#dashboard").css("display", "none");
|
||||
$("#visual_console").css("display", "none");
|
||||
break;
|
||||
case <?php echo "'" . 'External link' . "'"; ?>:
|
||||
$("#text-data_section").css("display", "");
|
||||
$("#dashboard").css("display", "none");
|
||||
$("#visual_console").css("display", "none");
|
||||
break;
|
||||
case <?php echo "'" . 'Other' . "'"; ?>:
|
||||
$("#text-data_section").css("display", "");
|
||||
$("#dashboard").css("display", "none");
|
||||
|
|
|
@ -76,11 +76,11 @@ switch ($sortField) {
|
|||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectLastConnectUp = $selected;
|
||||
$order = array('field' => 'fullname', 'order' => 'ASC');
|
||||
$order = array('field' => 'last_connect', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectLastConnectDown = $selected;
|
||||
$order = array('field' => 'fullname', 'order' => 'DESC');
|
||||
$order = array('field' => 'last_connect', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -494,10 +494,4 @@ echo '</div>';
|
|||
enterprise_hook('close_meta_frame');
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
console.log('sknknan');
|
||||
// text-filter_search
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 545 B |
After Width: | Height: | Size: 451 B |
|
@ -478,10 +478,13 @@ if ($get_extended_event) {
|
|||
|
||||
if ($get_events_details) {
|
||||
$event_ids = explode(',',get_parameter ('event_ids'));
|
||||
$events = db_get_all_rows_filter ('tevento',
|
||||
array ('id_evento' => $event_ids,
|
||||
'order' => 'utimestamp ASC'),
|
||||
array ('evento', 'utimestamp', 'estado', 'criticity', 'id_usuario'));
|
||||
$events = db_get_all_rows_filter (
|
||||
'tevento',
|
||||
array ('id_evento' => $event_ids,'order' => 'utimestamp ASC'),
|
||||
array ('evento', 'utimestamp', 'estado', 'criticity', 'id_usuario'),
|
||||
'AND',
|
||||
true
|
||||
);
|
||||
|
||||
$out = '<table class="eventtable" style="width:100%;height:100%;padding:0px 0px 0px 0px; border-spacing: 0px; margin: 0px 0px 0px 0px;">';
|
||||
$out .= '<tr style="font-size:0px; heigth: 0px; background: #ccc;"><td></td><td></td></tr>';
|
||||
|
|
|
@ -123,12 +123,17 @@ if ($get_module_detail) {
|
|||
$time_from = (string) get_parameter ('time_from', date ('h:iA'));
|
||||
$date_to = (string) get_parameter ('date_to', date ('Y-m-j'));
|
||||
$time_to = (string) get_parameter ('time_to', date ('h:iA'));
|
||||
$freesearch = (string) get_parameter ('freesearch', '');
|
||||
$free_checkbox = (bool) get_parameter ('free_checkbox', false);
|
||||
|
||||
$formtable->width = '98%';
|
||||
$formtable->class = "databox";
|
||||
$formtable->data = array ();
|
||||
$formtable->size = array ();
|
||||
|
||||
$moduletype_name = modules_get_moduletype_name(
|
||||
modules_get_agentmodule_type($module_id));
|
||||
|
||||
$periods = array(SECONDS_5MINUTES =>__('5 minutes'),
|
||||
SECONDS_30MINUTES =>__('30 minutes'),
|
||||
SECONDS_1HOUR =>__('1 hour'),
|
||||
|
@ -175,10 +180,19 @@ if ($get_module_detail) {
|
|||
$formtable->data[1][2] .= html_print_input_text('time_to', $time_to,
|
||||
'', 9, 7, true);
|
||||
|
||||
html_print_table($formtable);
|
||||
$freesearch_object = '';
|
||||
if (preg_match("/_string/", $moduletype_name)) {
|
||||
$formtable->data[2][0] = __('Free search') . ' ';
|
||||
$formtable->data[2][1] = html_print_input_text ('freesearch', $freesearch, '', 20, null, true);
|
||||
$formtable->data[2][2] = html_print_checkbox('free_checkbox', 1, $free_checkbox, true);
|
||||
$formtable->data[2][2] .= ' ' . __('Exact phrase');
|
||||
$freesearch_object = json_encode( array(
|
||||
'value' => io_safe_output($freesearch),
|
||||
'exact' => (bool)$free_checkbox
|
||||
));
|
||||
}
|
||||
|
||||
$moduletype_name = modules_get_moduletype_name(
|
||||
modules_get_agentmodule_type($module_id));
|
||||
html_print_table($formtable);
|
||||
|
||||
$offset = (int) get_parameter("offset");
|
||||
$block_size = (int) $config["block_size"];
|
||||
|
@ -222,10 +236,10 @@ if ($get_module_detail) {
|
|||
}
|
||||
|
||||
$count = modules_get_agentmodule_data ($module_id, $period,
|
||||
$date, true, $conexion);
|
||||
$date, true, $conexion, 'ASC', $freesearch_object);
|
||||
|
||||
$module_data = modules_get_agentmodule_data ($module_id, $period,
|
||||
$date, false, $conexion, 'DESC');
|
||||
$date, false, $conexion, 'DESC', $freesearch_object);
|
||||
|
||||
if (empty($module_data)) {
|
||||
$result = array();
|
||||
|
@ -758,7 +772,7 @@ if ($list_modules) {
|
|||
$table->head[5] = __('Status') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=status&sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectStatusUp, "alt" => "up")) . '</a>' .
|
||||
'<a href="' . $url . '&sort_field=status&sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectStatusDown, "alt" => "down")) . '</a>';
|
||||
$table->head[6] = __('Warn');
|
||||
$table->head[6] = __('Thresholds');
|
||||
$table->head[7] = __('Data');
|
||||
$table->head[8] = __('Graph');
|
||||
$table->head[9] = __('Last contact') . ' ' .
|
||||
|
|
|
@ -20,6 +20,7 @@ require_once("include/functions_snmp.php");
|
|||
$save_snmp_translation = (bool)get_parameter('save_snmp_translation', 0);
|
||||
$delete_snmp_translation = (bool)get_parameter('delete_snmp_translation', 0);
|
||||
$update_snmp_translation = (bool)get_parameter('update_snmp_translation', 0);
|
||||
$delete_snmp_filter = (bool)get_parameter('delete_snmp_filter', 0);
|
||||
|
||||
/* skins image checks */
|
||||
if ($save_snmp_translation) {
|
||||
|
@ -56,4 +57,11 @@ if ($update_snmp_translation) {
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($delete_snmp_filter) {
|
||||
$filter_id = get_parameter('filter_id');
|
||||
db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $filter_id));
|
||||
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -33,8 +33,6 @@ if(is_ajax()){
|
|||
$snmp3_privacy_pass = io_safe_output(get_parameter('snmp3_browser_privacy_pass'));
|
||||
|
||||
$targets_oids = get_parameter ("oids", "");
|
||||
$targets_oids = explode(",", $targets_oids);
|
||||
|
||||
|
||||
$custom_action = get_parameter ("custom_action", "");
|
||||
if ($custom_action != "") {
|
||||
|
|
|
@ -17,8 +17,25 @@
|
|||
if (is_ajax ()) {
|
||||
global $config;
|
||||
|
||||
// Login check
|
||||
check_login ();
|
||||
enterprise_include_once("include/functions_dashboard.php");
|
||||
|
||||
$public_hash = get_parameter('hash', 0);
|
||||
|
||||
// Try to authenticate by hash on public dashboards
|
||||
if ($public_hash == 0) {
|
||||
// Login check
|
||||
check_login();
|
||||
} else {
|
||||
$validate_hash = enterprise_hook(
|
||||
'dasboard_validate_public_hash',
|
||||
array($public_hash, 'tree_view')
|
||||
);
|
||||
if ($validate_hash === false || $validate_hash === ENTERPRISE_NOT_HOOK) {
|
||||
db_pandora_audit("Invalid public hash", "Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
require_once($config['homedir'] . "/include/class/Tree.class.php");
|
||||
enterprise_include_once("include/class/Tree.class.php");
|
||||
|
@ -36,6 +53,10 @@ if (is_ajax ()) {
|
|||
$rootID = get_parameter('rootID', -1);
|
||||
$serverID = get_parameter('serverID', false);
|
||||
$childrenMethod = get_parameter('childrenMethod', 'on_demand');
|
||||
$hash = get_parameter('hash', false);
|
||||
if ($hash !== false) {
|
||||
enterprise_hook('dasboard_validate_public_hash', array($hash, 'tree_view'));
|
||||
}
|
||||
|
||||
$default_filters = array(
|
||||
'searchAgent' => '',
|
||||
|
|
|
@ -12,10 +12,30 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Login check
|
||||
global $config;
|
||||
|
||||
check_login ();
|
||||
enterprise_include_once ('include/functions_dashboard.php');
|
||||
require_once('include/functions_visual_map.php');
|
||||
enterprise_include_once('include/functions_visual_map.php');
|
||||
|
||||
$public_hash = get_parameter('hash', false);
|
||||
$id_visual_console = get_parameter('id_visual_console', null);
|
||||
|
||||
// Try to authenticate by hash on public dashboards
|
||||
if ($public_hash === false) {
|
||||
// Login check
|
||||
check_login();
|
||||
} else {
|
||||
$validate_hash = enterprise_hook(
|
||||
'dasboard_validate_public_hash',
|
||||
array($public_hash, $id_visual_console, 'visual_console')
|
||||
);
|
||||
if ($validate_hash === false || $validate_hash === ENTERPRISE_NOT_HOOK) {
|
||||
db_pandora_audit("Invalid public hash", "Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Fix: IW was the old ACL to check for report editing, now is RW
|
||||
if (! check_acl ($config['id_user'], 0, "VR")) {
|
||||
|
@ -29,12 +49,6 @@ if (! check_acl ($config['id_user'], 0, "VR")) {
|
|||
//Fix ajax to avoid include the file, 'functions_graph.php'.
|
||||
$ajax = true;
|
||||
|
||||
|
||||
require_once('include/functions_visual_map.php');
|
||||
enterprise_include_once('include/functions_visual_map.php');
|
||||
|
||||
$id_visual_console = get_parameter('id_visual_console', null);
|
||||
|
||||
$render_map = (bool)get_parameter('render_map', false);
|
||||
$graph_javascript = (bool)get_parameter('graph_javascript', false);
|
||||
|
||||
|
|
|
@ -750,6 +750,7 @@ switch ($action) {
|
|||
// Don't change the label because only change the positions
|
||||
unset($values['label']);
|
||||
unset($values['label_position']);
|
||||
// Don't change this values when move
|
||||
unset($values['id_agent']);
|
||||
unset($values['id_agente_modulo']);
|
||||
unset($values['enable_link']);
|
||||
|
|
|
@ -689,42 +689,72 @@ function ldap_process_user_login ($login, $password) {
|
|||
}
|
||||
}
|
||||
|
||||
$correct_admin_bind = true;
|
||||
if ($config['ldap_admin_login'] != "" && $config['ldap_admin_pass'] != "") {
|
||||
if (!@ldap_bind($ds, io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'])) {
|
||||
$correct_admin_bind = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$correct_admin_bind) {
|
||||
$config["auth_error"] = 'Admin ldap connection fail';
|
||||
@ldap_close ($ds);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$dc = io_safe_output($config["ldap_base_dn"]);
|
||||
|
||||
#Search group of this user it belong.
|
||||
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($login) . ")";
|
||||
$justthese = array("objectclass=group");
|
||||
|
||||
$sr = ldap_search($ds, $dc, $filter, $justthese);
|
||||
$sr=local_ldap_search($config["ldap_server"], $config["ldap_port"], $config["ldap_version"], $dc, $config['ldap_login_attr'], io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'], io_safe_output($login));
|
||||
|
||||
if (!$sr == false){
|
||||
$user_dn=$sr["dn"];
|
||||
|
||||
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
|
||||
|
||||
$memberof = ldap_get_entries($ds, $sr);
|
||||
|
||||
if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) {
|
||||
$correct = false;
|
||||
if(!empty($ldap_base_dn)) {
|
||||
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($user_dn), $password) ) {
|
||||
$correct = true;
|
||||
}
|
||||
} else {
|
||||
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
|
||||
$correct = true;
|
||||
}
|
||||
}
|
||||
@ldap_close ($ds);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$memberof = $memberof[0];
|
||||
}
|
||||
|
||||
unset($memberof["count"]);
|
||||
|
||||
} else {
|
||||
$sr = ldap_search($ds, $dc, $filter, $justthese);
|
||||
|
||||
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
|
||||
|
||||
$correct = false;
|
||||
if(!empty($ldap_base_dn)) {
|
||||
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($memberof['dn']), $password) ) {
|
||||
$correct = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
|
||||
$correct = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ldap_close ($ds);
|
||||
$memberof = ldap_get_entries($ds, $sr);
|
||||
|
||||
if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) {
|
||||
@ldap_close ($ds);
|
||||
return false;
|
||||
} else {
|
||||
$memberof = $memberof[0];
|
||||
}
|
||||
unset($memberof["count"]);
|
||||
|
||||
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
|
||||
$correct = false;
|
||||
if(!empty($ldap_base_dn)) {
|
||||
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($memberof['dn']), $password) ) {
|
||||
$correct = true;
|
||||
}
|
||||
} else {
|
||||
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
|
||||
$correct = true;
|
||||
}
|
||||
}
|
||||
@ldap_close ($ds);
|
||||
}
|
||||
|
||||
if ($correct) {
|
||||
return true;
|
||||
}
|
||||
|
@ -768,28 +798,46 @@ function get_ldap_login_attr ($login) {
|
|||
$id_user = $login;
|
||||
|
||||
switch ($config['ldap_login_user_attr']) {
|
||||
case 'email':
|
||||
case 'mail':
|
||||
$dc = io_safe_output($config["ldap_base_dn"]);
|
||||
|
||||
$correct_admin_bind = true;
|
||||
if ($config['ldap_admin_login'] != "" && $config['ldap_admin_pass'] != "") {
|
||||
if (!@ldap_bind($ds, io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'])) {
|
||||
$correct_admin_bind = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$correct_admin_bind) {
|
||||
$config["auth_error"] = 'Admin ldap connection fail';
|
||||
@ldap_close ($ds);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")";
|
||||
$justthese = array("mail");
|
||||
|
||||
$sr = ldap_search($ds, $dc, $filter, $justthese);
|
||||
|
||||
$info = ldap_get_entries($ds, $sr);
|
||||
$sr=local_ldap_search($config["ldap_server"], $config["ldap_port"], $config["ldap_version"], $dc, $config['ldap_login_attr'],io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'], io_safe_output($login));
|
||||
|
||||
if ($info["count"] == 0 && !isset($info[0]["mail"])) {
|
||||
if (!$sr == false){
|
||||
$id_user=$sr["mail"];
|
||||
@ldap_close ($ds);
|
||||
} else {
|
||||
$sr = ldap_search($ds, $dc, $filter, $justthese, 0, 0 ,2);
|
||||
|
||||
$info = ldap_get_entries($ds, $sr);
|
||||
if ($info["count"] == 0 && !isset($info[0]["mail"])) {
|
||||
@ldap_close ($ds);
|
||||
return $id_user;
|
||||
} else {
|
||||
$info = $info[0];
|
||||
}
|
||||
|
||||
$id_user = $info['mail'][0];
|
||||
@ldap_close ($ds);
|
||||
return $id_user;
|
||||
}
|
||||
else {
|
||||
$info = $info[0];
|
||||
}
|
||||
|
||||
$id_user = $info['mail'][0];
|
||||
|
||||
@ldap_close ($ds);
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -859,42 +907,75 @@ function prepare_permissions_groups_of_user_ldap ($id_user, $password,
|
|||
|
||||
$dc = io_safe_output($config["ldap_base_dn"]);
|
||||
|
||||
$correct_admin_bind = true;
|
||||
if ($config['ldap_admin_login'] != "" && $config['ldap_admin_pass'] != "") {
|
||||
if (!@ldap_bind($ds, io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'])) {
|
||||
$correct_admin_bind = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$correct_admin_bind) {
|
||||
$config["auth_error"] = 'Admin ldap connection fail';
|
||||
@ldap_close ($ds);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#Search group of this user it belong.
|
||||
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")";
|
||||
$justthese = array("objectclass=group");
|
||||
|
||||
$sr = ldap_search($ds, $dc, $filter, $justthese);
|
||||
|
||||
$memberof = ldap_get_entries($ds, $sr);
|
||||
|
||||
if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) {
|
||||
@ldap_close ($ds);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$memberof = $memberof[0];
|
||||
}
|
||||
|
||||
unset($memberof["count"]);
|
||||
|
||||
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
|
||||
|
||||
$correct = false;
|
||||
if(!empty($ldap_base_dn)) {
|
||||
if (strlen($password) != 0 && @ldap_bind($ds, $memberof['dn'], $password) ) {
|
||||
$correct = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
|
||||
$correct = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$correct) {
|
||||
@ldap_close ($ds);
|
||||
$sr=local_ldap_search($config["ldap_server"], $config["ldap_port"], $config["ldap_version"], $dc, $config['ldap_login_attr'], io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'], io_safe_output($id_user));
|
||||
|
||||
return false;
|
||||
if (!$sr == false) {
|
||||
$user_dn=$sr["dn"];
|
||||
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
|
||||
|
||||
$correct = false;
|
||||
if(!empty($ldap_base_dn)) {
|
||||
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($user_dn), $password) ) {
|
||||
$correct = true;
|
||||
}
|
||||
} else {
|
||||
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
|
||||
$correct = true;
|
||||
}
|
||||
}
|
||||
if (!$correct) {
|
||||
@ldap_close ($ds);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$sr = ldap_search($ds, $dc, $filter, $justthese, 0, 0, 2);
|
||||
|
||||
$memberof = ldap_get_entries($ds, $sr);
|
||||
|
||||
if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) {
|
||||
@ldap_close ($ds);
|
||||
return false;
|
||||
} else {
|
||||
$memberof = $memberof[0];
|
||||
}
|
||||
|
||||
unset($memberof["count"]);
|
||||
|
||||
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
|
||||
|
||||
$correct = false;
|
||||
if(!empty($ldap_base_dn)) {
|
||||
if (strlen($password) != 0 && @ldap_bind($ds, $memberof['dn'], $password) ) {
|
||||
$correct = true;
|
||||
}
|
||||
} else {
|
||||
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
|
||||
$correct = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$correct) {
|
||||
@ldap_close ($ds);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$permissions = array();
|
||||
|
@ -968,25 +1049,31 @@ function prepare_permissions_groups_of_user_ldap ($id_user, $password,
|
|||
if (!is_user ($id_user)) {
|
||||
if (($config['ldap_login_user_attr'] != 'name') && ($config['ldap_login_user_attr'] != null)) {
|
||||
switch ($config['ldap_login_user_attr']) {
|
||||
case 'email':
|
||||
case 'mail':
|
||||
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")";
|
||||
$justthese = array("mail");
|
||||
|
||||
$sr = ldap_search($ds, $dc, $filter, $justthese);
|
||||
$sr=local_ldap_search($config["ldap_server"], $config["ldap_port"], $config["ldap_version"], $dc, $config['ldap_login_attr'], io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'], io_safe_output($id_user));
|
||||
|
||||
if (!$sr == false){
|
||||
$id_user=$sr["mail"];
|
||||
$user_info['fullname']=$sr["mail"];
|
||||
} else {
|
||||
$sr = ldap_search($ds, $dc, $filter, $justthese, 0, 0, 2);
|
||||
|
||||
$info = ldap_get_entries($ds, $sr);
|
||||
if ($info["count"] == 0 && !isset($info[0]["mail"])) {
|
||||
@ldap_close ($ds);
|
||||
return false;
|
||||
} else {
|
||||
$info = $info[0];
|
||||
}
|
||||
|
||||
$id_user = $info['mail'][0];
|
||||
$user_info['fullname'] = $id_user;
|
||||
|
||||
}
|
||||
|
||||
$info = ldap_get_entries($ds, $sr);
|
||||
|
||||
if ($info["count"] == 0 && !isset($info[0]["mail"])) {
|
||||
@ldap_close ($ds);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$info = $info[0];
|
||||
}
|
||||
|
||||
$id_user = $info['mail'][0];
|
||||
$user_info['fullname'] = $id_user;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1299,6 +1386,35 @@ function delete_user_pass_ldap ($id_user) {
|
|||
return;
|
||||
}
|
||||
|
||||
function local_ldap_search($ldap_host, $ldap_port=389, $ldap_version=3, $dn, $access_attr, $ldap_admin_user, $ldap_admin_pass, $user) {
|
||||
$filter="(" . $access_attr . "=" . $user . ")";
|
||||
$shell_ldap_search = explode("\n", shell_exec('ldapsearch -LLL -o ldif-wrap=no -x -h ' . $ldap_host . ' -p ' . $ldap_port . ' -P ' . $ldap_version . ' -E pr=10000/noprompt -D "' . $ldap_admin_user . '" -w ' . $ldap_admin_pass . ' -b "' . $dn . '" -s sub "' . $filter . '" | grep -v "^#\|^$" | sed "s/:\+ /=>/g"'));
|
||||
foreach($shell_ldap_search as $line) {
|
||||
$values = explode("=>", $line);
|
||||
if(!empty($values[0]) && !empty($values[1])) {
|
||||
$user_attr[$values[0]] = $values[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($user_attr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$user_dn = safe_output_accute(base64_decode($user_attr["dn"]));
|
||||
if(strlen($user_dn) > 0) {
|
||||
$user_attr["dn"]=$user_dn;
|
||||
}
|
||||
|
||||
return $user_attr;
|
||||
}
|
||||
|
||||
function safe_output_accute($string) {
|
||||
$no_allowed= array ("á","é","í","ó","ú","Á","É","Í","Ó","Ú","ñ","Ñ");
|
||||
$allowed= array ("a","e","i","o","u","A","E","I","O","U","n","N");
|
||||
$result = str_replace($no_allowed, $allowed ,$string);
|
||||
return $result;
|
||||
}
|
||||
|
||||
//Reference the global use authorization error to last auth error.
|
||||
$config["auth_error"] = &$mysql_cache["auth_error"];
|
||||
?>
|
|
@ -23,6 +23,7 @@ class Tree {
|
|||
protected $filter = array();
|
||||
protected $childrenMethod = "on_demand";
|
||||
|
||||
protected $userGroupsACL;
|
||||
protected $userGroups;
|
||||
|
||||
protected $strictACL = false;
|
||||
|
@ -36,45 +37,29 @@ class Tree {
|
|||
$this->id = $id;
|
||||
$this->rootID = !empty($rootID) ? $rootID : $id;
|
||||
$this->serverID = $serverID;
|
||||
$this->childrenMethod = $childrenMethod;
|
||||
$this->access = $access;
|
||||
|
||||
$userGroups = users_get_groups(false, $this->access);
|
||||
$this->childrenMethod = $childrenMethod;
|
||||
$this->access = $access;
|
||||
|
||||
if (empty($userGroups))
|
||||
$this->userGroups = false;
|
||||
else
|
||||
$this->userGroups = $userGroups;
|
||||
$userGroupsACL = users_get_groups(false, $this->access);
|
||||
$this->userGroupsACL = empty($userGroupsACL) ? false : $userGroupsACL;
|
||||
$this->userGroups = $this->userGroupsACL;
|
||||
|
||||
global $config;
|
||||
include_once($config['homedir']."/include/functions_servers.php");
|
||||
include_once($config['homedir']."/include/functions_modules.php");
|
||||
require_once($config['homedir']."/include/functions_tags.php");
|
||||
|
||||
if (is_metaconsole())
|
||||
enterprise_include_once("meta/include/functions_ui_meta.php");
|
||||
if (is_metaconsole()) enterprise_include_once("meta/include/functions_ui_meta.php");
|
||||
|
||||
$this->strictACL = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
|
||||
|
||||
$this->acltags = tags_get_user_module_and_tags($config['id_user'], $this->access);
|
||||
}
|
||||
|
||||
public function setType($type) {
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
public function setFilter($filter) {
|
||||
$this->filter = $filter;
|
||||
}
|
||||
|
||||
public function isStrict () {
|
||||
return $this->strictACL;
|
||||
}
|
||||
|
||||
public function setStrict ($value) {
|
||||
$this->strictACL = (bool) $value;
|
||||
}
|
||||
|
||||
protected function getAgentStatusFilter ($status = -1) {
|
||||
if ($status == -1)
|
||||
$status = $this->filter['statusAgent'];
|
||||
|
@ -323,7 +308,7 @@ class Tree {
|
|||
case 'group':
|
||||
// ACL Group
|
||||
$user_groups_str = "-1";
|
||||
$group_acl = "";
|
||||
$group_filter = "";
|
||||
if (!$this->strictACL) {
|
||||
if (empty($this->userGroups)) {
|
||||
return;
|
||||
|
@ -338,7 +323,7 @@ class Tree {
|
|||
// Asking for all groups.
|
||||
else {
|
||||
$user_groups_str = implode(",", array_keys($this->userGroups));
|
||||
$group_acl = "AND ta.id_grupo IN ($user_groups_str)";
|
||||
$group_filter = "AND ta.id_grupo IN ($user_groups_str)";
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -356,7 +341,7 @@ class Tree {
|
|||
}
|
||||
}
|
||||
}
|
||||
$group_acl = "AND ta.id_grupo IN ($user_groups_str)";
|
||||
$group_filter = "AND ta.id_grupo IN ($user_groups_str)";
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
|
@ -390,7 +375,7 @@ class Tree {
|
|||
$module_status_join
|
||||
WHERE ta.disabled = 0
|
||||
AND ta.id_grupo = $item_for_count
|
||||
$group_acl
|
||||
$group_filter
|
||||
$agent_search_filter
|
||||
$agent_status_filter";
|
||||
$sql = $this->getAgentCountersSql($agent_table);
|
||||
|
@ -411,7 +396,7 @@ class Tree {
|
|||
FROM tmetaconsole_agent ta
|
||||
WHERE ta.disabled = 0
|
||||
AND ta.id_grupo = $item_for_count
|
||||
$group_acl
|
||||
$group_filter
|
||||
$agent_search_filter
|
||||
$agent_status_filter";
|
||||
$sql = $this->getAgentCountersSql($agent_table);
|
||||
|
@ -439,7 +424,7 @@ class Tree {
|
|||
$module_status_join
|
||||
WHERE ta.disabled = 0
|
||||
AND ta.id_grupo = $rootID
|
||||
$group_acl
|
||||
$group_filter
|
||||
$agent_search_filter
|
||||
$agent_status_filter
|
||||
GROUP BY $group_by_fields
|
||||
|
@ -456,7 +441,7 @@ class Tree {
|
|||
FROM tmetaconsole_agent ta
|
||||
WHERE ta.disabled = 0
|
||||
AND ta.id_grupo = $rootID
|
||||
$group_acl
|
||||
$group_filter
|
||||
$agent_search_filter
|
||||
$agent_status_filter
|
||||
ORDER BY $order_fields";
|
||||
|
@ -498,7 +483,7 @@ class Tree {
|
|||
ON ta.disabled = 0
|
||||
AND tam.id_agente = ta.id_agente
|
||||
AND ta.id_grupo = $rootID
|
||||
$group_acl
|
||||
$group_filter
|
||||
$agent_search_filter
|
||||
$agent_status_filter
|
||||
WHERE tam.disabled = 0
|
||||
|
@ -1123,7 +1108,8 @@ class Tree {
|
|||
if (empty($data))
|
||||
return array();
|
||||
|
||||
if ($this->type == 'agent') {
|
||||
// [26/10/2017] It seems the module hierarchy should be only available into the tree by group
|
||||
if ($this->rootType == 'group' && $this->type == 'agent') {
|
||||
$data = $this->getProcessedModules($data);
|
||||
}
|
||||
|
||||
|
@ -1866,6 +1852,25 @@ class Tree {
|
|||
}
|
||||
}
|
||||
|
||||
private static function extractGroupsWithIDs ($groups, $ids_hash) {
|
||||
$result_groups = array();
|
||||
foreach ($groups as $group) {
|
||||
if (isset($ids_hash[$group['id']])) {
|
||||
$result_groups[] = $group;
|
||||
}
|
||||
else if (!empty($group['children'])) {
|
||||
$result = self::extractGroupsWithIDs($group['children'], $ids_hash);
|
||||
|
||||
// Item found on children
|
||||
if (!empty($result)) {
|
||||
$result_groups = array_merge($result_groups, $result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result_groups;
|
||||
}
|
||||
|
||||
private static function extractItemWithID ($items, $item_id, $item_type = "group", $strictACL = false) {
|
||||
foreach ($items as $item) {
|
||||
if ($item["type"] != $item_type)
|
||||
|
@ -2155,14 +2160,33 @@ class Tree {
|
|||
|
||||
$processed_items = $this->getProcessedGroups($items, true);
|
||||
|
||||
// groupID filter. To access the view from tactical views f.e.
|
||||
if (!empty($processed_items) && !empty($this->filter['groupID'])) {
|
||||
$result = self::extractItemWithID($processed_items, $this->filter['groupID'], "group", $this->strictACL);
|
||||
if (!empty($processed_items)) {
|
||||
// Filter by group name. This should be done after rerieving the items cause we need the possible items descendants
|
||||
if (!empty($this->filter['searchGroup'])) {
|
||||
// Save the groups which intersect with the user groups
|
||||
$groups = db_get_all_rows_filter('tgrupo', array('nombre' => '%' . $this->filter['searchGroup'] . '%'));
|
||||
if ($groups == false) $groups = array();
|
||||
$userGroupsACL = $this->userGroupsACL;
|
||||
$ids_hash = array_reduce($groups, function ($userGroups, $group) use ($userGroupsACL) {
|
||||
$group_id = $group['id_grupo'];
|
||||
if (isset($userGroupsACL[$group_id])) {
|
||||
$userGroups[$group_id] = $userGroupsACL[$group_id];
|
||||
}
|
||||
|
||||
return $userGroups;
|
||||
}, array());
|
||||
|
||||
$result = self::extractGroupsWithIDs($processed_items, $ids_hash);
|
||||
|
||||
$processed_items = ($result === false) ? array() : $result;
|
||||
}
|
||||
|
||||
// groupID filter. To access the view from tactical views f.e.
|
||||
if (!empty($this->filter['groupID'])) {
|
||||
$result = self::extractItemWithID($processed_items, $this->filter['groupID'], "group", $this->strictACL);
|
||||
|
||||
if ($result === false)
|
||||
$processed_items = array();
|
||||
else
|
||||
$processed_items = array($result);
|
||||
$processed_items = ($result === false) ? array() : array($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Agents
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC171120';
|
||||
$pandora_version = 'v7.0NG.715';
|
||||
$build_version = 'PC171218';
|
||||
$pandora_version = 'v7.0NG.716';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
|
@ -357,6 +357,7 @@ define('SERVER_TYPE_ENTERPRISE_TRANSACTIONAL', 14);
|
|||
define('SERVER_TYPE_MAINFRAME', 15);
|
||||
define('SERVER_TYPE_SYNC', 16);
|
||||
define('SERVER_TYPE_WUX', 17);
|
||||
define('SERVER_TYPE_SYSLOG', 18);
|
||||
|
||||
/* REPORTS */
|
||||
define('REPORT_TOP_N_MAX', 1);
|
||||
|
|
|
@ -738,7 +738,7 @@ function mysql_db_get_row_sql ($sql, $search_history_db = false) {
|
|||
*
|
||||
* @return mixed Array of the row or false in case of error.
|
||||
*/
|
||||
function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join = 'AND') {
|
||||
function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join = 'AND', $historydb = false) {
|
||||
if (empty ($fields)) {
|
||||
$fields = '*';
|
||||
}
|
||||
|
@ -758,7 +758,7 @@ function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join
|
|||
|
||||
$sql = sprintf ('SELECT %s FROM %s %s', $fields, $table, $filter);
|
||||
|
||||
return db_get_row_sql ($sql);
|
||||
return db_get_row_sql ($sql, $historydb);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2580,7 +2580,7 @@ function get_percentile($percentile, $array) {
|
|||
$index = ($percentile / 100) * count($array);
|
||||
|
||||
if (floor($index) == $index) {
|
||||
$result = ($array[$index-1] + $array[$index]) / 2;
|
||||
$result = ($array[$index-1] + $array[$index]) / 2;
|
||||
}
|
||||
else {
|
||||
$result = $array[floor($index)];
|
||||
|
|
|
@ -55,6 +55,17 @@ function agents_get_agent_id_by_module_id ($id_agente_modulo) {
|
|||
'id_agente_modulo', $id_agente_modulo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get agent id from an agent alias.
|
||||
*
|
||||
* @param string $alias Agent alias.
|
||||
*
|
||||
* @return int Id from the agent.
|
||||
*/
|
||||
function agents_get_agent_id_by_alias ($alias) {
|
||||
return db_get_all_rows_sql ("SELECT id_agente FROM tagente WHERE upper(alias) LIKE upper('%$alias%')");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an agent
|
||||
*
|
||||
|
@ -314,6 +325,13 @@ function agents_get_agents ($filter = false, $fields = false,
|
|||
$search = '';
|
||||
}
|
||||
|
||||
if (isset($filter['search_custom'])) {
|
||||
$search_custom = $filter['search_custom'];
|
||||
unset($filter['search_custom']);
|
||||
} else {
|
||||
$search_custom = '';
|
||||
}
|
||||
|
||||
if (isset($filter['offset'])) {
|
||||
$offset = $filter['offset'];
|
||||
unset($filter['offset']);
|
||||
|
@ -450,8 +468,8 @@ function agents_get_agents ($filter = false, $fields = false,
|
|||
$sql_extra, $where, $where_nogroup, $status_sql, $search, $disabled);
|
||||
}
|
||||
else {
|
||||
$where = sprintf('%s AND %s AND (%s) %s AND %s',
|
||||
$where, $where_nogroup, $status_sql, $search, $disabled);
|
||||
$where = sprintf('%s AND %s AND (%s) %s AND %s %s',
|
||||
$where, $where_nogroup, $status_sql, $search, $disabled, $search_custom);
|
||||
}
|
||||
$sql = sprintf('SELECT %s
|
||||
FROM tagente
|
||||
|
|
|
@ -1039,14 +1039,16 @@ function alerts_delete_alert_agent_module ($id_alert_agent_module, $filter = fal
|
|||
$filter = array ();
|
||||
if ($id_alert_agent_module)
|
||||
$filter['id'] = $id_alert_agent_module;
|
||||
|
||||
// Get the modules of the fired alerts that will be deleted to update counts
|
||||
$filter_get = $filter;
|
||||
|
||||
$filter_get['group'] = 'id_agent_module';
|
||||
$filter_get['times_fired'] = '>0';
|
||||
|
||||
$fired_alert_modules = db_get_all_rows_filter('talert_template_modules', $filter_get, array('id_agent_module', 'COUNT(*) alerts'));
|
||||
|
||||
// Get the id agent to update the fired alert counts
|
||||
$agent_id = false;
|
||||
if (isset ($filter['id_agent_module'])){
|
||||
$agent_id = modules_get_agentmodule_agent ($filter["id_agent_module"]);
|
||||
}
|
||||
else if (isset ($filter['id'])){
|
||||
$alert = alerts_get_alert_agent_module($id_alert_agent_module);
|
||||
$agent_id = modules_get_agentmodule_agent ($alert["id_agent_module"]);
|
||||
}
|
||||
|
||||
/*
|
||||
The deletion of actions from talert_template_module_actions,
|
||||
|
@ -1054,6 +1056,11 @@ function alerts_delete_alert_agent_module ($id_alert_agent_module, $filter = fal
|
|||
a foreing key and delete on cascade.
|
||||
*/
|
||||
if (@db_process_sql_delete ('talert_template_modules', $filter) !== false) {
|
||||
// Update fired alert count on the agent
|
||||
// It will only occur if is specified the alert id or the id_agent_module
|
||||
if ($agent_id !== false) {
|
||||
db_process_sql(sprintf('UPDATE tagente SET update_alert_count=1 WHERE id_agente = %d', $agent_id));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -8531,7 +8531,7 @@ function api_set_enable_module ($agent_name, $module_name, $thrast3, $thrash4) {
|
|||
* @param string $template_name Name of the alert template (for example, "Warning event")
|
||||
* @param $thrash4 Don't use.
|
||||
|
||||
// http://localhost/pandora_console/include/api.php?op=set&op2=disable_alert&id=garfio&id2=Status&other=Warning%20condition
|
||||
// http://localhost/pandora_console/include/api.php?op=set&op2=disable_alert&id=c2cea5860613e363e25f4ba185b54fe28f869ff8a5e8bb46343288337c903531&id2=Status&other=Warning%20condition
|
||||
*/
|
||||
|
||||
function api_set_disable_alert ($agent_name, $module_name, $template_name, $thrash4) {
|
||||
|
@ -8543,11 +8543,53 @@ function api_set_disable_alert ($agent_name, $module_name, $template_name, $thra
|
|||
$id_agent_module = db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('id_agente' => $id_agent, 'nombre' => $module_name));
|
||||
$id_template = db_get_value_filter('id', 'talert_templates', array('name' => $template_name["data"]));
|
||||
|
||||
db_process_sql("UPDATE talert_template_modules
|
||||
$result = db_process_sql("UPDATE talert_template_modules
|
||||
SET disabled = 1
|
||||
WHERE id_agent_module = $id_agent_module AND id_alert_template = $id_template");
|
||||
|
||||
returnData('string', array('type' => 'string', 'data' => "Correct alert disable"));
|
||||
if ($result) {
|
||||
returnData('string', array('type' => 'string', 'data' => "Correct alert disable"));
|
||||
} else {
|
||||
returnData('string', array('type' => 'string', 'data' => __('Error alert disable')));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Disable an alert with alias
|
||||
*
|
||||
* @param string $agent_alias Alias of agent (for example "myagent")
|
||||
* @param string $module_name Name of the module (for example "Host alive")
|
||||
* @param string $template_name Name of the alert template (for example, "Warning event")
|
||||
* @param $thrash4 Don't use.
|
||||
|
||||
// http://localhost/pandora_console/include/api.php?op=set&op2=disable_alert_alias&id=garfio&id2=Status&other=Warning%20condition
|
||||
*/
|
||||
|
||||
function api_set_disable_alert_alias ($agent_alias, $module_name, $template_name, $thrash4) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$agent_id = agents_get_agent_id_by_alias($agent_alias);
|
||||
$result = false;
|
||||
foreach ($agent_id as $key => $id_agent) {
|
||||
$id_agent_module = db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('id_agente' => $id_agent['id_agente'], 'nombre' => $module_name));
|
||||
$id_template = db_get_value_filter('id', 'talert_templates', array('name' => $template_name["data"]));
|
||||
|
||||
$result = db_process_sql("UPDATE talert_template_modules
|
||||
SET disabled = 1
|
||||
WHERE id_agent_module = $id_agent_module AND id_alert_template = $id_template");
|
||||
|
||||
if ($result) {
|
||||
returnData('string', array('type' => 'string', 'data' => "Correct alert disable"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$result){
|
||||
returnData('string', array('type' => 'string', 'data' => __('Error alert disable')));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -343,6 +343,10 @@ function config_update_config () {
|
|||
$error_update[] = __('Base DN');
|
||||
if (!config_update_value ('ldap_login_attr', get_parameter ('ldap_login_attr')))
|
||||
$error_update[] = __('Login attribute');
|
||||
if (!config_update_value ('ldap_admin_login', get_parameter ('ldap_admin_login')))
|
||||
$error_update[] = __('Admin LDAP login');
|
||||
if (!config_update_value ('ldap_admin_pass', get_parameter ('ldap_admin_pass')))
|
||||
$error_update[] = __('Admin LDAP password');
|
||||
if (!config_update_value ('fallback_local_auth', get_parameter ('fallback_local_auth')))
|
||||
$error_update[] = __('Fallback to local authentication');
|
||||
if (!config_update_value ('ldap_login_user_attr', get_parameter ('ldap_login_user_attr')))
|
||||
|
@ -1358,6 +1362,14 @@ function config_process_config () {
|
|||
if (!isset ($config['ldap_login_attr'])) {
|
||||
config_update_value ( 'ldap_login_attr', 'uid');
|
||||
}
|
||||
|
||||
if (!isset ($config['ldap_admin_login'])) {
|
||||
config_update_value ( 'ldap_admin_login', '');
|
||||
}
|
||||
|
||||
if (!isset ($config['ldap_admin_pass'])) {
|
||||
config_update_value ( 'ldap_admin_pass', '');
|
||||
}
|
||||
|
||||
if (!isset ($config['fallback_local_auth'])) {
|
||||
config_update_value ( 'fallback_local_auth', '0');
|
||||
|
|
|
@ -30,24 +30,30 @@ function cron_update_module_interval ($module_id, $cron) {
|
|||
$module_interval = db_get_value_filter('module_interval','tagente_modulo',array("id_agente_modulo" => $module_id));
|
||||
return db_process_sql ('UPDATE tagente_estado SET current_interval = ' . $module_interval . ' WHERE id_agente_modulo = ' . (int) $module_id);
|
||||
} else {
|
||||
return db_process_sql ('UPDATE tagente_estado SET current_interval = ' . cron_next_execution ($cron) . ' WHERE id_agente_modulo = ' . (int) $module_id);
|
||||
return db_process_sql (
|
||||
'UPDATE tagente_estado SET current_interval = ' .
|
||||
cron_next_execution ($cron, $module_interval, $module_id) .
|
||||
' WHERE id_agente_modulo = ' .
|
||||
(int) $module_id)
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Get the number of seconds left to the next execution of the given cron entry.
|
||||
function cron_next_execution ($cron) {
|
||||
function cron_next_execution ($cron, $module_interval, $module_id) {
|
||||
|
||||
// Get day of the week and month from cron config
|
||||
list ($minute, $hour, $mday, $month, $wday) = explode (" ", $cron);
|
||||
|
||||
// Get current time
|
||||
$cur_time = time();
|
||||
// Get last execution time
|
||||
$last_execution = db_get_value('utimestamp', 'tagente_estado', 'id_agente_modulo', $module_id);
|
||||
$cur_time = ($last_execution !== false) ? $last_execution : time();
|
||||
|
||||
// Any day of the way
|
||||
if ($wday == '*') {
|
||||
$nex_time = cron_next_execution_date ($cron, $cur_time);
|
||||
$nex_time = cron_next_execution_date ($cron, $cur_time, $module_interval);
|
||||
return $nex_time - $cur_time;
|
||||
}
|
||||
|
||||
|
@ -55,7 +61,7 @@ function cron_next_execution ($cron) {
|
|||
$count = 0;
|
||||
$nex_time = $cur_time;
|
||||
do {
|
||||
$nex_time = cron_next_execution_date ($cron, $nex_time);
|
||||
$nex_time = cron_next_execution_date ($cron, $nex_time, $module_interval);
|
||||
$nex_time_wd = $nex_time;
|
||||
list ($nex_mon, $nex_wday) = explode (" ", date ("m w", $nex_time_wd));
|
||||
|
||||
|
@ -80,90 +86,202 @@ function cron_next_execution ($cron) {
|
|||
}
|
||||
|
||||
// Get the next execution date for the given cron entry in seconds since epoch.
|
||||
function cron_next_execution_date ($cron, $cur_time = false) {
|
||||
function cron_next_execution_date ($cron, $cur_time = false, $module_interval = 300) {
|
||||
|
||||
// Get cron configuration
|
||||
list ($min, $hour, $mday, $mon, $wday) = explode (" ", $cron);
|
||||
|
||||
$cron_array = explode (" ", $cron);
|
||||
// Months start from 0
|
||||
if ($mon != '*') {
|
||||
$mon -= 1;
|
||||
if ($cron_array[3] != '*') {
|
||||
$mon_s = cron_get_interval ($cron_array[3]);
|
||||
if ($mon_s['up'] !== false) {
|
||||
$cron_array[3] = $mon_s['down'] - 1 . "-" . $mon_s['up'] - 1;
|
||||
} else {
|
||||
$cron_array[3] = $mon_s['down'] - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Get current time
|
||||
if ($cur_time === false) {
|
||||
$cur_time = time();
|
||||
}
|
||||
list ($cur_min, $cur_hour, $cur_mday, $cur_mon, $cur_year) = explode (" ", date ("i H d m Y", $cur_time));
|
||||
if ($cur_time === false) $cur_time = time();
|
||||
|
||||
$nex_time = $cur_time + $module_interval;
|
||||
$nex_time_array = explode (" ", date ("i H d m Y", $nex_time));
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array)) return $nex_time;
|
||||
|
||||
// Get first next date candidate from cron configuration
|
||||
$nex_min = $min;
|
||||
$nex_hour = $hour;
|
||||
$nex_mday = $mday;
|
||||
$nex_mon = $mon;
|
||||
$nex_year = $cur_year;
|
||||
// Get first next date candidate from next cron configuration
|
||||
// Initialize some vars
|
||||
$prev_ovfl = false;
|
||||
|
||||
// Update minutes
|
||||
$min_s = cron_get_interval ($cron_array[0]);
|
||||
$nex_time_array[0] = ($min_s['down'] == '*') ? 0 : $min_s['down'];
|
||||
|
||||
// Replace wildcards
|
||||
if ($min == '*') {
|
||||
if ($hour != '*' || $mday != '*' || $wday != '*' || $mon != '*') {
|
||||
$nex_min = 0;
|
||||
}
|
||||
else {
|
||||
$nex_min = $cur_min;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time >= $cur_time) {
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
|
||||
return $nex_time;
|
||||
}
|
||||
}
|
||||
if ($hour == '*') {
|
||||
if ($mday != '*' || $wday != '*' ||$mon != '*') {
|
||||
$nex_hour = 0;
|
||||
}
|
||||
else {
|
||||
$nex_hour = $cur_hour;
|
||||
}
|
||||
}
|
||||
if ($mday == '*') {
|
||||
if ($mon != '*') {
|
||||
$nex_mday = 1;
|
||||
}
|
||||
else {
|
||||
$nex_mday = $cur_mday;
|
||||
}
|
||||
}
|
||||
if ($mon == '*') {
|
||||
$nex_mon = $cur_mon;
|
||||
}
|
||||
|
||||
// Find the next execution date
|
||||
$count = 0;
|
||||
do {
|
||||
$next_time = mktime($nex_hour, $nex_min, 0, $nex_mon, $nex_mday, $nex_year);
|
||||
if ($next_time > $cur_time) {
|
||||
return $next_time;
|
||||
}
|
||||
if ($min == '*' && $hour == '*' && $wday == '*' && $mday == '*' && $mon == '*') {
|
||||
list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + SECONDS_1MINUTE));
|
||||
}
|
||||
else if ($hour == '*' && $wday == '*' && $mday == '*' && $mon == '*') {
|
||||
list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + SECONDS_1HOUR));
|
||||
}
|
||||
else if ($mday == '*' && $mon == '*') {
|
||||
list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + SECONDS_1DAY));
|
||||
}
|
||||
else if ($mon == '*') {
|
||||
$nex_mon = $nex_mon + 1;
|
||||
if ($nex_mon > 11) {
|
||||
$nex_mon = 0;
|
||||
$nex_year++;
|
||||
|
||||
// Check if next hour is in cron
|
||||
$nex_time_array[1]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
|
||||
if ($nex_time === false) {
|
||||
// Update the month day if overflow
|
||||
$prev_ovfl = true;
|
||||
$nex_time_array[1] = 0;
|
||||
$nex_time_array[2]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time === false) {
|
||||
// Update the month if overflow
|
||||
$nex_time_array[2] = 1;
|
||||
$nex_time_array[3]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time === false) {
|
||||
#Update the year if overflow
|
||||
$nex_time_array[3] = 0;
|
||||
$nex_time_array[4]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$nex_year++;
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
while ($count < SECONDS_1DAY);
|
||||
// Check the hour
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
|
||||
return $nex_time;
|
||||
}
|
||||
|
||||
// Update the hour if fails
|
||||
$hour_s = cron_get_interval ($cron_array[1]);
|
||||
$nex_time_array[1] = ($hour_s['down'] == '*') ? 0 : $hour_s['down'];
|
||||
|
||||
// When an overflow is passed check the hour update again
|
||||
if ($prev_ovfl) {
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
|
||||
return $nex_time;
|
||||
}
|
||||
}
|
||||
$prev_ovfl = false;
|
||||
|
||||
// Check if next day is in cron
|
||||
$nex_time_array[2]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time === false) {
|
||||
// Update the month if overflow
|
||||
$prev_ovfl = true;
|
||||
$nex_time_array[2] = 1;
|
||||
$nex_time_array[3]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time === false) {
|
||||
// Update the year if overflow
|
||||
$nex_time_array[3] = 0;
|
||||
$nex_time_array[4]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
}
|
||||
}
|
||||
// Check the day
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
|
||||
return $nex_time;
|
||||
}
|
||||
|
||||
// Update the day if fails
|
||||
$mday_s = cron_get_interval ($cron_array[2]);
|
||||
$nex_time_array[2] = ($mday_s['down'] == '*') ? 1 : $mday_s['down'];
|
||||
|
||||
// When an overflow is passed check the hour update in the next execution
|
||||
if ($prev_ovfl) {
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
|
||||
return $nex_time;
|
||||
}
|
||||
}
|
||||
$prev_ovfl = false;
|
||||
|
||||
// Check if next month is in cron
|
||||
$nex_time_array[3]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time === false) {
|
||||
#Update the year if overflow
|
||||
$prev_ovfl = true;
|
||||
$nex_time_array[3]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
}
|
||||
|
||||
// Check the month
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
|
||||
return $nex_time;
|
||||
}
|
||||
|
||||
// Update the month if fails
|
||||
$mon_s = cron_get_interval ($cron_array[3]);
|
||||
$nex_time_array[3] = ($mon_s['down'] == '*') ? 0 : $mon_s['down'];
|
||||
|
||||
// When an overflow is passed check the hour update in the next execution
|
||||
if ($prev_ovfl) {
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
|
||||
return $nex_time;
|
||||
}
|
||||
}
|
||||
|
||||
// Update the year
|
||||
$nex_time_array[4]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
|
||||
return ($nex_time !== false) ? $nex_time : $module_interval;
|
||||
}
|
||||
|
||||
// Get an array with the cron interval
|
||||
function cron_get_interval ($element) {
|
||||
# Not a range
|
||||
if (!preg_match('/(\d+)\-(\d+)/', $element, $capture)) {
|
||||
return array(
|
||||
'down' => $element,
|
||||
'up' => false
|
||||
);
|
||||
}
|
||||
return array(
|
||||
'down' => $capture[1],
|
||||
'up' => $capture[2]
|
||||
);
|
||||
}
|
||||
|
||||
// Returns if a date is in a cron. Recursive.
|
||||
function cron_is_in_cron($elems_cron, $elems_curr_time) {
|
||||
|
||||
// Something went wrong, default to 5 minutes
|
||||
return $cur_time + SECONDS_5MINUTES;
|
||||
$elem_cron = array_shift($elems_cron);
|
||||
$elem_curr_time = array_shift($elems_curr_time);
|
||||
|
||||
// If there is no elements means that is in cron
|
||||
if ($elem_cron === null || $elem_curr_time === null) return true;
|
||||
|
||||
// Go to last element if current is a wild card
|
||||
if ($elem_cron != '*') {
|
||||
$elem_s = cron_get_interval($elem_cron);
|
||||
// Check if there is no a range
|
||||
if (($elem_s['up'] === false) && ($elem_s['down'] != $elem_curr_time)) {
|
||||
return false;
|
||||
}
|
||||
// Check if there is on the range
|
||||
if ($elem_s['up'] !== false) {
|
||||
if ($elem_s['down'] < $elem_s['up']) {
|
||||
if ($elem_curr_time < $elem_s['down'] || $elem_curr_time > $elem_s['up']){
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if ($elem_curr_time > $elem_s['down'] || $elem_curr_time < $elem_s['up']){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return cron_is_in_cron($elems_cron, $elems_curr_time);
|
||||
}
|
||||
|
||||
function cron_valid_date ($da) {
|
||||
$st = sprintf("%04d:%02d:%02d %02d:%02d:00", $da[4], $da[3], $da[2], $da[1], $da[0]);
|
||||
$time = strtotime($st);
|
||||
return $time;
|
||||
}
|
||||
|
||||
// Check if cron is properly constructed
|
||||
|
|
|
@ -202,6 +202,11 @@ function custom_graphs_print($id_graph, $height, $width, $period,
|
|||
$sources = db_get_all_rows_field_filter('tgraph_source', 'id_graph',
|
||||
$id_graph);
|
||||
|
||||
$series = db_get_all_rows_sql('SELECT summatory_series,average_series,modules_series FROM tgraph WHERE id_graph = '.$id_graph);
|
||||
$summatory = $series[0]['summatory_series'];
|
||||
$average = $series[0]['average_series'];
|
||||
$modules_series = $series[0]['modules_series'];
|
||||
|
||||
$modules = array ();
|
||||
$weights = array ();
|
||||
$labels = array ();
|
||||
|
@ -262,7 +267,10 @@ function custom_graphs_print($id_graph, $height, $width, $period,
|
|||
$percentil,
|
||||
$from_interface,
|
||||
$id_widget_dashboard,
|
||||
$fullscale);
|
||||
$fullscale,
|
||||
$summatory,
|
||||
$average,
|
||||
$modules_series);
|
||||
|
||||
if ($return)
|
||||
return $output;
|
||||
|
|
|
@ -81,7 +81,7 @@ function db_connect($host = null, $db = null, $user = null, $pass = null, $port
|
|||
$ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
|
||||
$config['homedir'] = $ownDir;
|
||||
$login_screen = 'error_authconfig';
|
||||
require($config['homedir'] . '/general/error_screen.php');
|
||||
require($config['homedir'] . '../general/error_screen.php');
|
||||
exit;
|
||||
}
|
||||
else if ($error == 0) {
|
||||
|
@ -416,12 +416,12 @@ function db_get_row ($table, $field_search, $condition, $fields = false) {
|
|||
*
|
||||
* @return mixed Array of the row or false in case of error.
|
||||
*/
|
||||
function db_get_row_filter($table, $filter, $fields = false, $where_join = 'AND') {
|
||||
function db_get_row_filter($table, $filter, $fields = false, $where_join = 'AND', $historydb = false) {
|
||||
global $config;
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
return mysql_db_get_row_filter($table, $filter, $fields, $where_join);
|
||||
return mysql_db_get_row_filter($table, $filter, $fields, $where_join, $historydb);
|
||||
break;
|
||||
case "postgresql":
|
||||
return postgresql_db_get_row_filter($table, $filter, $fields, $where_join);
|
||||
|
@ -481,9 +481,6 @@ function db_get_all_rows_sql($sql, $search_history_db = false, $cache = true, $d
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the time the module is in unknown status (by events)
|
||||
|
@ -493,7 +490,7 @@ function db_get_all_rows_sql($sql, $search_history_db = false, $cache = true, $d
|
|||
* @param int $tend end of search
|
||||
*
|
||||
*/
|
||||
function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend = false) {
|
||||
function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend = false, $historydb = false) {
|
||||
global $config;
|
||||
|
||||
if (!isset($id_agente_modulo)) {
|
||||
|
@ -514,20 +511,19 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Retrieve going unknown events in range
|
||||
$query = "SELECT utimestamp,event_type FROM tevento WHERE id_agentmodule = " . $id_agente_modulo;
|
||||
$query .= " AND event_type like 'going_%' ";
|
||||
$query .= " AND utimestamp >= $tstart AND utimestamp <= $tend ";
|
||||
$query .= " ORDER BY utimestamp ASC";
|
||||
|
||||
$events = db_get_all_rows_sql($query);
|
||||
$events = db_get_all_rows_sql($query, $historydb);
|
||||
|
||||
if (! is_array($events)){
|
||||
return false;
|
||||
}
|
||||
|
||||
$last_status = 0; // normal
|
||||
$last_status = $events[0]["event_type"] != "going_unknown" ? 1:0;
|
||||
$return = array();
|
||||
$i=0;
|
||||
foreach ($events as $event) {
|
||||
|
@ -555,6 +551,9 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend
|
|||
}
|
||||
}
|
||||
}
|
||||
if(!isset($return[0])){
|
||||
return false;
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
@ -573,6 +572,16 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend
|
|||
*
|
||||
* Note: All "unknown" data are marked as NULL
|
||||
* Warning: Be careful with the amount of data, check your RAM size available
|
||||
* We'll return a bidimensional array
|
||||
* Structure returned: schema:
|
||||
*
|
||||
* uncompressed_data =>
|
||||
* pool_id (int)
|
||||
* utimestamp (start of current slice)
|
||||
* data
|
||||
* array
|
||||
* datos
|
||||
* utimestamp
|
||||
*
|
||||
*/
|
||||
function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = false) {
|
||||
|
@ -582,17 +591,6 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
|
|||
return false;
|
||||
}
|
||||
|
||||
if ((!isset($tstart)) || ($tstart === false)) {
|
||||
// Return data from the begining
|
||||
// Get first available utimestamp in active DB
|
||||
$query_first_man_time = " SELECT utimestamp FROM tagente_datos ";
|
||||
$query_first_man_time .= " WHERE id_agente_modulo = $id_agente_modulo";
|
||||
$query_first_man_time .= " ORDER BY utimestamp ASC LIMIT 1";
|
||||
|
||||
$first_man_time = db_get_all_rows_sql( $query_first_man_time, false);
|
||||
$tstart = $first_man_time[0]['utimestamp'];
|
||||
}
|
||||
|
||||
if ((!isset($tend)) || ($tend === false)) {
|
||||
// Return data until now
|
||||
$tend = time();
|
||||
|
@ -612,270 +610,263 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
|
|||
}
|
||||
$module_type = $module['id_tipo_modulo'];
|
||||
$module_type_str = modules_get_type_name ($module_type);
|
||||
|
||||
if (strstr ($module_type_str, 'string') !== false) {
|
||||
$table = "tagente_datos_string";
|
||||
}
|
||||
|
||||
// Get first available utimestamp in active DB
|
||||
$query = " SELECT utimestamp, datos FROM $table ";
|
||||
$query .= " WHERE id_agente_modulo=$id_agente_modulo AND utimestamp < $tstart";
|
||||
$query .= " ORDER BY utimestamp DESC LIMIT 1";
|
||||
|
||||
$ret = db_get_all_rows_sql( $query , $search_historydb);
|
||||
|
||||
if ( ( $ret === false ) || (( isset($ret[0]["utimestamp"]) && ($ret[0]["utimestamp"] > $tstart )))) {
|
||||
// Value older than first retrieved from active DB
|
||||
$search_historydb = true;
|
||||
|
||||
$ret = db_get_all_rows_sql( $query , $search_historydb);
|
||||
|
||||
if ($ret) {
|
||||
$tstart = $ret[0]["utimestamp"];
|
||||
}
|
||||
|
||||
$flag_async = false;
|
||||
if(strstr ($module_type_str, 'async_data') !== false) {
|
||||
$flag_async = true;
|
||||
}
|
||||
else {
|
||||
$first_data["utimestamp"] = $ret[0]["utimestamp"];
|
||||
$first_data["datos"] = $ret[0]["datos"];
|
||||
if(strstr ($module_type_str, 'async_proc') !== false) {
|
||||
$flag_async = true;
|
||||
}
|
||||
|
||||
if ( ( $ret === false ) || (( isset($ret[0]["utimestamp"]) && ($ret[0]["utimestamp"] > $tstart )))) {
|
||||
// No previous data. -> not init
|
||||
// Avoid false unknown status
|
||||
$first_data["utimestamp"] = time();
|
||||
$result = modules_get_first_date($id_agente_modulo,$tstart);
|
||||
$first_utimestamp = $result["first_utimestamp"];
|
||||
$search_historydb = $result["search_historydb"];
|
||||
|
||||
if ($first_utimestamp === false) {
|
||||
$first_data["utimestamp"] = $tstart;
|
||||
$first_data["datos"] = false;
|
||||
}
|
||||
else {
|
||||
$first_data["utimestamp"] = $ret[0]["utimestamp"];
|
||||
$first_data["datos"] = $ret[0]["datos"];
|
||||
$query = "SELECT datos,utimestamp FROM $table ";
|
||||
$query .= " WHERE id_agente_modulo=$id_agente_modulo ";
|
||||
$query .= " AND utimestamp=" . $first_utimestamp;
|
||||
|
||||
$data = db_get_all_rows_sql($query,$search_historydb);
|
||||
|
||||
if ($data === false) {
|
||||
// first utimestamp not found in active database
|
||||
// SEARCH HISTORY DB
|
||||
$search_historydb = true;
|
||||
$data = db_get_all_rows_sql($query,$search_historydb);
|
||||
}
|
||||
|
||||
if ($data === false) { // Not init
|
||||
$first_data["utimestamp"] = $tstart;
|
||||
$first_data["datos"] = false;
|
||||
}
|
||||
else {
|
||||
$first_data["utimestamp"] = $data[0]["utimestamp"];
|
||||
$first_data["datos"] = $data[0]["datos"];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$query = " SELECT utimestamp, datos FROM $table ";
|
||||
$query .= " WHERE id_agente_modulo=$id_agente_modulo AND utimestamp >= $tstart AND utimestamp <= $tend";
|
||||
$query .= " ORDER BY utimestamp ASC";
|
||||
|
||||
// Retrieve all data from module in given range
|
||||
$raw_data = db_get_all_rows_sql($query, $search_historydb);
|
||||
|
||||
if (($raw_data === false) && ($ret === false)) {
|
||||
$module_interval = modules_get_interval ($id_agente_modulo);
|
||||
|
||||
if (($raw_data === false) && ( ($first_utimestamp < $tstart - (SECONDS_1DAY + 2*$module_interval)) ) ) {
|
||||
// No data
|
||||
return false;
|
||||
}
|
||||
|
||||
// Retrieve going unknown events in range
|
||||
$unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend);
|
||||
$unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend, $search_historydb);
|
||||
|
||||
// Get the last event after inverval to know if graph start on unknown
|
||||
$previous_unknown_events = db_get_row_filter (
|
||||
'tevento',
|
||||
array ('id_agentmodule' => $id_agente_modulo,
|
||||
"utimestamp <= $tstart",
|
||||
'order' => 'utimestamp DESC'
|
||||
),
|
||||
false,
|
||||
'AND',
|
||||
$search_historydb
|
||||
);
|
||||
|
||||
//show graph if graph is inside unknown
|
||||
if( $previous_unknown_events && $previous_unknown_events['event_type'] == 'going_unknown' &&
|
||||
$unknown_events === false && $raw_data === false){
|
||||
$last_inserted_value = $first_data["datos"];
|
||||
$unknown_events[0]['time_from'] = $tstart+0.1;
|
||||
}
|
||||
|
||||
//if time to is missing in last event force time to outside range time
|
||||
if( $unknown_events && !isset($unknown_events[count($unknown_events) -1]['time_to']) ){
|
||||
$unknown_events[count($unknown_events) -1]['time_to'] = $tend + $module_interval;
|
||||
}
|
||||
|
||||
//if time to is missing in first event force time to outside range time
|
||||
if ($first_data["datos"] === false && !$flag_async) {
|
||||
$last_inserted_value = false;
|
||||
}elseif( ($unknown_events && !isset($unknown_events[0]['time_from']) &&
|
||||
$previous_unknown_events && $previous_unknown_events['event_type'] == 'going_unknown' && !$flag_async) ||
|
||||
($first_utimestamp < $tstart - (SECONDS_1DAY + 2*$module_interval) && !$flag_async) ){
|
||||
//$last_inserted_value = null;
|
||||
$last_inserted_value = $first_data["datos"];
|
||||
$unknown_events[0]['time_from'] = $tstart+0.1;
|
||||
}
|
||||
else{
|
||||
$last_inserted_value = $first_data["datos"];
|
||||
}
|
||||
|
||||
// Retrieve module_interval to build the template
|
||||
$module_interval = modules_get_interval ($id_agente_modulo);
|
||||
$slice_size = $module_interval;
|
||||
|
||||
// We'll return a bidimensional array
|
||||
// Structure returned: schema:
|
||||
//
|
||||
// uncompressed_data =>
|
||||
// pool_id (int)
|
||||
// utimestamp (start of current slice)
|
||||
// data
|
||||
// array
|
||||
// utimestamp
|
||||
// datos
|
||||
|
||||
$return = array();
|
||||
|
||||
// Point current_timestamp to begin of the set and initialize flags
|
||||
$current_timestamp = $tstart;
|
||||
$last_inserted_value = $first_data["datos"];
|
||||
$last_timestamp = $first_data["utimestamp"];
|
||||
$data_found = 0;
|
||||
$last_value = $first_data["datos"];
|
||||
|
||||
//reverse array data optimization
|
||||
$raw_data = array_reverse($raw_data);
|
||||
|
||||
// Build template
|
||||
$pool_id = 0;
|
||||
$now = time();
|
||||
|
||||
$in_unknown_status = 0;
|
||||
if (is_array($unknown_events)) {
|
||||
$current_unknown = array_shift($unknown_events);
|
||||
if($unknown_events){
|
||||
$current_unknown = array_shift($unknown_events);
|
||||
}
|
||||
else{
|
||||
$current_unknown = null;
|
||||
}
|
||||
|
||||
if($raw_data){
|
||||
$current_raw_data = array_pop($raw_data);
|
||||
}
|
||||
else{
|
||||
$current_raw_data = null;
|
||||
}
|
||||
while ( $current_timestamp < $tend ) {
|
||||
$expected_data_generated = 0;
|
||||
|
||||
while ( $current_timestamp < $tend ) {
|
||||
$return[$pool_id]["data"] = array();
|
||||
$tmp_data = array();
|
||||
$data_found = 0;
|
||||
$current_timestamp_end = $current_timestamp + $slice_size;
|
||||
|
||||
if (is_array($unknown_events)) {
|
||||
$i = 0;
|
||||
while ($current_timestamp >= $unknown_events[$i]["time_to"] ) {
|
||||
// Skip unknown events in past
|
||||
array_splice($unknown_events, $i,1);
|
||||
$i++;
|
||||
if (!isset($unknown_events[$i])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isset($current_unknown)) {
|
||||
|
||||
// check if recovered from unknown status
|
||||
if(is_array($unknown_events) && isset($current_unknown)) {
|
||||
if ( (($current_timestamp+$slice_size) > $current_unknown["time_to"])
|
||||
&& ($current_timestamp < $current_unknown["time_to"])
|
||||
&& ($in_unknown_status == 1) ) {
|
||||
// Recovered from unknown
|
||||
|
||||
if ( ($current_unknown["time_to"] > $current_timestamp)
|
||||
&& ($expected_data_generated == 0) ) {
|
||||
// also add the "expected" data
|
||||
$tmp_data["utimestamp"] = $current_timestamp;
|
||||
if ($in_unknown_status == 1) {
|
||||
$tmp_data["datos"] = null;
|
||||
}
|
||||
else {
|
||||
$tmp_data["datos"] = $last_inserted_value;
|
||||
}
|
||||
$return[$pool_id]["utimestamp"] = $current_timestamp;
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
$expected_data_generated = 1;
|
||||
}
|
||||
|
||||
|
||||
$tmp_data["utimestamp"] = $current_unknown["time_to"];
|
||||
$tmp_data["datos"] = $last_inserted_value;
|
||||
// debug purpose
|
||||
//$tmp_data["obs"] = "event recovery data";
|
||||
|
||||
$return[$pool_id]["utimestamp"] = $current_timestamp;
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
$data_found = 1;
|
||||
$in_unknown_status = 0;
|
||||
}
|
||||
|
||||
if ( (($current_timestamp+$slice_size) > $current_unknown["time_from"])
|
||||
&& (($current_timestamp+$slice_size) < $current_unknown["time_to"])
|
||||
&& ($in_unknown_status == 0) ) {
|
||||
// Add unknown state detected
|
||||
|
||||
if ( $current_unknown["time_from"] < ($current_timestamp+$slice_size)) {
|
||||
if ( ($current_unknown["time_from"] > $current_timestamp)
|
||||
&& ($expected_data_generated == 0) ) {
|
||||
// also add the "expected" data
|
||||
$tmp_data["utimestamp"] = $current_timestamp;
|
||||
if ($in_unknown_status == 1) {
|
||||
$tmp_data["datos"] = null;
|
||||
}
|
||||
else {
|
||||
$tmp_data["datos"] = $last_inserted_value;
|
||||
}
|
||||
$return[$pool_id]["utimestamp"] = $current_timestamp;
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
$expected_data_generated = 1;
|
||||
}
|
||||
|
||||
$tmp_data["utimestamp"] = $current_unknown["time_from"];
|
||||
$tmp_data["datos"] = null;
|
||||
// debug purpose
|
||||
//$tmp_data["obs"] = "event data";
|
||||
$return[$pool_id]["utimestamp"] = $current_timestamp;
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
$data_found = 1;
|
||||
}
|
||||
$in_unknown_status = 1;
|
||||
}
|
||||
|
||||
if ( ($in_unknown_status == 0) && ($current_timestamp >= $current_unknown["time_to"]) ) {
|
||||
$current_unknown = array_shift($unknown_events);
|
||||
}
|
||||
}
|
||||
} // unknown events handle
|
||||
}
|
||||
|
||||
// Search for data
|
||||
$i=0;
|
||||
if (is_array($raw_data)) {
|
||||
foreach ($raw_data as $data) {
|
||||
if ( ($data["utimestamp"] >= $current_timestamp)
|
||||
&& ($data["utimestamp"] < ($current_timestamp+$slice_size)) ) {
|
||||
// Data in block, push in, and remove from $raw_data (processed)
|
||||
|
||||
if ( ($data["utimestamp"] > $current_timestamp)
|
||||
&& ($expected_data_generated == 0) ) {
|
||||
// also add the "expected" data
|
||||
$tmp_data["utimestamp"] = $current_timestamp;
|
||||
if ($in_unknown_status == 1) {
|
||||
$tmp_data["datos"] = null;
|
||||
}
|
||||
else {
|
||||
$tmp_data["datos"] = $last_inserted_value;
|
||||
}
|
||||
//$tmp_data["obs"] = "expected data";
|
||||
$return[$pool_id]["utimestamp"] = $current_timestamp;
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
$expected_data_generated = 1;
|
||||
}
|
||||
|
||||
$tmp_data["utimestamp"] = intval($data["utimestamp"]);
|
||||
$tmp_data["datos"] = $data["datos"];
|
||||
// debug purpose
|
||||
//$tmp_data["obs"] = "real data";
|
||||
|
||||
$return[$pool_id]["utimestamp"] = $current_timestamp;
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
|
||||
$last_inserted_value = $data["datos"];
|
||||
$last_timestamp = intval($data["utimestamp"]);
|
||||
|
||||
unset($raw_data[$i]);
|
||||
$data_found = 1;
|
||||
$in_unknown_status = 0;
|
||||
}
|
||||
elseif ($data["utimestamp"] > ($current_timestamp+$slice_size)) {
|
||||
// Data in future, stop searching new ones
|
||||
break;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($data_found == 0) {
|
||||
// No data found, lug the last_value until SECONDS_1DAY + 2*modules_get_interval
|
||||
// UNKNOWN!
|
||||
|
||||
if (($current_timestamp > $now) || (($current_timestamp - $last_timestamp) > (SECONDS_1DAY + 2*$module_interval))) {
|
||||
if (isset($last_inserted_value)) {
|
||||
// unhandled unknown status control
|
||||
$unhandled_time_unknown = $current_timestamp - (SECONDS_1DAY + 2*$module_interval) - $last_timestamp;
|
||||
if ($unhandled_time_unknown > 0) {
|
||||
// unhandled unknown status detected. Add to previous pool
|
||||
$tmp_data["utimestamp"] = intval($last_timestamp) + (SECONDS_1DAY + 2*$module_interval);
|
||||
$tmp_data["datos"] = null;
|
||||
// debug purpose
|
||||
//$tmp_data["obs"] = "unknown extra";
|
||||
// add to previous pool if needed
|
||||
if (isset($return[$pool_id-1])) {
|
||||
array_push($return[$pool_id-1]["data"], $tmp_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
$last_inserted_value = null;
|
||||
}
|
||||
|
||||
$tmp_data["utimestamp"] = $current_timestamp;
|
||||
|
||||
if ($in_unknown_status == 1) {
|
||||
$tmp_data["datos"] = null;
|
||||
}
|
||||
else {
|
||||
$tmp_data["datos"] = $last_inserted_value;
|
||||
}
|
||||
// debug purpose
|
||||
//$tmp_data["obs"] = "virtual data";
|
||||
if (( $current_timestamp > $now) ||
|
||||
( ($current_timestamp_end - $last_timestamp) >
|
||||
(SECONDS_1DAY + 2 * $module_interval) ) ) {
|
||||
|
||||
$tmp_data["utimestamp"] = $last_timestamp + SECONDS_1DAY + 2 * $module_interval;
|
||||
|
||||
$return[$pool_id]["utimestamp"] = $current_timestamp;
|
||||
//check not init
|
||||
$tmp_data["datos"] = $last_value === false ? false : null;
|
||||
|
||||
//async not unknown
|
||||
if($flag_async && $tmp_data["datos"] === null){
|
||||
$tmp_data["datos"] = $last_inserted_value;
|
||||
}
|
||||
|
||||
// debug purpose
|
||||
//$tmp_data["obs"] = "unknown extra";
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
}
|
||||
|
||||
//insert first slice data
|
||||
$tmp_data["utimestamp"] = $current_timestamp;
|
||||
$tmp_data["datos"] = $last_inserted_value;
|
||||
// debug purpose
|
||||
//$tmp_data["obs"] = "virtual data";
|
||||
|
||||
$return[$pool_id]["utimestamp"] = $current_timestamp;
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
|
||||
//insert raw data
|
||||
while ( ($current_raw_data != null) &&
|
||||
( ($current_timestamp_end >= $current_raw_data['utimestamp']) &&
|
||||
($current_timestamp < $current_raw_data['utimestamp']) ) ) {
|
||||
|
||||
// Add unknown state detected
|
||||
$tmp_data["utimestamp"] = $current_raw_data["utimestamp"];
|
||||
$tmp_data["datos"] = $current_raw_data["datos"];
|
||||
// debug purpose
|
||||
//$tmp_data["obs"] = "real data";
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
|
||||
$last_value = $current_raw_data["datos"];
|
||||
$last_timestamp = $current_raw_data["utimestamp"];
|
||||
if($raw_data){
|
||||
$current_raw_data = array_pop($raw_data);
|
||||
}
|
||||
else{
|
||||
$current_raw_data = null;
|
||||
}
|
||||
}
|
||||
|
||||
//unknown
|
||||
$data_slices = $return[$pool_id]["data"];
|
||||
if(!$flag_async){
|
||||
while ( ($current_unknown != null) &&
|
||||
( ( ($current_unknown['time_from'] != null) &&
|
||||
($current_timestamp_end >= $current_unknown['time_from']) ) ||
|
||||
($current_timestamp_end >= $current_unknown['time_to']) ) ) {
|
||||
|
||||
if( ( $current_timestamp <= $current_unknown['time_from']) &&
|
||||
( $current_timestamp_end >= $current_unknown['time_from'] ) ){
|
||||
// Add unknown state detected
|
||||
$tmp_data["utimestamp"] = $current_unknown["time_from"];
|
||||
$tmp_data["datos"] = null;
|
||||
// debug purpose
|
||||
//$tmp_data["obs"] = "event data unknown from";
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
$current_unknown["time_from"] = null;
|
||||
}
|
||||
|
||||
if( ($current_timestamp <= $current_unknown['time_to']) &&
|
||||
($current_timestamp_end >= $current_unknown['time_to'] ) ){
|
||||
$tmp_data["utimestamp"] = $current_unknown["time_to"];
|
||||
$i = count($data_slices) - 1;
|
||||
while ($i >= 0) {
|
||||
if($data_slices[$i]['utimestamp'] <= $current_unknown["time_to"]){
|
||||
$tmp_data["datos"] =
|
||||
$data_slices[$i]['datos'] == null
|
||||
? $last_value
|
||||
: $data_slices[$i]['datos'];
|
||||
break;
|
||||
}
|
||||
$i--;
|
||||
}
|
||||
|
||||
// debug purpose
|
||||
//$tmp_data["obs"] = "event data unknown to";
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
if($unknown_events){
|
||||
$current_unknown = array_shift($unknown_events);
|
||||
}
|
||||
else{
|
||||
$current_unknown = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//sort current slice
|
||||
usort(
|
||||
$return[$pool_id]['data'],
|
||||
function ($a, $b) {
|
||||
if ($a['utimestamp'] == $b['utimestamp']) return 0;
|
||||
return ($a['utimestamp'] < $b['utimestamp']) ? -1 : 1;
|
||||
}
|
||||
);
|
||||
//put the last slice data like first element of next slice
|
||||
$last_inserted_value = end($return[$pool_id]['data']);
|
||||
$last_inserted_value = $last_inserted_value['datos'];
|
||||
|
||||
//increment
|
||||
$pool_id++;
|
||||
$current_timestamp += $slice_size;
|
||||
$current_timestamp = $current_timestamp_end;
|
||||
}
|
||||
|
||||
//slice to the end.
|
||||
if($pool_id == 1){
|
||||
$end_array = array();
|
||||
$end_array['data'][0]['utimestamp'] = $tend;
|
||||
$end_array['data'][0]['datos'] = $last_inserted_value;
|
||||
//$end_array['data'][0]['obs'] = 'virtual data END';
|
||||
array_push($return, $end_array);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1687,7 +1687,7 @@ function events_page_responses ($event, $childrens_ids = array()) {
|
|||
$users[0]['id_user'] = $config['id_user'];
|
||||
$users[0]['fullname'] = $user_name;
|
||||
} else {
|
||||
$users = groups_get_users($_user_groups, array('id_perfil' => $profiles_view_events), true, true);
|
||||
$users = groups_get_users($_user_groups, array('id_perfil' => $profiles_view_events), true);
|
||||
}
|
||||
|
||||
foreach($users as $u) {
|
||||
|
@ -2080,7 +2080,7 @@ function events_page_details ($event, $server = "") {
|
|||
}
|
||||
else {
|
||||
$module_group = db_get_value('name', 'tmodule_group', 'id_mg', $id_module_group);
|
||||
$data[1] = '<a href="'.$serverstring . 'index.php?sec=estado&sec2=operation/agentes/status_monitor&status=-1&modulegroup=' . $id_module_group . $hashstring.'">';
|
||||
$data[1] = '<a href="'.$serverstring . 'index.php?sec=view&sec2=operation/agentes/status_monitor&status=-1&modulegroup=' . $id_module_group . $hashstring.'">';
|
||||
$data[1] .= $module_group;
|
||||
$data[1] .= '</a>';
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ if ($upload_file) {
|
|||
|
||||
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 File manager");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
|
@ -219,7 +219,7 @@ if ($create_text_file) {
|
|||
|
||||
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 File manager");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
|
@ -279,7 +279,7 @@ if ($upload_zip) {
|
|||
|
||||
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 File manager");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
|
|
|
@ -573,14 +573,17 @@ function gis_get_agent_icon_map($idAgent, $state = false, $status = null) {
|
|||
switch ($status) {
|
||||
case 1:
|
||||
case 4:
|
||||
case 100:
|
||||
//Critical (BAD or ALERT)
|
||||
$state = ".bad";
|
||||
break;
|
||||
case 0:
|
||||
case 300:
|
||||
//Normal (OK)
|
||||
$state = ".ok";
|
||||
break;
|
||||
case 2:
|
||||
case 200:
|
||||
//Warning
|
||||
$state = ".warning";
|
||||
break;
|
||||
|
|