Merge branch 'develop' into 2479-Errores-en-vista-de-alertas-de-meta
Conflicts: pandora_console/include/functions_ui.php
This commit is contained in:
commit
0c899f5078
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, AIX version
|
||||
# Version 7.0NG.727, 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.724, FreeBSD Version
|
||||
# Version 7.0NG.727, 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.724, HP-UX Version
|
||||
# Version 7.0NG.727, 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.724, GNU/Linux
|
||||
# Version 7.0NG.727, 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.724, GNU/Linux
|
||||
# Version 7.0NG.727, 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.724, Solaris Version
|
||||
# Version 7.0NG.727, 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.724
|
||||
# Version 7.0NG.727
|
||||
|
||||
# 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.724, AIX version
|
||||
# Version 7.0NG.727, 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.724
|
||||
# Version 7.0NG.727
|
||||
# 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.724, HPUX Version
|
||||
# Version 7.0NG.727, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724
|
||||
# Version 7.0NG.727
|
||||
# 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.724
|
||||
# Version 7.0NG.727
|
||||
# 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.724
|
||||
# Version 7.0NG.727
|
||||
# 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.724, Solaris version
|
||||
# Version 7.0NG.727, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, AIX version
|
||||
# Version 7.0NG.727, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -87,6 +87,9 @@ transfer_mode tentacle
|
|||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
# remote_config 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
# proxy_mode 1
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.724-180718
|
||||
Version: 7.0NG.727-181001
|
||||
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.724-180718"
|
||||
pandora_version="7.0NG.727-181001"
|
||||
|
||||
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.724, GNU/Linux
|
||||
# Version 7.0NG.727, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -117,6 +117,9 @@ transfer_mode tentacle
|
|||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
#remote_config 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
# proxy_mode 1
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, FreeBSD Version
|
||||
# Version 7.0NG.727, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -130,6 +130,9 @@ transfer_mode tentacle
|
|||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
remote_config 0
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
#proxy_mode 1
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, HP-UX Version
|
||||
# Version 7.0NG.727, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -89,6 +89,9 @@ transfer_mode tentacle
|
|||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
# remote_config 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
# proxy_mode 1
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, GNU/Linux
|
||||
# Version 7.0NG.727, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -136,6 +136,9 @@ transfer_mode tentacle
|
|||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
remote_config 0
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
# proxy_mode 1
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, GNU/Linux
|
||||
# Version 7.0NG.727, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -41,9 +41,9 @@ udp_server_auth_address 0.0.0.0
|
|||
|
||||
# Group assigned for this agent (descriptive, p.e: Servers)
|
||||
#group Servers
|
||||
|
||||
# Group password (if defined).
|
||||
#group_password
|
||||
|
||||
# Group password (if defined).
|
||||
#group_password
|
||||
|
||||
# Autotime: Enforce to server to ignore timestamp coming from this
|
||||
# agent, used when agents has no timer or it's inestable. 1 to enable
|
||||
|
@ -102,6 +102,9 @@ transfer_mode tentacle
|
|||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
remote_config 0
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# Number of threads to execute modules in parallel
|
||||
#agent_threads 1
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, NetBSD Version
|
||||
# Version 7.0NG.727, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -98,6 +98,9 @@ transfer_mode tentacle
|
|||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
#remote_config 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
#proxy_mode 1
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, Solaris Version
|
||||
# Version 7.0NG.727, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -92,6 +92,9 @@ transfer_mode tentacle
|
|||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
#remote_config 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
#proxy_mode 1
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.724';
|
||||
use constant AGENT_BUILD => '180718';
|
||||
use constant AGENT_VERSION => '7.0NG.727';
|
||||
use constant AGENT_BUILD => '181001';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -186,6 +186,7 @@ my %DefaultConf = (
|
|||
'xml_buffer' => 0,
|
||||
'custom_id' => '',
|
||||
'url_address' => '',
|
||||
'standby' => 0,
|
||||
);
|
||||
my %Conf = %DefaultConf;
|
||||
|
||||
|
@ -1333,6 +1334,41 @@ sub check_collections () {
|
|||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Sleep function
|
||||
################################################################################
|
||||
sub sleep_agent {
|
||||
my ($main_agent, $iter_base_time) = @_;
|
||||
|
||||
# Sleep if main agent
|
||||
if ($main_agent != 0) {
|
||||
foreach my $broker_pid (@BrokerPid) {
|
||||
waitpid ($broker_pid, 0);
|
||||
}
|
||||
|
||||
# Cron mode
|
||||
exit (0) if ($Conf{'cron_mode'} == 1);
|
||||
|
||||
$iter_base_time += $Conf{'intensive_interval'};
|
||||
my $now = time();
|
||||
|
||||
my $interval_remain = $iter_base_time - $now;
|
||||
|
||||
if ($interval_remain >= 0) {
|
||||
sleep ($interval_remain);
|
||||
} else {
|
||||
# don't sleep if iteraion took more than "intensive_interval" seconds
|
||||
$iter_base_time = $now; # use current time as base time
|
||||
}
|
||||
}
|
||||
# Finish if broker agent
|
||||
else {
|
||||
exit (0);
|
||||
}
|
||||
|
||||
return $iter_base_time;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Return the MD5 checksum of the given string as a hex string.
|
||||
# Pseudocode from: http://en.wikipedia.org/wiki/MD5#Pseudocode
|
||||
|
@ -2959,6 +2995,12 @@ while (1) {
|
|||
}
|
||||
}
|
||||
|
||||
# Do not report to server if standby mode is enabled
|
||||
if ($Conf{'standby'} eq '1' && $Conf{'debug'} ne '1') {
|
||||
$iter_base_time = sleep_agent($main_agent, $iter_base_time);
|
||||
next;
|
||||
}
|
||||
|
||||
my $address;
|
||||
|
||||
if(defined($Conf{'address'})) {
|
||||
|
@ -3161,31 +3203,8 @@ while (1) {
|
|||
$SIG{'INT'} = \&udp_server_signal;
|
||||
}
|
||||
|
||||
# Sleep if main agent
|
||||
if ($main_agent != 0) {
|
||||
foreach my $broker_pid (@BrokerPid) {
|
||||
waitpid ($broker_pid, 0);
|
||||
}
|
||||
|
||||
# Cron mode
|
||||
last if ($Conf{'cron_mode'} == 1);
|
||||
|
||||
$iter_base_time += $Conf{'intensive_interval'};
|
||||
my $now = time();
|
||||
|
||||
my $interval_remain = $iter_base_time - $now;
|
||||
|
||||
if ($interval_remain >= 0) {
|
||||
sleep ($interval_remain);
|
||||
} else {
|
||||
# don't sleep if iteraion took more than "intensive_interval" seconds
|
||||
$iter_base_time = $now; # use current time as base time
|
||||
}
|
||||
}
|
||||
# Finish if broker agent
|
||||
else {
|
||||
exit (0);
|
||||
}
|
||||
# Sleep agent function
|
||||
$iter_base_time = sleep_agent($main_agent, $iter_base_time);
|
||||
}
|
||||
|
||||
__END__
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.724
|
||||
%define release 180718
|
||||
%define version 7.0NG.727
|
||||
%define release 181001
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -24,7 +24,7 @@ Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
|
|||
Requires: fileutils textutils unzip
|
||||
Requires: util-linux procps grep
|
||||
Requires: /sbin/ip /bin/awk
|
||||
Requires: perl perl(Sys::Syslog)
|
||||
Requires: perl perl(Sys::Syslog) perl(IO::Compress::Zip)
|
||||
# Required by plugins
|
||||
#Requires: sh-utils sed passwd net-tools rpm
|
||||
AutoReq: 0
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.724
|
||||
%define release 180718
|
||||
%define version 7.0NG.727
|
||||
%define release 181001
|
||||
|
||||
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.724"
|
||||
PI_BUILD="180718"
|
||||
PI_VERSION="7.0NG.727"
|
||||
PI_BUILD="181001"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -325,7 +325,9 @@ sub print_log ($) {
|
|||
$output .= "<source><![CDATA[" . $Module_name . "]]></source>\n";
|
||||
$output .= "<data><![CDATA[";
|
||||
foreach my $line (@kdata) {
|
||||
$output .= $data->{$line};
|
||||
my $processed_line = $line;
|
||||
$processed_line =~ s/\]\]/]]]]><![CDATA[/g;
|
||||
$output .= $processed_line;
|
||||
}
|
||||
$output .= "]]></data>";
|
||||
$output .= "</log_module>\n";
|
||||
|
@ -343,7 +345,9 @@ sub print_log ($) {
|
|||
foreach my $line (@kdata) {
|
||||
$output .= "<data><value><![CDATA[";
|
||||
foreach my $content (@{$data->{$line}}) {
|
||||
$output .= $content;
|
||||
my $processed_line = $content;
|
||||
$processed_line =~ s/\]\]/]]]]><![CDATA[/g;
|
||||
$output .= $processed_line;
|
||||
}
|
||||
$output .= "]]></value></data>\n";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,250 @@
|
|||
#!/usr/bin/perl
|
||||
###############################################################################
|
||||
#
|
||||
# Copyright (c) 2018 Artica Soluciones Tecnologicas S.L.
|
||||
#
|
||||
# grep_log Perl script to search log files for a matching pattern. The last
|
||||
# searched position is saved in an index file so that consecutive
|
||||
# runs do not return the same results. The log file inode number is
|
||||
# also saved to detect log rotation.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
###############################################################################
|
||||
use strict;
|
||||
use File::Basename;
|
||||
use IO::Compress::Zip qw(zip $ZipError);
|
||||
use MIME::Base64;
|
||||
|
||||
# Be verbose
|
||||
my $Verbose = 0;
|
||||
|
||||
# Index file storage directory, with a trailing '/'
|
||||
my $Idx_dir=($^O =~ /win/i)?'.\\':'/tmp/';
|
||||
|
||||
# Log file
|
||||
my $Log_file = '';
|
||||
|
||||
# Index file
|
||||
my $Idx_file = '';
|
||||
|
||||
# Log file position index
|
||||
my $Idx_pos = 0;
|
||||
|
||||
# Log file inode number
|
||||
my $Idx_ino = '';
|
||||
|
||||
# Log file size
|
||||
my $Idx_size = 0;
|
||||
|
||||
###############################################################################
|
||||
# SUB error_msg
|
||||
# Print an error message and exit.
|
||||
###############################################################################
|
||||
sub error_msg ($) {
|
||||
my $err_msg = $_[0];
|
||||
|
||||
if (! -z $err_msg) {
|
||||
print(STDERR "[error] $err_msg.\n");
|
||||
}
|
||||
|
||||
exit 1;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# SUB print_help
|
||||
# Print a help message.
|
||||
###############################################################################
|
||||
sub print_help () {
|
||||
print "Usage: $0 <snmptrapd log file>\n";
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# SUB log_msg
|
||||
# Print a log message.
|
||||
###############################################################################
|
||||
sub log_msg ($) {
|
||||
my $log_msg = $_[0];
|
||||
|
||||
if (! -z $log_msg && $Verbose == 1) {
|
||||
print(STDOUT "[log] $log_msg.\n");
|
||||
}
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# SUB load_idx
|
||||
# Load index file.
|
||||
###############################################################################
|
||||
sub load_idx () {
|
||||
my $line;
|
||||
my $current_ino;
|
||||
my $current_size;
|
||||
|
||||
log_msg("Loading index file $Idx_file");
|
||||
|
||||
open(IDXFILE, $Idx_file) || error_msg("Error opening file $Idx_file: " .
|
||||
$!);
|
||||
|
||||
# Read position and date
|
||||
$line = <IDXFILE>;
|
||||
($Idx_pos, $Idx_ino, $Idx_size) = split(' ', $line);
|
||||
|
||||
close(IDXFILE);
|
||||
|
||||
# Reset the file index if the file has changed
|
||||
$current_ino = (stat($Log_file))[1];
|
||||
$current_size = -s "$Log_file";
|
||||
if ($current_ino != $Idx_ino || $current_size < $Idx_size) {
|
||||
log_msg("File changed, resetting index");
|
||||
|
||||
$Idx_pos = 0;
|
||||
$Idx_ino = $current_ino;
|
||||
}
|
||||
$Idx_size = $current_size;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# SUB save_idx
|
||||
# Save index file.
|
||||
###############################################################################
|
||||
sub save_idx () {
|
||||
|
||||
log_msg("Saving index file $Idx_file");
|
||||
|
||||
open(IDXFILE, "> $Idx_file") || error_msg("Error opening file $Idx_file: "
|
||||
. $!);
|
||||
print (IDXFILE $Idx_pos . " " . $Idx_ino . " " . $Idx_size);
|
||||
close(IDXFILE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# SUB create_idx
|
||||
# Create index file.
|
||||
###############################################################################
|
||||
sub create_idx () {
|
||||
my $first_line;
|
||||
|
||||
log_msg("Creating index file $Idx_file");
|
||||
|
||||
open(LOGFILE, $Log_file) || error_msg("Error opening file $Log_file: " .
|
||||
$!);
|
||||
|
||||
# Go to EOF and save the position
|
||||
seek(LOGFILE, 0, 2);
|
||||
$Idx_pos = tell(LOGFILE);
|
||||
|
||||
close(LOGFILE);
|
||||
|
||||
# Save the file inode number
|
||||
$Idx_ino = (stat($Log_file))[1];
|
||||
|
||||
# Save the index file
|
||||
save_idx();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# SUB parse_log
|
||||
# Parse log file starting from position $Idx_pos.
|
||||
###############################################################################
|
||||
sub parse_log () {
|
||||
my $line;
|
||||
|
||||
log_msg("Parsing log file $Log_file");
|
||||
|
||||
# Open log file for reading
|
||||
open(LOGFILE, $Log_file) || error_msg("Error opening file $Log_file: " .
|
||||
$!);
|
||||
|
||||
# Go to starting position.
|
||||
seek(LOGFILE, $Idx_pos, 0);
|
||||
|
||||
# Parse log file
|
||||
my $data;
|
||||
|
||||
# Matched line id
|
||||
my $matched_line = 0;
|
||||
|
||||
$/ = undef;
|
||||
$data = <LOGFILE>;
|
||||
|
||||
$Idx_pos = tell(LOGFILE);
|
||||
close(LOGFILE);
|
||||
|
||||
# Save the index file
|
||||
save_idx();
|
||||
|
||||
return \$data;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# SUB parse_log
|
||||
# Print log data to STDOUT.
|
||||
###############################################################################
|
||||
sub print_log ($) {
|
||||
my $data = shift;
|
||||
my $zdata;
|
||||
|
||||
return unless defined($data) and $$data ne '';
|
||||
|
||||
if (!zip($data => \$zdata)) {
|
||||
error_msg("Compression error: $ZipError");
|
||||
return;
|
||||
}
|
||||
|
||||
print STDOUT "<trap_data><![CDATA[" . encode_base64($zdata, '') . "]]></trap_data>\n";
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
## Main
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
|
||||
# Check command line parameters
|
||||
if ($#ARGV < 0) {
|
||||
print_help();
|
||||
exit 1;
|
||||
}
|
||||
|
||||
$Log_file = $ARGV[0];
|
||||
# Create index file storage directory
|
||||
if ( ! -d $Idx_dir) {
|
||||
mkdir($Idx_dir) || error_msg("Error creating directory $Idx_dir: "
|
||||
. $!);
|
||||
}
|
||||
|
||||
# Check that log file exists
|
||||
if (! -e $Log_file) {
|
||||
error_msg("File $Log_file does not exist");
|
||||
}
|
||||
|
||||
# Create index file if it does not exist
|
||||
$Idx_file=$Idx_dir . basename($Log_file) . ".idx";
|
||||
if (! -e $Idx_file) {
|
||||
create_idx();
|
||||
exit 0;
|
||||
}
|
||||
|
||||
# Load index file
|
||||
load_idx();
|
||||
|
||||
# Parse log file
|
||||
my $data = parse_log();
|
||||
|
||||
# Print output to STDOUT
|
||||
print_log ($data);
|
||||
|
||||
exit 0;
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2017 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.724
|
||||
# Version 7.0NG.727
|
||||
|
||||
# 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
|
||||
|
@ -82,6 +82,9 @@ server_port 41121
|
|||
# Debug mode renames XML in the temp folder and continues running
|
||||
# debug 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# 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
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.724}
|
||||
{Pandora FMS Windows Agent v7.0NG.727}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{180718}
|
||||
{181001}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -32,7 +32,7 @@ using namespace Pandora;
|
|||
*/
|
||||
Pandora_Data::Pandora_Data (string value) {
|
||||
this->value = value;
|
||||
GetSystemTime (&(this->timestamp));
|
||||
GetLocalTime (&(this->timestamp));
|
||||
this->data_origin = pandora_data_unknown_source;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ Pandora_Data::Pandora_Data (string value, SYSTEMTIME *system_time) {
|
|||
*/
|
||||
Pandora_Data::Pandora_Data (string value, string data_origin) {
|
||||
this->value = value;
|
||||
GetSystemTime (&(this->timestamp));
|
||||
GetLocalTime (&(this->timestamp));
|
||||
this->data_origin = data_origin;
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ Pandora_Data::Pandora_Data (string value, SYSTEMTIME *system_time, string data_o
|
|||
*/
|
||||
Pandora_Data::Pandora_Data () {
|
||||
this->value = "";
|
||||
GetSystemTime (&(this->timestamp));
|
||||
GetLocalTime (&(this->timestamp));
|
||||
this->data_origin = "";
|
||||
}
|
||||
|
||||
|
|
|
@ -67,16 +67,16 @@ Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source
|
|||
|
||||
// Set the type filter
|
||||
int type_number = -1;
|
||||
if (upper_type.compare("ERROR") == 0) {
|
||||
type_number = EVENTLOG_ERROR_TYPE;
|
||||
if (upper_type.compare("CRITICAL") == 0) {
|
||||
type_number = WINEVENT_LEVEL_CRITICAL;
|
||||
} else if (upper_type.compare("ERROR") == 0) {
|
||||
type_number = WINEVENT_LEVEL_ERROR;
|
||||
} else if (upper_type.compare("WARNING") == 0) {
|
||||
type_number = EVENTLOG_WARNING_TYPE;
|
||||
} else if (upper_type.compare("INFORMATION") == 0) {
|
||||
type_number = EVENTLOG_INFORMATION_TYPE;
|
||||
} else if (upper_type.compare("AUDIT SUCCESS") == 0) {
|
||||
type_number = EVENTLOG_AUDIT_SUCCESS;
|
||||
} else if (upper_type.compare("AUDIT FAILURE") == 0) {
|
||||
type_number = EVENTLOG_AUDIT_FAILURE;
|
||||
type_number = WINEVENT_LEVEL_WARNING;
|
||||
} else if (upper_type.compare("INFO") == 0) {
|
||||
type_number = WINEVENT_LEVEL_INFO;
|
||||
} else if (upper_type.compare("VERBOSE") == 0) {
|
||||
type_number = WINEVENT_LEVEL_VERBOSE;
|
||||
}
|
||||
// Append type to log query
|
||||
if (type_number != -1) {
|
||||
|
|
|
@ -29,6 +29,13 @@
|
|||
// Log event read buffer size
|
||||
#define BUFFER_SIZE 1024
|
||||
|
||||
// WINEVENT consts
|
||||
#define WINEVENT_LEVEL_CRITICAL 1
|
||||
#define WINEVENT_LEVEL_ERROR 2
|
||||
#define WINEVENT_LEVEL_WARNING 3
|
||||
#define WINEVENT_LEVEL_INFO 4
|
||||
#define WINEVENT_LEVEL_VERBOSE 5
|
||||
|
||||
// Types for pointers to Wevtapi.dll functions
|
||||
typedef EVT_HANDLE WINAPI (*EvtQueryT) (EVT_HANDLE Session, LPCWSTR Path, LPCWSTR Query, DWORD Flags);
|
||||
typedef WINBOOL WINAPI (*EvtNextT) (EVT_HANDLE ResultSet, DWORD EventArraySize, EVT_HANDLE* EventArray, DWORD Timeout, DWORD Flags, PDWORD Returned);
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.724(Build 180718)")
|
||||
#define PANDORA_VERSION ("7.0NG.727(Build 181001)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -1869,7 +1869,7 @@ Pandora_Windows_Service::pandora_run_broker (string config) {
|
|||
|
||||
server_addr = conf->getValue ("server_ip");
|
||||
|
||||
if (this->broker_modules != NULL) {
|
||||
if (this->broker_modules != NULL && !(conf->getValue ("standby") == "1" && !getPandoraDebug())) {
|
||||
this->broker_modules->goFirst ();
|
||||
|
||||
while (! this->broker_modules->isLast ()) {
|
||||
|
@ -1937,7 +1937,7 @@ Pandora_Windows_Service::pandora_run_broker (string config) {
|
|||
}
|
||||
}
|
||||
|
||||
if (data_flag == 1 || this->timestamp + this->interval_sec <= this->run_time) {
|
||||
if ((data_flag == 1 || this->timestamp + this->interval_sec <= this->run_time) && !(conf->getValue ("standby") == "1" && !getPandoraDebug())) {
|
||||
|
||||
// Send the XML
|
||||
if (!server_addr.empty ()) {
|
||||
|
@ -1997,7 +1997,7 @@ Pandora_Windows_Service::pandora_run (int forced_run) {
|
|||
|
||||
execution_number++;
|
||||
|
||||
if (this->modules != NULL) {
|
||||
if (this->modules != NULL && !(conf->getValue ("standby") == "1" && !getPandoraDebug())) {
|
||||
this->modules->goFirst ();
|
||||
|
||||
while (! this->modules->isLast ()) {
|
||||
|
@ -2057,7 +2057,7 @@ Pandora_Windows_Service::pandora_run (int forced_run) {
|
|||
}
|
||||
}
|
||||
|
||||
if (forced_run == 1 || data_flag == 1 || this->timestamp + this->interval_sec <= this->run_time) {
|
||||
if ((forced_run == 1 || data_flag == 1 || this->timestamp + this->interval_sec <= this->run_time) && !(conf->getValue ("standby") == "1" && !getPandoraDebug())) {
|
||||
|
||||
// Send the XML
|
||||
if (!server_addr.empty ()) {
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.724(Build 180718))"
|
||||
VALUE "ProductVersion", "(7.0NG.727(Build 181001))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.724-180718
|
||||
Version: 7.0NG.727-181001
|
||||
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.724-180718"
|
||||
pandora_version="7.0NG.727-181001"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -77,15 +77,6 @@ $isFunctionSkins = enterprise_include_once ('include/functions_skins.php');
|
|||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK)
|
||||
$config["relative_path"] = enterprise_hook('skins_set_image_skin_path',array($config['id_user']));
|
||||
|
||||
// Load user language
|
||||
$user_language = get_user_language ($config['id_user']);
|
||||
|
||||
$l10n = NULL;
|
||||
if (file_exists ('./include/languages/'.$user_language.'.mo')) {
|
||||
$l10n = new gettext_reader (new CachedFileReader ('./include/languages/'.$user_language.'.mo'));
|
||||
$l10n->load_tables();
|
||||
}
|
||||
|
||||
if (isset($config['metaconsole'])) {
|
||||
// Not cool way of know if we are executing from metaconsole or normal console
|
||||
if ($config['metaconsole'])
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
Order deny,allow
|
||||
Deny from All
|
||||
Allow from localhost
|
|
@ -17,103 +17,21 @@
|
|||
|
||||
global $config;
|
||||
|
||||
if (is_ajax ()) {
|
||||
check_login ();
|
||||
|
||||
require_once('include/functions_agents.php');
|
||||
|
||||
$get_info_alert_module_group = (bool)get_parameter('get_info_alert_module_group');
|
||||
$module_group = (int)get_parameter('module_group');
|
||||
$id_agent_group = (int)get_parameter('id_agent_group');
|
||||
|
||||
$data = false;
|
||||
if ($get_info_alert_module_group) {
|
||||
$agents = agents_get_group_agents($id_agent_group);
|
||||
if (!empty($agents)) {
|
||||
$alerts = agents_get_alerts_simple(array_keys($agents));
|
||||
foreach ($alerts as $alert) {
|
||||
$module = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module']));
|
||||
if ($module_group == $module['id_module_group']) {
|
||||
if ($alert["times_fired"] > 0) {
|
||||
$data = true;
|
||||
echo '<strong>' . __('Number fired of alerts').': </strong> ' . $alert["times_fired"] . '<br />';
|
||||
$agent = db_get_row('tagente', 'id_agente', $module['id_agente']);
|
||||
echo '<strong>' . __('Agent').': </strong>';
|
||||
echo io_safe_output($agent['nombre']) . '<br />';
|
||||
echo '<strong>' . __('Module') . ': </strong>';
|
||||
echo io_safe_output($module['nombre']) . '<br />';
|
||||
$template = db_get_row('talert_templates', 'id' , $alert['id_alert_template']);
|
||||
echo '<strong>' . __('Alert template') . ': </strong>';
|
||||
echo io_safe_output($template['name']) . '<br />';
|
||||
|
||||
// This prevent from templates without predefined actions
|
||||
if (empty($template['id_alert_action']))
|
||||
$template_id_alert_action = "''";
|
||||
else
|
||||
$template_id_alert_action = $template['id_alert_action'];
|
||||
|
||||
// True if the alert only has the default template action
|
||||
$default_action = false;
|
||||
// Try to get actions for the current alert
|
||||
$sql = 'SELECT t2.name
|
||||
FROM talert_template_module_actions t1
|
||||
INNER JOIN talert_actions t2
|
||||
INNER JOIN talert_template_modules t3
|
||||
ON t3.id = t1.id_alert_template_module
|
||||
AND t1.id_alert_action = t2.id
|
||||
WHERE (t3.id_alert_template = ' . $template['id'] . ' AND
|
||||
t3.id_agent_module = ' . $module['id_agente_modulo'] . ');';
|
||||
|
||||
$actions = db_get_all_rows_sql($sql);
|
||||
|
||||
// If this alert doesn't have actions try to get default action from template
|
||||
if ($actions === false) {
|
||||
$sql = 'SELECT name
|
||||
FROM talert_actions
|
||||
WHERE (id = ' . $template_id_alert_action . ');';
|
||||
|
||||
$default_action = true;
|
||||
|
||||
$actions = db_get_all_rows_sql($sql);
|
||||
}
|
||||
|
||||
if ($actions === false) {
|
||||
$actions = array();
|
||||
}
|
||||
|
||||
echo '<strong>' . __('Actions') . ': </strong>' . '<br />';
|
||||
echo '<ul style="margin-top: 0px; margin-left: 30px;">';
|
||||
foreach ($actions as $action) {
|
||||
echo '<li style="list-style: disc;">';
|
||||
if ($default_action)
|
||||
echo 'Default: ';
|
||||
echo $action['name'] . '</li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
if ($alert != end($alerts)) {
|
||||
echo '<hr />';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$data) {
|
||||
echo '<i>These module/s have no alerts or alert/s are not fired</i>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo '<i>No available data</i>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo '<i>No available data</i>';
|
||||
}
|
||||
}
|
||||
check_login ();
|
||||
|
||||
/**
|
||||
* Translate the array texts using gettext
|
||||
*/
|
||||
function translate(&$item, $key) {
|
||||
$item = __($item);
|
||||
if (is_ajax ()) {
|
||||
$get_info_alert_module_group = (bool)get_parameter('get_info_alert_module_group');
|
||||
|
||||
if ($get_info_alert_module_group) {
|
||||
$send_tooltip = json_decode(io_safe_output(get_parameter('send_tooltip')), true);
|
||||
echo "<ul class='tooltip_counters'><h3>" . __('Counters Module') . "</h3>";
|
||||
echo "<li><div style='background-color: " . COL_ALERTFIRED . ";'></div>" . __('Alerts_Fired') . ": " . $send_tooltip['alerts_module_count'] . "</li>";
|
||||
echo "<li><div style='background-color: " . COL_CRITICAL . ";'></div>" . __('Critical') . ": " . $send_tooltip['critical_module_count'] . "</li>";
|
||||
echo "<li><div style='background-color: " . COL_WARNING . ";'></div>" . __('warning') . ": " . $send_tooltip['warning_module_count'] . "</li>";
|
||||
echo "<li><div style='background-color: " . COL_UNKNOWN . ";'></div>" . __('Unknown') . ": " . $send_tooltip['unknown_module_count'] . "</li>";
|
||||
echo "<li><div style='background-color: " . COL_NORMAL . ";'></div>" . __('OK') . ": " . $send_tooltip['normal_module_count'] . "</li>";
|
||||
echo "<li><div style='background-color: " . COL_MAINTENANCE . ";'></div>" . __('Not_init') . ": " . $send_tooltip['notInit_module_count'] . "</li></ul>";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -121,192 +39,229 @@ function translate(&$item, $key) {
|
|||
* execute the code.
|
||||
*/
|
||||
function mainModuleGroups() {
|
||||
global $config; //the useful global var of Pandora Console, it has many data can you use
|
||||
|
||||
require_once ('include/functions_reporting.php');
|
||||
require_once($config['homedir'] . "/include/functions_agents.php");
|
||||
require_once($config['homedir'] . "/include/functions_users.php");
|
||||
|
||||
//The big query
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = "SELECT COUNT(id_agente) AS count, case utimestamp when 0 then 5 else estado end as estado
|
||||
FROM tagente_estado
|
||||
WHERE id_agente IN
|
||||
(SELECT id_agente FROM tagente WHERE id_grupo = %d AND disabled IS FALSE)
|
||||
AND id_agente_modulo IN
|
||||
(SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE id_module_group = %d AND disabled IS FALSE AND delete_pending IS FALSE)
|
||||
GROUP BY estado";
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = "SELECT COUNT(id_agente) AS count,
|
||||
case utimestamp when 0 then 5 else estado end as estado
|
||||
FROM tagente_estado
|
||||
WHERE id_agente IN
|
||||
(SELECT id_agente FROM tagente WHERE id_grupo = %d AND disabled = 0)
|
||||
AND id_agente_modulo IN
|
||||
(SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE id_module_group = %d AND disabled = 0 AND delete_pending = 0)
|
||||
GROUP BY estado, utimestamp";
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = "SELECT COUNT(id_agente) AS count, (case when utimestamp = 0 then 5 else estado end) AS estado
|
||||
FROM tagente_estado
|
||||
WHERE id_agente IN
|
||||
(SELECT id_agente FROM tagente WHERE id_grupo = %d AND (disabled IS NOT NULL AND disabled <> 0))
|
||||
AND id_agente_modulo IN
|
||||
(SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE id_module_group = %d AND (disabled IS NOT NULL AND disabled <> 0) AND (delete_pending IS NOT NULL AND delete_pending <> 0))
|
||||
GROUP BY (case when utimestamp = 0 then 5 else estado end)";
|
||||
break;
|
||||
}
|
||||
|
||||
ui_print_page_header (__("Combined table of agent group and module group"), "images/module_group.png", false, "", false, '');
|
||||
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=>
|
||||
__("This table shows in columns the modules group and in rows agents group. The cell shows all modules") )
|
||||
);
|
||||
|
||||
|
||||
$agentGroups = users_get_groups ($config['id_user'], "AR", false);
|
||||
$modelGroups = users_get_all_model_groups();
|
||||
|
||||
if (!empty($agentGroups) && !empty($modelGroups)) {
|
||||
array_walk($modelGroups, 'translate'); //Translate all head titles to language is set
|
||||
|
||||
$table = null;
|
||||
$table->headstyle[] = "width: 20%";
|
||||
foreach ($modelGroups as $i => $n) {
|
||||
$table->headstyle[] = "min-width: 60px;max-width: 5%;text-align:center;";
|
||||
$modelGroups[$i] = ui_print_truncate_text($n, GENERIC_SIZE_TEXT, true, true, true, '…', 'color:#FFF');
|
||||
}
|
||||
|
||||
$head = $modelGroups;
|
||||
array_unshift($head, ' ');
|
||||
|
||||
//Metaobject use in html_print_table
|
||||
$table->align[0] = 'left'; //Align to left the first column.
|
||||
$table->style[0] = 'color: #ffffff; '.
|
||||
'background-color: #373737; font-weight: bolder; padding-right: 10px; width:20%; ';
|
||||
$table->head = $head;
|
||||
$table->width = '100%';
|
||||
|
||||
//The content of table
|
||||
$tableData = array();
|
||||
|
||||
//Create rows and cells
|
||||
foreach ($agentGroups as $idAgentGroup => $name) {
|
||||
$fired = false;
|
||||
$row = array();
|
||||
|
||||
array_push($row, ui_print_truncate_text($name, GENERIC_SIZE_TEXT, true, true, true, '…', 'color:#FFF'));
|
||||
|
||||
foreach ($modelGroups as $idModelGroup => $modelGroup) {
|
||||
$fired = false;
|
||||
$query = sprintf($sql, $idAgentGroup, $idModelGroup);
|
||||
|
||||
$rowsDB = db_get_all_rows_sql ($query);
|
||||
|
||||
$agents = agents_get_group_agents($idAgentGroup);
|
||||
|
||||
if (!empty($agents)) {
|
||||
$alerts = agents_get_alerts_simple(array_keys($agents));
|
||||
|
||||
foreach ($alerts as $alert) {
|
||||
$module = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module']));
|
||||
|
||||
if ($idModelGroup == $module['id_module_group']) {
|
||||
if ($alert["times_fired"] > 0) {
|
||||
$fired = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$states = array();
|
||||
if ($rowsDB !== false) {
|
||||
foreach ($rowsDB as $rowDB) {
|
||||
$states[$rowDB['estado']] = $rowDB['count'];
|
||||
}
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
foreach ($states as $idState => $state) {
|
||||
$count += $state;
|
||||
}
|
||||
|
||||
$color = 'transparent'; //Defaut color for cell
|
||||
$font_color = '#000000'; //Default font color for cell
|
||||
if ($count == 0) {
|
||||
$color = '#eeeeee'; //Soft grey when the cell for this model group and agent group hasn't modules.
|
||||
$alinkStart = '';
|
||||
$alinkEnd = '';
|
||||
}
|
||||
else {
|
||||
|
||||
if ($fired) {
|
||||
$color = '#FFA631'; //Orange when the cell for this model group and agent has at least one alert fired.
|
||||
}
|
||||
else if (array_key_exists(1, $states)) {
|
||||
$color = '#FC4444'; //Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
|
||||
$font_color = '#ffffff';
|
||||
}
|
||||
elseif (array_key_exists(2, $states)) {
|
||||
$color = '#FAD403'; //Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
|
||||
}
|
||||
elseif (array_key_exists(3, $states)) {
|
||||
$color = '#B2B2B2 '; //Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
|
||||
}
|
||||
elseif (array_key_exists(0, $states)) {
|
||||
$color = '#80BA27'; //Green when the cell for this model group and agent has OK state all modules.
|
||||
}
|
||||
elseif (array_key_exists(5, $states)) {
|
||||
$color = '#5BB6E5'; // Blue when the cell for this module group and all modules have not init value.
|
||||
}
|
||||
|
||||
|
||||
$alinkStart = '<a class="info_cell" rel="ajax.php?page=extensions/module_groups&get_info_alert_module_group=1&module_group=' .
|
||||
$idModelGroup . '&id_agent_group=' . $idAgentGroup . '"href="index.php?sec=estado&sec2=operation/agentes/status_monitor&status=-1&ag_group=' .
|
||||
$idAgentGroup . '&modulegroup=' . $idModelGroup . '" style="color: ' . $font_color . '; font-size: 18px;";>';
|
||||
$alinkEnd = '</a>';
|
||||
}
|
||||
|
||||
array_push($row,
|
||||
'<div
|
||||
style="background: ' . $color . ';
|
||||
height: 20px;min-width: 60px;max-width:5%;overflow:hidden;
|
||||
margin-left: auto; margin-right: auto;
|
||||
text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;">
|
||||
' . $alinkStart . $count . $alinkEnd . '</div>');
|
||||
}
|
||||
array_push($tableData,$row);
|
||||
}
|
||||
$table->data = $tableData;
|
||||
echo "<div style='width:100%; overflow-x:auto;'>";
|
||||
html_print_table($table);
|
||||
echo "</div>";
|
||||
|
||||
echo "<div class='legend_basic' style='width: 98.6%'>";
|
||||
global $config;
|
||||
|
||||
echo "<table >";
|
||||
echo "<tr><td colspan='2' style='padding-bottom: 10px;'><b>" . __('Legend') . "</b></td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_ALERTFIRED . ";'></div></td><td>" . __("Orange cell when the module group and agent have at least one alarm fired.") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_CRITICAL . ";'></div></td><td>" . __("Red cell when the module group and agent have at least one module in critical status and the others in any status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_WARNING . ";'></div></td><td>" . __("Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_NORMAL . ";'></div></td><td>" . __("Green cell when the module group and agent have all modules in OK status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_UNKNOWN . ";'></div></td><td>" . __("Grey cell when the module group and agent have at least one in unknown status and the others in green status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_MAINTENANCE . ";'></div></td><td>" .__("Blue cell when the module group and agent have all modules in not init status.") . "</td></tr>";
|
||||
echo "</table>";
|
||||
require_once($config['homedir'] . "/include/class/TreeGroup.class.php");
|
||||
require_once($config['homedir'] . "/include/functions_groupview.php");
|
||||
|
||||
$tree_group = new TreeGroup("group", "group");
|
||||
$tree_group->setPropagateCounters(false);
|
||||
$tree_group->setDisplayAllGroups(true);
|
||||
$tree_group->setFilter( array(
|
||||
'searchAgent' => '',
|
||||
'statusAgent' => AGENT_STATUS_ALL,
|
||||
'searchModule' => '',
|
||||
'statusModule' => -1,
|
||||
'groupID' => 0,
|
||||
'tagID' => 0,
|
||||
'show_not_init_agents' => 1,
|
||||
'show_not_init_modules' => 1
|
||||
));
|
||||
$info = $tree_group->getArray();
|
||||
$info = groupview_plain_groups($info);
|
||||
$counter = count($info);
|
||||
$offset = get_parameter('offset', 0);
|
||||
$groups_view = $is_not_paginated
|
||||
? $info
|
||||
: array_slice($info, $offset, $config['block_size']);
|
||||
$agents_counters = array_reduce($groups_view, function($carry, $item){
|
||||
$carry[$item['id']] = $item;
|
||||
return $carry;
|
||||
}, array());
|
||||
|
||||
$ids_array = array_keys($agents_counters);
|
||||
|
||||
$ids_group = implode(',', $ids_array);
|
||||
|
||||
$condition_critical = modules_get_state_condition(AGENT_MODULE_STATUS_CRITICAL_ALERT);
|
||||
$condition_warning = modules_get_state_condition(AGENT_MODULE_STATUS_WARNING_ALERT);
|
||||
$condition_unknown = modules_get_state_condition(AGENT_MODULE_STATUS_UNKNOWN);
|
||||
$condition_not_init = modules_get_state_condition(AGENT_MODULE_STATUS_NO_DATA);
|
||||
$condition_normal = modules_get_state_condition(AGENT_MODULE_STATUS_NORMAL);
|
||||
|
||||
$array_for_defect = array();
|
||||
$array_module_group = array();
|
||||
$array_data = array();
|
||||
|
||||
$sql = "SELECT id_mg, `name` FROM tmodule_group";
|
||||
$array_mod= db_get_all_rows_sql($sql);
|
||||
|
||||
foreach ($array_mod as $key => $value) {
|
||||
$array_module_group[$value['id_mg']] = $value['name'];
|
||||
}
|
||||
$array_module_group[0] = 'Nothing';
|
||||
foreach ($agents_counters as $key => $value) {
|
||||
$array_for_defect[$key]['gm'] = $array_module_group;
|
||||
$array_for_defect[$key]['data']['name'] = $value['name'];
|
||||
$array_for_defect[$key]['data']['parent'] = $value['parent'];
|
||||
$array_for_defect[$key]['data']['icon'] = $value['icon'];
|
||||
}
|
||||
|
||||
$sql =
|
||||
"SELECT SUM(IF(tae.alert_fired <> 0, 1, 0)) AS alerts_module_count,
|
||||
SUM(IF($condition_warning, 1, 0)) AS warning_module_count,
|
||||
SUM(IF($condition_unknown, 1, 0)) AS unknown_module_count,
|
||||
SUM(IF($condition_not_init, 1, 0)) AS notInit_module_count,
|
||||
SUM(IF($condition_critical, 1, 0)) AS critical_module_count,
|
||||
SUM(IF($condition_normal, 1, 0)) AS normal_module_count,
|
||||
COUNT(tae.id_agente_modulo) AS total_count,
|
||||
tmg.id_mg,
|
||||
tmg.name as n,
|
||||
tg.id_grupo
|
||||
FROM (
|
||||
SELECT tam.id_agente_modulo,
|
||||
tam.id_module_group,
|
||||
ta.id_grupo AS g,
|
||||
tae.estado,
|
||||
SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
|
||||
FROM tagente_modulo tam
|
||||
LEFT JOIN talert_template_modules tatm
|
||||
ON tatm.id_agent_module = tam.id_agente_modulo
|
||||
LEFT JOIN tagente_estado tae
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||
INNER JOIN tagente ta
|
||||
ON ta.id_agente = tam.id_agente
|
||||
WHERE ta.disabled = 0
|
||||
AND tam.disabled = 0
|
||||
AND tam.delete_pending = 0
|
||||
AND ta.id_grupo IN ($ids_group)
|
||||
GROUP BY tam.id_agente_modulo
|
||||
UNION ALL
|
||||
SELECT tam.id_agente_modulo,
|
||||
tam.id_module_group,
|
||||
tasg.id_group AS g,
|
||||
tae.estado,
|
||||
SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
|
||||
FROM tagente_modulo tam
|
||||
LEFT JOIN talert_template_modules tatm
|
||||
ON tatm.id_agent_module = tam.id_agente_modulo
|
||||
LEFT JOIN tagente_estado tae
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||
INNER JOIN tagente ta
|
||||
ON ta.id_agente = tam.id_agente
|
||||
INNER JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE ta.disabled = 0
|
||||
AND tam.disabled = 0
|
||||
AND tam.delete_pending = 0
|
||||
AND tasg.id_group IN ($ids_group)
|
||||
GROUP BY tam.id_agente_modulo, tasg.id_group
|
||||
) AS tae
|
||||
RIGHT JOIN tgrupo tg
|
||||
ON tg.id_grupo = tae.g
|
||||
INNER JOIN (
|
||||
SELECT * FROM tmodule_group
|
||||
UNION ALL
|
||||
SELECT 0 AS 'id_mg', 'Nothing' AS 'name'
|
||||
) AS tmg
|
||||
ON tae.id_module_group = tmg.id_mg
|
||||
GROUP BY tae.g, tmg.id_mg";
|
||||
|
||||
$array_data_prev = db_get_all_rows_sql($sql);
|
||||
|
||||
foreach ($array_data_prev as $key => $value) {
|
||||
$array_data[$value['id_grupo']][$value['id_mg']] = $value;
|
||||
}
|
||||
|
||||
ui_print_page_header (__("Combined table of agent group and module group"), "images/module_group.png", false, "", false, '');
|
||||
|
||||
if(count($array_for_defect) > 0){
|
||||
$table = new StdClass();
|
||||
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; padding-right: 10px; min-width: 230px;';
|
||||
$table->width = '100%';
|
||||
|
||||
$head[0] = __('Groups');
|
||||
$headstyle[0] = "width: 20%; font-weight: bolder;";
|
||||
foreach ($array_module_group as $key => $value) {
|
||||
$headstyle[] = "min-width: 60px;max-width: 5%;text-align:center; color: #ffffff; background-color: #373737; font-weight: bolder;";
|
||||
$head[] = ui_print_truncate_text($value, GENERIC_SIZE_TEXT, true, true, true, '…', 'color:#FFF');
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
foreach ($array_for_defect as $key => $value) {
|
||||
$deep = groups_get_group_deep($key);
|
||||
$data[$i][0] = $deep . ui_print_truncate_text($value['data']['name'], GENERIC_SIZE_TEXT, true, true, true, '…', 'color:#FFF');
|
||||
$j = 1;
|
||||
if(isset($array_data[$key])){
|
||||
foreach ($value['gm'] as $k => $v) {
|
||||
if(isset($array_data[$key][$k])){
|
||||
$send_tooltip = json_encode($array_data[$key][$k]);
|
||||
$rel = "ajax.php?page=extensions/module_groups&get_info_alert_module_group=1&send_tooltip=" . $send_tooltip;
|
||||
$url = "index.php?sec=estado&sec2=operation/agentes/status_monitor&status=-1&ag_group=" . $key . "&modulegroup=" . $k;
|
||||
|
||||
if ($array_data[$key][$k]['alerts_module_count'] != 0) {
|
||||
$color = '#FFA631'; //Orange when the cell for this model group and agent has at least one alert fired.
|
||||
}
|
||||
else if ($array_data[$key][$k]['critical_module_count'] != 0) {
|
||||
$color = '#FC4444'; //Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
|
||||
}
|
||||
elseif ($array_data[$key][$k]['warning_module_count'] != 0) {
|
||||
$color = '#FAD403'; //Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
|
||||
}
|
||||
elseif ($array_data[$key][$k]['unknown_module_count'] != 0) {
|
||||
$color = '#B2B2B2 '; //Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
|
||||
}
|
||||
elseif ($array_data[$key][$k]['normal_module_count'] != 0) {
|
||||
$color = '#80BA27'; //Green when the cell for this model group and agent has OK state all modules.
|
||||
}
|
||||
elseif ($array_data[$key][$k]['notInit_module_count'] != 0) {
|
||||
$color = '#5BB6E5'; // Blue when the cell for this module group and all modules have not init value.
|
||||
}
|
||||
|
||||
$data[$i][$j] ="<div style='background:$color; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
|
||||
$data[$i][$j] .= "<a class='info_cell' rel='$rel' href='$url' style='color:white;font-size: 18px;'>";
|
||||
$data[$i][$j] .= $array_data[$key][$k]['total_count'];
|
||||
$data[$i][$j] .= "</a></div>";
|
||||
}
|
||||
else{
|
||||
$data[$i][$j] ="<div style='background:white; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
|
||||
$data[$i][$j] .= 0;
|
||||
$data[$i][$j] .= "</div>";
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
else{
|
||||
foreach ($value['gm'] as $k => $v) {
|
||||
$data[$i][$j] ="<div style='background:white; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
|
||||
$data[$i][$j] .= 0;
|
||||
$data[$i][$j] .= "</div>";
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
$table->head = $head;
|
||||
$table->headstyle = $headstyle;
|
||||
$table->data = $data;
|
||||
|
||||
ui_pagination($counter);
|
||||
|
||||
echo "<div style='width:100%; overflow-x:auto;'>";
|
||||
html_print_table($table);
|
||||
echo "</div>";
|
||||
|
||||
ui_pagination($counter);
|
||||
|
||||
echo "<div class='legend_basic' style='width: 98.6%'>";
|
||||
echo "<table >";
|
||||
echo "<tr><td colspan='2' style='padding-bottom: 10px;'><b>" . __('Legend') . "</b></td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_ALERTFIRED . ";'></div></td><td>" . __("Orange cell when the module group and agent have at least one alarm fired.") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_CRITICAL . ";'></div></td><td>" . __("Red cell when the module group and agent have at least one module in critical status and the others in any status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_WARNING . ";'></div></td><td>" . __("Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_UNKNOWN . ";'></div></td><td>" . __("Grey cell when the module group and agent have at least one in unknown status and the others in green status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_NORMAL . ";'></div></td><td>" . __("Green cell when the module group and agent have all modules in OK status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_MAINTENANCE . ";'></div></td><td>" .__("Blue cell when the module group and agent have all modules in not init status.") . "</td></tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
}
|
||||
else {
|
||||
echo "<div class='nf'>".__('There are no defined groups or module groups')."</div>";
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __("This table shows in columns the modules group and in rows agents group. The cell shows all modules") ));
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined groups or module groups') ));
|
||||
}
|
||||
|
||||
|
||||
ui_require_css_file('cluetip');
|
||||
ui_require_jquery_file('cluetip');
|
||||
?>
|
||||
|
@ -315,7 +270,8 @@ function mainModuleGroups() {
|
|||
$("a.info_cell").cluetip ({
|
||||
arrows: true,
|
||||
attribute: 'rel',
|
||||
cluetipClass: 'default'
|
||||
cluetipClass: 'default',
|
||||
width: '200px'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -125,7 +125,7 @@ function pandora_realtime_graphs () {
|
|||
if ($graph != 'snmp_module') {
|
||||
$data['incremental'] = __('Incremental') . ' ' . html_print_checkbox ('incremental', 1, 0, true);
|
||||
}
|
||||
$data['reset'] = html_print_button(__('Clear graph'), 'reset', false, 'clearGraph()', 'class="sub delete" style="margin-top:0px;"', true);
|
||||
$data['reset'] = html_print_button(__('Clear graph'), 'reset', false, 'javascript:realtimeGraphs.clearGraph();', 'class="sub delete" style="margin-top:0px;"', true);
|
||||
$table->data[] = $data;
|
||||
|
||||
if ($graph == 'snmp_interface' || $graph == 'snmp_module') {
|
||||
|
@ -154,7 +154,7 @@ function pandora_realtime_graphs () {
|
|||
$table->colspan[2]['snmp_oid'] = 2;
|
||||
|
||||
$data['snmp_ver'] = __('Version') . ' ' . html_print_select ($snmp_versions, 'snmp_version', $snmp_ver, '', '', 0, true);
|
||||
$data['snmp_ver'] .= ' ' . html_print_button (__('SNMP walk'), 'snmp_walk', false, 'snmpBrowserWindow()', 'class="sub next"', true);
|
||||
$data['snmp_ver'] .= ' ' . html_print_button (__('SNMP walk'), 'snmp_walk', false, 'javascript:realtimeGraphs.snmpBrowserWindow();', 'class="sub next"', true);
|
||||
$table->colspan[2]['snmp_ver'] = 2;
|
||||
|
||||
$table->data[] = $data;
|
||||
|
@ -176,7 +176,7 @@ function pandora_realtime_graphs () {
|
|||
echo '</form>';
|
||||
|
||||
// Define a custom action to save the OID selected in the SNMP browser to the form
|
||||
html_print_input_hidden ('custom_action', urlencode (base64_encode(' <a href="javascript:setOID()"><img src="' . ui_get_full_url("images") . '/input_filter.disabled.png" title="' . __("Use this OID") . '" style="vertical-align: middle;"></img></a>')), false);
|
||||
html_print_input_hidden ('custom_action', urlencode (base64_encode(' <a href="javascript:realtimeGraphs.setOID();"><img src="' . ui_get_full_url("images") . '/input_filter.disabled.png" title="' . __("Use this OID") . '" style="vertical-align: middle;"></img></a>')), false);
|
||||
html_print_input_hidden ('incremental_base', '0');
|
||||
|
||||
echo '<script type="text/javascript" src="'.ui_get_full_url("extensions/realtime_graphs/realtime_graphs.js").'"></script>';
|
||||
|
|
|
@ -1,192 +1,207 @@
|
|||
var max_data_plot = 100;
|
||||
(function () {
|
||||
var numberOfPoints = 100;
|
||||
var refresh = parseInt($('#refresh').val());
|
||||
var incremental = $('#checkbox-incremental').is(':checked') || $('#hidden-incremental').val() == 1;
|
||||
var lastIncVal = null;
|
||||
var intervalRef = null;
|
||||
var currentXHR = null;
|
||||
|
||||
var options = {
|
||||
legend: { container: $("#chartLegend") },
|
||||
xaxis: {
|
||||
tickFormatter: function (timestamp, axis) {
|
||||
var date = new Date(timestamp * 1000);
|
||||
|
||||
var server_timezone_offset = get_php_value('timezone_offset');
|
||||
var local_timezone_offset = date.getTimezoneOffset()*60*-1;
|
||||
|
||||
if (server_timezone_offset != local_timezone_offset) {
|
||||
// If timezone of server and client is different, adjust the time to the server
|
||||
date = new Date((timestamp + (server_timezone_offset - local_timezone_offset)) * 1000);
|
||||
var plot;
|
||||
var plotOptions = {
|
||||
legend: { container: $("#chartLegend") },
|
||||
xaxis: {
|
||||
tickFormatter: function (timestamp, axis) {
|
||||
var date = new Date(timestamp * 1000);
|
||||
|
||||
var server_timezone_offset = get_php_value('timezone_offset');
|
||||
var local_timezone_offset = date.getTimezoneOffset()*60*-1;
|
||||
|
||||
if (server_timezone_offset != local_timezone_offset) {
|
||||
// If timezone of server and client is different, adjust the time to the server
|
||||
date = new Date((timestamp + (server_timezone_offset - local_timezone_offset)) * 1000);
|
||||
}
|
||||
|
||||
var hours = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours());
|
||||
var minutes = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes());
|
||||
var seconds = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
|
||||
var formattedTime = hours + ':' + minutes + ':' + seconds;
|
||||
return formattedTime;
|
||||
}
|
||||
},
|
||||
yaxis: {
|
||||
tickFormatter: function (value, axis) {
|
||||
return shortNumber(value);
|
||||
}
|
||||
},
|
||||
series: {
|
||||
lines: {
|
||||
lineWidth: 2,
|
||||
fill: true
|
||||
}
|
||||
},
|
||||
colors: ['#6db431']
|
||||
};
|
||||
|
||||
function updatePlot (data) {
|
||||
plot = $.plot($('.graph'), data, plotOptions);
|
||||
}
|
||||
|
||||
function requestData () {
|
||||
var rel_path = $("#hidden-rel_path").val();
|
||||
|
||||
currentXHR = $.ajax({
|
||||
url: rel_path + "extensions/realtime_graphs/ajax.php",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: {
|
||||
graph: $('#graph :selected').val(),
|
||||
graph_title: $('#graph :selected').html(),
|
||||
snmp_community: $('#text-snmp_community').val(),
|
||||
snmp_oid: $('#text-snmp_oid').val(),
|
||||
snmp_ver: $('#snmp_version :selected').val(),
|
||||
snmp_address: $('#text-ip_target').val(),
|
||||
refresh: refresh
|
||||
},
|
||||
success: function (serie) {
|
||||
var timestamp = serie.data[0][0];
|
||||
var data = plot.getData();
|
||||
|
||||
if (incremental) {
|
||||
var currentVal = serie.data[0][1];
|
||||
// Try to avoid the first value, cause we need at least two values to get the increment
|
||||
serie.data[0][1] = lastIncVal == null ? 0 : currentVal - lastIncVal;
|
||||
// Incremental is always positive
|
||||
if (serie.data[0][1] < 0) serie.data[0][1] = 0;
|
||||
// Store the current value to use it into the next request
|
||||
lastIncVal = currentVal;
|
||||
}
|
||||
|
||||
if (data.length === 0) {
|
||||
for (i = 0; i < numberOfPoints; i++) {
|
||||
var step = i * (refresh / 1000);
|
||||
serie.data.unshift([timestamp - step, 0]);
|
||||
}
|
||||
|
||||
var hours = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours());
|
||||
var minutes = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes());
|
||||
var seconds = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
|
||||
var formattedTime = hours + ':' + minutes + ':' + seconds;
|
||||
return formattedTime;
|
||||
serie = [serie];
|
||||
updatePlot(serie);
|
||||
return;
|
||||
}
|
||||
|
||||
data[0].label = serie.label;
|
||||
if (data[0].data.length >= numberOfPoints) {
|
||||
data[0].data.shift();
|
||||
}
|
||||
|
||||
data[0].data.push(serie.data[0]);
|
||||
updatePlot(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function startDataPooling () {
|
||||
intervalRef = window.setInterval(requestData, refresh);
|
||||
}
|
||||
|
||||
function resetDataPooling () {
|
||||
if (currentXHR !== null) currentXHR.abort();
|
||||
// Stop and start the interval
|
||||
window.clearInterval(intervalRef);
|
||||
startDataPooling();
|
||||
}
|
||||
|
||||
function clearGraph () {
|
||||
var data = plot.getData();
|
||||
if (data.length === 0) return;
|
||||
|
||||
for (i = 0; i < data[0].data.length; i ++) {
|
||||
data[0].data[i][1] = 0;
|
||||
}
|
||||
if (incremental) lastIncVal = null;
|
||||
|
||||
updatePlot(data);
|
||||
|
||||
resetDataPooling();
|
||||
}
|
||||
|
||||
// Set the form OID to the value selected in the SNMP browser
|
||||
function setOID () {
|
||||
if ($('#snmp_browser_version').val() == '3') {
|
||||
$('#text-snmp_oid').val($('#table1-0-1').text());
|
||||
} else {
|
||||
$('#text-snmp_oid').val($('#snmp_selected_oid').text());
|
||||
}
|
||||
|
||||
// Close the SNMP browser
|
||||
$('.ui-dialog-titlebar-close').trigger('click');
|
||||
}
|
||||
|
||||
// Show the SNMP browser window
|
||||
function snmpBrowserWindow () {
|
||||
|
||||
// Keep elements in the form and the SNMP browser synced
|
||||
$('#text-target_ip').val($('#text-ip_target').val());
|
||||
$('#text-community').val($('#text-snmp_community').val());
|
||||
$('#snmp_browser_version').val($('#snmp_version').val());
|
||||
$('#snmp3_browser_auth_user').val($('#snmp3_auth_user').val());
|
||||
$('#snmp3_browser_security_level').val($('#snmp3_security_level').val());
|
||||
$('#snmp3_browser_auth_method').val($('#snmp3_auth_method').val());
|
||||
$('#snmp3_browser_auth_pass').val($('#snmp3_auth_pass').val());
|
||||
$('#snmp3_browser_privacy_method').val($('#snmp3_privacy_method').val());
|
||||
$('#snmp3_browser_privacy_pass').val($('#snmp3_privacy_pass').val());
|
||||
|
||||
$("#snmp_browser_container").show().dialog ({
|
||||
title: '',
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
series: {
|
||||
lines: {
|
||||
lineWidth: 2,
|
||||
fill: true
|
||||
}
|
||||
},
|
||||
colors: ['#6db431']
|
||||
width: 920,
|
||||
height: 500
|
||||
});
|
||||
}
|
||||
|
||||
function shortNumber (number) {
|
||||
if (Math.round(number) != number) return number;
|
||||
number = Number.parseInt(number);
|
||||
if (Number.isNaN(number)) return number;
|
||||
|
||||
var shorts = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"];
|
||||
var pos = 0;
|
||||
|
||||
while (number >= 1000 || number <= -1000) {
|
||||
pos++;
|
||||
number = number / 1000;
|
||||
}
|
||||
|
||||
var data = [];
|
||||
return number + " " + shorts[pos];
|
||||
}
|
||||
|
||||
var id = $('.graph').attr('id');
|
||||
var plot = $.plot("#" + id, data, options);
|
||||
|
||||
|
||||
var refresh = parseInt($('#refresh').val());
|
||||
var incremental = $('#checkbox-incremental').is(':checked') || $('#hidden-incremental').val() == 1;
|
||||
var incremental_base = 0;
|
||||
var last_inc = 0;
|
||||
var to;
|
||||
|
||||
refresh_graph();
|
||||
|
||||
function refresh_graph () {
|
||||
var refresh = parseInt($('#refresh').val());
|
||||
|
||||
var postvars = new Array();
|
||||
var postvars = {};
|
||||
postvars['graph'] = $('#graph :selected').val();
|
||||
postvars['graph_title'] = $('#graph :selected').html();
|
||||
|
||||
postvars['snmp_community'] = $('#text-snmp_community').val();
|
||||
postvars['snmp_oid'] = $('#text-snmp_oid').val();
|
||||
postvars['snmp_ver'] = $('#snmp_version :selected').val();
|
||||
postvars['snmp_address'] = $('#text-ip_target').val();
|
||||
|
||||
postvars['refresh'] = refresh;
|
||||
|
||||
var rel_path = $("#hidden-rel_path").val();
|
||||
|
||||
$.ajax({
|
||||
url: rel_path + "extensions/realtime_graphs/ajax.php",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: postvars,
|
||||
success: function(serie) {
|
||||
var timestamp = serie.data[0][0];
|
||||
data = plot.getData();
|
||||
if (data.length == 0) {
|
||||
for(i = 0; i < max_data_plot; i ++) {
|
||||
step = i * (refresh/1000);
|
||||
serie.data.unshift([timestamp-step, 0]);
|
||||
}
|
||||
|
||||
serie = [serie];
|
||||
plot = $.plot("#" + id, serie, options);
|
||||
return;
|
||||
}
|
||||
data[0].label = serie.label;
|
||||
if (data[0].data.length >= max_data_plot) {
|
||||
data[0].data.shift();
|
||||
}
|
||||
|
||||
if (incremental) {
|
||||
var last_item = parseInt(data[0].data.length)-1;
|
||||
var last_value = data[0].data[last_item][1];
|
||||
|
||||
var current_value = serie.data[0][1];
|
||||
|
||||
serie.data[0][1] = current_value - last_inc;
|
||||
|
||||
last_inc = current_value;
|
||||
|
||||
// Incremental is always positive
|
||||
if (serie.data[0][1] < 0) {
|
||||
serie.data[0][1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
data[0].data.push(serie.data[0]);
|
||||
$.plot("#" + id, data, options);
|
||||
}
|
||||
$('#graph').change(function() {
|
||||
$('form#realgraph').submit();
|
||||
});
|
||||
to = window.setTimeout(refresh_graph, refresh);
|
||||
}
|
||||
|
||||
$('#graph').change(function() {
|
||||
$('form#realgraph').submit();
|
||||
});
|
||||
|
||||
$('#refresh').change(function() {
|
||||
var refresh = parseInt($('#refresh').val());
|
||||
|
||||
// Stop and start the Timeout
|
||||
clearTimeout(to);
|
||||
to = window.setTimeout(refresh_graph, refresh);
|
||||
});
|
||||
|
||||
// Show the SNMP browser window
|
||||
function snmpBrowserWindow () {
|
||||
|
||||
// Keep elements in the form and the SNMP browser synced
|
||||
$('#text-target_ip').val($('#text-ip_target').val());
|
||||
$('#text-community').val($('#text-snmp_community').val());
|
||||
$('#snmp_browser_version').val($('#snmp_version').val());
|
||||
$('#snmp3_browser_auth_user').val($('#snmp3_auth_user').val());
|
||||
$('#snmp3_browser_security_level').val($('#snmp3_security_level').val());
|
||||
$('#snmp3_browser_auth_method').val($('#snmp3_auth_method').val());
|
||||
$('#snmp3_browser_auth_pass').val($('#snmp3_auth_pass').val());
|
||||
$('#snmp3_browser_privacy_method').val($('#snmp3_privacy_method').val());
|
||||
$('#snmp3_browser_privacy_pass').val($('#snmp3_privacy_pass').val());
|
||||
|
||||
$("#snmp_browser_container").show().dialog ({
|
||||
title: '',
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 920,
|
||||
height: 500
|
||||
$('#refresh').change(function () {
|
||||
refresh = parseInt($('#refresh').val());
|
||||
resetDataPooling();
|
||||
});
|
||||
}
|
||||
|
||||
// Set the form OID to the value selected in the SNMP browser
|
||||
function setOID () {
|
||||
|
||||
if($('#snmp_browser_version').val() == '3'){
|
||||
$('#text-snmp_oid').val($('#table1-0-1').text());
|
||||
} else {
|
||||
$('#text-snmp_oid').val($('#snmp_selected_oid').text());
|
||||
$('#checkbox-incremental').change(function() {
|
||||
incremental = $('#checkbox-incremental').is(':checked');
|
||||
clearGraph();
|
||||
});
|
||||
|
||||
updatePlot([]);
|
||||
requestData();
|
||||
startDataPooling();
|
||||
|
||||
// Expose this functions
|
||||
window.realtimeGraphs = {
|
||||
clearGraph: clearGraph,
|
||||
setOID: setOID,
|
||||
snmpBrowserWindow: snmpBrowserWindow
|
||||
}
|
||||
|
||||
// Close the SNMP browser
|
||||
$('.ui-dialog-titlebar-close').trigger('click');
|
||||
}
|
||||
|
||||
$('#checkbox-incremental').change(function() {
|
||||
incremental = $('#checkbox-incremental').is(':checked');
|
||||
clearGraph();
|
||||
});
|
||||
|
||||
function firstNotZero(data) {
|
||||
var notZero = 0;
|
||||
for(i = 0; i < data[0].data.length; i ++) {
|
||||
if (data[0].data[i][1] != 0) {
|
||||
return data[0].data[i][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setOnIncremental() {
|
||||
|
||||
}
|
||||
|
||||
function clearGraph() {
|
||||
data = plot.getData();
|
||||
if (data.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(i = 0; i < data[0].data.length; i ++) {
|
||||
data[0].data[i][1] = 0;
|
||||
}
|
||||
|
||||
$.plot("#" + id, data, options);
|
||||
}
|
||||
})();
|
|
@ -14,4 +14,58 @@ ALTER TABLE `tservice` ADD COLUMN `evaluate_sla` int(1) NOT NULL DEFAULT '0';
|
|||
|
||||
ALTER TABLE `tpolicy_modules` ADD COLUMN `cps` int NOT NULL DEFAULT '0';
|
||||
|
||||
COMMIT;
|
||||
DROP INDEX id_policy ON `tpolicy_agents`;
|
||||
|
||||
ALTER TABLE `tpolicy_agents` ADD COLUMN `id_node` int(10) NOT NULL DEFAULT '0';
|
||||
|
||||
ALTER TABLE `tpolicy_agents` ADD UNIQUE(`id_policy`, `id_agent`, `id_node`);
|
||||
|
||||
ALTER TABLE `tevento` ADD COLUMN `data` double(22,5) default NULL;
|
||||
|
||||
ALTER TABLE `tmetaconsole_event` ADD COLUMN `data` double(22,5) default NULL;
|
||||
|
||||
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `data` double(22,5) default NULL;
|
||||
|
||||
ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
||||
|
||||
ALTER TABLE `tmetaconsole_event` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
||||
|
||||
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
||||
|
||||
CREATE TABLE `tautoconfig` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`order` int(11) NOT NULL DEFAULT '0',
|
||||
`description` text,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
CREATE TABLE `tautoconfig_rules` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_autoconfig` int(10) unsigned NOT NULL,
|
||||
`order` int(11) NOT NULL DEFAULT '0',
|
||||
`operator` enum('AND','OR') DEFAULT 'OR',
|
||||
`type` enum('alias','ip-range','group','os','custom-field','script','server-name') DEFAULT 'alias',
|
||||
`value` text,
|
||||
`custom` text,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id_autoconfig` (`id_autoconfig`),
|
||||
CONSTRAINT `tautoconfig_rules_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
CREATE TABLE `tautoconfig_actions` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_autoconfig` int(10) unsigned NOT NULL,
|
||||
`order` int(11) NOT NULL DEFAULT '0',
|
||||
`action_type` enum('set-group', 'set-secondary-group', 'apply-policy', 'launch-script', 'launch-event', 'launch-alert-action', 'raw-config') DEFAULT 'launch-event',
|
||||
`value` text,
|
||||
`custom` text,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id_autoconfig` (`id_autoconfig`),
|
||||
CONSTRAINT `tautoconfig_action_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
START TRANSACTION;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlayout_template`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tlayout_template` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(50) NOT NULL,
|
||||
`id_group` INTEGER UNSIGNED NOT NULL,
|
||||
`background` varchar(200) NOT NULL,
|
||||
`height` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`width` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`background_color` varchar(50) NOT NULL default '#FFF',
|
||||
`is_favourite` INTEGER UNSIGNED NOT NULL default 0,
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlayout_template_data`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_layout_template` INTEGER UNSIGNED NOT NULL,
|
||||
`pos_x` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`pos_y` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`height` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`width` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`label` TEXT,
|
||||
`image` varchar(200) DEFAULT "",
|
||||
`type` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
`period` INTEGER UNSIGNED NOT NULL default 3600,
|
||||
`module_name` text NOT NULL,
|
||||
`agent_name` varchar(600) BINARY NOT NULL default '',
|
||||
`id_layout_linked` INTEGER unsigned NOT NULL default '0',
|
||||
`parent_item` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`enable_link` tinyint(1) UNSIGNED NOT NULL default 1,
|
||||
`id_metaconsole` int(10) NOT NULL default 0,
|
||||
`id_group` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`id_custom_graph` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`border_width` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`type_graph` varchar(50) NOT NULL default 'area',
|
||||
`label_position` varchar(50) NOT NULL default 'down',
|
||||
`border_color` varchar(200) DEFAULT "",
|
||||
`fill_color` varchar(200) DEFAULT "",
|
||||
`show_statistics` tinyint(2) NOT NULL default '0',
|
||||
`id_layout_linked_weight` int(10) NOT NULL default '0',
|
||||
`element_group` int(10) NOT NULL default '0',
|
||||
`show_on_top` tinyint(1) NOT NULL default '0',
|
||||
`clock_animation` varchar(60) NOT NULL default "analogic_1",
|
||||
`time_format` varchar(60) NOT NULL default "time",
|
||||
`timezone` varchar(60) NOT NULL default "Europe/Madrid",
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Rename column is_secondary to no_hierarchy in `tusuario _perfil`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE `tusuario_perfil` ADD COLUMN `no_hierarchy` tinyint(1) NOT NULL DEFAULT 0;
|
||||
UPDATE `tusuario_perfil` SET `no_hierarchy` = `is_secondary`;
|
||||
ALTER TABLE `tusuario_perfil` DROP COLUMN `is_secondary`;
|
||||
|
||||
UPDATE `talert_commands` SET name='Monitoring Event' WHERE name='Pandora FMS Event';
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tgis_map_layer_groups`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tgis_map_layer_groups` (
|
||||
`layer_id` INT NOT NULL,
|
||||
`group_id` MEDIUMINT(4) UNSIGNED NOT NULL,
|
||||
`agent_id` INT(10) UNSIGNED NOT NULL COMMENT 'Used to link the position to the group',
|
||||
PRIMARY KEY (`layer_id`, `group_id`),
|
||||
FOREIGN KEY (`layer_id`) REFERENCES `tgis_map_layer` (`id_tmap_layer`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`group_id`) REFERENCES `tgrupo` (`id_grupo`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`agent_id`) REFERENCES `tagente` (`id_agente`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
COMMIT;
|
|
@ -0,0 +1,49 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE treport_content ADD COLUMN `recursion` TINYINT(1) default NULL;
|
||||
|
||||
ALTER TABLE tevent_filter ADD COLUMN `user_comment` text NOT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `source` tinytext NOT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL;
|
||||
|
||||
ALTER TABLE tagente_modulo ALTER COLUMN `parent_module_id` SET default 0;
|
||||
|
||||
-- Changes for the 'service like status' feature (Carrefour)
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_type` ENUM ('default', 'weight', 'service') DEFAULT 'default';
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0;
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0;
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_node_id` INT(10) NOT NULL default 0;
|
||||
ALTER TABLE `tlayout_template_data` ADD COLUMN `linked_layout_status_type` ENUM ('default', 'weight', 'service') DEFAULT 'default';
|
||||
ALTER TABLE `tlayout_template_data` ADD COLUMN `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0;
|
||||
ALTER TABLE `tlayout_template_data` ADD COLUMN `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0;
|
||||
ALTER TABLE `tlayout_template_data` ADD COLUMN `linked_layout_node_id` INT(10) NOT NULL default 0;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Add column in table `treport`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_pass` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_method` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_method` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_pass` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_security_level` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `tpolicy_modules_inventory` ADD COLUMN `custom_fields` MEDIUMBLOB NOT NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tlog_graph_models` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`title` TEXT NOT NULL,
|
||||
`regexp` TEXT NOT NULL,
|
||||
`fields` TEXT NOT NULL,
|
||||
`average` tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (1, 'Apache log model',
|
||||
'^.*?\s+.*".*?\s(\/.*?)\?.*1.1"\s+(.*?)\s+(.*?)\s+',
|
||||
'pagina, html_err_code, _tiempo_', 1);
|
||||
|
||||
COMMIT;
|
|
@ -1,3 +1,14 @@
|
|||
<script type="text/javascript">
|
||||
|
||||
function effectFadeOut() {
|
||||
$('.content').fadeOut(800).fadeIn(800)
|
||||
}
|
||||
$(document).ready(function(){
|
||||
setInterval(effectFadeOut, 1600);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
// Pandora FMS - the Flexible Monitoring System
|
||||
|
@ -13,6 +24,44 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
global $config;
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit("ACL Violation", "Trying to change License settings");
|
||||
include ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
$update_settings = (bool) get_parameter_post ('update_settings');
|
||||
|
||||
if ($update_settings) {
|
||||
foreach ($_POST['keys'] as $key => $value) {
|
||||
db_process_sql_update(
|
||||
'tupdate_settings',
|
||||
array(db_escape_key_identifier('value') => $value),
|
||||
array(db_escape_key_identifier('key') => $key));
|
||||
}
|
||||
|
||||
ui_print_success_message(__('License updated'));
|
||||
}
|
||||
|
||||
ui_require_javascript_file_enterprise('load_enterprise');
|
||||
enterprise_include_once('include/functions_license.php');
|
||||
$license = enterprise_hook('license_get_info');
|
||||
|
||||
$rows = db_get_all_rows_in_table('tupdate_settings');
|
||||
|
||||
$settings = new StdClass;
|
||||
foreach ($rows as $row) {
|
||||
$settings->$row['key'] = $row['value'];
|
||||
}
|
||||
|
||||
echo '<script type="text/javascript">';
|
||||
if (enterprise_installed())
|
||||
print_js_var_enteprise();
|
||||
echo '</script>';
|
||||
|
||||
function render_info ($table) {
|
||||
global $console_mode;
|
||||
|
||||
|
@ -46,6 +95,164 @@ function render_row ($data, $label) {
|
|||
}
|
||||
}
|
||||
|
||||
function get_value_sum($arr){
|
||||
foreach($arr as $clave){
|
||||
foreach($clave as $valor){
|
||||
$result += $valor;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function execution_time(){
|
||||
$times = db_get_all_rows_sql("SELECT datos FROM tagente_datos WHERE id_agente_modulo = 29 ORDER BY utimestamp DESC LIMIT 2");
|
||||
if($times[0]['datos'] > $times[1]['datos'] * 1.2)
|
||||
return "<a class= 'content' style= 'color: red;'>Warning Status</a><a>   The execution time could be degrading. For a more extensive information of this data consult the Execution Time graph</a>";
|
||||
else
|
||||
return "<a style ='color: green;'>Normal Status</a><a>   The execution time is correct. For a more extensive information of this data consult the Execution Time graph</a>";
|
||||
}
|
||||
|
||||
|
||||
function get_logs_size($file){
|
||||
$file_name = '/var'. $file .'';
|
||||
$size_server_log = filesize($file_name);
|
||||
return $size_server_log;
|
||||
|
||||
}
|
||||
|
||||
function get_status_logs($path){
|
||||
$status_server_log = "";
|
||||
$size_server_log = get_logs_size($path);
|
||||
if ($size_server_log <= 10240){
|
||||
$status_server_log = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   You have less than 10 MB of logs</a>";
|
||||
}else{
|
||||
$status_server_log = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   You have more than 10 MB of logs</a>";
|
||||
}
|
||||
return $status_server_log;
|
||||
}
|
||||
function percentage_modules_per_agent(){
|
||||
$status_average_modules = "";
|
||||
$total_agents = db_get_value_sql ('SELECT count(*) FROM tagente');
|
||||
$total_modules = db_get_value_sql ('SELECT count(*) FROM tagente_modulo');
|
||||
$average_modules_per_agent = $total_modules / $total_agents;
|
||||
if($average_modules_per_agent <= 40){
|
||||
$status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The average of modules per agent is less than 40 percent</a>";
|
||||
}else{
|
||||
$status_average_modules = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>  The average of modules per agent is more than 40 percent. You can have performance problems</a>";
|
||||
}
|
||||
return $status_average_modules;
|
||||
}
|
||||
|
||||
function license_capacity(){
|
||||
$license = enterprise_hook('license_get_info');
|
||||
$license_limit = $license['limit'];
|
||||
$status_license_capacity = "";
|
||||
$current_count = db_get_value_sql ('SELECT count(*) FROM tagente');
|
||||
if ($current_count > $license_limit * 90 /100){
|
||||
$status_license_capacity = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   The license capacity is more than 90 percent</a>";
|
||||
}else{
|
||||
$status_license_capacity = "<a style= 'color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The license capacity is less than 90 percent</a>";
|
||||
}
|
||||
return $status_license_capacity;
|
||||
}
|
||||
|
||||
function status_license_params($license_param){
|
||||
$status_license_par ="";
|
||||
if ($license_param <=0)
|
||||
$status_license_par = "OFF";
|
||||
else
|
||||
$status_license_par = "ON";
|
||||
return $status_license_par;
|
||||
}
|
||||
function interval_average_of_network_modules(){
|
||||
$total_network_modules = db_get_value_sql ("SELECT count(*) FROM tagente_modulo WHERE id_tipo_modulo BETWEEN 6 AND 18");
|
||||
$total_module_interval_time = db_get_value_sql ("SELECT SUM(module_interval) FROM tagente_modulo WHERE id_tipo_modulo BETWEEN 6 AND 18");
|
||||
$average_time= (int) $total_module_interval_time / $total_network_modules;
|
||||
|
||||
if($average_time < 180 ){
|
||||
$status_average_modules = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   The system has a lot of load and a very fine configuration is required</a>";
|
||||
}else{
|
||||
$status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The system has an acceptable charge</a>";
|
||||
}
|
||||
if ($average_time == 0)
|
||||
$status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The system has no load</a>";
|
||||
return $status_average_modules;
|
||||
}
|
||||
|
||||
$attachment_total_files = count(glob($config['homedir']."/attachment/{*.*}",GLOB_BRACE));
|
||||
|
||||
function files_attachment_folder($total_files){
|
||||
if($total_files <= 700){
|
||||
$status_total_files = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The attachment folder has less than 700 files.</a>";
|
||||
}else{
|
||||
$status_total_files = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   The attachment folder has more than 700 files.</a>";
|
||||
}
|
||||
return $status_total_files;
|
||||
}
|
||||
|
||||
$tagente_datos_size = db_get_value_sql('SELECT COUNT(*) FROM tagente_datos');
|
||||
|
||||
function status_tagente_datos($tagente_datos_size){
|
||||
if ($tagente_datos_size <=3000000){
|
||||
$tagente_datos_size = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The tagente_datos table has an acceptable amount of data.</a>";
|
||||
}else{
|
||||
$tagente_datos_size = "<a class= 'content' style ='color: red;text-decoration: none;'>Warning Status</a><a>   The tagente_datos table has too much data. A historical database is recommended.</a>";
|
||||
}
|
||||
return $tagente_datos_size;
|
||||
}
|
||||
|
||||
function status_values($val_rec, $val){
|
||||
if ($val_rec <= $val)
|
||||
return $val . "<a style='text-decoration: none;'> (Min. Recommended Value </a>" . $val_rec. "<a>)</a>";
|
||||
else
|
||||
return $val . "<a style='text-decoration: none;'> (Min. Recommended Value </a>" . $val_rec. "<a>)</a><a class= 'content' style ='color: red;text-decoration: none;'> Warning Status</a>";
|
||||
}
|
||||
|
||||
$tables_fragmentation=db_get_sql ("SELECT (data_free/(index_length+data_length))
|
||||
as frag_ratio from information_schema.tables where DATA_FREE > 0 and table_name='tagente_datos' and table_schema='pandora'");
|
||||
$db_size=db_get_all_rows_sql("SELECT table_schema,
|
||||
ROUND(SUM(data_length+index_length)/1024/1024,3)
|
||||
FROM information_schema.TABLES
|
||||
GROUP BY table_schema;"
|
||||
);
|
||||
|
||||
if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN'){
|
||||
$total_server_threads = shell_exec("ps -T aux | grep pandora_server | grep -v grep | wc -l");
|
||||
$percentage_threads_ram = shell_exec("ps axo pmem,cmd | grep pandora_server | awk '{sum+=$1} END {print sum}'");
|
||||
$percentage_threads_cpu = shell_exec("ps axo pcpu,cmd | grep pandora_server | awk '{sum+=$1} END {print sum}'");
|
||||
$innodb_buffer_pool_size_min_rec_value = shell_exec("cat /proc/meminfo | grep -i total | head -1 | awk '{print $(NF-1)*0.4/1024}'");
|
||||
}
|
||||
$path_server_logs ="/log/pandora/pandora_server.log";
|
||||
$path_console_logs ="/www/html/pandora_console/pandora_console.log";
|
||||
$innodb_log_file_size_min_rec_value = "64M";
|
||||
$innodb_log_buffer_size_min_rec_value = "16M";
|
||||
$innodb_flush_log_at_trx_commit_min_rec_value = 0;
|
||||
$query_cache_limit_min_rec_value = 2;
|
||||
$max_allowed_packet_min_rec_value = 32;
|
||||
$innodb_buffer_pool_size_min_rec_value = shell_exec("cat /proc/meminfo | grep -i total | head -1 | awk '{print $(NF-1)*0.4/1024}'");
|
||||
$sort_buffer_size_min_rec_value = 32;
|
||||
$join_buffer_size_min_rec_value = 265;
|
||||
$query_cache_type_min_rec_value = "ON";
|
||||
$query_cache_size_min_rec_value = 24;
|
||||
$innodb_lock_wait_timeout_max_rec_value = 120;
|
||||
$tables_fragmentation_max_rec_value = 10;
|
||||
$thread_cache_size_max_rec_value = 8;
|
||||
$thread_stack_min_rec_value = 256;
|
||||
$max_connections_max_rec_value = 150;
|
||||
$key_buffer_size_min_rec_value = 256;
|
||||
$read_buffer_size_min_rec_value = 32;
|
||||
$read_rnd_buffer_size_min_rec_value = 32;
|
||||
$query_cache_min_res_unit_min_rec_value = 2;
|
||||
$innodb_file_per_table_min_rec_value = 0;
|
||||
|
||||
function status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation){
|
||||
$status_tables_frag = "";
|
||||
if($tables_fragmentation > $tables_fragmentation_max_rec_value)
|
||||
$status_tables_frag = "<a class= 'content' style ='color: red; text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   The fragmentation tables is higher than recommended. You should defragment them.</a>";
|
||||
else
|
||||
$status_tables_frag = "<a style ='color: green; text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The fragmentation tables is correct.</a>";
|
||||
return $status_tables_frag;
|
||||
}
|
||||
|
||||
$console_mode = 1;
|
||||
if (!isset($argc))
|
||||
|
@ -78,8 +285,6 @@ else {
|
|||
if (file_exists("../include/config.php"))
|
||||
include "../include/config.php";
|
||||
|
||||
global $config;
|
||||
|
||||
// Not from console, this is a web session
|
||||
if ((!isset($config["id_user"])) OR (!check_acl ($config["id_user"], 0, "PM"))) {
|
||||
echo "<h2>You don't have privileges to use diagnostic tool</h2>";
|
||||
|
@ -125,9 +330,9 @@ echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic
|
|||
|
||||
render_row (phpversion(), "PHP Version");
|
||||
|
||||
render_row (ini_get('max_execution_time'), "PHP Max execution time");
|
||||
render_row (ini_get('max_execution_time')." seconds", "PHP Max execution time");
|
||||
|
||||
render_row (ini_get('max_input_time'), "PHP Max input time");
|
||||
render_row (ini_get('max_input_time')." seconds", "PHP Max input time");
|
||||
|
||||
render_row (ini_get('memory_limit'), "PHP Memory limit");
|
||||
|
||||
|
@ -246,8 +451,11 @@ switch ($config["dbtype"]) {
|
|||
render_info_data ("SELECT `value`
|
||||
FROM tconfig
|
||||
WHERE `token` = 'db_scheme_build'", "DB Schema Build");
|
||||
|
||||
render_row(get_value_sum($db_size) . "M", "DB Size");
|
||||
|
||||
|
||||
if(strpos($_SERVER['HTTP_USER_AGENT'],'Windows') == false){
|
||||
if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN'){
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__("System info")."</th></tr>";
|
||||
|
||||
|
@ -312,7 +520,121 @@ switch ($config["dbtype"]) {
|
|||
WHERE \"key\" = 'current_update'", "Current Update #");
|
||||
break;
|
||||
}
|
||||
$innodb_log_file_size =db_get_value_sql ("SELECT @@innodb_log_file_size")/1048576;
|
||||
$innodb_log_buffer_size =db_get_value_sql("SELECT @@innodb_log_buffer_size")/1048576;
|
||||
$innodb_flush_log_at_trx_commit =db_get_value_sql("SELECT @@innodb_flush_log_at_trx_commit");
|
||||
$max_allowed_packet =db_get_value_sql("SELECT @@max_allowed_packet")/1048576;
|
||||
$innodb_buffer_pool_size = db_get_value_sql("SELECT @@innodb_buffer_pool_size")/1024;
|
||||
$sort_buffer_size =number_format(db_get_value_sql("SELECT @@sort_buffer_size")/1024, 2);
|
||||
$join_buffer_size =db_get_value_sql("SELECT @@join_buffer_size")/1024;
|
||||
$query_cache_type =db_get_value_sql("SELECT @@query_cache_type");
|
||||
$query_cache_size =db_get_value_sql("SELECT @@query_cache_size")/1048576;
|
||||
$query_cache_limit =db_get_value_sql("SELECT @@query_cache_limit")/1048576;
|
||||
$innodb_lock_wait_timeout =db_get_value_sql("SELECT @@innodb_lock_wait_timeout");
|
||||
$thread_cache_size =db_get_value_sql("SELECT @@thread_cache_size");
|
||||
$thread_stack =db_get_value_sql("SELECT @@thread_stack")/1024;
|
||||
$max_connections =db_get_value_sql("SELECT @@max_connections");
|
||||
$key_buffer_size =db_get_value_sql("SELECT @@key_buffer_size")/1024;
|
||||
$read_buffer_size =db_get_value_sql("SELECT @@read_buffer_size")/1024;
|
||||
$read_rnd_buffer_size =db_get_value_sql("SELECT @@read_rnd_buffer_size")/1024;
|
||||
$query_cache_min_res_unit =db_get_value_sql("SELECT @@query_cache_min_res_unit")/1024;
|
||||
$innodb_file_per_table = db_get_value_sql("SELECT @@innodb_file_per_table");
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__("MySQL Performance metrics")."</th></tr>";
|
||||
|
||||
render_row(status_values($innodb_log_file_size_min_rec_value,$innodb_log_file_size),'InnoDB log file size ', 'InnoDB log file size ');
|
||||
render_row(status_values($innodb_log_buffer_size_min_rec_value,$innodb_log_buffer_size),'InnoDB log buffer size ', 'InnoDB log buffer size ');
|
||||
render_row(status_values($innodb_flush_log_at_trx_commit_min_rec_value,$innodb_flush_log_at_trx_commit), 'InnoDB flush log at trx-commit ','InnoDB flush log at trx-commit ');
|
||||
render_row(status_values($max_allowed_packet_min_rec_value,$max_allowed_packet), 'Maximun allowed packet ','Maximun allowed packet ');
|
||||
render_row(status_values($innodb_buffer_pool_size_min_rec_value,$innodb_buffer_pool_size), 'InnoDB buffer pool size ','InnoDB buffer pool size ');
|
||||
render_row(status_values($sort_buffer_size_min_rec_value,$sort_buffer_size), 'Sort buffer size ','Sort buffer size ');
|
||||
render_row(status_values($join_buffer_size_min_rec_value,$join_buffer_size), 'Join buffer size ','Join buffer size ');
|
||||
render_row(status_values($query_cache_type_min_rec_value,$query_cache_type), 'Query cache type ', 'Query cache type ');
|
||||
render_row(status_values($query_cache_size_min_rec_value,$query_cache_size), 'Query cache size ','Query cache size ');
|
||||
render_row(status_values($query_cache_limit_min_rec_value,$query_cache_limit), 'Query cache limit ','Query cache limit ');
|
||||
render_row(status_values($innodb_lock_wait_timeout_max_rec_value,$innodb_lock_wait_timeout), 'InnoDB lock wait timeout ','InnoDB lock wait timeout ');
|
||||
render_row(status_values($thread_cache_size_max_rec_value,$thread_cache_size), 'Thread cache size ','Thread cache size ');
|
||||
render_row(status_values($thread_stack_min_rec_value,$thread_stack), 'Thread stack ','Thread stack ');
|
||||
render_row(status_values($max_connections_max_rec_value,$max_connections), 'Maximum connections ','Maximun connections ');
|
||||
render_row(status_values($key_buffer_size_min_rec_value,$key_buffer_size), 'Key buffer size ','Key buffer size ');
|
||||
render_row(status_values($read_buffer_size_min_rec_value,$read_buffer_size), 'Read buffer size ','Read buffer size ');
|
||||
render_row(status_values($read_rnd_buffer_size_min_rec_value,$read_rnd_buffer_size), 'Read rnd-buffer size ','Read rnd-buffer size ');
|
||||
render_row(status_values($query_cache_min_res_unit_min_rec_value,$query_cache_min_res_unit), 'Query cache min-res-unit ','Query cache min-res-unit ');
|
||||
render_row(status_values($innodb_file_per_table_min_rec_value,$innodb_file_per_table), 'InnoDB file per table ','InnoDB file per table ');
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__("Tables fragmentation in the PandoraFMS database")."</th></tr>";
|
||||
|
||||
|
||||
|
||||
render_row ($tables_fragmentation_max_rec_value . "%", "Tables fragmentation (maximum recommended value)");
|
||||
render_row (number_format($tables_fragmentation, 2) . "%", "Tables fragmentation (current value)");
|
||||
render_row (status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation), "Status fragmentation tables");
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(" PandoraFMS logs dates")."</th></tr>";
|
||||
|
||||
render_row(number_format(get_logs_size($path_server_logs)/1024, 2) . "M", 'Size server logs (current value)');
|
||||
render_row(get_status_logs($path_server_logs),'Status server logs');
|
||||
render_row(number_format(get_logs_size($path_console_logs)/1024, 2) . "M", 'Size console logs (current value)');
|
||||
render_row(get_status_logs($path_console_logs),'Status console logs');
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(" PandoraFMS Licence Information")."</th></tr>";
|
||||
|
||||
render_row( html_print_textarea ('keys[customer_key]', 10, 255, $settings->customer_key, 'style="height:40px; width:450px;"', true),'Customer key');
|
||||
render_row( $license['expiry_date'],'Expires');
|
||||
render_row( $license['limit'] . ' agents','Platform Limit');
|
||||
render_row( $license['count'] . ' agents','Current Platform Count');
|
||||
render_row( $license['count_enabled']. ' agents','Current Platform Count (enabled: items)');
|
||||
render_row( $license['count_disabled']. ' agents','Current Platform Count (disabled: items)');
|
||||
render_row( $license['license_mode'],'License Mode');
|
||||
render_row( status_license_params($license['nms']) , 'Network Management System');
|
||||
render_row( status_license_params($license['dhpm']) , 'Satellite');
|
||||
render_row( $license['licensed_to'], 'Licensed to');
|
||||
render_row( license_capacity(), "Status of agents capacity");
|
||||
render_row(percentage_modules_per_agent(), "Status of average modules per agent");
|
||||
render_row(interval_average_of_network_modules(), "Interval average of the network modules");
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(" Status of the attachment folder")."</th></tr>";
|
||||
|
||||
render_row($attachment_total_files, "Total files in the attachment folder");
|
||||
render_row(files_attachment_folder($attachment_total_files), "Status of the attachment folder");
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(" Information from the tagente_datos table")."</th></tr>";
|
||||
|
||||
render_row($tagente_datos_size, "Total data in the tagente_datos table");
|
||||
render_row(status_tagente_datos($tagente_datos_size), "Status of the tagente_datos table");
|
||||
render_row(execution_time(), "Degradation of the execution time when executing a count");
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(" Pandora FMS server threads")."</th></tr>";
|
||||
|
||||
render_row($total_server_threads, "Total server threads");
|
||||
render_row($percentage_threads_ram . "%", "Percentage of threads used by the RAM");
|
||||
render_row($percentage_threads_cpu . "%", "Percentage of threads used by the CPU");
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(" Graphs modules that represent the self-monitoring system")."</th></tr>";
|
||||
|
||||
$server_name = db_get_value_sql("SELECT name FROM tserver WHERE master = 1");
|
||||
$agent_id= db_get_value_sql ("SELECT id_agente FROM tagente WHERE nombre = '$server_name'");
|
||||
|
||||
$id_modules = agents_get_modules($agent_id);
|
||||
|
||||
$id_modules = array (
|
||||
modules_get_agentmodule_id('Agents_Unknown',$agent_id),
|
||||
modules_get_agentmodule_id('Database Maintenance',$agent_id),
|
||||
modules_get_agentmodule_id('FreeDisk_SpoolDir',$agent_id),
|
||||
modules_get_agentmodule_id('Free_RAM',$agent_id),
|
||||
modules_get_agentmodule_id('Queued_Modules',$agent_id),
|
||||
modules_get_agentmodule_id('Status',$agent_id),
|
||||
modules_get_agentmodule_id('System_Load_AVG',$agent_id),
|
||||
modules_get_agentmodule_id('Execution_time',$agent_id)
|
||||
);
|
||||
|
||||
foreach ($id_modules as $id_module){
|
||||
$params =array(
|
||||
'agent_module_id' => $id_module['id_agente_modulo'],
|
||||
'period' => SECONDS_1MONTH,
|
||||
'date' => time() ,
|
||||
'height' => '150'
|
||||
);
|
||||
render_row(grafico_modulo_sparse ($params),"Graph of the " . $id_module['nombre']." module.");
|
||||
}
|
||||
if ($console_mode == 0) {
|
||||
echo "</table>";
|
||||
}
|
||||
|
|
|
@ -1175,13 +1175,13 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
|
|||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 18);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 20);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '724');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '727');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tconfig_os`
|
||||
|
@ -1213,6 +1213,9 @@ UPDATE `tlink` SET `link` = 'https://github.com/pandorafms/pandorafms/issues' WH
|
|||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tevent_filter ADD COLUMN `date_from` date DEFAULT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `date_to` date DEFAULT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `user_comment` text NOT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `source` tinytext NOT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL;
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tusuario`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
@ -1228,7 +1231,7 @@ ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL defa
|
|||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tagente_modulo ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
|
||||
ALTER TABLE tagente_modulo ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
|
||||
ALTER TABLE tagente_modulo ADD COLUMN `parent_module_id` int(10) unsigned NOT NULL;
|
||||
ALTER TABLE tagente_modulo ADD COLUMN `parent_module_id` int(10) unsigned NOT NULL default 0;
|
||||
ALTER TABLE `tagente_modulo` ADD COLUMN `cps` int NOT NULL default 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
|
@ -1337,6 +1340,7 @@ ALTER TABLE treport_content ADD COLUMN `lapse_calc` tinyint(1) default '0';
|
|||
ALTER TABLE treport_content ADD COLUMN `lapse` int(11) default '300';
|
||||
ALTER TABLE treport_content ADD COLUMN `visual_format` tinyint(1) default '0';
|
||||
ALTER TABLE treport_content ADD COLUMN `hide_no_data` tinyint(1) default '0';
|
||||
ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmodule_relationship`
|
||||
|
@ -1668,4 +1672,129 @@ create table IF NOT EXISTS `tmetaconsole_agent_secondary_group`(
|
|||
|
||||
ALTER TABLE tagente ADD COLUMN `update_secondary_groups` tinyint(1) NOT NULL default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `update_secondary_groups` tinyint(1) NOT NULL default '0';
|
||||
ALTER TABLE tusuario_perfil ADD COLUMN `is_secondary` tinyint(1) NOT NULL default '0';
|
||||
ALTER TABLE tusuario_perfil ADD COLUMN `no_hierarchy` tinyint(1) NOT NULL default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tautoconfig`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tautoconfig` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`order` int(11) NOT NULL DEFAULT '0',
|
||||
`description` text,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tautoconfig_rules`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tautoconfig_rules` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_autoconfig` int(10) unsigned NOT NULL,
|
||||
`order` int(11) NOT NULL DEFAULT '0',
|
||||
`operator` enum('AND','OR') DEFAULT 'OR',
|
||||
`type` enum('alias','ip-range','group','os','custom-field','script','server-name') DEFAULT 'alias',
|
||||
`value` text,
|
||||
`custom` text,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id_autoconfig` (`id_autoconfig`),
|
||||
CONSTRAINT `tautoconfig_rules_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tautoconfig_actions`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tautoconfig_actions` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_autoconfig` int(10) unsigned NOT NULL,
|
||||
`order` int(11) NOT NULL DEFAULT '0',
|
||||
`action_type` enum('set-group', 'set-secondary-group', 'apply-policy', 'launch-script', 'launch-event', 'launch-alert-action', 'raw-config') DEFAULT 'launch-event',
|
||||
`value` text,
|
||||
`custom` text,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id_autoconfig` (`id_autoconfig`),
|
||||
CONSTRAINT `tautoconfig_action_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlayout_template`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tlayout_template` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(50) NOT NULL,
|
||||
`id_group` INTEGER UNSIGNED NOT NULL,
|
||||
`background` varchar(200) NOT NULL,
|
||||
`height` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`width` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`background_color` varchar(50) NOT NULL default '#FFF',
|
||||
`is_favourite` INTEGER UNSIGNED NOT NULL default 0,
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlayout_template_data`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_layout_template` INTEGER UNSIGNED NOT NULL,
|
||||
`pos_x` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`pos_y` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`height` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`width` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`label` TEXT,
|
||||
`image` varchar(200) DEFAULT "",
|
||||
`type` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
`period` INTEGER UNSIGNED NOT NULL default 3600,
|
||||
`module_name` text NOT NULL,
|
||||
`agent_name` varchar(600) BINARY NOT NULL default '',
|
||||
`id_layout_linked` INTEGER unsigned NOT NULL default '0',
|
||||
`parent_item` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`enable_link` tinyint(1) UNSIGNED NOT NULL default 1,
|
||||
`id_metaconsole` int(10) NOT NULL default 0,
|
||||
`id_group` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`id_custom_graph` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`border_width` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`type_graph` varchar(50) NOT NULL default 'area',
|
||||
`label_position` varchar(50) NOT NULL default 'down',
|
||||
`border_color` varchar(200) DEFAULT "",
|
||||
`fill_color` varchar(200) DEFAULT "",
|
||||
`show_statistics` tinyint(2) NOT NULL default '0',
|
||||
`id_layout_linked_weight` int(10) NOT NULL default '0',
|
||||
`element_group` int(10) NOT NULL default '0',
|
||||
`show_on_top` tinyint(1) NOT NULL default '0',
|
||||
`clock_animation` varchar(60) NOT NULL default "analogic_1",
|
||||
`time_format` varchar(60) NOT NULL default "time",
|
||||
`timezone` varchar(60) NOT NULL default "Europe/Madrid",
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlog_graph_models`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tlog_graph_models` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`title` TEXT NOT NULL,
|
||||
`regexp` TEXT NOT NULL,
|
||||
`fields` TEXT NOT NULL,
|
||||
`average` tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (1, 'Apache log model',
|
||||
'^.*?\s+.*".*?\s(\/.*?)\?.*1.1"\s+(.*?)\s+(.*?)\s+',
|
||||
'pagina, html_err_code, _tiempo_', 1);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Add column in table `treport`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_pass` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_method` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_method` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_pass` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_security_level` varchar(25) NOT NULL default '';
|
||||
|
|
|
@ -258,10 +258,7 @@ if(!$new_agent){
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
$groups = users_get_groups ($config["id_user"], "AR",false);
|
||||
$agents = agents_get_group_agents (array_keys ($groups));
|
||||
|
||||
|
||||
$modules = db_get_all_rows_sql("SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
|
||||
WHERE id_agente = " . $id_parent);
|
||||
|
@ -279,6 +276,7 @@ if (isset($groups[$grupo]) || $new_agent) {
|
|||
$table->data[4][1] = html_print_select_groups(false, "AR", false, 'grupo', $grupo, '', '', 0, true);
|
||||
} else {
|
||||
$table->data[4][1] = groups_get_name($grupo);
|
||||
$table->data[4][1] .= html_print_input_hidden('grupo', $grupo, true);
|
||||
}
|
||||
$table->data[4][1] .= ' <span id="group_preview">';
|
||||
$table->data[4][1] .= ui_print_group_icon ($grupo, true);
|
||||
|
@ -332,7 +330,8 @@ $table->data = array ();
|
|||
|
||||
if (enterprise_installed()) {
|
||||
$secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', array($id_agente));
|
||||
$table->data['secondary_groups'][0] = __('Secondary groups');
|
||||
$table->data['secondary_groups'][0] = __('Secondary groups') .
|
||||
ui_print_help_icon("secondary_groups", true);
|
||||
$table->data['secondary_groups'][1] = html_print_select_groups(
|
||||
false, // Use the current user to select the groups
|
||||
"AR", // ACL permission
|
||||
|
@ -376,28 +375,6 @@ if (enterprise_installed()) {
|
|||
true, // Return HTML (not echo)
|
||||
true // Multiple selection
|
||||
);
|
||||
}
|
||||
|
||||
// Custom ID
|
||||
$table->data[0][0] = __('Custom ID');
|
||||
$table->data[0][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true);
|
||||
|
||||
$table->data[1][0] = __('Parent');
|
||||
$params = array();
|
||||
$params['return'] = true;
|
||||
$params['show_helptip'] = true;
|
||||
$params['input_name'] = 'id_parent';
|
||||
$params['print_hidden_input_idagent'] = true;
|
||||
$params['hidden_input_idagent_name'] = 'id_agent_parent';
|
||||
$params['hidden_input_idagent_value'] = $id_parent;
|
||||
$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent);
|
||||
$params['selectbox_id'] = 'cascade_protection_module';
|
||||
$params['javascript_is_function_select'] = true;
|
||||
$params['cascade_protection'] = true;
|
||||
|
||||
$table->data[1][1] = ui_print_agent_autocomplete_input($params);
|
||||
$table->data[1][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). " " . ui_print_help_icon("cascade_protection", true);
|
||||
$table->data[1][1] .= " " . __('Module') . " " . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true);
|
||||
|
||||
//safe operation mode
|
||||
if($id_agente){
|
||||
|
@ -416,27 +393,6 @@ if($id_agente){
|
|||
$table->data[2][1] .= " " . __('Module') . " " . html_print_select ($safe_mode_modules, "safe_mode_module", $safe_mode_module, "", "", 0, true);
|
||||
}
|
||||
|
||||
|
||||
// Learn mode / Normal mode
|
||||
$table->data[3][0] = __('Module definition') .
|
||||
ui_print_help_icon("module_definition", true);
|
||||
$table->data[3][1] = __('Learning mode') . ' ' .
|
||||
html_print_radio_button_extended ("modo", 1, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
|
||||
'style="margin-right: 40px;"', true);
|
||||
$table->data[3][1] .= __('Normal mode') . ' ' .
|
||||
html_print_radio_button_extended ("modo", 0, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
|
||||
'style="margin-right: 40px;"', true);
|
||||
$table->data[3][1] .= __('Autodisable mode') . ' ' .
|
||||
html_print_radio_button_extended ("modo", 2, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
|
||||
'style="margin-right: 40px;"', true);
|
||||
|
||||
// Status (Disabled / Enabled)
|
||||
$table->data[4][0] = __('Status');
|
||||
$table->data[4][1] = __('Disabled') . ' ' .
|
||||
html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[4][1] .= __('Active') . ' ' .
|
||||
html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
|
||||
// Remote configuration
|
||||
$table->data[5][0] = __('Remote configuration');
|
||||
|
||||
|
@ -465,6 +421,81 @@ if (!$new_agent) {
|
|||
else
|
||||
$table->data[5][1] = '<em>' . __('Not available') . '</em>';
|
||||
|
||||
|
||||
|
||||
$cps_array[-1] = __('Disabled');
|
||||
if($cps > 0){
|
||||
$cps_array[$cps] = __('Enabled');
|
||||
}
|
||||
else{
|
||||
$cps_inc = 0;
|
||||
if($id_agente){
|
||||
$cps_inc = service_agents_cps($id_agente);
|
||||
}
|
||||
$cps_array[$cps_inc] = __('Enabled');
|
||||
}
|
||||
|
||||
$table->data[6][0] = __('Cascade protection services');
|
||||
$table->data[6][0] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true);
|
||||
$table->data[6][1] = html_print_select($cps_array, 'cps', $cps, '', '', 0, true);
|
||||
|
||||
|
||||
}
|
||||
// Custom ID
|
||||
$table->data[0][0] = __('Custom ID');
|
||||
$table->data[0][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true);
|
||||
|
||||
$table->data[1][0] = __('Parent');
|
||||
$params = array();
|
||||
$params['return'] = true;
|
||||
$params['show_helptip'] = true;
|
||||
$params['input_name'] = 'id_parent';
|
||||
$params['print_hidden_input_idagent'] = true;
|
||||
$params['hidden_input_idagent_name'] = 'id_agent_parent';
|
||||
$params['hidden_input_idagent_value'] = $id_parent;
|
||||
$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent);
|
||||
$params['selectbox_id'] = 'cascade_protection_module';
|
||||
$params['javascript_is_function_select'] = true;
|
||||
$params['cascade_protection'] = true;
|
||||
|
||||
$table->data[1][1] = ui_print_agent_autocomplete_input($params);
|
||||
if (enterprise_installed()) {
|
||||
$table->data[1][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). " " . ui_print_help_icon("cascade_protection", true);
|
||||
}
|
||||
$table->data[1][1] .= " " . __('Module') . " " . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true);
|
||||
// Learn mode / Normal mode
|
||||
$table->data[3][0] = __('Module definition') .
|
||||
ui_print_help_icon("module_definition", true);
|
||||
$table->data[3][1] = __('Learning mode') . ' ' .
|
||||
html_print_radio_button_extended ("modo", 1, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
|
||||
'style="margin-right: 40px;"', true);
|
||||
$table->data[3][1] .= __('Normal mode') . ' ' .
|
||||
html_print_radio_button_extended ("modo", 0, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
|
||||
'style="margin-right: 40px;"', true);
|
||||
$table->data[3][1] .= __('Autodisable mode') . ' ' .
|
||||
html_print_radio_button_extended ("modo", 2, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
|
||||
'style="margin-right: 40px;"', true);
|
||||
|
||||
// Status (Disabled / Enabled)
|
||||
$table->data[4][0] = __('Status');
|
||||
$table->data[4][1] = __('Disabled') . ' ' .
|
||||
ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true) . ' ' .
|
||||
html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[4][1] .= __('Enabled') . ' ' .
|
||||
html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
if (enterprise_installed()) {
|
||||
$table->data[4][2] = __('Url address');
|
||||
$table->data[4][3] = html_print_input_text ('url_description',
|
||||
$url_description, '', 45, 255, true);
|
||||
}else{
|
||||
$table->data[5][0] = __('Url address');
|
||||
$table->data[5][1] = html_print_input_text ('url_description',
|
||||
$url_description, '', 45, 255, true);
|
||||
}
|
||||
$table->data[5][2] = __('Quiet');
|
||||
$table->data[5][3] .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true);
|
||||
$table->data[5][3] = html_print_checkbox('quiet', 1, $quiet, true);
|
||||
|
||||
$listIcons = gis_get_array_list_icons();
|
||||
|
||||
$arraySelectIcon = array();
|
||||
|
@ -510,30 +541,6 @@ if ($config['activate_gis']) {
|
|||
$update_gis_data, false, '', 'style="margin-right: 40px;"', true);
|
||||
}
|
||||
|
||||
$table->data[4][2] = __('Url address');
|
||||
$table->data[4][3] = html_print_input_text ('url_description',
|
||||
$url_description, '', 45, 255, true);
|
||||
|
||||
$table->data[5][2] = __('Quiet');
|
||||
$table->data[5][3] .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true);
|
||||
$table->data[5][3] = html_print_checkbox('quiet', 1, $quiet, true);
|
||||
|
||||
$cps_array[-1] = __('Disabled');
|
||||
if($cps > 0){
|
||||
$cps_array[$cps] = __('Enabled');
|
||||
}
|
||||
else{
|
||||
$cps_inc = 0;
|
||||
if($id_agente){
|
||||
$cps_inc = service_agents_cps($id_agente);
|
||||
}
|
||||
$cps_array[$cps_inc] = __('Enabled');
|
||||
}
|
||||
|
||||
$table->data[6][0] = __('Cascade protection services');
|
||||
$table->data[6][0] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true);
|
||||
$table->data[6][1] = html_print_select($cps_array, 'cps', $cps, '', '', 0, true);
|
||||
|
||||
ui_toggle(html_print_table ($table, true), __('Advanced options'));
|
||||
unset($table);
|
||||
|
||||
|
@ -599,8 +606,8 @@ echo clippy_context_help("modules_not_learning_mode");
|
|||
echo "</span>";
|
||||
|
||||
|
||||
|
||||
if ($id_agente) {
|
||||
echo '<div class="action-buttons" style="width: ' . $table->width . '">';
|
||||
html_print_submit_button (__('Update'), 'updbutton', false,
|
||||
'class="sub upd"');
|
||||
html_print_input_hidden ('update_agent', 1);
|
||||
|
|
|
@ -757,7 +757,7 @@ $table->data[2][1] = '<b>'.__('Auth user').'</b>';
|
|||
$table->data[2][2] = html_print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
|
||||
$table->data[2][3] = '<b>'.__('Auth password').'</b>';
|
||||
$table->data[2][4] = html_print_input_password ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
|
||||
$table->data[2][4] .= html_print_input_hidden('active_snmp_v3', 0, true);
|
||||
$table->data[2][4] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_awse', true);
|
||||
|
||||
$table->data[5][0] = '<b>'.__('Privacy method').'</b>';
|
||||
$table->data[5][1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true);
|
||||
|
|
|
@ -474,7 +474,7 @@ $table->data[2][1] = '<b>'.__('Auth user').'</b>';
|
|||
$table->data[2][2] = html_print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
|
||||
$table->data[2][3] = '<b>'.__('Auth password').'</b>';
|
||||
$table->data[2][4] = html_print_input_password ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
|
||||
$table->data[2][4] .= html_print_input_hidden('active_snmp_v3', 0, true);
|
||||
$table->data[2][4] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_awsie', true);
|
||||
|
||||
$table->data[5][0] = '<b>'.__('Privacy method').'</b>';
|
||||
$table->data[5][1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true);
|
||||
|
|
|
@ -760,7 +760,7 @@ if ($update_agent) { // if modified some agent paramenter
|
|||
$quiet = (int) get_parameter("quiet", 0);
|
||||
$cps = (int) get_parameter("cps", 0);
|
||||
|
||||
$old_interval = db_get_value('intervalo', 'tagente', 'id_agente', $id_agente);
|
||||
$old_values = db_get_row('tagente', 'id_agente', $id_agente);
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
|
||||
if ($fields === false) $fields = array();
|
||||
|
@ -800,10 +800,9 @@ if ($update_agent) { // if modified some agent paramenter
|
|||
ui_print_error_message(__('No agent alias specified'));
|
||||
//If there is an agent with the same name, but a different ID
|
||||
}
|
||||
/*elseif (agents_get_agent_id ($nombre_agente) > 0 &&
|
||||
agents_get_agent_id ($nombre_agente) != $id_agente) {
|
||||
ui_print_error_message(__('There is already an agent in the database with this name'));
|
||||
}*/
|
||||
if ($grupo <= 0) {
|
||||
ui_print_error_message(__('The group id %d is incorrect.', $grupo));
|
||||
}
|
||||
else {
|
||||
//If different IP is specified than previous, add the IP
|
||||
if ($direccion_agente != '' &&
|
||||
|
@ -861,11 +860,21 @@ if ($update_agent) { // if modified some agent paramenter
|
|||
// Update the agent from the metaconsole cache
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
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));
|
||||
|
||||
# Update the configuration files
|
||||
if ($old_values['intervalo'] != $intervalo) {
|
||||
enterprise_hook(
|
||||
'config_agents_update_config_token',
|
||||
array($id_agente, 'interval', $intervalo)
|
||||
);
|
||||
}
|
||||
|
||||
if ($old_values['disabled'] != $disabled) {
|
||||
enterprise_hook(
|
||||
'config_agents_update_config_token',
|
||||
array($id_agente, 'standby', $disabled ? "1" : "0")
|
||||
);
|
||||
}
|
||||
|
||||
if($tpolicy_group_old){
|
||||
foreach ($tpolicy_group_old as $key => $value) {
|
||||
$tpolicy_agents_old= db_get_sql("SELECT * FROM tpolicy_agents
|
||||
|
@ -987,16 +996,16 @@ $edit_module = (bool) get_parameter ('edit_module');
|
|||
// GET DATA for MODULE UPDATE OR MODULE INSERT
|
||||
if ($update_module || $create_module) {
|
||||
$id_grupo = agents_get_agent_group ($id_agente);
|
||||
$all_groups = agents_get_all_groups_agent ($id_agente, $id_grupo);
|
||||
|
||||
$id_agent_module = (int) get_parameter ('id_agent_module');
|
||||
|
||||
if (!check_acl ($config["id_user"], $id_grupo, "AW")) {
|
||||
if (! check_acl_one_of_groups ($config["id_user"], $all_groups, "AW")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to create a module without admin rights");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$id_agent_module = (int) get_parameter ('id_agent_module');
|
||||
$id_module_type = (int) get_parameter ('id_module_type');
|
||||
$name = (string) get_parameter ('name');
|
||||
$description = (string) get_parameter ('description');
|
||||
|
@ -1714,12 +1723,18 @@ if ($delete_module) { // DELETE agent module !
|
|||
ui_print_error_message(__('There was a problem deleting the module'));
|
||||
}
|
||||
else {
|
||||
ui_print_success_message(__('Module deleted succesfully'));
|
||||
|
||||
echo '<script type="text/javascript">
|
||||
location="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'";
|
||||
alert("'.__('Module deleted succesfully').'");
|
||||
</script>';
|
||||
|
||||
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
|
||||
db_pandora_audit("Agent management",
|
||||
"Deleted module '".$module_data["nombre"]."' for agent ".$agent["alias"]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// MODULE DUPLICATION
|
||||
|
@ -1937,11 +1952,11 @@ switch ($tab) {
|
|||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 220,
|
||||
height: 240,
|
||||
width: 600,
|
||||
title: 'Changing the module name of a satellite agent',
|
||||
open: function(){
|
||||
$('#dialog').html('<br><img src="images/icono-warning-triangulo.png" style="float:left;margin-left:25px;"><p style="float:right;font-style:nunito;font-size:11pt;margin-right:50px;"><span style="font-weight:bold;font-size:12pt;">Warning</span> <br>The names of the modules of a satellite should not be <br> altered manually. Unless you are absolutely certain of <br> the process, do not alter these names.</p>');
|
||||
$('#dialog').html('<br><table><tr><td><img src="images/icono-warning-triangulo.png" style="float:left;margin-left:25px;"></td><td><p style="float:right;font-style:nunito;font-size:11pt;margin-right:50px;margin-left:40px;"><span style="font-weight:bold;font-size:12pt;">Warning</span> <br>The names of the modules of a satellite should not be altered manually. Unless you are absolutely certain of the process, do not alter these names.</p></td></tr></table>');
|
||||
},
|
||||
buttons: [{
|
||||
text: "Ok",
|
||||
|
@ -1971,11 +1986,11 @@ switch ($tab) {
|
|||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 280,
|
||||
width: 670,
|
||||
height: 240,
|
||||
width: 650,
|
||||
title: 'Changing snmp module name',
|
||||
open: function(){
|
||||
$('#dialog').html('<br><img src="images/icono-warning-triangulo.png" style="float:left;margin-left:25px;margin-top:30px;"><p style="float:right;font-style:nunito;font-size:11pt;margin-right:50px;"><span style="font-weight:bold;font-size:12pt;">Warning</span> <br> If you change the name of this module, various features <br> associated with this module, such as network maps, <br> interface graphs or other network modules, may no longer <br> work. If you are not completely sure of the process, please <br> do not change the name of the module. </p>');
|
||||
$('#dialog').html('<br><table><tr><td><img src="images/icono-warning-triangulo.png" style="float:left;margin-left:25px;margin-top:30px;"></td><td><p style="float:right;font-style:nunito;font-size:11pt;margin-right:50px;margin-left:40px;"><span style="font-weight:bold;font-size:12pt;">Warning</span> <br> If you change the name of this module, various features associated with this module, such as network maps, interface graphs or other network modules, may no longer work. If you are not completely sure of the process, please do not change the name of the module. </p></td></tr></table>');
|
||||
},
|
||||
buttons: [{
|
||||
text: "Ok",
|
||||
|
|
|
@ -343,6 +343,7 @@ if($os != 0){
|
|||
$search_sql .= " AND id_os = " . $os;
|
||||
}
|
||||
|
||||
$user_groups_to_sql = "";
|
||||
// Show only selected groups
|
||||
if ($ag_group > 0) {
|
||||
$ag_groups = array();
|
||||
|
@ -350,100 +351,39 @@ if ($ag_group > 0) {
|
|||
if ($recursion) {
|
||||
$ag_groups = groups_get_id_recursive($ag_group, true);
|
||||
}
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM tagente
|
||||
WHERE id_grupo IN (%s)
|
||||
%s
|
||||
ORDER BY %s %s, %s %s
|
||||
LIMIT %d, %d',
|
||||
implode (",", $ag_groups), $search_sql, $order['field'],$order['order'], $order['field2'], $order['order'], $offset, $config["block_size"]);
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM tagente
|
||||
WHERE id_grupo IN (%s)
|
||||
%s
|
||||
ORDER BY %s %s, %s %s
|
||||
LIMIT %d OFFSET %d',
|
||||
implode (",", $ag_groups), $search_sql, $order['field'],$order['order'], $order['field2'], $order['order'], $config["block_size"], $offset);
|
||||
break;
|
||||
case "oracle":
|
||||
$set = array ();
|
||||
$set['limit'] = $config["block_size"];
|
||||
$set['offset'] = $offset;
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM tagente
|
||||
WHERE id_grupo IN (%s)
|
||||
%s
|
||||
ORDER BY %s %s, %s %s',
|
||||
implode (",", $ag_groups), $search_sql, $order['field'],$order['order'], $order['field2'], $order['order']);
|
||||
$sql = oracle_recode_query ($sql, $set);
|
||||
break;
|
||||
}
|
||||
|
||||
$sql_total = sprintf ('SELECT COUNT(*)
|
||||
FROM tagente
|
||||
WHERE id_grupo IN (%s)
|
||||
%s',
|
||||
implode (",", $ag_groups), $search_sql);
|
||||
$total_agents = db_get_sql ($sql_total);
|
||||
}
|
||||
else {
|
||||
$user_groups_to_sql = implode (",", $ag_groups);
|
||||
} else {
|
||||
// Concatenate AW and AD permisions to get all the possible groups where the user can manage
|
||||
$user_groupsAW = users_get_groups ($config['id_user'], 'AW');
|
||||
$user_groupsAD = users_get_groups ($config['id_user'], 'AD');
|
||||
|
||||
|
||||
$user_groups = $user_groupsAW + $user_groupsAD;
|
||||
|
||||
$sql = sprintf ('SELECT COUNT(*)
|
||||
FROM tagente
|
||||
WHERE id_grupo IN (%s)
|
||||
%s',
|
||||
implode (',', array_keys ($user_groups)),
|
||||
$search_sql);
|
||||
|
||||
$total_agents = db_get_sql ($sql);
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM tagente
|
||||
WHERE id_grupo IN (%s)
|
||||
%s
|
||||
ORDER BY %s %s, %s %s
|
||||
LIMIT %d, %d',
|
||||
implode (',', array_keys ($user_groups)),
|
||||
$search_sql, $order['field'],$order['order'], $order['field2'], $order['order'], $offset, $config["block_size"]);
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM tagente
|
||||
WHERE id_grupo IN (%s)
|
||||
%s
|
||||
ORDER BY %s %s, %s %s
|
||||
LIMIT %d OFFSET %d',
|
||||
implode (',', array_keys ($user_groups)),
|
||||
$search_sql, $order['field'],$order['order'], $order['field2'], $order['order'], $config["block_size"], $offset);
|
||||
break;
|
||||
case "oracle":
|
||||
$set = array ();
|
||||
$set['limit'] = $config["block_size"];
|
||||
$set['offset'] = $offset;
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM tagente
|
||||
WHERE id_grupo IN (%s)
|
||||
%s
|
||||
ORDER BY %s %s, %s %s',
|
||||
implode (',', array_keys ($user_groups)),
|
||||
$search_sql, $order['field'],$order['order'], $order['field2'], $order['order']);
|
||||
$sql = oracle_recode_query ($sql, $set);
|
||||
break;
|
||||
}
|
||||
$user_groups_to_sql = implode (',', array_keys ($user_groups));
|
||||
}
|
||||
|
||||
$sql = sprintf ('SELECT COUNT(DISTINCT(tagente.id_agente))
|
||||
FROM tagente LEFT JOIN tagent_secondary_group tasg
|
||||
ON tagente.id_agente = tasg.id_agent
|
||||
WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s))
|
||||
%s',
|
||||
$user_groups_to_sql, $user_groups_to_sql,
|
||||
$search_sql);
|
||||
|
||||
$total_agents = db_get_sql ($sql);
|
||||
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM tagente LEFT JOIN tagent_secondary_group tasg
|
||||
ON tagente.id_agente = tasg.id_agent
|
||||
WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s))
|
||||
%s
|
||||
GROUP BY tagente.id_agente
|
||||
ORDER BY %s %s, %s %s
|
||||
LIMIT %d, %d',
|
||||
$user_groups_to_sql, $user_groups_to_sql,
|
||||
$search_sql,
|
||||
$order['field'], $order['order'], $order['field2'], $order['order'],
|
||||
$offset, $config["block_size"]);
|
||||
|
||||
$agents = db_get_all_rows_sql ($sql);
|
||||
|
||||
// Delete rnum row generated by oracle_recode_query() function
|
||||
|
@ -494,13 +434,15 @@ if ($agents !== false) {
|
|||
}
|
||||
|
||||
/* End Update tagente.remote 0/1 with remote agent function return */
|
||||
|
||||
$id_grupo = $agent["id_grupo"];
|
||||
|
||||
|
||||
$all_groups = agents_get_all_groups_agent($agent["id_agente"], $agent["id_grupo"]);
|
||||
$check_aw = check_acl_one_of_groups ($config["id_user"], $all_groups, "AW");
|
||||
$check_ad = check_acl_one_of_groups ($config["id_user"], $all_groups, "AD");
|
||||
|
||||
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
|
||||
|
||||
if (! check_acl ($config["id_user"], $id_grupo, "AW", $agent['id_agente']) && ! check_acl ($config["id_user"], $id_grupo, "AD", $agent['id_agente']))
|
||||
continue;
|
||||
|
||||
// Do not show the agent if there is not enough permissions
|
||||
if (!$check_aw && !$check_ad) continue;
|
||||
|
||||
if ($color == 1) {
|
||||
$tdcolor = "datos";
|
||||
|
@ -526,7 +468,7 @@ if ($agents !== false) {
|
|||
echo '<span class="left">';
|
||||
echo "<strong>";
|
||||
|
||||
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
|
||||
if ($check_aw) {
|
||||
$main_tab = 'main';
|
||||
}
|
||||
else {
|
||||
|
@ -574,7 +516,7 @@ if ($agents !== false) {
|
|||
}
|
||||
|
||||
echo '</span><div class="left actions" style="visibility: hidden; clear: left">';
|
||||
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
|
||||
if ($check_aw) {
|
||||
if($agent["id_os"] == 100){
|
||||
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
|
||||
echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1">'.__('Edit').'</a>';
|
||||
|
@ -640,7 +582,7 @@ if ($agents !== false) {
|
|||
|
||||
|
||||
// Group icon and name
|
||||
echo "<td class='$tdcolor' align='left' valign='middle'>" . ui_print_group_icon ($id_grupo, true)."</td>";
|
||||
echo "<td class='$tdcolor' align='left' valign='middle'>" . ui_print_group_icon ($agent["id_grupo"], true)."</td>";
|
||||
// Description
|
||||
echo "<td class='".$tdcolor."f9'>" .
|
||||
ui_print_truncate_text($agent["comentarios"], 'description', true, true, true, '[…]', 'font-size: 6.5pt;')."</td>";
|
||||
|
@ -679,7 +621,7 @@ if ($agents !== false) {
|
|||
echo html_print_image('images/lightbulb.png', true, array('alt' => __('Disable agent'), 'title' => __('Disable agent'))) ."</a>";
|
||||
}
|
||||
|
||||
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
|
||||
if ($check_aw) {
|
||||
echo " <a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
|
||||
borrar_agente=".$agent["id_agente"]."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@ else {
|
|||
|
||||
enterprise_include ('godmode/agentes/module_manager.php');
|
||||
$isFunctionPolicies = enterprise_include_once ('include/functions_policies.php');
|
||||
require_once ('include/functions_modules.php');
|
||||
require_once ('include/functions_agents.php');
|
||||
require_once ('include/functions_servers.php');
|
||||
require_once ($config['homedir'] . '/include/functions_modules.php');
|
||||
require_once ($config['homedir'] . '/include/functions_agents.php');
|
||||
require_once ($config['homedir'] . '/include/functions_servers.php');
|
||||
|
||||
$search_string = io_safe_output(urldecode(trim(get_parameter ("search_string", ""))));
|
||||
|
||||
|
@ -35,7 +35,6 @@ if (!isset($policy_page))
|
|||
$policy_page = false;
|
||||
|
||||
// Search string filter form
|
||||
//echo '<form id="create_module_type" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
|
||||
if (($policy_page) || (isset($agent)))
|
||||
echo '<form id="" method="post" action="">';
|
||||
else
|
||||
|
@ -67,11 +66,13 @@ $prediction_available = db_get_sql ("SELECT count(*)
|
|||
WHERE server_type = 5"); //POSTGRESQL AND ORACLE COMPATIBLE
|
||||
|
||||
// Development mode to use all servers
|
||||
if ($develop_bypass) {
|
||||
if ($develop_bypass || is_metaconsole()) {
|
||||
$network_available = 1;
|
||||
$wmi_available = 1;
|
||||
$plugin_available = 1;
|
||||
$prediction_available = 1;
|
||||
// FIXME when prediction predictions server modules can be configured
|
||||
// on metaconsole
|
||||
$prediction_available = is_metaconsole() ? 0 : 1;
|
||||
}
|
||||
|
||||
$modules = array ();
|
||||
|
@ -108,7 +109,7 @@ $checked = get_parameter("checked");
|
|||
|
||||
if (($policy_page) || (isset($agent))) {
|
||||
if ($policy_page) {
|
||||
$show_creation = true;
|
||||
$show_creation = !is_central_policies_on_node();
|
||||
}
|
||||
else {
|
||||
if (!isset($all_groups)) {
|
||||
|
@ -655,7 +656,7 @@ foreach ($modules as $module) {
|
|||
"alt" => "")) . " ";
|
||||
}
|
||||
|
||||
if (check_acl ($config['id_user'], $agent['id_grupo'], "AW")) {
|
||||
if (check_acl_one_of_groups ($config["id_user"], $all_groups, "AW")) {
|
||||
$data[0] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=' . $id_agente . '&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].'">';
|
||||
}
|
||||
|
||||
|
@ -667,7 +668,7 @@ foreach ($modules as $module) {
|
|||
$data[0] .= ui_print_truncate_text($module['nombre'], 'module_medium', false, true, true, '[…]', 'font-size: 7.2pt');
|
||||
}
|
||||
|
||||
if (check_acl ($config['id_user'], $agent['id_grupo'], "AW")) {
|
||||
if (check_acl_one_of_groups ($config["id_user"], $all_groups, "AW")) {
|
||||
$data[0] .= '</a>';
|
||||
}
|
||||
|
||||
|
|
|
@ -14,10 +14,11 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
include_once("include/functions_modules.php");
|
||||
include_once("include/functions_categories.php");
|
||||
include_once($config['homedir'] . "/include/functions_modules.php");
|
||||
include_once($config['homedir'] . "/include/functions_categories.php");
|
||||
include_once($config['homedir'] . "/include/graphs/functions_d3.php");
|
||||
|
||||
echo "<script type='text/javascript' src='include/javascript/d3.3.5.14.js'></script>" . "\n";
|
||||
include_javascript_d3();
|
||||
|
||||
function prepend_table_simple ($row, $id = false) {
|
||||
global $table_simple;
|
||||
|
@ -133,19 +134,30 @@ $table_simple->id = 'simple';
|
|||
$table_simple->width = '100%';
|
||||
$table_simple->class = 'databox';
|
||||
$table_simple->data = array ();
|
||||
$table_simple->colspan = array ();
|
||||
$table_simple->style = array ();
|
||||
$table_simple->style[0] = 'font-weight: bold; width: 15%;';
|
||||
$table_simple->style[1] = 'width: 35%';
|
||||
$table_simple->style[0] = 'font-weight: bold; width: 25%;';
|
||||
$table_simple->style[1] = 'width: 25%';
|
||||
$table_simple->style[2] = 'font-weight: bold; width: 25%;';
|
||||
$table_simple->style[3] = 'width: 25%';
|
||||
$table_simple->cellclass = array();
|
||||
|
||||
$table_simple->colspan = array ();
|
||||
|
||||
|
||||
|
||||
#$table_simple->colspan[4][1] = 3;
|
||||
$table_simple->colspan[5][1] = 3;
|
||||
$table_simple->colspan[6][1] = 3;
|
||||
|
||||
$table_simple->rowspan = array ();
|
||||
if(strstr($page, "policy_modules")){
|
||||
$table_simple->rowspan[3][2] = 3;
|
||||
$table_simple->colspan[3][2] = 2;
|
||||
}
|
||||
else{
|
||||
$table_simple->rowspan[4][2] = 3;
|
||||
$table_simple->colspan[4][2] = 2;
|
||||
$table_simple->colspan[5][1] = 3;
|
||||
}
|
||||
|
||||
$table_simple->data[0][0] = __('Name');
|
||||
$table_simple->data[0][1] = html_print_input_text_extended ('name',
|
||||
io_safe_input(html_entity_decode($name)), 'text-name', '', 45, 100, $disabledBecauseInPolicy, '', $largeClassDisabledBecauseInPolicy, true);
|
||||
|
@ -154,7 +166,7 @@ $table_simple->data[0][1] = html_print_input_text_extended ('name',
|
|||
|
||||
if (!empty($id_agent_module) && isset($id_agente)) {
|
||||
$table_simple->data[0][1] .= ' <b>' . __('ID') . '</b> ' . $id_agent_module . ' ';
|
||||
|
||||
|
||||
$table_simple->data[0][1] .= ' <a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$id_agent_module.'"
|
||||
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
$table_simple->data[0][1] .= html_print_image ('images/cross.png', true,
|
||||
|
@ -182,7 +194,6 @@ if (!$in_policy) {
|
|||
'parent_module_id', $parent_module_id, '', __('Not assigned'), '0', true, false, true);
|
||||
}
|
||||
|
||||
|
||||
$table_simple->data[2][0] = __('Type').' ' . ui_print_help_icon ('module_type', true);
|
||||
$table_simple->data[2][0] .= html_print_input_hidden ('id_module_type_hidden', $id_module_type, true);
|
||||
|
||||
|
@ -205,14 +216,14 @@ if (!$edit) {
|
|||
WHERE id_tipo = %s
|
||||
ORDER BY descripcion',
|
||||
$id_module_type);
|
||||
|
||||
|
||||
$type_names = db_get_all_rows_sql($sql);
|
||||
|
||||
|
||||
$type_names_hash = array();
|
||||
foreach ($type_names as $tn) {
|
||||
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
|
||||
}
|
||||
|
||||
|
||||
$table_simple->data[2][1] = '<em>'.modules_get_moduletype_description ($id_module_type).' ('.$type_names_hash[$id_module_type].')</em>';
|
||||
$table_simple->data[2][1] .= html_print_input_hidden('type_names',base64_encode(io_json_mb_encode($type_names_hash)),true);
|
||||
}
|
||||
|
@ -223,35 +234,35 @@ else {
|
|||
else {
|
||||
$idModuleType = '';
|
||||
}
|
||||
|
||||
|
||||
$sql = sprintf ('SELECT id_tipo, descripcion
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria IN (%s)
|
||||
ORDER BY descripcion',
|
||||
implode (',', $categories));
|
||||
|
||||
|
||||
$table_simple->data[2][1] = html_print_select_from_sql ($sql, 'id_module_type',
|
||||
$idModuleType, '', '', '', true, false, false, $disabledBecauseInPolicy, false, false, 100);
|
||||
|
||||
|
||||
// Store the relation between id and name of the types on a hidden field
|
||||
$sql = sprintf ('SELECT id_tipo, nombre
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria IN (%s)
|
||||
ORDER BY descripcion',
|
||||
implode (',', $categories));
|
||||
|
||||
|
||||
$type_names = db_get_all_rows_sql($sql);
|
||||
|
||||
|
||||
$type_names_hash = array();
|
||||
foreach ($type_names as $tn) {
|
||||
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
|
||||
}
|
||||
|
||||
|
||||
$table_simple->data[2][1] .= html_print_input_hidden('type_names',base64_encode(io_json_mb_encode($type_names_hash)),true);
|
||||
}
|
||||
|
||||
if($disabledBecauseInPolicy){
|
||||
$table_simple->data[2][3] .= html_print_input_hidden ('id_module_group', $id_module_group, true);
|
||||
$table_simple->data[2][3] .= html_print_input_hidden ('id_module_group', $id_module_group, true);
|
||||
}
|
||||
$table_simple->data[3][0] = __('Dynamic Threshold Interval') .' ' . ui_print_help_icon ('dynamic_threshold', true);
|
||||
$table_simple->data[3][1] = html_print_extended_select_for_time ('dynamic_interval', $dynamic_interval, '', 'None', '0', 10, true, 'width:150px',false, $classdisabledBecauseInPolicy, $disabledBecauseInPolicy);
|
||||
|
@ -280,21 +291,21 @@ if (!modules_is_string_type($id_module_type) || $edit) {
|
|||
$table_simple->data[4][1] .= html_print_input_text ('min_warning', $min_warning, '', 10, 255, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
$table_simple->data[4][1] .= '<br /><em>'.__('Max.').'</em>';
|
||||
$table_simple->data[4][1] .= html_print_input_text ('max_warning', $max_warning, '', 10, 255, true,
|
||||
$table_simple->data[4][1] .= html_print_input_text ('max_warning', $max_warning, '', 10, 255, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).'</span>';
|
||||
}
|
||||
if (modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[4][1] .= '<span id="string_warning"><em>'.__('Str.').'</em>';
|
||||
$table_simple->data[4][1] .= html_print_input_text ('str_warning', str_replace("\"","",$str_warning),
|
||||
$table_simple->data[4][1] .= html_print_input_text ('str_warning', str_replace("\"","",$str_warning),
|
||||
'', 10, 255, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).'</span>';
|
||||
}
|
||||
$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="800" height="300"> </svg>';
|
||||
$table_simple->colspan[4][2] = 2;
|
||||
$table_simple->rowspan[4][2] = 3;
|
||||
$table_simple->data[4][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
|
||||
}
|
||||
|
||||
$table_simple->data[5][0] = __('Critical status').' ' . ui_print_help_icon ('critical_status', true);
|
||||
if (!modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[5][1] .= '<span id="minmax_critical"><em>'.__('Min. ').'</em>';
|
||||
|
@ -306,30 +317,29 @@ if (!modules_is_string_type($id_module_type) || $edit) {
|
|||
}
|
||||
if (modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[5][1] .= '<span id="string_critical"><em>'.__('Str.').'</em>';
|
||||
$table_simple->data[5][1] .= html_print_input_text ('str_critical', str_replace("\"","",$str_critical),
|
||||
$table_simple->data[5][1] .= html_print_input_text ('str_critical', str_replace("\"","",$str_critical),
|
||||
'', 10, 255, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).'</span>';
|
||||
}
|
||||
|
||||
$table_simple->data[5][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
$table_simple->data[5][1] .= html_print_checkbox ("critical_inverse", 1, $critical_inverse, true, $disabledBecauseInPolicy);
|
||||
|
||||
/* FF stands for Flip-flop */
|
||||
//FF stands for Flip-flop
|
||||
$table_simple->data[6][0] = __('FF threshold').' ' . ui_print_help_icon ('ff_threshold', true);
|
||||
$table_simple->colspan[5][1] = 3;
|
||||
|
||||
$table_simple->data[6][1] = html_print_radio_button ('each_ff', 0, '', $each_ff, true, $disabledBecauseInPolicy) . ' ' . __('All state changing') . ' : ';
|
||||
$table_simple->data[6][1] .= html_print_input_text ('ff_event', $ff_event, '', 5, 15, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . '<br />';
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . '<br />';
|
||||
$table_simple->data[6][1] .= html_print_radio_button ('each_ff', 1, '', $each_ff, true, $disabledBecauseInPolicy) . ' ' . __('Each state changing') . ' : ';
|
||||
$table_simple->data[6][1] .= __('To normal');
|
||||
$table_simple->data[6][1] .= html_print_input_text ('ff_event_normal', $ff_event_normal, '', 5, 15, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . ' ';
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . ' ';
|
||||
$table_simple->data[6][1] .= __('To warning');
|
||||
$table_simple->data[6][1] .= html_print_input_text ('ff_event_warning', $ff_event_warning, '', 5, 15, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . ' ';
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . ' ';
|
||||
$table_simple->data[6][1] .= __('To critical');
|
||||
$table_simple->data[6][1] .= html_print_input_text ('ff_event_critical', $ff_event_critical, '', 5, 15, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
$table_simple->data[7][0] = __('Historical data');
|
||||
if($disabledBecauseInPolicy) {
|
||||
// If is disabled, we send a hidden in his place and print a false checkbox because HTML dont send disabled fields and could be disabled by error
|
||||
|
@ -340,7 +350,7 @@ else {
|
|||
$table_simple->data[7][1] = html_print_checkbox ("history_data", 1, $history_data, true, $disabledBecauseInPolicy);
|
||||
}
|
||||
|
||||
/* Advanced form part */
|
||||
//Advanced form part
|
||||
$table_advanced = new stdClass();
|
||||
$table_advanced->id = 'advanced';
|
||||
$table_advanced->width = '100%';
|
||||
|
@ -359,8 +369,8 @@ $table_advanced->data[0][1] = html_print_textarea ('description', 2, 65,
|
|||
|
||||
$table_advanced->data[1][0] = __('Custom ID');
|
||||
$table_advanced->colspan[1][1] = 2;
|
||||
$table_advanced->data[1][1] = html_print_input_text ('custom_id', $custom_id, '', 20, 65, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
$table_advanced->data[1][1] = html_print_input_text ('custom_id', $custom_id, '', 20, 65, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
|
||||
$table_advanced->data[1][3] = __('Unit');
|
||||
// $table_advanced->data[1][4] = html_print_input_text ('unit', $unit, '', 20, 65, true,
|
||||
|
@ -576,7 +586,8 @@ if($cps_module > 0){
|
|||
else{
|
||||
$cps_inc = 0;
|
||||
if($id_agent_module){
|
||||
$cps_inc = service_modules_cps($id_agent_module);
|
||||
$cps_inc = enterprise_hook('service_modules_cps', array($id_agent_module));
|
||||
if ($cps_inc === ENTERPRISE_NOT_HOOK) $cps_inc = 0;
|
||||
}
|
||||
$cps_array[$cps_inc] = __('Enabled');
|
||||
}
|
||||
|
|
|
@ -16,15 +16,18 @@
|
|||
global $config;
|
||||
|
||||
require_once($config['homedir'] . "/include/functions_snmp_browser.php");
|
||||
?>
|
||||
<script type="text/javascript" src="include/javascript/pandora_snmp_browser.js"></script>
|
||||
<?php
|
||||
$snmp_browser_path = is_metaconsole() ? "../../" : "";
|
||||
$snmp_browser_path .= "include/javascript/pandora_snmp_browser.js";
|
||||
echo "<script type='text/javascript' src='$snmp_browser_path'></script>";
|
||||
//This line does not run with the dinamic loader editor in policies.
|
||||
//ui_require_javascript_file ('pandora_snmp_browser');
|
||||
|
||||
//WARNING REPEAT input hidden errors in console
|
||||
// Save some variables for javascript functions
|
||||
html_print_input_hidden ('ajax_url', ui_get_full_url("ajax.php"), false);
|
||||
html_print_input_hidden ('search_matches_translation', __("Search matches"), false);
|
||||
//html_print_input_hidden ('ajax_url', ui_get_full_url("ajax.php"), false);
|
||||
//html_print_input_hidden ('search_matches_translation', __("Search matches"), false);
|
||||
|
||||
|
||||
|
||||
// Define a custom action to save the OID selected in the SNMP browser to the form
|
||||
html_print_input_hidden ('custom_action', urlencode (base64_encode(' <a href="javascript:setOID()"><img src="' . ui_get_full_url("images") . '/input_filter.disabled.png" title="' . __("Use this OID") . '" style="vertical-align: middle;"></img></a>')), false);
|
||||
|
@ -215,11 +218,11 @@ else if ($id_agent_module === false) {
|
|||
$data = array();
|
||||
$data[0] = __('Auth user');
|
||||
$data[1] = html_print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true, $disabledBecauseInPolicy,
|
||||
false, '', $classdisabledBecauseInPolicy);
|
||||
false, '', $classdisabledBecauseInPolicy);
|
||||
$data[2] = __('Auth password') . ui_print_help_tip(__("The pass length must be eight character minimum."), true);
|
||||
$data[3] = html_print_input_password ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true, $disabledBecauseInPolicy,
|
||||
false, $largeclassdisabledBecauseInPolicy);
|
||||
$data[3] .= html_print_input_hidden('active_snmp_v3', 0, true);
|
||||
false, $largeclassdisabledBecauseInPolicy);
|
||||
$data[3] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_mmen', true);
|
||||
if ($snmp_version != 3) $table_simple->rowstyle['field_snmpv3_row1'] = 'display: none;';
|
||||
push_table_simple($data, 'field_snmpv3_row1');
|
||||
|
||||
|
|
|
@ -370,12 +370,8 @@ foreach ($actions as $action) {
|
|||
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'.
|
||||
$action['name'].'</a>';
|
||||
$data[1] = ui_print_group_icon ($action["id_group"], true) .' ';
|
||||
$hack_id_group_all = $action["id_group"];
|
||||
if ($hack_id_group_all == 0) {
|
||||
//To avoid check all groups instead the pseudo-group all
|
||||
$hack_id_group_all = -1;
|
||||
}
|
||||
if (check_acl($config['id_user'], $hack_id_group_all, "LM")) {
|
||||
|
||||
if (check_acl($config['id_user'], $action["id_group"], "LM")) {
|
||||
$data[2] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&copy_action=1&id='.$action['id'].'&pure='.$pure.'"
|
||||
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">' .
|
||||
html_print_image("images/copy.png", true) . '</a>';
|
||||
|
|
|
@ -218,7 +218,7 @@ $(document).ready (function () {
|
|||
$("#value", $value).append ("<em><?php echo __('Empty') ?></em>");
|
||||
}
|
||||
else {
|
||||
$("#value", $value).append (data);
|
||||
$("#value", $value).append (parseInt(data));
|
||||
}
|
||||
$loading.hide ();
|
||||
$value.show ();
|
||||
|
|
|
@ -705,18 +705,26 @@ foreach ($simple_alerts as $alert) {
|
|||
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LW")) {
|
||||
$data[4] .= ' <form class="delete_alert_form" action="' . $url . '" method="post" style="display: inline;">';
|
||||
if ($alert['disabled']) {
|
||||
$data[4] .= html_print_image('images/add.disabled.png',
|
||||
true, array('title' => __("Add action")));
|
||||
|
||||
}
|
||||
else {
|
||||
$data[4] .= '<a href="javascript:show_add_action(\'' . $alert['id'] . '\');">';
|
||||
$data[4] .= html_print_image('images/add.png', true, array('title' => __("Add action")));
|
||||
|
||||
$data[4] .= '</a>';
|
||||
}
|
||||
$data[4] .= html_print_input_image ('delete', 'images/cross.png', 1, '', true, array('title' => __('Delete')));
|
||||
$data[4] .= html_print_input_hidden ('delete_alert', 1, true);
|
||||
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
|
||||
$data[4] .= '</form>';
|
||||
|
||||
$data[4] .= '<form class="view_alert_form" method="post" style="display: inline;">';
|
||||
|
||||
$data[4] .= html_print_input_image ('update', 'images/builder.png', 1, '', true, array('title' => __('Update')));
|
||||
$data[4] .= html_print_input_hidden ('upd_alert', 1, true);
|
||||
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
|
||||
|
||||
$data[4] .= '</form>';
|
||||
|
||||
}
|
||||
|
||||
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LM")) {
|
||||
|
|
|
@ -47,6 +47,7 @@ $add_action = (bool) get_parameter ('add_action');
|
|||
$update_action = (bool) get_parameter ('update_action');
|
||||
$delete_action = (bool) get_parameter ('delete_action');
|
||||
$delete_alert = (bool) get_parameter ('delete_alert');
|
||||
$update_alert = (bool) get_parameter ('update_alert'); ////
|
||||
$disable_alert = (bool) get_parameter ('disable_alert');
|
||||
$enable_alert = (bool) get_parameter ('enable_alert');
|
||||
$standbyon_alert = (bool) get_parameter ('standbyon_alert');
|
||||
|
@ -67,10 +68,32 @@ $standby = get_parameter('standby','');
|
|||
$pure = get_parameter('pure', 0);
|
||||
$messageAction = '';
|
||||
|
||||
if ($update_alert) {
|
||||
|
||||
$id_alert_agent_module = (int) get_parameter ('id_alert_update');
|
||||
|
||||
$id_alert_template = (int) get_parameter ('template');
|
||||
$id_agent_module = (int) get_parameter ('id_agent_module');
|
||||
|
||||
$values_upd = array();
|
||||
|
||||
if (!empty($id_alert_template))
|
||||
$values_upd['id_agent_module'] = $id_agent_module;
|
||||
|
||||
if (!empty($id_alert_template))
|
||||
$values_upd['id_alert_template'] = $id_alert_template;
|
||||
|
||||
$id = alerts_update_alert_agent_module ($id_alert_agent_module, $values_upd);
|
||||
|
||||
$messageAction = ui_print_result_message ($id,
|
||||
__('Successfully updated'), __('Could not be updated'), '', true);
|
||||
|
||||
}
|
||||
|
||||
if ($create_alert) {
|
||||
$id_alert_template = (int) get_parameter ('template');
|
||||
$id_agent_module = (int) get_parameter ('id_agent_module');
|
||||
|
||||
|
||||
if (db_get_value_sql("SELECT COUNT(id)
|
||||
FROM talert_template_modules
|
||||
WHERE id_agent_module = " . $id_agent_module . "
|
||||
|
@ -81,7 +104,7 @@ if ($create_alert) {
|
|||
}
|
||||
else {
|
||||
$id = alerts_create_alert_agent_module ($id_agent_module, $id_alert_template);
|
||||
|
||||
|
||||
$alert_template_name = db_get_value ("name",
|
||||
"talert_templates","id", $id_alert_template);
|
||||
$module_name = db_get_value ("nombre",
|
||||
|
@ -116,6 +139,7 @@ if ($create_alert) {
|
|||
$values['module_action_threshold'] =
|
||||
(int)get_parameter ('module_action_threshold');
|
||||
|
||||
|
||||
alerts_add_alert_agent_module_action ($id, $action_select, $values);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -326,13 +326,8 @@ foreach ($templates as $template) {
|
|||
|
||||
$data[1] = ui_print_group_icon ($template["id_group"], true);
|
||||
$data[3] = alerts_get_alert_templates_type_name ($template['type']);
|
||||
|
||||
$hack_id_group_all = $template["id_group"];
|
||||
if ($hack_id_group_all == 0) {
|
||||
//To avoid check all groups instead the pseudo-group all
|
||||
$hack_id_group_all = -1;
|
||||
}
|
||||
if (check_acl($config['id_user'], $hack_id_group_all, "LM")) {
|
||||
|
||||
if (check_acl($config['id_user'], $template["id_group"], "LM")) {
|
||||
$data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'" style="display: inline; float: left">';
|
||||
$data[4] .= html_print_input_hidden ('duplicate_template', 1, true);
|
||||
$data[4] .= html_print_input_hidden ('source_id', $template['id'], true);
|
||||
|
|
|
@ -65,13 +65,13 @@ if ($fields_selected[0]!='') {
|
|||
foreach ($fields_selected as $field_selected) {
|
||||
switch ($field_selected) {
|
||||
case 'id_evento':
|
||||
$result = __('Event id');
|
||||
$result = __('Event Id');
|
||||
break;
|
||||
case 'evento':
|
||||
$result = __('Event name');
|
||||
$result = __('Event Name');
|
||||
break;
|
||||
case 'id_agente':
|
||||
$result = __('Agent name');
|
||||
$result = __('Agent Name');
|
||||
break;
|
||||
case 'id_usuario':
|
||||
$result = __('User');
|
||||
|
@ -86,10 +86,10 @@ if ($fields_selected[0]!='') {
|
|||
$result = __('Timestamp');
|
||||
break;
|
||||
case 'event_type':
|
||||
$result = __('Event type');
|
||||
$result = __('Event Type');
|
||||
break;
|
||||
case 'id_agentmodule':
|
||||
$result = __('Agent module');
|
||||
$result = __('Module Name');
|
||||
break;
|
||||
case 'id_alert_am':
|
||||
$result = __('Alert');
|
||||
|
@ -107,7 +107,7 @@ if ($fields_selected[0]!='') {
|
|||
$result = __('Source');
|
||||
break;
|
||||
case 'id_extra':
|
||||
$result = __('Extra id');
|
||||
$result = __('Extra Id');
|
||||
break;
|
||||
case 'owner_user':
|
||||
$result = __('Owner');
|
||||
|
@ -119,8 +119,15 @@ if ($fields_selected[0]!='') {
|
|||
$result = __('Instructions');
|
||||
break;
|
||||
case 'server_name':
|
||||
$result = __('Server name');
|
||||
$result = __('Server Name');
|
||||
break;
|
||||
case 'data':
|
||||
$result = __('Data');
|
||||
break;
|
||||
case 'module_status':
|
||||
$result = __('Module Status');
|
||||
break;
|
||||
|
||||
}
|
||||
$result_selected[$field_selected] = $result;
|
||||
}
|
||||
|
@ -149,25 +156,27 @@ $table->data = array();
|
|||
|
||||
$fields_available = array();
|
||||
|
||||
$fields_available['id_evento'] = __('Event id');
|
||||
$fields_available['evento'] = __('Event name');
|
||||
$fields_available['id_agente'] = __('Agent name');
|
||||
$fields_available['id_evento'] = __('Event Id');
|
||||
$fields_available['evento'] = __('Event Name');
|
||||
$fields_available['id_agente'] = __('Agent Name');
|
||||
$fields_available['id_usuario'] = __('User');
|
||||
$fields_available['id_grupo'] = __('Group');
|
||||
$fields_available['estado'] = __('Status');
|
||||
$fields_available['timestamp'] = __('Timestamp');
|
||||
$fields_available['event_type'] = __('Event type');
|
||||
$fields_available['id_agentmodule'] = __('Agent module');
|
||||
$fields_available['event_type'] = __('Event Type');
|
||||
$fields_available['id_agentmodule'] = __('Module Name');
|
||||
$fields_available['id_alert_am'] = __('Alert');
|
||||
$fields_available['criticity'] = __('Severity');
|
||||
$fields_available['user_comment'] = __('Comment');
|
||||
$fields_available['tags'] = __('Tags');
|
||||
$fields_available['source'] = __('Source');
|
||||
$fields_available['id_extra'] = __('Extra id');
|
||||
$fields_available['id_extra'] = __('Extra Id');
|
||||
$fields_available['owner_user'] = __('Owner');
|
||||
$fields_available['ack_utimestamp'] = __('ACK Timestamp');
|
||||
$fields_available['instructions'] = __('Instructions');
|
||||
$fields_available['server_name'] = __('Server name');
|
||||
$fields_available['server_name'] = __('Server Name');
|
||||
$fields_available['data'] = __('Data');
|
||||
$fields_available['module_status'] = __('Module Status');
|
||||
|
||||
//remove fields already selected
|
||||
foreach ($fields_available as $key=>$available) {
|
||||
|
@ -179,7 +188,7 @@ foreach ($fields_available as $key=>$available) {
|
|||
}
|
||||
|
||||
$table->data[0][0] = '<b>' . __('Fields available').'</b>';
|
||||
$table->data[1][0] = html_print_select ($fields_available, 'fields_available[]', true, '', '', '', true, true, false, '', false, 'width: 300px');
|
||||
$table->data[1][0] = html_print_select ($fields_available, 'fields_available[]', true, '', '', 0, true, true, false, '', false, 'width: 300px');
|
||||
$table->data[1][1] = '<a href="javascript:">' .
|
||||
html_print_image('images/darrowright.png', true,
|
||||
array('id' => 'right', 'title' => __('Add fields to select'))) .
|
||||
|
@ -192,7 +201,7 @@ $table->data[1][1] .= '<br><br><br><br><a href="javascript:">' .
|
|||
$table->data[0][1] = '';
|
||||
$table->data[0][2] = '<b>' . __('Fields selected') . '</b>';
|
||||
$table->data[1][2] = html_print_select($result_selected,
|
||||
'fields_selected[]', true, '', '', '', true, true, false, '', false, 'width: 300px');
|
||||
'fields_selected[]', true, '', '', 0, true, true, false, '', false, 'width: 300px');
|
||||
|
||||
echo '<form id="custom_events" method="post" action="index.php?sec=geventos&sec2=godmode/events/events§ion=fields&pure='.$config['pure'].'">';
|
||||
html_print_table($table);
|
||||
|
@ -214,6 +223,7 @@ $(document).ready (function () {
|
|||
id_field = $(value).attr('value');
|
||||
$("select[name='fields_selected[]']").append($("<option></option>").html(field_name).attr("value", id_field));
|
||||
$("#fields_available").find("option[value='" + id_field + "']").remove();
|
||||
$("#fields_selected").find("option[value='0']").remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -225,11 +235,13 @@ $(document).ready (function () {
|
|||
id_field = $(value).attr('value');
|
||||
$("select[name='fields_available[]']").append($("<option></option>").val(id_field).html('<i>' + field_name + '</i>'));
|
||||
$("#fields_selected").find("option[value='" + id_field + "']").remove();
|
||||
$("#fields_available").find("option[value='0']").remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#submit-upd_button").click(function () {
|
||||
$("#fields_selected").find("option[value='0']").remove();
|
||||
$('#fields_selected option').map(function() {
|
||||
$(this).prop('selected', true);
|
||||
});
|
||||
|
|
|
@ -65,6 +65,9 @@ if ($id) {
|
|||
$group_rep = $filter['group_rep'];
|
||||
$date_from = str_replace("-","/",$filter['date_from']);
|
||||
$date_to = str_replace("-","/",$filter['date_to']);
|
||||
$source = $filter['source'];
|
||||
$id_extra = $filter['id_extra'];
|
||||
$user_comment = $filter['user_comment'];
|
||||
|
||||
$tag_with_json = $filter['tag_with'];
|
||||
$tag_with_json_clean = io_safe_output($tag_with_json);
|
||||
|
@ -130,6 +133,9 @@ if ($update || $create) {
|
|||
$group_rep = get_parameter('group_rep', '');
|
||||
$date_from = get_parameter('date_from', '');
|
||||
$date_to = get_parameter('date_to', '');
|
||||
$source = get_parameter('source');
|
||||
$id_extra = get_parameter('id_extra');
|
||||
$user_comment = get_parameter('user_comment');
|
||||
|
||||
$tag_with_base64 = get_parameter('tag_with', json_encode(array()));
|
||||
$tag_with_json = io_safe_input(base64_decode($tag_with_base64));
|
||||
|
@ -158,6 +164,9 @@ if ($update || $create) {
|
|||
'tag_without' => $tag_without_json,
|
||||
'date_from' => $date_from,
|
||||
'date_to' => $date_to,
|
||||
'source' => $source,
|
||||
'id_extra' => $id_extra,
|
||||
'user_comment' => $user_comment,
|
||||
'filter_only_alert' => $filter_only_alert);
|
||||
}
|
||||
|
||||
|
@ -390,6 +399,16 @@ if (!is_metaconsole()) {
|
|||
$text_module, false, true, '', array(), true, $id_agent_module);
|
||||
}
|
||||
|
||||
$sources = events_get_all_source();
|
||||
$table ->data[22][0] = '<b>' . __('Source') . '</b>';
|
||||
$table ->data[22][1] = html_print_select ($sources, 'source', $source, '', '', '', true);
|
||||
|
||||
$table ->data[23][0] = '<b>' . __('Extra ID') . '</b>';
|
||||
$table ->data[23][1] = html_print_input_text ('id_extra', $id_extra, '', 11, 255, true);
|
||||
|
||||
$table ->data[24][0] = '<b>' . __('Comment') . '</b>';
|
||||
$table ->data[24][1] = html_print_input_text ('user_comment', $user_comment, '', 35, 255, true);
|
||||
|
||||
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events§ion=edit_filter&pure='.$config['pure'].'">';
|
||||
html_print_table ($table);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,40 +32,40 @@ if (is_ajax ()) {
|
|||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$get_group_json = (bool) get_parameter ('get_group_json');
|
||||
$get_group_agents = (bool) get_parameter ('get_group_agents');
|
||||
$get_is_disabled = (bool) get_parameter ('get_is_disabled');
|
||||
|
||||
|
||||
if ($get_group_json) {
|
||||
$id_group = (int) get_parameter ('id_group');
|
||||
|
||||
|
||||
if ($id_group == 0) {
|
||||
$group = array('id_grupo' => 0,
|
||||
'nombre' => 'All',
|
||||
'nombre' => 'All',
|
||||
'icon' => 'world',
|
||||
'parent' => 0,
|
||||
'disabled' => 0,
|
||||
'custom_id' => null);
|
||||
|
||||
echo json_encode ($group);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (! check_acl ($config['id_user'], $id_group, "AR")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Alert Management");
|
||||
echo json_encode (false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$group = db_get_row ('tgrupo', 'id_grupo', $id_group);
|
||||
|
||||
|
||||
echo json_encode ($group);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ($get_group_agents) {
|
||||
ob_clean();
|
||||
$id_group = (int) get_parameter ('id_group');
|
||||
$disabled = (int) get_parameter ('disabled', 0);
|
||||
$search = (string) get_parameter ('search', '');
|
||||
|
@ -82,33 +82,36 @@ if (is_ajax ()) {
|
|||
$status_agents = (int)get_parameter('status_agents', AGENT_STATUS_ALL);
|
||||
// Juanma (22/05/2014) Fix: If setted remove void agents from result (by default and for compatibility show void agents)
|
||||
$show_void_agents = (int)get_parameter('show_void_agents', 1);
|
||||
|
||||
$serialized = (bool)get_parameter('serialized', false);
|
||||
$serialized_separator = (string)get_parameter('serialized_separator', "|");
|
||||
$force_serialized = (bool)get_parameter('force_serialized', false);
|
||||
|
||||
if (! check_acl ($config['id_user'], $id_group, "AR")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Alert Management");
|
||||
echo json_encode (false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( https_is_running() ) {
|
||||
header('Content-type: application/json');
|
||||
}
|
||||
|
||||
|
||||
if ($filter_agents_json != '') {
|
||||
$filter['id_agente'] = json_decode(io_safe_output($filter_agents_json), true);
|
||||
}
|
||||
|
||||
|
||||
if ($all_agents) {
|
||||
$filter['all_agents'] = true;
|
||||
}
|
||||
else {
|
||||
$filter['disabled'] = $disabled;
|
||||
}
|
||||
|
||||
|
||||
if ($search != '') {
|
||||
$filter['string'] = $search;
|
||||
}
|
||||
|
||||
|
||||
if ($status_agents != AGENT_STATUS_ALL) {
|
||||
$filter['status'] = $status_agents;
|
||||
}
|
||||
|
@ -116,23 +119,29 @@ if (is_ajax ()) {
|
|||
# Juanma (22/05/2014) Fix: If remove void agents setted
|
||||
$_sql_post = ' 1=1 ';
|
||||
if ($show_void_agents == 0) {
|
||||
|
||||
$_sql_post .= ' AND id_agente IN (SELECT a.id_agente FROM tagente a, tagente_modulo b WHERE a.id_agente=b.id_agente AND b.delete_pending=0) AND \'1\'';
|
||||
$filter[$_sql_post] = '1';
|
||||
|
||||
}
|
||||
|
||||
|
||||
$id_groups_get_agents = $id_group;
|
||||
if ( $id_group == 0 && $privilege != '') {
|
||||
$groups = users_get_groups ($config["id_user"], $privilege, false);
|
||||
// if group ID doesn't matter and $privilege is specified (like 'AW'),
|
||||
// retruns all agents that current user has $privilege privilege for.
|
||||
$agents = agents_get_group_agents(array_keys($groups), $filter, "none", false, $recursion, false, '|', $add_alert_bulk_op);
|
||||
$id_groups_get_agents = array_keys($groups);
|
||||
}
|
||||
else {
|
||||
$agents = agents_get_group_agents($id_group, $filter, "none",
|
||||
true, $recursion, false, '|', $add_alert_bulk_op);
|
||||
}
|
||||
|
||||
$agents = agents_get_group_agents(
|
||||
$id_groups_get_agents,
|
||||
$filter,
|
||||
"none",
|
||||
false,
|
||||
$recursion,
|
||||
$serialized,
|
||||
$serialized_separator,
|
||||
$add_alert_bulk_op,
|
||||
$force_serialized
|
||||
);
|
||||
|
||||
$agents_disabled = array();
|
||||
// Add keys prefix
|
||||
if ($keys_prefix !== "") {
|
||||
|
@ -140,7 +149,34 @@ if (is_ajax ()) {
|
|||
$agents[$keys_prefix . $k] = $v;
|
||||
unset($agents[$k]);
|
||||
if ($all_agents) {
|
||||
$agent_disabled = db_get_value_filter('disabled', 'tagente', array('id_agente' => $k));
|
||||
// Unserialize to get the status
|
||||
if ($serialized && is_metaconsole()) {
|
||||
$agent_info = explode($serialized_separator, $k);
|
||||
$agent_disabled = db_get_value_filter(
|
||||
'disabled',
|
||||
'tmetaconsole_agent',
|
||||
array(
|
||||
'id_tagente' => $agent_info[1],
|
||||
'id_tmetaconsole_setup' => $agent_info[0]
|
||||
)
|
||||
);
|
||||
} elseif ($serialized && !is_metaconsole() && $force_serialized) {
|
||||
$agent_info = explode($serialized_separator, $k);
|
||||
$agent_disabled = db_get_value_filter(
|
||||
'disabled',
|
||||
'tagente',
|
||||
array('id_agente' => $agent_info[1])
|
||||
);
|
||||
} elseif (!$serialized && is_metaconsole()) {
|
||||
// Cannot retrieve the disabled status. Mark all as not disabled
|
||||
$agent_disabled = 0;
|
||||
} else {
|
||||
$agent_disabled = db_get_value_filter(
|
||||
'disabled',
|
||||
'tagente',
|
||||
array('id_agente' => $k)
|
||||
);
|
||||
}
|
||||
$agents_disabled[$keys_prefix . $k] = $agent_disabled;
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +189,7 @@ if (is_ajax ()) {
|
|||
|
||||
$agents = $all_agents_array;
|
||||
}
|
||||
|
||||
|
||||
echo json_encode ($agents);
|
||||
return;
|
||||
}
|
||||
|
@ -169,36 +205,68 @@ if (is_ajax ()) {
|
|||
echo json_encode($return);
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (! check_acl($config['id_user'], 0, "AW")) {
|
||||
if (! check_acl($config['id_user'], 0, "PM")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Group Management");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
$sec = defined('METACONSOLE') ? 'advanced' : 'gagente';
|
||||
$url_tree = "index.php?sec=$sec&sec2=godmode/groups/group_list&tab=tree";
|
||||
$url_groups = "index.php?sec=$sec&sec2=godmode/groups/group_list&tab=groups";
|
||||
$buttons['tree'] = array(
|
||||
'active' => false,
|
||||
'text' => "<a href='$url_tree'>" .
|
||||
html_print_image(
|
||||
"images/gm_massive_operations.png",
|
||||
true,
|
||||
array (
|
||||
"title" => __('Tree Group view')
|
||||
)
|
||||
) . "</a>"
|
||||
);
|
||||
|
||||
$buttons['groups'] = array(
|
||||
'active' => false,
|
||||
'text' => "<a href='$url_groups'>" .
|
||||
html_print_image(
|
||||
"images/group.png",
|
||||
true,
|
||||
array(
|
||||
"title" => __('Group view')
|
||||
)
|
||||
) . "</a>"
|
||||
);
|
||||
|
||||
$tab = (string)get_parameter('tab', 'groups');
|
||||
|
||||
// Marks correct tab
|
||||
switch ($tab) {
|
||||
case 'tree':
|
||||
$buttons['tree']['active'] = true;
|
||||
break;
|
||||
case 'groups':
|
||||
default:
|
||||
$buttons['groups']['active'] = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// Header
|
||||
if (defined('METACONSOLE')) {
|
||||
|
||||
agents_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
|
||||
echo '<div class="notify">';
|
||||
echo __("Edit or delete groups can cause problems with synchronization");
|
||||
echo '</div>';
|
||||
|
||||
} else {
|
||||
ui_print_page_header (
|
||||
__("Groups defined in %s", get_product_name()),
|
||||
"images/group.png", false, "", true, $buttons
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
||||
ui_print_page_header (__("Groups defined in %s", get_product_name()),
|
||||
"images/group.png", false, "", true, "");
|
||||
$sec = 'gagente';
|
||||
|
||||
}
|
||||
|
||||
|
||||
$create_group = (bool) get_parameter ('create_group');
|
||||
$update_group = (bool) get_parameter ('update_group');
|
||||
|
@ -219,7 +287,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, "PM"))) {
|
|||
$other = (string) get_parameter ('other');
|
||||
$check = db_get_value('nombre', 'tgrupo', 'nombre', $name);
|
||||
$propagate = (bool) get_parameter('propagate');
|
||||
|
||||
|
||||
/*Check if name field is empty*/
|
||||
if ($name != "") {
|
||||
if (!$check) {
|
||||
|
@ -236,7 +304,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, "PM"))) {
|
|||
'other' => $other,
|
||||
'password' => io_safe_input($group_pass)
|
||||
);
|
||||
|
||||
|
||||
$result = db_process_sql_insert('tgrupo', $values);
|
||||
if ($result) {
|
||||
ui_print_success_message(__('Group successfully created'));
|
||||
|
@ -270,7 +338,7 @@ if ($update_group) {
|
|||
$description = (string) get_parameter ('description');
|
||||
$contact = (string) get_parameter ('contact');
|
||||
$other = (string) get_parameter ('other');
|
||||
|
||||
|
||||
/*Check if name field is empty*/
|
||||
if ( $name != "") {
|
||||
switch ($config["dbtype"]) {
|
||||
|
@ -293,7 +361,7 @@ if ($update_group) {
|
|||
else {
|
||||
$result = false;
|
||||
}
|
||||
|
||||
|
||||
if ($result !== false) {
|
||||
ui_print_success_message(__('Group successfully updated'));
|
||||
}
|
||||
|
@ -305,19 +373,19 @@ if ($update_group) {
|
|||
/* Delete group */
|
||||
if (($delete_group) && (check_acl($config['id_user'], 0, "PM"))) {
|
||||
$id_group = (int) get_parameter ('id_group');
|
||||
|
||||
|
||||
$usedGroup = groups_check_used($id_group);
|
||||
|
||||
|
||||
if (!$usedGroup['return']) {
|
||||
$group = db_get_row_filter('tgrupo',
|
||||
array('id_grupo' => $id_group));
|
||||
|
||||
|
||||
db_process_sql_update('tgrupo',
|
||||
array('parent' => $group['parent']), array('parent' => $id_group));
|
||||
|
||||
|
||||
$result = db_process_sql_delete('tgroup_stat',
|
||||
array('id_group' => $id_group));
|
||||
|
||||
|
||||
$result = db_process_sql_delete('tgrupo',
|
||||
array('id_grupo' => $id_group));
|
||||
}
|
||||
|
@ -325,136 +393,272 @@ if (($delete_group) && (check_acl($config['id_user'], 0, "PM"))) {
|
|||
ui_print_error_message(
|
||||
sprintf(__('The group is not empty. It is use in %s.'), implode(', ', $usedGroup['tables'])));
|
||||
}
|
||||
|
||||
|
||||
if ($result && (!$usedGroup['return'])) {
|
||||
ui_print_success_message(__('Group successfully deleted'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui_print_error_message(__('There was a problem deleting group'));
|
||||
}
|
||||
}
|
||||
db_clean_cache();
|
||||
|
||||
if ($create_group || $delete_group || $update_group) {
|
||||
$groups = users_get_groups ($config['id_user'], "AR", true, true, null, 'id_grupo', false);
|
||||
$groups = groups_get_groups_tree_recursive($groups);
|
||||
} else {
|
||||
$groups = users_get_groups_tree ($config['id_user'], "AR", true);
|
||||
if($tab == 'tree'){
|
||||
echo html_print_image('images/spinner.gif', true,
|
||||
array('class' => "loading_tree",
|
||||
'style' => 'display: none;'));
|
||||
echo "<div id='tree-controller-recipient'></div>";
|
||||
|
||||
}
|
||||
|
||||
$table = new StdClass();
|
||||
$table->width = '100%';
|
||||
|
||||
$all_parents = array();
|
||||
$groups_count = 0;
|
||||
$sons = array();
|
||||
|
||||
$groups_count = count($groups);
|
||||
|
||||
foreach ($groups as $k => $g) {
|
||||
if ($g['parent'] != 0) {
|
||||
$all_parents[$g['parent']] = $g['parent'];
|
||||
}
|
||||
}
|
||||
krsort($all_parents);
|
||||
foreach ($all_parents as $parent) {
|
||||
foreach ($groups as $k => $g) {
|
||||
if ($g['parent'] == $parent) {
|
||||
$sons[$g['parent']][] = $g;
|
||||
unset($groups[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($groups)) {
|
||||
$table->class = "databox data";
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('ID');
|
||||
$table->head[2] = __('Icon');
|
||||
$table->head[3] = __('Alerts');
|
||||
$table->head[4] = __('Description');
|
||||
$table->head[5] = __('Actions');
|
||||
$table->align = array ();
|
||||
$table->align[2] = 'left';
|
||||
$table->align[5] = 'left';
|
||||
$table->size[4] = '30%';
|
||||
$table->size[5] = '10%';
|
||||
$table->data = array ();
|
||||
|
||||
else{
|
||||
$acl='';
|
||||
$search_name = '';
|
||||
$offset = (int)get_parameter('offset', 0);
|
||||
$limit = $offset + $config['block_size'];
|
||||
|
||||
|
||||
|
||||
$pagination = ui_pagination($groups_count,
|
||||
false, 0, $config['block_size'], true, 'offset', false);
|
||||
|
||||
$n = -1;
|
||||
$iterator = 0;
|
||||
$branch_classes = array();
|
||||
foreach ($groups as $group) {
|
||||
$n++;
|
||||
|
||||
// Only print the page range
|
||||
if ($n < $offset || $n >= $limit) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$symbolBranchs = ' symbol_branch_' . $group['parent'];
|
||||
|
||||
$has_children = isset($sons[$group['id_grupo']]);
|
||||
$data = groups_get_group_to_list($group, $groups_count, $symbolBranchs, $has_children);
|
||||
array_push ($table->data, $data);
|
||||
$table->rowstyle[$iterator] = '';
|
||||
if ($group['id_grupo'] != 0) {
|
||||
$branch_classes[$group['id_grupo']] = ' branch_0';
|
||||
$table->rowclass[$iterator] = 'parent_' . $group['parent'] . ' branch_0';
|
||||
}
|
||||
$iterator++;
|
||||
|
||||
groups_print_group_sons($group, $sons, $branch_classes,
|
||||
$groups_count, $table, $iterator, $symbolBranchs);
|
||||
$search = (string)get_parameter('search', '');
|
||||
$block_size = $config['block_size'];
|
||||
|
||||
if(!empty($search)){
|
||||
$search_name = "AND t.nombre LIKE '%$search%'";
|
||||
}
|
||||
|
||||
if (!users_can_manage_group_all("AR")){
|
||||
$user_groups_acl = users_get_groups(false, "AR");
|
||||
$groups_acl = implode(",", $user_groups_ACL);
|
||||
if(empty($groups_acl)) return ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined groups') ) );
|
||||
|
||||
$acl = "AND t.id_grupo IN ($groups_acl)";
|
||||
}
|
||||
|
||||
$form = "<form method='post' action=''>";
|
||||
$form .= "<table class='databox filters' width='100%' style='font-weight: bold;'>";
|
||||
$form .= "<tr><td>" . __('Search') . ' ';
|
||||
$form .= html_print_input_text ("search", $search, '', 100, 100, true);
|
||||
$form .= "</td><td>";
|
||||
$form .= "<input name='find' type='submit' class='sub search' value='".__('Search')."'>";
|
||||
$form .= "<td></tr>";
|
||||
$form .= "</table>";
|
||||
$form .= "</form>";
|
||||
|
||||
echo $form;
|
||||
|
||||
$groups_sql =
|
||||
"SELECT t.*,
|
||||
p.nombre AS parent_name,
|
||||
IF(t.parent=p.id_grupo, 1, 0) AS has_child
|
||||
FROM tgrupo t
|
||||
LEFT JOIN tgrupo p
|
||||
ON t.parent=p.id_grupo
|
||||
WHERE 1=1
|
||||
$acl
|
||||
$search_name
|
||||
ORDER BY nombre
|
||||
LIMIT $offset, $block_size
|
||||
";
|
||||
|
||||
$groups = db_get_all_rows_sql($groups_sql);
|
||||
|
||||
if (!empty($groups)) {
|
||||
//Count all groups for pagination only saw user and filters
|
||||
$groups_sql_count = "SELECT count(*)
|
||||
FROM tgrupo t
|
||||
WHERE 1=1
|
||||
$acl
|
||||
$search_name
|
||||
";
|
||||
$groups_count = db_get_value_sql($groups_sql_count);
|
||||
|
||||
$table = new StdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = "databox data";
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('ID');
|
||||
$table->head[1] = __('Name');
|
||||
$table->head[2] = __('Icon');
|
||||
$table->head[3] = __('Alerts');
|
||||
$table->head[4] = __('Parent');
|
||||
$table->head[5] = __('Description');
|
||||
$table->head[6] = __('Actions');
|
||||
$table->align = array ();
|
||||
$table->align[0] = 'left';
|
||||
$table->align[2] = 'left';
|
||||
$table->align[6] = 'left';
|
||||
$table->size[0] = '3%';
|
||||
$table->size[5] = '30%';
|
||||
$table->size[6] = '5%';
|
||||
$table->data = array ();
|
||||
|
||||
foreach ($groups as $key => $group) {
|
||||
$url = "index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group=".$group['id_grupo'];
|
||||
$url_delete = "index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group=" . $group['id_grupo'];
|
||||
$table->data[$key][0] = $group['id_grupo'];
|
||||
$table->data[$key][1] = "<a href='$url'>" . $group['nombre'] . "</a>";
|
||||
$table->data[$key][2] = html_print_image(
|
||||
"images/groups_small/" . $group['icon'] . ".png",
|
||||
true,
|
||||
array(
|
||||
"style" => '',
|
||||
"class" => "bot",
|
||||
"alt" => $group['nombre'],
|
||||
"title" => $group['nombre'],
|
||||
false, false, false, true
|
||||
)
|
||||
);
|
||||
|
||||
//reporting_get_group_stats
|
||||
$table->data[$key][3] = $group['disabled'] ? __('Disabled') : __('Enabled');
|
||||
$table->data[$key][4] = $group['parent_name'];
|
||||
$table->data[$key][5] = $group['description'];
|
||||
$table->data[$key][6] = "<a href='$url'>" .
|
||||
html_print_image(
|
||||
"images/config.png",
|
||||
true,
|
||||
array(
|
||||
"alt" => __('Edit'),
|
||||
"title" => __('Edit'),
|
||||
"border" => '0'
|
||||
)
|
||||
) .
|
||||
"</a>";
|
||||
|
||||
$confirm_message = __('Are you sure?');
|
||||
if ($group['has_child']) {
|
||||
$confirm_message = __('The child groups will be updated to use the parent id of the deleted group') . ". " . $confirm_message;
|
||||
}
|
||||
|
||||
$table->data[$key][6] .= ' ' .
|
||||
'<a href="'. $url_delete. '" onClick="if (!confirm(\' '.$confirm_message.'\')) return false;">' .
|
||||
html_print_image(
|
||||
"images/cross.png",
|
||||
true,
|
||||
array(
|
||||
"alt" => __('Delete'),
|
||||
"title" => __('Delete'),
|
||||
"border" => '0'
|
||||
)
|
||||
) .
|
||||
"</a>";
|
||||
|
||||
}
|
||||
|
||||
echo ui_pagination(
|
||||
$groups_count, false,
|
||||
$offset, $block_size,
|
||||
true, 'offset', false
|
||||
);
|
||||
html_print_table ($table);
|
||||
echo ui_pagination(
|
||||
$groups_count, false,
|
||||
$offset, $block_size,
|
||||
true, 'offset', true
|
||||
);
|
||||
}
|
||||
else {
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined groups') ) );
|
||||
}
|
||||
|
||||
echo $pagination;
|
||||
|
||||
html_print_table ($table);
|
||||
|
||||
echo $pagination;
|
||||
}
|
||||
else {
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined groups') ) );
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, "PM")) {
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/configure_group&pure='.$pure.'">';
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_submit_button (__('Create group'), 'crt', false, 'class="sub next"');
|
||||
echo '</div>';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/configure_group">';
|
||||
echo '<div class="action-buttons" style="width:100%;">';
|
||||
html_print_submit_button (__('Create group'), 'crt', false, 'class="sub next"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
ui_require_javascript_file("TreeController", "include/javascript/tree/");
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
$tab = "group_edition";
|
||||
|
||||
?>
|
||||
|
||||
<?php if (!is_metaconsole()){ ?>
|
||||
<script type="text/javascript" src="include/javascript/fixed-bottom-box.js"></script>
|
||||
<?php }else{ ?>
|
||||
<script type="text/javascript" src="../../include/javascript/fixed-bottom-box.js"></script>
|
||||
<?php } ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
function showBranch(parent) {
|
||||
display = $('.parent_' + parent).css('display');
|
||||
|
||||
if (display != 'none') {
|
||||
$('.symbol_' + parent).html('+');
|
||||
$('.parent_' + parent).css('display', 'none');
|
||||
|
||||
//Close the child branch too
|
||||
$('.branch_' + parent).css('display', 'none');
|
||||
$('.symbol_branch_' + parent).html('+');
|
||||
}
|
||||
else {
|
||||
$('.symbol_' + parent).html('-');
|
||||
$('.parent_' + parent).css('display', '');
|
||||
}
|
||||
}
|
||||
var treeController = TreeController.getController();
|
||||
|
||||
if (typeof treeController.recipient != 'undefined' && treeController.recipient.length > 0)
|
||||
treeController.recipient.empty();
|
||||
|
||||
$(".loading_tree").show();
|
||||
|
||||
var parameters = {};
|
||||
parameters['page'] = "include/ajax/tree.ajax";
|
||||
parameters['getChildren'] = 1;
|
||||
parameters['type'] = "<?php echo $tab; ?>";
|
||||
parameters['filter'] = {};
|
||||
parameters['filter']['searchGroup'] = '';
|
||||
parameters['filter']['searchAgent'] = '';
|
||||
parameters['filter']['statusAgent'] = '';
|
||||
parameters['filter']['searchModule'] = '';
|
||||
parameters['filter']['statusModule'] = '';
|
||||
parameters['filter']['groupID'] = '';
|
||||
parameters['filter']['tagID'] = '';
|
||||
parameters['filter']['searchHirearchy'] = 1;
|
||||
parameters['filter']['show_not_init_agents'] = 1;
|
||||
parameters['filter']['show_not_init_modules'] = 1;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
data: parameters,
|
||||
success: function(data) {
|
||||
if (data.success) {
|
||||
$(".loading_tree").hide();
|
||||
|
||||
treeController.init({
|
||||
recipient: $("div#tree-controller-recipient"),
|
||||
//detailRecipient: $.fixedBottomBox({ width: 400, height: window.innerHeight * 0.9 }),
|
||||
page: parameters['page'],
|
||||
emptyMessage: "<?php echo __('No data found'); ?>",
|
||||
foundMessage: "<?php echo __('Found groups'); ?>",
|
||||
tree: data.tree,
|
||||
baseURL: "<?php echo ui_get_full_url(false, false, false, is_metaconsole()); ?>",
|
||||
ajaxURL: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
filter: parameters['filter'],
|
||||
counterTitles: {
|
||||
total: {
|
||||
agents: "<?php echo __('Total agents'); ?>",
|
||||
modules: "<?php echo __('Total modules'); ?>",
|
||||
none: "<?php echo __('Total'); ?>"
|
||||
},
|
||||
alerts: {
|
||||
agents: "<?php echo __('Fired alerts'); ?>",
|
||||
modules: "<?php echo __('Fired alerts'); ?>",
|
||||
none: "<?php echo __('Fired alerts'); ?>"
|
||||
},
|
||||
critical: {
|
||||
agents: "<?php echo __('Critical agents'); ?>",
|
||||
modules: "<?php echo __('Critical modules'); ?>",
|
||||
none: "<?php echo __('Critical'); ?>"
|
||||
},
|
||||
warning: {
|
||||
agents: "<?php echo __('Warning agents'); ?>",
|
||||
modules: "<?php echo __('Warning modules'); ?>",
|
||||
none: "<?php echo __('Warning'); ?>"
|
||||
},
|
||||
unknown: {
|
||||
agents: "<?php echo __('Unknown agents'); ?>",
|
||||
modules: "<?php echo __('Unknown modules'); ?>",
|
||||
none: "<?php echo __('Unknown'); ?>"
|
||||
},
|
||||
not_init: {
|
||||
agents: "<?php echo __('Not init agents'); ?>",
|
||||
modules: "<?php echo __('Not init modules'); ?>",
|
||||
none: "<?php echo __('Not init'); ?>"
|
||||
},
|
||||
ok: {
|
||||
agents: "<?php echo __('Normal agents'); ?>",
|
||||
modules: "<?php echo __('Normal modules'); ?>",
|
||||
none: "<?php echo __('Normal'); ?>"
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
dataType: "json"
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -52,6 +52,8 @@ function process_manage_delete ($module_name, $id_agents, $module_status = 'all'
|
|||
|
||||
global $config;
|
||||
|
||||
$status_module = (int) get_parameter ('status_module');
|
||||
|
||||
if (empty ($module_name)) {
|
||||
ui_print_error_message(__('No module selected'));
|
||||
return false;
|
||||
|
@ -212,8 +214,10 @@ function process_manage_delete ($module_name, $id_agents, $module_status = 'all'
|
|||
}
|
||||
}
|
||||
else {
|
||||
$modules = agents_get_modules ($id_agents, 'id_agente_modulo',
|
||||
sprintf('nombre IN ("%s")', implode('","',$module_name)), true);
|
||||
if ($status_module != -1) // If module status filter has been applied
|
||||
$modules = agents_get_modules ($id_agents, 'id_agente_modulo', sprintf('nombre IN ("%s") AND id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_estado where estado = %s OR utimestamp=0 )', implode('","',$module_name), $status_module), true);
|
||||
else
|
||||
$modules = agents_get_modules ($id_agents, 'id_agente_modulo', sprintf('nombre IN ("%s")', implode('","',$module_name)), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ require_once ('include/functions_modules.php');
|
|||
require_once ('include/functions_servers.php');
|
||||
require_once ('include/functions_gis.php');
|
||||
require_once ('include/functions_users.php');
|
||||
enterprise_include_once('include/functions_config_agents.php');
|
||||
|
||||
if (is_ajax ()) {
|
||||
$get_n_conf_files = (bool) get_parameter ('get_n_conf_files');
|
||||
|
@ -136,8 +137,11 @@ if ($update_agents) {
|
|||
foreach ($id_agents as $id_agent) {
|
||||
if (!empty($values)) {
|
||||
$group_old = false;
|
||||
if($values['id_grupo']){
|
||||
$group_old = db_get_sql("SELECT id_grupo FROM tagente WHERE id_agente =" .$id_agent);
|
||||
$disabled_old = false;
|
||||
if($values['id_grupo'] || isset($values['disabled'])){
|
||||
$values_old = db_get_row_filter('tagente', array('id_agente' => $id_agent), array('id_grupo', 'disabled'));
|
||||
if ($values_old['id_grupo']) $group_old = $values_old['id_grupo'];
|
||||
if (isset($values['disabled'])) $disabled_old = $values_old['disabled'];
|
||||
}
|
||||
|
||||
$result = db_process_sql_update ('tagente',
|
||||
|
@ -149,7 +153,14 @@ if ($update_agents) {
|
|||
// Force an update of the agent cache.
|
||||
$result_metaconsole = agent_update_from_cache($id_agent,$values,$server_name);
|
||||
}
|
||||
|
||||
|
||||
if ($disabled_old !== false && $disabled_old != $values['disabled']) {
|
||||
enterprise_hook(
|
||||
'config_agents_update_config_token',
|
||||
array($id_agent, 'standby', $values['disabled'])
|
||||
);
|
||||
}
|
||||
|
||||
if($group_old || $result){
|
||||
if ($group_old && $group_old != null) {
|
||||
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
|
||||
|
@ -421,7 +432,9 @@ $table->data[1][1] .= __('Autodisable mode').' '.html_print_radio_button_extende
|
|||
// Status (Disabled / Enabled)
|
||||
$table->data[2][0] = __('Status');
|
||||
$table->data[2][1] = __('No change').' '.html_print_radio_button_extended ("disabled", -1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[2][1] .= __('Disabled').' '.html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[2][1] .= __('Disabled') . ' ' .
|
||||
ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true) . ' ' .
|
||||
html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[2][1] .= __('Active').' '.html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
|
||||
// Remote configuration
|
||||
|
|
|
@ -47,17 +47,21 @@ $update = (bool) get_parameter_post ('update');
|
|||
if ($update) {
|
||||
$agents_ = '';
|
||||
if ($selection_mode == 'modules') {
|
||||
|
||||
$agents_ = array();
|
||||
|
||||
$force = get_parameter('force_type', false);
|
||||
|
||||
if ($agents_select == false) {
|
||||
$agents_select = array();
|
||||
$agents_ = array();
|
||||
}
|
||||
|
||||
foreach ($agents_select as $agent_name) {
|
||||
$agents_[] = agents_get_agent_id($agent_name);
|
||||
}
|
||||
|
||||
$modules_ = $module_name;
|
||||
|
||||
}
|
||||
else if ($selection_mode == 'agents') {
|
||||
$force = get_parameter('force_group', false);
|
||||
|
@ -75,6 +79,7 @@ if ($update) {
|
|||
// If the option to select all of one group or module type is checked
|
||||
if ($force) {
|
||||
if ($force == 'type') {
|
||||
|
||||
$type_condition = '';
|
||||
if ($module_type != 0)
|
||||
$type_condition = "AND tam.id_tipo_modulo = $module_type";
|
||||
|
@ -141,12 +146,11 @@ if ($update) {
|
|||
else {
|
||||
// Standard procedure
|
||||
foreach ($agents_ as $agent_) {
|
||||
|
||||
|
||||
if ($modules_ == false)
|
||||
$modules_ = array();
|
||||
|
||||
foreach ($modules_ as $module_) {
|
||||
|
||||
$result = process_manage_edit ($module_, $agent_, $modules_selection_mode);
|
||||
$count++;
|
||||
$success += (int)$result;
|
||||
|
@ -331,6 +335,7 @@ $table->data['form_modules_2'][2] .= html_print_select (
|
|||
'all' => __('Show all agents')),
|
||||
'agents_selection_mode',
|
||||
'common', false, '', '', true);
|
||||
|
||||
$table->data['form_modules_2'][3] = html_print_select (array(), 'agents[]',
|
||||
$agents_select, false, __('None'), 0, true, true, false);
|
||||
|
||||
|
@ -650,25 +655,25 @@ $table->data['edit16'][1] = html_print_input_text ('max_retries', '', '', 5, 10,
|
|||
__('Number of retries that the module will attempt to run.'), true);
|
||||
|
||||
$table->data['edit22'][0] = __('Web checks').ui_print_help_icon ("web_checks", true);;
|
||||
$table->data['edit22'][1] = '<textarea id="textarea_plugin_parameter" name="plugin_parameter" cols="65" rows="15"></textarea>';
|
||||
$table->data['edit22'][1] = '<textarea id="textarea_plugin_parameter" name="plugin_parameter_text" cols="65" rows="15"></textarea>';
|
||||
|
||||
$table->data['edit16'][2] = __('Port');
|
||||
$table->data['edit16'][3] = html_print_input_text ('tcp_port', '', '', 5, 20, true);
|
||||
|
||||
$table->data['edit17'][0] = __('TCP send') . ' ' . ui_print_help_icon ("tcp_send", true);
|
||||
$table->data['edit17'][1] = html_print_textarea ('tcp_send', 2, 65, '', '', true);
|
||||
$table->data['edit17'][1] = html_print_textarea ('tcp_send2', 2, 65, '', '', true);
|
||||
|
||||
$table->data['edit17'][2] = __('TCP receive');
|
||||
$table->data['edit17'][3] = html_print_textarea ('tcp_rcv', 2, 65, '', '', true);
|
||||
|
||||
$table->data['edit18'][0] = __('WMI query') . ui_print_help_icon ('wmiquery', true);
|
||||
$table->data['edit18'][1] = html_print_input_text ('snmp_oid', '', '', 35, 255, true);
|
||||
$table->data['edit18'][1] = html_print_input_text ('wmi_query', '', '', 35, 255, true);
|
||||
|
||||
$table->data['edit18'][2] = __('Key string');
|
||||
$table->data['edit18'][3] = html_print_input_text ('snmp_community', '', '', 20, 60, true);
|
||||
$table->data['edit18'][3] = html_print_input_text ('key_string', '', '', 20, 60, true);
|
||||
|
||||
$table->data['edit19'][0] = __('Field number') . ui_print_help_icon ('wmifield', true);
|
||||
$table->data['edit19'][1] = html_print_input_text ('tcp_port', '', '', 5, 15, true);
|
||||
$table->data['edit19'][1] = html_print_input_text ('field_number', '', '', 5, 15, true);
|
||||
|
||||
$table->data['edit20'][0] = __('Plugin') . ui_print_help_icon ('plugin_macros', true);
|
||||
$table->data['edit20'][1] = html_print_select_from_sql ('SELECT id, name FROM tplugin ORDER BY name',
|
||||
|
@ -1381,7 +1386,8 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
|
|||
'id_category', 'disabled_types_event', 'ip_target', "custom_ip_target",
|
||||
'descripcion', 'min_ff_event_normal', 'min_ff_event_warning',
|
||||
'min_ff_event_critical', 'each_ff', 'module_ff_interval',
|
||||
'ff_timeout', 'max_timeout','tcp_port','max_retries','tcp_rcv','id_plugin');
|
||||
'ff_timeout', 'max_timeout','tcp_port','max_retries','tcp_rcv','id_plugin',
|
||||
'wmi_query','key_string','field_number','tcp_send2','plugin_parameter_text');
|
||||
$values = array ();
|
||||
|
||||
foreach ($fields as $field) {
|
||||
|
@ -1391,61 +1397,55 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
|
|||
case 'id_plugin':
|
||||
if ($value != 0) {
|
||||
|
||||
$value_field_1 = get_parameter ('_field1_', '');
|
||||
$value_field_1_desc = get_parameter ('desc_field1_', '');
|
||||
|
||||
$value_field_2 = get_parameter ('_field2_', '');
|
||||
$value_field_2_desc = get_parameter ('desc_field2_', '');
|
||||
|
||||
$value_field_3 = get_parameter ('_field3_', '');
|
||||
$value_field_3_desc = get_parameter ('desc_field3_', '');
|
||||
|
||||
$value_field_4 = get_parameter ('_field4_', '');
|
||||
$value_field_4_desc = get_parameter ('desc_field4_', '');
|
||||
|
||||
$value_field_5 = get_parameter ('_field5_', '');
|
||||
$value_field_5_desc = get_parameter ('desc_field5_', '');
|
||||
|
||||
$values['macros'] = '{"1":{"macro":"_field1_","desc":"'.io_safe_input($value_field_1_desc).'","help":"'.io_safe_input($value_field_1_desc).'","value":"'.$value_field_1.'"}';
|
||||
|
||||
if($value_field_2_desc != ''){
|
||||
$values['macros'] .= ',"2":{"macro":"_field2_","desc":"'.io_safe_input($value_field_2_desc).'","help":"'.io_safe_input($value_field_2_desc).'","value":"'.$value_field_2.'"}';
|
||||
|
||||
if($value_field_3_desc != ''){
|
||||
$values['macros'] .= ',"3":{"macro":"_field3_","desc":"'.io_safe_input($value_field_3_desc).'","help":"'.io_safe_input($value_field_3_desc).'","value":"'.$value_field_3.'"}';
|
||||
$value_field_1 = get_parameter ('_field1_', '');
|
||||
$value_field_1_desc = get_parameter ('desc_field1_', '');
|
||||
|
||||
if($value_field_4_desc != ''){
|
||||
$values['macros'] .= ',"4":{"macro":"_field4_","desc":"'.io_safe_input($value_field_4_desc).'","help":"'.io_safe_input($value_field_4_desc).'","value":"'.$value_field_4.'"}';
|
||||
|
||||
if($value_field_5_desc != ''){
|
||||
$values['macros'] .= ',"5":{"macro":"_field5_","desc":"'.io_safe_input($value_field_5_desc).'","help":"'.io_safe_input($value_field_5_desc).'","value":"'.$value_field_5.'"}';
|
||||
}
|
||||
else{
|
||||
$values['macros'] .= '}';
|
||||
}
|
||||
|
||||
$value_field_2 = get_parameter ('_field2_', '');
|
||||
$value_field_2_desc = get_parameter ('desc_field2_', '');
|
||||
|
||||
$value_field_3 = get_parameter ('_field3_', '');
|
||||
$value_field_3_desc = get_parameter ('desc_field3_', '');
|
||||
|
||||
$value_field_4 = get_parameter ('_field4_', '');
|
||||
$value_field_4_desc = get_parameter ('desc_field4_', '');
|
||||
|
||||
$value_field_5 = get_parameter ('_field5_', '');
|
||||
$value_field_5_desc = get_parameter ('desc_field5_', '');
|
||||
|
||||
$values['macros'] = '{"1":{"macro":"_field1_","desc":"'.io_safe_input($value_field_1_desc).'","help":"'.io_safe_input($value_field_1_desc).'","value":"'.$value_field_1.'"}';
|
||||
|
||||
if($value_field_2_desc != ''){
|
||||
$values['macros'] .= ',"2":{"macro":"_field2_","desc":"'.io_safe_input($value_field_2_desc).'","help":"'.io_safe_input($value_field_2_desc).'","value":"'.$value_field_2.'"}';
|
||||
|
||||
if($value_field_3_desc != ''){
|
||||
$values['macros'] .= ',"3":{"macro":"_field3_","desc":"'.io_safe_input($value_field_3_desc).'","help":"'.io_safe_input($value_field_3_desc).'","value":"'.$value_field_3.'"}';
|
||||
|
||||
if($value_field_4_desc != ''){
|
||||
$values['macros'] .= ',"4":{"macro":"_field4_","desc":"'.io_safe_input($value_field_4_desc).'","help":"'.io_safe_input($value_field_4_desc).'","value":"'.$value_field_4.'"}';
|
||||
|
||||
if($value_field_5_desc != ''){
|
||||
$values['macros'] .= ',"5":{"macro":"_field5_","desc":"'.io_safe_input($value_field_5_desc).'","help":"'.io_safe_input($value_field_5_desc).'","value":"'.$value_field_5.'"}';
|
||||
}
|
||||
else{
|
||||
$values['macros'] .= '}';
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
$values['macros'] .= '}';
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
$values['macros'] .= '}';
|
||||
}
|
||||
}
|
||||
else{
|
||||
$values['macros'] .= '}';
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
$values['macros'] .= '}';
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
$values['macros'] .= '}';
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'module_interval':
|
||||
if ($value != 0) {
|
||||
$values[$field] = $value;
|
||||
|
@ -1470,6 +1470,32 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
|
|||
}
|
||||
}
|
||||
break;
|
||||
case 'wmi_query':
|
||||
if ($value != '') {
|
||||
$values['snmp_oid'] = $value;
|
||||
}
|
||||
break;
|
||||
case 'key_string':
|
||||
if ($value != '') {
|
||||
$values['snmp_community'] = $value;
|
||||
}
|
||||
break;
|
||||
case 'field_number':
|
||||
if ($value != '') {
|
||||
$values['tcp_port'] = $value;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'tcp_send2':
|
||||
if ($value != '') {
|
||||
$values['tcp_send'] = $value;
|
||||
}
|
||||
break;
|
||||
case 'plugin_parameter_text':
|
||||
if ($value != '') {
|
||||
$values['plugin_parameter'] = $value;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ($value != '') {
|
||||
$values[$field] = $value;
|
||||
|
@ -1477,7 +1503,7 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Specific snmp reused fields
|
||||
if (get_parameter ('tcp_send', '') == 3) {
|
||||
$plugin_user_snmp = get_parameter ('plugin_user_snmp', '');
|
||||
|
@ -1519,12 +1545,14 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
|
|||
$update_tags = get_parameter('id_tag', false);
|
||||
|
||||
if (array_search(0, $agents_select) !== false) {
|
||||
|
||||
//Apply at All agents.
|
||||
$modules = db_get_all_rows_filter ('tagente_modulo',
|
||||
$filter_modules,
|
||||
array ('id_agente_modulo'));
|
||||
}
|
||||
else {
|
||||
|
||||
if ($module_name == "0") {
|
||||
//Any module
|
||||
$modules = db_get_all_rows_filter ('tagente_modulo',
|
||||
|
@ -1538,7 +1566,8 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
|
|||
array ('id_agente_modulo'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($modules === false)
|
||||
return false;
|
||||
|
||||
|
@ -1554,16 +1583,16 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
|
|||
}
|
||||
$modules = $modules_to_delete;
|
||||
}
|
||||
|
||||
|
||||
foreach ($modules as $module) {
|
||||
|
||||
$result = modules_update_agent_module(
|
||||
$module['id_agente_modulo'], $values, true, $update_tags);
|
||||
|
||||
if (is_error($result)) {
|
||||
|
||||
|
||||
if (is_error($result))
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -101,12 +101,12 @@ if (check_acl ($config['id_user'], 0, "PM")) {
|
|||
$sub["godmode/modules/manage_network_templates"]["text"] = __('Module templates');
|
||||
$sub["godmode/modules/manage_network_templates"]["id"] = 'Module templates';
|
||||
enterprise_hook ('inventory_submenu');
|
||||
enterprise_hook ('autoconfiguration_menu');
|
||||
}
|
||||
if (check_acl ($config['id_user'], 0, "AW")) {
|
||||
enterprise_hook ('policies_menu');
|
||||
enterprise_hook('agents_submenu');
|
||||
}
|
||||
|
||||
if (check_acl ($config['id_user'], 0, "AW")) {
|
||||
$sub["gmassive"]["text"] = __('Bulk operations');
|
||||
$sub["gmassive"]["id"] = 'Bulk operations';
|
||||
|
@ -328,8 +328,6 @@ if (is_array ($config['extensions'])) {
|
|||
$sub2 = array ();
|
||||
|
||||
foreach ($config['extensions'] as $extension) {
|
||||
// html_debug($extension);
|
||||
|
||||
//If no godmode_menu is a operation extension
|
||||
if ($extension['godmode_menu'] == '') {
|
||||
continue;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// GNU General Public License for more details.
|
||||
|
||||
global $config;
|
||||
include_once($config['homedir'] . '/include/graphs/functions_d3.php');
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "PM")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
|
@ -22,7 +23,7 @@ if (! check_acl ($config['id_user'], 0, "PM")) {
|
|||
return;
|
||||
}
|
||||
|
||||
echo "<script type='text/javascript' src='include/javascript/d3.3.5.14.js'></script>" . "\n";
|
||||
include_javascript_d3();
|
||||
|
||||
function push_table_row ($row, $id = false) {
|
||||
global $table;
|
||||
|
@ -128,7 +129,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="800" height="300"> </svg>';
|
||||
$table->data[4][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
|
||||
$table->colspan[4][2] = 2;
|
||||
$table->rowspan[4][2] = 3;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ $data[0] = __('Auth user');
|
|||
$data[1] = html_print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
|
||||
$data[2] = __('Auth password');
|
||||
$data[3] = html_print_input_password ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
|
||||
$data[3] .= html_print_input_hidden('active_snmp_v3', 0, true);
|
||||
$data[3] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_mncfn', true);
|
||||
push_table_row($data, 'field_snmpv3_row1');
|
||||
|
||||
$data = array();
|
||||
|
|
|
@ -22,6 +22,9 @@ $vconsoles_read = check_acl ($config['id_user'], 0, "VR");
|
|||
$vconsoles_write = check_acl ($config['id_user'], 0, "VW");
|
||||
$vconsoles_manage = check_acl ($config['id_user'], 0, "VM");
|
||||
|
||||
$is_enterprise = enterprise_include_once('include/functions_policies.php');
|
||||
$is_metaconsole = is_metaconsole();
|
||||
|
||||
if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access map builder");
|
||||
|
@ -29,19 +32,64 @@ if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) {
|
|||
exit;
|
||||
}
|
||||
|
||||
if(!$is_metaconsole){
|
||||
$url_visual_console = 'index.php?sec=network&sec2=godmode/reporting/map_builder';
|
||||
$url_visual_console_favorite = 'index.php?sec=network&sec2=godmode/reporting/visual_console_favorite';
|
||||
$url_visual_console_template = 'index.php?sec=network&sec2=enterprise/godmode/reporting/visual_console_template';
|
||||
$url_visual_console_template_wizard = 'index.php?sec=network&sec2=enterprise/godmode/reporting/visual_console_template_wizard';
|
||||
}
|
||||
else{
|
||||
$url_visual_console = 'index.php?sec=screen&sec2=screens/screens&action=visualmap';
|
||||
$url_visual_console_favorite = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite';
|
||||
$url_visual_console_template = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_template';
|
||||
$url_visual_console_template_wizard = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_wizard';
|
||||
}
|
||||
|
||||
$pure = (int)get_parameter('pure', 0);
|
||||
$hack_metaconsole = '';
|
||||
if (defined('METACONSOLE'))
|
||||
$hack_metaconsole = '../../';
|
||||
|
||||
$buttons['visual_console_favorite'] = array('active' => false,
|
||||
'text' => '<a href="index.php?sec=network&sec2=godmode/reporting/visual_console_favorite">' .
|
||||
html_print_image ("images/list.png", true, array ("title" => __('Visual Favourite Console'))) .'</a>');
|
||||
$buttons['visual_console'] = array(
|
||||
'active' => true,
|
||||
'text' => '<a href="'.$url_visual_console.'">' .
|
||||
html_print_image ("images/visual_console.png", true, array ("title" => __('Visual Console List'))) .'</a>'
|
||||
);
|
||||
|
||||
if (!defined('METACONSOLE')) {
|
||||
$buttons['visual_console_favorite'] = array(
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$url_visual_console_favorite.'">' .
|
||||
html_print_image ("images/list.png", true, array ("title" => __('Visual Favourite Console'))) .'</a>'
|
||||
);
|
||||
|
||||
if($is_enterprise && $vconsoles_manage){
|
||||
$buttons['visual_console_template'] = array(
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$url_visual_console_template.'">' .
|
||||
html_print_image ("images/templates.png", true, array ("title" => __('Visual Console Template'))) .'</a>'
|
||||
);
|
||||
|
||||
$buttons['visual_console_template_wizard'] = array(
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$url_visual_console_template_wizard.'">' .
|
||||
html_print_image ("images/wand.png", true, array ("title" => __('Visual Console Template Wizard'))) .'</a>'
|
||||
);
|
||||
}
|
||||
|
||||
if (!$is_metaconsole) {
|
||||
ui_print_page_header(
|
||||
__('Reporting') .' » ' . __('Visual Console'),
|
||||
"images/op_reporting.png", false, "map_builder", false, $buttons);
|
||||
"images/op_reporting.png",
|
||||
false,
|
||||
"map_builder",
|
||||
false,
|
||||
$buttons
|
||||
);
|
||||
}
|
||||
else{
|
||||
ui_meta_print_header(
|
||||
__('Visual console') . " » " . $visualConsoleName, "",
|
||||
$buttons);
|
||||
}
|
||||
|
||||
$id_layout = (int) get_parameter ('id_layout');
|
||||
|
@ -62,7 +110,7 @@ if ($delete_layout || $copy_layout) {
|
|||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$group_id = db_get_value("id_group", "tlayout", "id", $id_layout);
|
||||
if ($group_id === false) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
|
|
|
@ -426,9 +426,12 @@ switch ($action) {
|
|||
$description = $item['description'];
|
||||
$period = $item['period'];
|
||||
$group = $item['id_group'];
|
||||
$recursion = $item['recursion'];
|
||||
break;
|
||||
case 'event_report_agent':
|
||||
case 'event_report_group':
|
||||
$recursion = $item['recursion'];
|
||||
break;
|
||||
case 'event_report_module':
|
||||
$description = $item['description'];
|
||||
$period = $item['period'];
|
||||
|
@ -477,12 +480,14 @@ switch ($action) {
|
|||
case 'group_report':
|
||||
$description = $item['description'];
|
||||
$group = $item['id_group'];
|
||||
$recursion = $item['recursion'];
|
||||
break;
|
||||
case 'network_interfaces_report':
|
||||
$description = $item['description'];
|
||||
$group = $item['id_group'];
|
||||
$period = $item['period'];
|
||||
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
|
||||
$recursion = $item['recursion'];
|
||||
break;
|
||||
case 'top_n':
|
||||
$description = $item['description'];
|
||||
|
@ -521,6 +526,7 @@ switch ($action) {
|
|||
$es = json_decode($item['external_source'], true);
|
||||
$id_agents = $es['id_agents'];
|
||||
$selection_a_m = get_parameter('selection');
|
||||
$recursion = $item['recursion'];
|
||||
|
||||
if ((count($es['module']) == 1) && ($es['module'][0] == 0)) {
|
||||
$module = "";
|
||||
|
@ -538,6 +544,7 @@ switch ($action) {
|
|||
$date = $es['date'];
|
||||
$inventory_modules = $es['inventory_modules'];
|
||||
$id_agents = $es['id_agents'];
|
||||
$recursion = $item['recursion'];
|
||||
|
||||
$idAgent = $es['id_agents'];
|
||||
$idAgentModule = $inventory_modules;
|
||||
|
@ -549,6 +556,7 @@ switch ($action) {
|
|||
$es = json_decode($item['external_source'], true);
|
||||
$inventory_modules = $es['inventory_modules'];
|
||||
$id_agents = $es['id_agents'];
|
||||
$recursion = $item['recursion'];
|
||||
break;
|
||||
|
||||
case 'agent_configuration':
|
||||
|
@ -557,6 +565,7 @@ switch ($action) {
|
|||
|
||||
case 'group_configuration':
|
||||
$group = $item['id_group'];
|
||||
$recursion = $item['recursion'];
|
||||
break;
|
||||
|
||||
case 'netflow_area':
|
||||
|
@ -609,6 +618,7 @@ switch ($action) {
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
$urlForm = $config['homeurl'] .
|
||||
'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=' . $actionParameter . '&id_report=' . $idReport;
|
||||
|
||||
|
@ -914,7 +924,7 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
html_print_select_groups($config['id_user'],
|
||||
"RM", true, 'combo_group', $group, '');
|
||||
|
||||
echo " ".__('Recursion').html_print_checkbox('recursion', 1, 0, true);
|
||||
echo " ".__('Recursion').html_print_checkbox('recursion', 1, $recursion, true);
|
||||
|
||||
?>
|
||||
</td>
|
||||
|
@ -1760,6 +1770,9 @@ function print_SLA_list($width, $action, $idItem = null) {
|
|||
$itemsSLA = db_get_all_rows_filter(
|
||||
'treport_content_sla_combined',
|
||||
array('id_report_content' => $idItem));
|
||||
|
||||
|
||||
|
||||
if ($itemsSLA === false) {
|
||||
$itemsSLA = array();
|
||||
}
|
||||
|
@ -1971,6 +1984,9 @@ function print_General_list($width, $action, $idItem = null, $type = 'general')
|
|||
$itemsGeneral = db_get_all_rows_filter(
|
||||
'treport_content_item',
|
||||
array('id_report_content' => $idItem));
|
||||
|
||||
|
||||
|
||||
if ($itemsGeneral === false) {
|
||||
$itemsGeneral = array();
|
||||
}
|
||||
|
|
|
@ -940,17 +940,22 @@ switch ($action) {
|
|||
$report = db_get_row_filter('treport',
|
||||
array('id_report' => $idReport));
|
||||
|
||||
|
||||
|
||||
|
||||
$reportName = $report['name'];
|
||||
$idGroupReport = $report['id_group'];
|
||||
$description = $report['description'];
|
||||
$good_format = false;
|
||||
switch ($action) {
|
||||
case 'update':
|
||||
|
||||
$values = array();
|
||||
$values['id_report'] = $idReport;
|
||||
$values['id_report'] = $idReport; //---------------------------------------------------
|
||||
//$values['name'] = (string) get_parameter('name');
|
||||
$values['description'] = get_parameter('description');
|
||||
$values['type'] = get_parameter('type', null);
|
||||
$values['recursion'] = get_parameter('recursion', null);
|
||||
$label = get_parameter('label', '');
|
||||
|
||||
//Add macros name
|
||||
|
@ -1290,6 +1295,7 @@ switch ($action) {
|
|||
}
|
||||
break;
|
||||
case 'save':
|
||||
|
||||
$values = array();
|
||||
$values['id_report'] = $idReport;
|
||||
$values['type'] = get_parameter('type', null);
|
||||
|
@ -1303,6 +1309,7 @@ switch ($action) {
|
|||
$items_label['id_agent'] = get_parameter('id_agent');
|
||||
$items_label['id_agent_module'] = get_parameter('id_agent_module');
|
||||
$name_it = (string) get_parameter('name');
|
||||
$values['recursion'] = get_parameter('recursion', null);
|
||||
$values['name'] = reporting_label_macro($items_label, $name_it);
|
||||
|
||||
// Support for projection graph, prediction date and SLA reports
|
||||
|
|
|
@ -829,8 +829,12 @@ function readFields() {
|
|||
values['bars_graph_type'] = $("select[name=bars_graph_type]").val();
|
||||
values['parent'] = $("select[name=parent]").val();
|
||||
values['map_linked'] = $("select[name=map_linked]").val();
|
||||
values['linked_map_node_id'] = $("input[name=linked_map_node_id]").val();
|
||||
values['linked_map_status_calculation_type'] = $("select[name=linked_map_status_calculation_type]").val();
|
||||
values['map_linked_weight'] = $("input[name=map_linked_weight]").val();
|
||||
values['linked_map_status_service_critical'] = $("input[name=linked_map_status_service_critical]").val();
|
||||
values['linked_map_status_service_warning'] = $("input[name=linked_map_status_service_warning]").val();
|
||||
values['element_group'] = $("select[name=element_group]").val();
|
||||
values['map_linked_weight'] = $("select[name=map_linked_weight]").val();
|
||||
values['width_percentile'] = $("input[name=width_percentile]").val();
|
||||
values['bars_graph_height'] = $("input[name=bars_graph_height]").val();
|
||||
values['max_percentile'] = parseInt($("input[name=max_percentile]").val());
|
||||
|
@ -1537,10 +1541,26 @@ function loadFieldsFromDB(item) {
|
|||
$("input[name=height]").val(val);
|
||||
if (key == 'parent_item')
|
||||
$("select[name=parent]").val(val);
|
||||
if (key == 'id_layout_linked')
|
||||
$("select[name=map_linked]").val(val);
|
||||
if (key == 'linked_layout_status_type')
|
||||
$("select[name=linked_map_status_calculation_type]").val(val).change();
|
||||
if (key == 'id_layout_linked') {
|
||||
if (data['linked_layout_node_id'] == null) {
|
||||
$("select[name=map_linked]").val(val).change();
|
||||
}
|
||||
else {
|
||||
var $option = $("select[name=map_linked] > option[data-node-id=" + data['linked_layout_node_id'] + "][value=" + val + "]");
|
||||
if ($option.length === 0) $option = $("select[name=map_linked] > option[value=" + val + "]");
|
||||
$option.prop("selected", true).parent().change();
|
||||
}
|
||||
}
|
||||
if (key == 'linked_layout_node_id')
|
||||
$("input[name=linked_map_node_id]").val(val);
|
||||
if (key == 'id_layout_linked_weight')
|
||||
$("select[name=map_linked_weight]").val(val);
|
||||
$("input[name=map_linked_weight]").val(val);
|
||||
if (key == 'linked_layout_status_as_service_critical')
|
||||
$("input[name=linked_map_status_service_critical]").val(val);
|
||||
if (key == 'linked_layout_status_as_service_warning')
|
||||
$("input[name=linked_map_status_service_warning]").val(val);
|
||||
if (key == 'element_group')
|
||||
$("select[name=element_group]").val(val);
|
||||
if (key == 'width_percentile')
|
||||
|
@ -1574,8 +1594,28 @@ function loadFieldsFromDB(item) {
|
|||
$("select[name=clock_animation]").val(val);
|
||||
if (key == 'time_format')
|
||||
$("select[name=time_format]").val(val);
|
||||
if (key == 'timezone')
|
||||
$("select[name=timezone]").val(val);
|
||||
if (key == 'timezone') {
|
||||
var zone = val.split("/");
|
||||
$("select[name=zone]").val(zone[0]);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: "page=godmode/setup/setup&select_timezone=1&zone=" + zone[0],
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
$("#timezone").empty();
|
||||
jQuery.each (data, function (id, value) {
|
||||
timezone = value;
|
||||
var timezone_country = timezone.replace (/^.*\//g, "");
|
||||
$("select[name='timezone']").append($("<option>").val(timezone).html(timezone_country));
|
||||
if (timezone == val) {
|
||||
$("select[name='timezone']").val(timezone);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (key == 'value_show') {
|
||||
$("select[name=value_show]").val(val);
|
||||
|
@ -1838,14 +1878,16 @@ function hiddenFields(item) {
|
|||
$("#parent_row." + item).css('display', '');
|
||||
|
||||
$("#map_linked_row").css('display', 'none');
|
||||
$("#linked_map_status_calculation_row").css('display', 'none');
|
||||
$("#map_linked_weight").css('display', 'none');
|
||||
$("#linked_map_status_service_critical_row").css('display', 'none');
|
||||
$("#linked_map_status_service_warning_row").css('display', 'none');
|
||||
|
||||
$("#map_linked_row." + item).css('display', '');
|
||||
|
||||
$("#element_group_row").css('display', 'none');
|
||||
$("#element_group_row." + item).css('display', '');
|
||||
|
||||
$("#map_linked_weight").css('display', 'none');
|
||||
$("#map_linked_weight." + item).css('display', '');
|
||||
|
||||
$("#module_graph_size_row").css('display', 'none');
|
||||
$("#module_graph_size_row." + item).css('display', '');
|
||||
|
||||
|
@ -1925,9 +1967,13 @@ function cleanFields(item) {
|
|||
$("input[name=width]").val(0);
|
||||
$("input[name=height]").val(0);
|
||||
$("select[name=parent]").val('');
|
||||
$("select[name=map_linked]").val('');
|
||||
$("select[name=linked_map_status_calculation_type]").val('default').change();
|
||||
$("select[name=map_linked]").val('').change();
|
||||
$("input[name=linked_map_node_id]").val(0);
|
||||
$("input[name=map_linked_weight]").val('');
|
||||
$("input[name=linked_map_status_service_critical]").val('');
|
||||
$("input[name=linked_map_status_service_warning]").val('');
|
||||
$("select[name=element_group]").val('');
|
||||
$("select[name=map_linked_weight]").val('');
|
||||
$("input[name=width_module_graph]").val(300);
|
||||
$("input[name=height_module_graph]").val(180);
|
||||
$("input[name='width_box']").val(300);
|
||||
|
@ -5141,4 +5187,74 @@ function multiDragMouse(eventDrag){
|
|||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function linkedMapStatusCalculationTypeChanged ($linkedMapStatusCalcRow, value) {
|
||||
if ($linkedMapStatusCalcRow.length === 0) return;
|
||||
|
||||
switch (value) {
|
||||
case "weight":
|
||||
// Show weight input
|
||||
$linkedMapStatusCalcRow
|
||||
.siblings("#map_linked_weight")
|
||||
.show()
|
||||
.siblings("#linked_map_status_service_critical_row")
|
||||
.hide()
|
||||
.siblings("#linked_map_status_service_warning_row")
|
||||
.hide();
|
||||
break;
|
||||
case "service":
|
||||
// Show critical and warning values
|
||||
$linkedMapStatusCalcRow
|
||||
.siblings("#map_linked_weight")
|
||||
.hide()
|
||||
.siblings("#linked_map_status_service_critical_row")
|
||||
.show()
|
||||
.siblings("#linked_map_status_service_warning_row")
|
||||
.show();
|
||||
break;
|
||||
default:
|
||||
// Hide inputs
|
||||
$linkedMapStatusCalcRow
|
||||
.siblings("#map_linked_weight")
|
||||
.hide()
|
||||
.siblings("#linked_map_status_service_critical_row")
|
||||
.hide()
|
||||
.siblings("#linked_map_status_service_warning_row")
|
||||
.hide();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function linkedMapChanged ($linkedMapRow, value) {
|
||||
if ($linkedMapRow.length === 0) return;
|
||||
|
||||
if (value === 0) {
|
||||
$linkedMapRow
|
||||
.siblings("#linked_map_status_calculation_row")
|
||||
.hide()
|
||||
.siblings("#map_linked_weight")
|
||||
.hide()
|
||||
.siblings("#linked_map_status_service_critical_row")
|
||||
.hide()
|
||||
.siblings("#linked_map_status_service_warning_row")
|
||||
.hide();
|
||||
} else {
|
||||
var $linkedMapStatusCalcRow = $linkedMapRow.siblings("#linked_map_status_calculation_row");
|
||||
var calcType = $linkedMapStatusCalcRow.find("select").val();
|
||||
$linkedMapStatusCalcRow.show();
|
||||
linkedMapStatusCalculationTypeChanged($linkedMapStatusCalcRow, calcType);
|
||||
}
|
||||
}
|
||||
|
||||
function onLinkedMapChange (event) {
|
||||
var $linkedMapRow = $(event.target).parent().parent();
|
||||
var value = Number.parseInt(event.target.value);
|
||||
linkedMapChanged($linkedMapRow, value);
|
||||
}
|
||||
|
||||
function onLinkedMapStatusCalculationTypeChange (event) {
|
||||
var $linkedMapStatusCalcRow = $(event.target).parent().parent();
|
||||
var value = event.target.value || "default";
|
||||
linkedMapStatusCalculationTypeChanged($linkedMapStatusCalcRow, value);
|
||||
}
|
||||
|
|
|
@ -17,10 +17,13 @@ global $config;
|
|||
require_once ($config['homedir'] . '/include/functions_visual_map.php');
|
||||
|
||||
// ACL for the general permission
|
||||
$vconsoles_read = check_acl ($config['id_user'], 0, "VR");
|
||||
$vconsoles_write = check_acl ($config['id_user'], 0, "VW");
|
||||
$vconsoles_read = check_acl ($config['id_user'], 0, "VR");
|
||||
$vconsoles_write = check_acl ($config['id_user'], 0, "VW");
|
||||
$vconsoles_manage = check_acl ($config['id_user'], 0, "VM");
|
||||
|
||||
$is_enterprise = enterprise_include_once('include/functions_policies.php');
|
||||
$is_metaconsole = is_metaconsole();
|
||||
|
||||
if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access map builder");
|
||||
|
@ -28,15 +31,55 @@ if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) {
|
|||
exit;
|
||||
}
|
||||
|
||||
$buttons['map_builder'] = array('active' => false,
|
||||
'text' => '<a href="index.php?sec=network&sec2=godmode/reporting/map_builder">' .
|
||||
html_print_image ("images/visual_console.png", true, array ("title" => __('Visual Console'))) .'</a>');
|
||||
if(!$is_metaconsole){
|
||||
$url_visual_console = 'index.php?sec=network&sec2=godmode/reporting/map_builder';
|
||||
$url_visual_console_favorite = 'index.php?sec=network&sec2=godmode/reporting/visual_console_favorite';
|
||||
$url_visual_console_template = 'index.php?sec=network&sec2=enterprise/godmode/reporting/visual_console_template';
|
||||
$url_visual_console_template_wizard = 'index.php?sec=network&sec2=enterprise/godmode/reporting/visual_console_template_wizard';
|
||||
}
|
||||
else{
|
||||
$url_visual_console = 'index.php?sec=screen&sec2=screens/screens&action=visualmap';
|
||||
$url_visual_console_favorite = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite';
|
||||
$url_visual_console_template = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_template';
|
||||
$url_visual_console_template_wizard = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_wizard';
|
||||
}
|
||||
|
||||
if (!defined('METACONSOLE')) {
|
||||
$buttons['visual_console'] = array(
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$url_visual_console.'">' .
|
||||
html_print_image ("images/visual_console.png", true, array ("title" => __('Visual Console List'))) .'</a>'
|
||||
);
|
||||
|
||||
$buttons['visual_console_favorite'] = array(
|
||||
'active' => true,
|
||||
'text' => '<a href="'.$url_visual_console_favorite.'">' .
|
||||
html_print_image ("images/list.png", true, array ("title" => __('Visual Favourite Console'))) .'</a>'
|
||||
);
|
||||
|
||||
if($is_enterprise && $vconsoles_manage){
|
||||
$buttons['visual_console_template'] = array(
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$url_visual_console_template.'">' .
|
||||
html_print_image ("images/templates.png", true, array ("title" => __('Visual Console Template'))) .'</a>'
|
||||
);
|
||||
|
||||
$buttons['visual_console_template_wizard'] = array(
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$url_visual_console_template_wizard.'">' .
|
||||
html_print_image ("images/wand.png", true, array ("title" => __('Visual Console Template Wizard'))) .'</a>'
|
||||
);
|
||||
}
|
||||
|
||||
if (!$is_metaconsole) {
|
||||
ui_print_page_header(
|
||||
__('Reporting') .' » ' . __('Visual Favourite Console'),
|
||||
"images/op_reporting.png", false, "map_builder", false, $buttons);
|
||||
}
|
||||
else{
|
||||
ui_meta_print_header(
|
||||
__('Visual console') . " » " . $visualConsoleName, "",
|
||||
$buttons);
|
||||
}
|
||||
|
||||
$search = (string) get_parameter("search","");
|
||||
$ag_group = (int) get_parameter("ag_group",0);
|
||||
|
@ -48,7 +91,7 @@ if(!is_metaconsole()){
|
|||
action='index.php?sec=network&sec2=godmode/reporting/visual_console_favorite'>";
|
||||
} else {
|
||||
echo "<form method='post'
|
||||
action='index.php?sec=screen&sec2=screens/screens&action=visualmap'>";
|
||||
action='index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite'>";
|
||||
}
|
||||
echo "<ul class='form_flex'><li class='first_elements'>";
|
||||
echo "<ul><li>";
|
||||
|
@ -61,14 +104,14 @@ if(!is_metaconsole()){
|
|||
$return_all_group = false;
|
||||
else
|
||||
$return_all_group = true;
|
||||
html_print_select_groups(false, "AR", $return_all_group, "ag_group",
|
||||
$ag_group, 'this.form.submit();', '', 0, false,
|
||||
html_print_select_groups(false, "AR", $return_all_group, "ag_group",
|
||||
$ag_group, 'this.form.submit();', '', 0, false,
|
||||
false, true, '', false
|
||||
);
|
||||
echo "</li></ul></li><li class='second_elements'><ul><li>";
|
||||
echo __('Group Recursion');
|
||||
html_print_checkbox ("recursion", 1, $recursion, false, false, 'this.form.submit()');
|
||||
echo "</li><li>";
|
||||
echo "</li><li>";
|
||||
echo "<input name='search_visual_console' type='submit' class='sub search' value='".__('Search')."'>";
|
||||
echo "</li></ul></li></ul>";
|
||||
echo "</form>";
|
||||
|
@ -99,16 +142,21 @@ $favorite_array = visual_map_get_user_layouts ($config['id_user'],false,$filters
|
|||
|
||||
echo "<div id='is_favourite'>";
|
||||
if($favorite_array == false){
|
||||
ui_print_error_message(__('No data to show'));
|
||||
ui_print_info_message(__('No favourite consoles defined'));
|
||||
}
|
||||
else{
|
||||
echo "<ul class='container'>";
|
||||
foreach( $favorite_array as $favorite_k => $favourite_v ){
|
||||
echo "<a href='index.php?sec=network&sec2=operation/visual_console/render_view&id=" . $favourite_v["id"] .
|
||||
"' title='Visual console". $favourite_v["name"] ."' alt='". $favourite_v["name"] ."'><li>";
|
||||
foreach( $favorite_array as $favorite_k => $favourite_v ){
|
||||
if($is_metaconsole){
|
||||
$url = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&id_visualmap='. $favourite_v["id"];
|
||||
}
|
||||
else{
|
||||
$url = 'index.php?sec=network&sec2=operation/visual_console/render_view&id='. $favourite_v["id"];
|
||||
}
|
||||
echo "<a href='". $url ."' title='Visual console". $favourite_v["name"] ."' alt='". $favourite_v["name"] ."'><li>";
|
||||
echo "<div class='icon_img'>";
|
||||
echo html_print_image ("images/groups_small/" . groups_get_icon($favourite_v["id_group"]).".png",
|
||||
true,
|
||||
echo html_print_image ("images/groups_small/" . groups_get_icon($favourite_v["id_group"]).".png",
|
||||
true,
|
||||
array ("style" => '')
|
||||
);
|
||||
echo "</div>";
|
||||
|
@ -120,4 +168,4 @@ echo "<div id='is_favourite'>";
|
|||
echo "</ul>";
|
||||
}
|
||||
echo "</div>";
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -97,7 +97,15 @@ if ((isset ($_GET["update"])) OR ((isset ($_GET["create"])))) {
|
|||
$field2 = get_parameter ("_field2_", "");
|
||||
$field3 = get_parameter ("_field3_", "");
|
||||
$field4 = get_parameter ("_field4_", "");
|
||||
|
||||
$snmp_version = get_parameter_post ("snmp_version");
|
||||
$snmp3_auth_user = get_parameter_post ("snmp_auth_user");
|
||||
$snmp3_auth_pass = get_parameter_post ("snmp_auth_pass");
|
||||
$snmp3_privacy_method = get_parameter_post ("snmp_privacy_method");
|
||||
$snmp3_privacy_pass = get_parameter_post ("snmp_privacy_pass");
|
||||
$snmp3_auth_method = get_parameter_post ("snmp_auth_method");
|
||||
$snmp3_security_level = get_parameter_post ("snmp_security_level");
|
||||
|
||||
|
||||
if ($mode == "network_sweep")
|
||||
$id_recon_script = 0;
|
||||
else
|
||||
|
@ -154,8 +162,30 @@ if (isset($_GET["update"])) {
|
|||
'macros' => $macros,
|
||||
'alias_as_name' => $alias_as_name,
|
||||
'snmp_enabled' => $snmp_enabled,
|
||||
'vlan_enabled' => $vlan_enabled
|
||||
'vlan_enabled' => $vlan_enabled,
|
||||
'snmp_version' => $snmp_version
|
||||
);
|
||||
|
||||
$values_v3 = array(
|
||||
'snmp_auth_user' => $snmp3_auth_user,
|
||||
'snmp_auth_pass' => $snmp3_auth_pass,
|
||||
'snmp_privacy_method' => $snmp3_privacy_method,
|
||||
'snmp_privacy_pass' => $snmp3_privacy_pass,
|
||||
'snmp_auth_method' => $snmp3_auth_method,
|
||||
'snmp_security_level' => $snmp3_security_level
|
||||
);
|
||||
if($values['snmp_version'] == '1' || $values['snmp_version'] == '2' || $values['snmp_version'] == '2c'){
|
||||
$values_v3 = array(
|
||||
'snmp_auth_user' => '',
|
||||
'snmp_auth_pass' => '',
|
||||
'snmp_privacy_method' => '',
|
||||
'snmp_privacy_pass' => '',
|
||||
'snmp_auth_method' => '',
|
||||
'snmp_security_level' => ''
|
||||
);
|
||||
}
|
||||
|
||||
$values = array_merge($values, $values_v3);
|
||||
|
||||
$where = array('id_rt' => $id);
|
||||
|
||||
|
@ -217,13 +247,37 @@ if (isset($_GET["create"])) {
|
|||
'macros' => $macros,
|
||||
'alias_as_name' => $alias_as_name,
|
||||
'snmp_enabled' => $snmp_enabled,
|
||||
'vlan_enabled' => $vlan_enabled
|
||||
'vlan_enabled' => $vlan_enabled,
|
||||
'snmp_version' => $snmp_version
|
||||
);
|
||||
|
||||
$values_v3 = array(
|
||||
'snmp_auth_user' => $snmp3_auth_user,
|
||||
'snmp_auth_pass' => $snmp3_auth_pass,
|
||||
'snmp_privacy_method' => $snmp3_privacy_method,
|
||||
'snmp_privacy_pass' => $snmp3_privacy_pass,
|
||||
'snmp_auth_method' => $snmp3_auth_method,
|
||||
'snmp_security_level' => $snmp3_security_level
|
||||
);
|
||||
if($values['snmp_version'] == '1' || $values['snmp_version'] == '2' || $values['snmp_version'] == '2c'){
|
||||
$values_v3 = array(
|
||||
'snmp_auth_user' => '',
|
||||
'snmp_auth_pass' => '',
|
||||
'snmp_privacy_method' => '',
|
||||
'snmp_privacy_pass' => '',
|
||||
'snmp_auth_method' => '',
|
||||
'snmp_security_level' => ''
|
||||
);
|
||||
}
|
||||
if ($values['snmp_version'] == '3'){
|
||||
$values['vlan_enabled'] = 0;
|
||||
}
|
||||
|
||||
$values = array_merge($values, $values_v3);
|
||||
|
||||
$name = io_safe_output($name);
|
||||
$name = trim($name, ' ');
|
||||
$name = io_safe_input($name);
|
||||
|
||||
$reason = "";
|
||||
|
||||
if ($name != "") {
|
||||
|
@ -293,7 +347,7 @@ else {
|
|||
$color=1;
|
||||
if ($result !== false) {
|
||||
$table = new StdClass();
|
||||
$table->head = array (__('Name'), __('Network'), __('Mode'), __('Group'), __('Incident'), __('OS'), __('Interval'), __('Ports'), __('Action'));
|
||||
$table->head = array (__('Name'), __('Network'), __('Mode'), __('Group'), __('SNMP Version'), __('Incident'), __('OS'), __('Interval'), __('Ports'), __('Action'));
|
||||
$table->align = array ("left","left","left","left","left","left","left","left");
|
||||
$table->width = "100%";
|
||||
$table->cellpadding = 4;
|
||||
|
@ -336,48 +390,64 @@ if ($result !== false) {
|
|||
$data[3] = "-";
|
||||
}
|
||||
|
||||
//SNMP VERSION
|
||||
if ($row["snmp_version"] == '1'){
|
||||
$data[4] = "v. 1";
|
||||
}
|
||||
elseif($row["snmp_version"] == '2'){
|
||||
$data[4] = "v. 2";
|
||||
}
|
||||
elseif($row["snmp_version"] == '2c'){
|
||||
$data[4] = "v. 2c";
|
||||
}
|
||||
elseif($row["snmp_version"] == '3'){
|
||||
$data[4] = "v. 3";
|
||||
}
|
||||
|
||||
|
||||
|
||||
// INCIDENT
|
||||
$data[4] = (($row["create_incident"] == 1) ? __('Yes') : __('No'));
|
||||
$data[5] = (($row["create_incident"] == 1) ? __('Yes') : __('No'));
|
||||
|
||||
// OS
|
||||
if ($row["id_recon_script"] == 0) {
|
||||
$data[5] =(($row["id_os"] > 0) ? ui_print_os_icon ($row["id_os"], false, true) : __('Any'));
|
||||
$data[6] =(($row["id_os"] > 0) ? ui_print_os_icon ($row["id_os"], false, true) : __('Any'));
|
||||
}
|
||||
else {
|
||||
$data[5] = "-";
|
||||
$data[6] = "-";
|
||||
}
|
||||
// INTERVAL
|
||||
if ($row["interval_sweep"]==0)
|
||||
$data[6] = __("Manual");
|
||||
$data[7] = __("Manual");
|
||||
else
|
||||
$data[6] =human_time_description_raw($row["interval_sweep"]);
|
||||
$data[7] =human_time_description_raw($row["interval_sweep"]);
|
||||
|
||||
// PORTS
|
||||
if ($row["id_recon_script"] == 0) {
|
||||
$data[7] = substr($row["recon_ports"],0,15);
|
||||
$data[8] = substr($row["recon_ports"],0,15);
|
||||
}
|
||||
else {
|
||||
$data[7] = "-";
|
||||
$data[8] = "-";
|
||||
}
|
||||
|
||||
// ACTION
|
||||
$task_group = $row["id_group"];
|
||||
|
||||
if (in_array($task_group, $user_groups_w)){
|
||||
$data[8] = '<a href="index.php?sec=estado&sec2=operation/servers/recon_view">' . html_print_image("images/eye.png", true) . '</a>';
|
||||
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&delete='.$row["id_rt"].'">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>';
|
||||
$data[9] = '<a href="index.php?sec=estado&sec2=operation/servers/recon_view">' . html_print_image("images/eye.png", true) . '</a>';
|
||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&delete='.$row["id_rt"].'">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>';
|
||||
if($mode_name != 'IPAM Recon'){
|
||||
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update='.$row["id_rt"].'">' .html_print_image("images/config.png", true) . '</a>';
|
||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update='.$row["id_rt"].'">' .html_print_image("images/config.png", true) . '</a>';
|
||||
} else {
|
||||
$sql_ipam = 'select id from tipam_network where id_recon_task =' . $row["id_rt"];
|
||||
$id_recon_ipam = db_get_sql($sql_ipam);
|
||||
$data[8] .= '<a href="index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=' . $id_recon_ipam . '">' . html_print_image("images/config.png", true) . '</a>';
|
||||
$data[9] .= '<a href="index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=' . $id_recon_ipam . '">' . html_print_image("images/config.png", true) . '</a>';
|
||||
}
|
||||
if($row["disabled"] == 0) {
|
||||
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row["id_rt"].'&disabled=1">' .html_print_image("images/lightbulb.png", true) . '</a>';
|
||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row["id_rt"].'&disabled=1">' .html_print_image("images/lightbulb.png", true) . '</a>';
|
||||
}
|
||||
else {
|
||||
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row["id_rt"].'&disabled=0">' .html_print_image("images/lightbulb_off.png", true) . '</a>';
|
||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row["id_rt"].'&disabled=0">' .html_print_image("images/lightbulb_off.png", true) . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -108,6 +108,13 @@ if (isset($_GET["update"]) || (isset($_GET["upd"]))) {
|
|||
$id_os = $row["id_os"];
|
||||
$recon_ports = $row["recon_ports"];
|
||||
$snmp_community = $row["snmp_community"];
|
||||
$snmp_version = $row["snmp_version"];
|
||||
$snmp3_auth_user = $row["snmp_auth_user"];
|
||||
$snmp3_auth_pass = $row["snmp_auth_pass"];
|
||||
$snmp3_privacy_method = $row["snmp_privacy_method"];
|
||||
$snmp3_privacy_pass = $row["snmp_privacy_pass"];
|
||||
$snmp3_auth_method = $row["snmp_auth_method"];
|
||||
$snmp3_security_level = $row["snmp_security_level"];
|
||||
$id_recon_script = $row["id_recon_script"];
|
||||
$field1 = $row["field1"];
|
||||
$field2 = $row["field2"];
|
||||
|
@ -156,6 +163,13 @@ elseif (isset($_GET["create"]) || isset($_GET["crt"])) {
|
|||
$id_group = 0;
|
||||
$create_incident = 1;
|
||||
$snmp_community = "public";
|
||||
$snmp3_auth_user = '';
|
||||
$snmp3_auth_pass = '';
|
||||
$snmp_version = 1;
|
||||
$snmp3_privacy_method = '';
|
||||
$snmp3_privacy_pass = '';
|
||||
$snmp3_auth_method = '';
|
||||
$snmp3_security_level = '';
|
||||
$id_network_profile = 0;
|
||||
$id_os = -1; // Any
|
||||
$recon_ports = ""; // Any
|
||||
|
@ -212,6 +226,13 @@ $table->rowclass[20] = "network_sweep";
|
|||
$table->rowclass[21] = "network_sweep";
|
||||
$table->rowclass[22] = "network_sweep";
|
||||
$table->rowclass[23] = "network_sweep";
|
||||
$table->rowclass[24] = "network_sweep";
|
||||
$table->rowclass[25] = "network_sweep recon_v3";
|
||||
$table->rowclass[26] = "network_sweep recon_v3";
|
||||
$table->rowclass[27] = "network_sweep recon_v3";
|
||||
$table->rowclass[28] = "network_sweep recon_v3";
|
||||
$table->rowclass[29] = "network_sweep recon_v3";
|
||||
$table->rowclass[30] = "network_sweep recon_v3";
|
||||
|
||||
$table->rowclass[6] = "recon_script";
|
||||
$table->rowclass[13] = "recon_script";
|
||||
|
@ -327,6 +348,34 @@ $table->data[12][0] = "<b>".__('SNMP Default community');
|
|||
$table->data[12][0] .= ui_print_help_tip (__('You can specify several values, separated by commas, for example: public,mysecret,1234'), true);
|
||||
$table->data[12][1] = html_print_input_text ('snmp_community', $snmp_community, '', 35, 0, true);
|
||||
|
||||
//SNMP version
|
||||
|
||||
$snmp_versions['1'] = 'v. 1';
|
||||
$snmp_versions['2'] = 'v. 2';
|
||||
$snmp_versions['2c'] = 'v. 2c';
|
||||
$snmp_versions['3'] = 'v. 3';
|
||||
$table->data[24][0] ="<b>". _('SNMP version');
|
||||
$table->data[24][1] = html_print_select ($snmp_versions, 'snmp_version', $snmp_version, '', '', 0, true);
|
||||
|
||||
$table->data[25][0] ="<b>".__('Auth user');
|
||||
$table->data[25][1] = html_print_input_text ('snmp_auth_user', $snmp3_auth_user, '', 15, 60, true, '',
|
||||
false, '', '');
|
||||
$table->data[26][0] ="<b>". __('Auth password') . ui_print_help_tip(__("The pass length must be eight character minimum."), true);
|
||||
$table->data[26][1] = html_print_input_password ('snmp_auth_pass', $snmp3_auth_pass, '', 15, 60, true, '',
|
||||
false, '');
|
||||
$table->data[26][1] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_mmen', true);
|
||||
|
||||
$table->data[27][0] ="<b>". __('Privacy method');
|
||||
$table->data[27][1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp_privacy_method', $snmp3_privacy_method, '', '', '', true, false, false, '', '');
|
||||
$table->data[28][0] ="<b>". __('Privacy pass') . ui_print_help_tip(__("The pass length must be eight character minimum."), true);
|
||||
$table->data[28][1] = html_print_input_password ('snmp_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true, '',
|
||||
false, '');
|
||||
$table->data[29][0] ="<b>". __('Auth method');
|
||||
$table->data[29][1] = html_print_select(array('MD5' => __('MD5'), 'SHA' => __('SHA')), 'snmp_auth_method', $snmp3_auth_method, '', '', '', true, false, false, '', '');
|
||||
$table->data[30][0] ="<b>". __('Security level');
|
||||
$table->data[30][1] = html_print_select(array('noAuthNoPriv' => __('Not auth and not privacy method'),
|
||||
'authNoPriv' => __('Auth and not privacy method'), 'authPriv' => __('Auth and privacy method')), 'snmp_security_level', $snmp3_security_level, '', '', '', true, false, false, '', '');
|
||||
|
||||
// Explanation
|
||||
$explanation = db_get_value('description', 'trecon_script', 'id_recon_script', $id_recon_script);
|
||||
|
||||
|
@ -461,9 +510,24 @@ $('select#id_recon_script').change(function() {
|
|||
get_explanation_recon_script($(this).val());
|
||||
});
|
||||
|
||||
$('select#snmp_version').change(function () {
|
||||
if (this.value == "3") {
|
||||
$(".recon_v3").show();
|
||||
$("input[name=active_snmp_v3]").val(1);
|
||||
$("input[name=snmp_community]").attr("disabled", true);
|
||||
$("input[name=vlan_enabled]").removeAttr("checked");
|
||||
$("input[name=vlan_enabled]").attr("disabled", true);
|
||||
}
|
||||
else {
|
||||
$(".recon_v3").hide();
|
||||
$("input[name=active_snmp_v3]").val(0);
|
||||
$("input[name=snmp_community]").removeAttr('disabled');
|
||||
$("input[name=vlan_enabled]").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
$('select#mode').change(function() {
|
||||
var type = $(this).val();
|
||||
|
||||
if (type == 'recon_script') {
|
||||
$(".recon_script").show();
|
||||
$(".network_sweep").hide();
|
||||
|
@ -474,6 +538,7 @@ $('select#mode').change(function() {
|
|||
$(".recon_script").hide();
|
||||
$(".network_sweep").show();
|
||||
$('.macro_field').remove();
|
||||
$('select#snmp_version').trigger('change');
|
||||
}
|
||||
}).change();
|
||||
|
||||
|
@ -543,5 +608,5 @@ function get_explanation_recon_script (id) {
|
|||
});
|
||||
taskManager.addTask(xhr);
|
||||
}
|
||||
/* ]]> */
|
||||
|
||||
</script>
|
||||
|
|
|
@ -833,7 +833,7 @@ ui_require_javascript_file('pandora_modules');
|
|||
i++;
|
||||
}
|
||||
|
||||
$('#command_preview').html(command+' '+parameters);
|
||||
$('#command_preview').html(_.escape(command) + ' ' + _.escape(parameters));
|
||||
}
|
||||
|
||||
function show_locked_dialog(id_plugin, plugin_name) {
|
||||
|
|
|
@ -686,8 +686,8 @@ $table_chars->data[$row][1] = html_print_select($options_full_escale, 'full_scal
|
|||
$row++;
|
||||
|
||||
|
||||
$table_chars->data[$row][0] = __('Soft graphs:');
|
||||
$table_chars->data[$row][0] .= ui_print_help_tip(__('This option may cause performance issues'), true);
|
||||
$table_chars->data[$row][0] = __('Show only average');
|
||||
$table_chars->data[$row][0] .= ui_print_help_tip(__('If enabled, the module graphs will only show the average value, otherwise it will show three sets of data showing maximums, averages and minimums.'), true);
|
||||
|
||||
$options_soft_graphs = array();
|
||||
$options_soft_graphs[0] = __('Standard mode');
|
||||
|
@ -696,7 +696,23 @@ $options_soft_graphs[1] = __('Classic mode');
|
|||
$table_chars->data[$row][1] = html_print_select($options_soft_graphs, 'type_mode_graph', $config["type_mode_graph"], '', '', 0, true, false, false);
|
||||
$row++;
|
||||
|
||||
$table_chars->data[$row][0] = __('Zoom graphs:');
|
||||
|
||||
$options_zoom_graphs = array();
|
||||
$options_zoom_graphs[1] = 'x1';
|
||||
$options_zoom_graphs[2] = 'x2';
|
||||
$options_zoom_graphs[3] = 'x3';
|
||||
$options_zoom_graphs[4] = 'x4';
|
||||
$options_zoom_graphs[5] = 'x5';
|
||||
|
||||
$table_chars->data[$row][1] = html_print_select($options_zoom_graphs, 'zoom_graph', $config["zoom_graph"], '', '', 0, true, false, false);
|
||||
$row++;
|
||||
|
||||
$table_chars->data[$row][0] = __('Graph image height');
|
||||
$table_chars->data[$row][0] .= ui_print_help_tip(
|
||||
__('This is the height in pixels of the module graph or custom graph in the reports (both: HTML and PDF)'),
|
||||
true
|
||||
);
|
||||
$table_chars->data[$row][1] = html_print_input_text ('graph_image_height', $config['graph_image_height'], '', 20, 20, true);
|
||||
$row++;
|
||||
|
||||
|
|
|
@ -152,7 +152,8 @@ if ($create_user) {
|
|||
ui_print_error_message (__('The current authentication scheme doesn\'t support creating users on %s', get_product_name()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (html_print_csrf_error()) return;
|
||||
|
||||
$values = array ();
|
||||
$values['id_user'] = (string) get_parameter ('id_user');
|
||||
$values['fullname'] = (string) get_parameter ('fullname');
|
||||
|
@ -279,6 +280,8 @@ if ($create_user) {
|
|||
}
|
||||
|
||||
if ($update_user) {
|
||||
if (html_print_csrf_error()) return;
|
||||
|
||||
$values = array ();
|
||||
$values['id_user'] = (string) get_parameter ('id_user');
|
||||
$values['fullname'] = (string) get_parameter ('fullname');
|
||||
|
@ -449,30 +452,22 @@ if ($add_profile) {
|
|||
$group2 = (int) get_parameter ('assign_group');
|
||||
$profile2 = (int) get_parameter ('assign_profile');
|
||||
$tags = (array) get_parameter ('assign_tags');
|
||||
$is_secondary = (bool)get_parameter ('is_secondary', 0);
|
||||
$no_hierarchy = (int)get_parameter ('no_hierarchy', 0);
|
||||
|
||||
foreach ($tags as $k => $tag) {
|
||||
if(empty($tag)) {
|
||||
unset($tags[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
$tags = $is_secondary ? '' : implode(',', $tags);
|
||||
|
||||
$tags = implode(',', $tags);
|
||||
|
||||
db_pandora_audit("User management",
|
||||
"Added profile for user ".io_safe_input($id2), false, false, 'Profile: ' . $profile2 . ' Group: ' . $group2 . ' Tags: ' . $tags);
|
||||
if (profile_check_group_mode($id2, $group2, $is_secondary)) {
|
||||
$return = profile_create_user_profile($id2, $profile2, $group2, false, $tags, $is_secondary);
|
||||
ui_print_result_message ($return,
|
||||
__('Profile added successfully'),
|
||||
__('Profile cannot be added'));
|
||||
} else {
|
||||
if ($is_secondary) {
|
||||
ui_print_error_message ("A group assigned like primary cannot be assigned like secondary.");
|
||||
} else {
|
||||
ui_print_error_message ("A group assigned like secondary cannot be assigned like primary.");
|
||||
}
|
||||
}
|
||||
$return = profile_create_user_profile($id2, $profile2, $group2, false, $tags, $no_hierarchy);
|
||||
ui_print_result_message ($return,
|
||||
__('Profile added successfully'),
|
||||
__('Profile cannot be added'));
|
||||
}
|
||||
|
||||
if ($delete_profile) {
|
||||
|
@ -669,6 +664,7 @@ $table->data[15][0] .= ui_print_help_tip(__('This is defined in minutes, If you
|
|||
$table->data[15][1] = html_print_input_text ('session_time', $user_info["session_time"], '', 5, 5, true);
|
||||
|
||||
$event_filter_data = db_get_all_rows_sql('SELECT id_name, id_filter FROM tevent_filter');
|
||||
if ($event_filter_data === false) $event_filter_data = array();
|
||||
$event_filter = array();
|
||||
$event_filter[0] = __('None');
|
||||
foreach ($event_filter_data as $filter) {
|
||||
|
@ -712,14 +708,12 @@ echo '<form method="post" autocomplete="off">';
|
|||
html_print_table ($table);
|
||||
|
||||
echo '<div style="width: '.$table->width.'" class="action-buttons">';
|
||||
if ($new_user) {
|
||||
if ($config['admin_can_add_user']) {
|
||||
if ($config['admin_can_add_user']) {
|
||||
html_print_csrf_hidden();
|
||||
if ($new_user) {
|
||||
html_print_input_hidden ('create_user', 1);
|
||||
html_print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"');
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($config['user_can_update_info']) {
|
||||
} else {
|
||||
html_print_input_hidden ('update_user', 1);
|
||||
html_print_submit_button (__('Update'), 'uptbutton', false, 'class="sub upd"');
|
||||
}
|
||||
|
@ -730,8 +724,7 @@ echo '<br />';
|
|||
|
||||
/* Don't show anything else if we're creating an user */
|
||||
if (!empty ($id) && !$new_user) {
|
||||
profile_print_profile_table($id, __('Profiles/Groups assigned to this user'));
|
||||
enterprise_hook('profile_print_profile_secondary_table', array($id));
|
||||
profile_print_profile_table($id);
|
||||
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
|
@ -295,19 +295,8 @@ if ($get_module_detail) {
|
|||
elseif (($config['command_snapshot'] == '0') && (preg_match ("/[\n]+/i", $row[$attr[0]]))) {
|
||||
// Its a single-data, multiline data (data snapshot) ?
|
||||
|
||||
// Detect string data with \n and convert to <br>'s
|
||||
$datos = $row[$attr[0]];
|
||||
|
||||
$datos = preg_replace ('/</', '<', $datos);
|
||||
$datos = preg_replace ('/>/', '>', $datos);
|
||||
$datos = preg_replace ('/\n/i','<br>',$datos);
|
||||
$datos = preg_replace ('/\s/i',' ',$datos);
|
||||
$datos_format = "<div id='result_div' style='width: 100%; height: 100%; overflow: scroll; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'>";
|
||||
$datos_format .= $datos;
|
||||
$datos_format .= "</div>";
|
||||
|
||||
// I dont why, but using index (value) method, data is automatically converted to html entities ¿?
|
||||
$data[] = $datos_format;
|
||||
$data[] = html_print_result_div($row[$attr[0]]);
|
||||
}
|
||||
elseif ($is_web_content_string) {
|
||||
//Fixed the goliat sends the strings from web
|
||||
|
@ -315,11 +304,9 @@ if ($get_module_detail) {
|
|||
$data[] = io_safe_input($row[$attr[0]]);
|
||||
}
|
||||
else {
|
||||
// Just a string of alphanumerical data... just do print
|
||||
//Fixed the data from Selenium Plugin
|
||||
if ($row[$attr[0]] != strip_tags($row[$attr[0]])) {
|
||||
|
||||
$data[] = io_safe_input($row[$attr[0]]);
|
||||
$data[] = html_print_result_div($row[$attr[0]]);
|
||||
}
|
||||
else if (is_numeric($row[$attr[0]]) && !modules_is_string_type($row['module_type']) ) {
|
||||
switch($row['module_type']) {
|
||||
|
@ -334,7 +321,6 @@ if ($get_module_detail) {
|
|||
}else{
|
||||
$data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision']));
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
$data_macro = modules_get_unit_macro($row[$attr[0]],$unit);
|
||||
|
@ -355,7 +341,7 @@ if ($get_module_detail) {
|
|||
if($data_macro){
|
||||
$data[] = $data_macro;
|
||||
} else {
|
||||
$data[] = $row[$attr[0]];
|
||||
$data[] = html_print_result_div($row[$attr[0]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,14 @@ if (is_ajax ()) {
|
|||
}
|
||||
|
||||
require_once($config['homedir'] . "/include/class/Tree.class.php");
|
||||
enterprise_include_once("include/class/Tree.class.php");
|
||||
require_once($config['homedir'] . "/include/class/TreeOS.class.php");
|
||||
require_once($config['homedir'] . "/include/class/TreeModuleGroup.class.php");
|
||||
require_once($config['homedir'] . "/include/class/TreeModule.class.php");
|
||||
require_once($config['homedir'] . "/include/class/TreeTag.class.php");
|
||||
require_once($config['homedir'] . "/include/class/TreeGroup.class.php");
|
||||
require_once($config['homedir'] . "/include/class/TreeGroupEdition.class.php");
|
||||
enterprise_include_once("include/class/TreePolicies.class.php");
|
||||
enterprise_include_once("include/class/TreeGroupMeta.class.php");
|
||||
require_once($config['homedir'] . "/include/functions_reporting.php");
|
||||
require_once($config['homedir'] . "/include/functions_os.php");
|
||||
|
||||
|
@ -67,17 +74,45 @@ if (is_ajax ()) {
|
|||
'tagID' => 0,
|
||||
);
|
||||
$filter = get_parameter('filter', $default_filters);
|
||||
|
||||
|
||||
$agent_a = check_acl ($config['id_user'], 0, "AR");
|
||||
$agent_w = check_acl ($config['id_user'], 0, "AW");
|
||||
$access = ($agent_a == true) ? 'AR' : (($agent_w == true) ? 'AW' : 'AR');
|
||||
if (class_exists('TreeEnterprise')) {
|
||||
$tree = new TreeEnterprise($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
$switch_type = !empty($rootType) ? $rootType : $type;
|
||||
switch ($switch_type) {
|
||||
case 'os':
|
||||
$tree = new TreeOS($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
break;
|
||||
case 'module_group':
|
||||
$tree = new TreeModuleGroup($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
break;
|
||||
case 'module':
|
||||
$tree = new TreeModule($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
break;
|
||||
case 'tag':
|
||||
$tree = new TreeTag($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
break;
|
||||
case 'group':
|
||||
if(is_metaconsole()){
|
||||
if (!class_exists('TreeGroupMeta')) break;
|
||||
$tree = new TreeGroupMeta($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
}
|
||||
else{
|
||||
$tree = new TreeGroup($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
}
|
||||
break;
|
||||
case 'policies':
|
||||
if (!class_exists('TreePolicies')) break;
|
||||
$tree = new TreePolicies($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
break;
|
||||
case 'group_edition':
|
||||
$tree = new TreeGroupEdition($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
break;
|
||||
default:
|
||||
// FIXME. No error handler
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$tree = new Tree($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
}
|
||||
|
||||
|
||||
$tree->setFilter($filter);
|
||||
ob_clean();
|
||||
echo json_encode(array('success' => 1, 'tree' => $tree->getArray()));
|
||||
|
|
|
@ -100,7 +100,22 @@ $width = get_parameter('width', null);
|
|||
$height = get_parameter('height', null);
|
||||
$parent = get_parameter('parent', null);
|
||||
$map_linked = get_parameter('map_linked', null);
|
||||
$linked_map_node_id = get_parameter('linked_map_node_id', null);
|
||||
$linked_map_status_calculation_type = get_parameter('linked_map_status_calculation_type', null);
|
||||
|
||||
$map_linked_weight = get_parameter('map_linked_weight', null);
|
||||
if ($map_linked_weight !== null) {
|
||||
$map_linked_weight = (int) $map_linked_weight;
|
||||
}
|
||||
$linked_map_status_service_critical = get_parameter('linked_map_status_service_critical', null);
|
||||
if ($linked_map_status_service_critical !== null) {
|
||||
$linked_map_status_service_critical = (float) $linked_map_status_service_critical;
|
||||
}
|
||||
$linked_map_status_service_warning = get_parameter('linked_map_status_service_warning', null);
|
||||
if ($linked_map_status_service_warning !== null) {
|
||||
$linked_map_status_service_warning = (float) $linked_map_status_service_warning;
|
||||
}
|
||||
|
||||
$element_group = get_parameter('element_group', null);
|
||||
$width_percentile = get_parameter('width_percentile', 0);
|
||||
$bars_graph_height = get_parameter('bars_graph_height', null);
|
||||
|
@ -408,7 +423,7 @@ switch ($action) {
|
|||
|
||||
// Linked to other layout ?? - Only if not module defined
|
||||
if ($layoutData['id_layout_linked'] != 0) {
|
||||
$status = visual_map_get_layout_status ($layoutData['id_layout_linked'], $layoutData['id_layout_linked_weight']);
|
||||
$status = visual_map_get_layout_status($layoutData['id_layout_linked'], $layoutData);
|
||||
|
||||
// Single object
|
||||
}
|
||||
|
@ -599,6 +614,10 @@ switch ($action) {
|
|||
if ($id_agent !== null) {
|
||||
$values['id_agent'] = $id_agent;
|
||||
}
|
||||
|
||||
if ($linked_map_node_id !== null) {
|
||||
$values['linked_layout_node_id'] = (int) $linked_map_node_id;
|
||||
}
|
||||
}
|
||||
else if ($id_agent == 0) {
|
||||
$values['id_agent'] = 0;
|
||||
|
@ -619,12 +638,27 @@ switch ($action) {
|
|||
if ($map_linked !== null) {
|
||||
$values['id_layout_linked'] = $map_linked;
|
||||
}
|
||||
if ($element_group !== null) {
|
||||
$values['element_group'] = $element_group;
|
||||
if ($linked_map_status_calculation_type !== null) {
|
||||
$values['linked_layout_status_type'] = $linked_map_status_calculation_type;
|
||||
}
|
||||
if ($map_linked_weight !== null) {
|
||||
if ($map_linked_weight > 100) $map_linked_weight = 100;
|
||||
if ($map_linked_weight < 0) $map_linked_weight = 0;
|
||||
$values['id_layout_linked_weight'] = $map_linked_weight;
|
||||
}
|
||||
if ($linked_map_status_service_critical !== null) {
|
||||
if ($linked_map_status_service_critical > 100) $linked_map_status_service_critical = 100;
|
||||
if ($linked_map_status_service_critical < 0) $linked_map_status_service_critical = 0;
|
||||
$values['linked_layout_status_as_service_critical'] = $linked_map_status_service_critical;
|
||||
}
|
||||
if ($linked_map_status_service_warning !== null) {
|
||||
if ($linked_map_status_service_warning > 100) $linked_map_status_service_warning = 100;
|
||||
if ($linked_map_status_service_warning < 0) $linked_map_status_service_warning = 0;
|
||||
$values['linked_layout_status_as_service_warning'] = $linked_map_status_service_warning;
|
||||
}
|
||||
if ($element_group !== null) {
|
||||
$values['element_group'] = $element_group;
|
||||
}
|
||||
switch ($type) {
|
||||
// -- line_item ------------------------------------
|
||||
case 'handler_start':
|
||||
|
@ -944,6 +978,16 @@ switch ($action) {
|
|||
if ($elementFields['id_metaconsole'] != 0) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
if (isset($elementFields["id_layout_linked_weight"])) {
|
||||
$elementFields["id_layout_linked_weight"] = (int) $elementFields["id_layout_linked_weight"];
|
||||
}
|
||||
if (isset($elementFields["linked_layout_status_as_service_critical"])) {
|
||||
$elementFields["linked_layout_status_as_service_critical"] = (float) $elementFields["linked_layout_status_as_service_critical"];
|
||||
}
|
||||
if (isset($elementFields["linked_layout_status_as_service_warning"])) {
|
||||
$elementFields["linked_layout_status_as_service_warning"] = (float) $elementFields["linked_layout_status_as_service_warning"];
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'auto_sla_graph':
|
||||
|
@ -1096,8 +1140,32 @@ switch ($action) {
|
|||
}
|
||||
$values['id_agente_modulo'] = $id_module;
|
||||
$values['id_layout_linked'] = $map_linked;
|
||||
|
||||
if (defined('METACONSOLE') && $metaconsole) {
|
||||
$values['linked_layout_node_id'] = (int) $linked_map_node_id;
|
||||
}
|
||||
|
||||
$values['linked_layout_status_type'] = $linked_map_status_calculation_type;
|
||||
|
||||
if ($map_linked_weight !== null) {
|
||||
if ($map_linked_weight > 100) $map_linked_weight = 100;
|
||||
if ($map_linked_weight < 0) $map_linked_weight = 0;
|
||||
$values['id_layout_linked_weight'] = $map_linked_weight;
|
||||
}
|
||||
|
||||
if ($linked_map_status_service_critical !== null) {
|
||||
if ($linked_map_status_service_critical > 100) $linked_map_status_service_critical = 100;
|
||||
if ($linked_map_status_service_critical < 0) $linked_map_status_service_critical = 0;
|
||||
$values['linked_layout_status_as_service_critical'] = $linked_map_status_service_critical;
|
||||
}
|
||||
|
||||
if ($linked_map_status_service_warning !== null) {
|
||||
if ($linked_map_status_service_warning > 100) $linked_map_status_service_warning = 100;
|
||||
if ($linked_map_status_service_warning < 0) $linked_map_status_service_warning = 0;
|
||||
$values['linked_layout_status_as_service_warning'] = $linked_map_status_service_warning;
|
||||
}
|
||||
|
||||
$values['element_group'] = $element_group;
|
||||
$values['id_layout_linked_weight'] = $map_linked_weight;
|
||||
$values['parent_item'] = $parent;
|
||||
$values['enable_link'] = $enable_link;
|
||||
$values['show_on_top'] = $show_on_top;
|
||||
|
@ -1361,7 +1429,6 @@ if ($get_element_status) {
|
|||
array('id' => $id_element));
|
||||
|
||||
$res = visual_map_get_status_element($layoutData);
|
||||
|
||||
echo $res;
|
||||
|
||||
return;
|
||||
|
|
|
@ -54,6 +54,7 @@ $no_login_msg = "";
|
|||
// Clean unwanted output
|
||||
ob_clean();
|
||||
|
||||
// READ THIS:
|
||||
// Special call without checks to retrieve version and build of the Pandora FMS
|
||||
// This info is avalable from the web console without login
|
||||
// Don't change the format, it is parsed by applications
|
||||
|
@ -63,7 +64,7 @@ switch($info) {
|
|||
$config["MR"] = 0;
|
||||
}
|
||||
|
||||
echo get_product_name() . ' ' . $pandora_version . ' - ' . $build_version . " MR" . $config["MR"];
|
||||
echo 'Pandora FMS ' . $pandora_version . ' - ' . $build_version . " MR" . $config["MR"];
|
||||
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -349,15 +349,15 @@ function process_user_login_remote ($login, $pass, $api = false) {
|
|||
|
||||
foreach ($attributes as $attr) {
|
||||
$attr = explode('=', $attr, 2);
|
||||
if(preg_match('/' . $attr[1] . '/', $sr[$attr[0]][0])){
|
||||
$permissions[$i]["profile"] = $ldap_adv_perm['profile'];
|
||||
$permissions[$i]["groups"] = $ldap_adv_perm['group'];
|
||||
$permissions[$i]["tags"] = implode(",",$ldap_adv_perm['tags']);
|
||||
$i++;
|
||||
break;
|
||||
foreach ($sr[$attr[0]] as $s_attr) {
|
||||
if(preg_match('/' . $attr[1] . '/', $s_attr)){
|
||||
$permissions[$i]["profile"] = $ldap_adv_perm['profile'];
|
||||
$permissions[$i]["groups"] = $ldap_adv_perm['group'];
|
||||
$permissions[$i]["tags"] = implode(",",$ldap_adv_perm['tags']);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
$permissions[0]["profile"] = $config['default_remote_profile'];
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,457 @@
|
|||
<?php
|
||||
//Pandora FMS- http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
global $config;
|
||||
|
||||
require_once($config['homedir']."/include/class/Tree.class.php");
|
||||
|
||||
class TreeGroup extends Tree {
|
||||
|
||||
protected $propagateCounters = true;
|
||||
protected $displayAllGroups = false;
|
||||
|
||||
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand", $access = 'AR') {
|
||||
|
||||
global $config;
|
||||
|
||||
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
|
||||
$this->L1fieldName = "id_group";
|
||||
$this->L1extraFields = array(
|
||||
"tg.nombre AS `name`",
|
||||
"tg.icon",
|
||||
"tg.id_grupo AS gid"
|
||||
);
|
||||
|
||||
$this->L2conditionInside = "AND (
|
||||
ta.id_grupo = " . $this->id . "
|
||||
OR tasg.id_group = " . $this->id . "
|
||||
)";
|
||||
}
|
||||
|
||||
public function setPropagateCounters($value) {
|
||||
$this->propagateCounters = (bool)$value;
|
||||
}
|
||||
|
||||
public function setDisplayAllGroups($value) {
|
||||
$this->displayAllGroups = (bool)$value;
|
||||
}
|
||||
|
||||
protected function getData() {
|
||||
if ($this->id == -1) {
|
||||
$this->getFirstLevel();
|
||||
} elseif ($this->type == 'group') {
|
||||
$this->getSecondLevel();
|
||||
} elseif ($this->type == 'agent') {
|
||||
$this->getThirdLevel();
|
||||
}
|
||||
}
|
||||
|
||||
protected function getGroupSearchFilter() {
|
||||
return "";
|
||||
}
|
||||
|
||||
protected function getFirstLevel() {
|
||||
$processed_items = $this->getProcessedGroups();
|
||||
|
||||
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);
|
||||
|
||||
$processed_items = ($result === false) ? array() : array($result);
|
||||
}
|
||||
}
|
||||
|
||||
$this->tree = $processed_items;
|
||||
}
|
||||
|
||||
protected function getProcessedGroups () {
|
||||
$processed_groups = array();
|
||||
// Index and process the groups
|
||||
$groups = $this->getGroupCounters();
|
||||
|
||||
// If user have not permissions in parent, set parent node to 0 (all)
|
||||
// Avoid to do foreach for admins
|
||||
if (!users_can_manage_group_all("AR")) {
|
||||
foreach ($groups as $id => $group) {
|
||||
if (!isset($this->userGroups[$groups[$id]['parent']])) {
|
||||
$groups[$id]['parent'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Build the group hierarchy
|
||||
foreach ($groups as $id => $group) {
|
||||
if (isset($groups[$id]['parent']) && ($groups[$id]['parent'] != 0)) {
|
||||
$parent = $groups[$id]['parent'];
|
||||
// Parent exists
|
||||
if (!isset($groups[$parent]['children'])) {
|
||||
$groups[$parent]['children'] = array();
|
||||
}
|
||||
// Store a reference to the group into the parent
|
||||
$groups[$parent]['children'][] = &$groups[$id];
|
||||
// This group was introduced into a parent
|
||||
$groups[$id]['have_parent'] = true;
|
||||
}
|
||||
}
|
||||
// Sort the children groups
|
||||
foreach ($groups as $id => $group) {
|
||||
if (isset($groups[$id]['children'])) {
|
||||
usort($groups[$id]['children'], array("Tree", "cmpSortNames"));
|
||||
}
|
||||
}
|
||||
//Filter groups and eliminates the reference to children groups out of her parent
|
||||
$groups = array_filter($groups, function ($group) {
|
||||
return !$group['have_parent'];
|
||||
});
|
||||
// Propagate child counters to her parents
|
||||
|
||||
if ($this->propagateCounters) {
|
||||
TreeGroup::processCounters($groups);
|
||||
// Filter groups and eliminates the reference to empty groups
|
||||
$groups = $this->deleteEmptyGroups($groups);
|
||||
} else {
|
||||
$groups = $this->deleteEmptyGroupsNotPropagate($groups);
|
||||
}
|
||||
|
||||
usort($groups, array("Tree", "cmpSortNames"));
|
||||
return $groups;
|
||||
}
|
||||
|
||||
protected function getGroupCounters() {
|
||||
$fields = $this->getFirstLevelFields();
|
||||
$inside_fields = $this->getFirstLevelFieldsInside();
|
||||
|
||||
$group_acl = "";
|
||||
$secondary_group_acl = "";
|
||||
if (!users_can_manage_group_all("AR")) {
|
||||
$user_groups_str = implode(",", $this->userGroupsArray);
|
||||
$group_acl = " AND ta.id_grupo IN ($user_groups_str)";
|
||||
$secondary_group_acl = " AND tasg.id_group IN ($user_groups_str)";
|
||||
}
|
||||
$agent_search_filter = $this->getAgentSearchFilter();
|
||||
$agent_search_filter = preg_replace("/%/", "%%", $agent_search_filter);
|
||||
$agent_status_filter = $this->getAgentStatusFilter();
|
||||
$module_status_filter = $this->getModuleStatusFilter();
|
||||
|
||||
$module_search_inner = "";
|
||||
$module_search_filter = "";
|
||||
if (!empty($this->filter['searchModule'])) {
|
||||
$module_search_inner = "
|
||||
INNER JOIN tagente_modulo tam
|
||||
ON ta.id_agente = tam.id_agente
|
||||
INNER JOIN tagente_estado tae
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo";
|
||||
$module_search_filter = "AND tam.disabled = 0
|
||||
AND tam.nombre LIKE '%%" . $this->filter['searchModule'] . "%%' " .
|
||||
$this->getModuleStatusFilterFromTestado()
|
||||
;
|
||||
}
|
||||
|
||||
$table = is_metaconsole() ? "tmetaconsole_agent" : "tagente";
|
||||
$table_sec = is_metaconsole() ? "tmetaconsole_agent_secondary_group" : "tagent_secondary_group";
|
||||
|
||||
$sql_model = "SELECT %s FROM
|
||||
(
|
||||
SELECT COUNT(DISTINCT(ta.id_agente)) AS total, id_grupo AS g
|
||||
FROM $table ta
|
||||
$module_search_inner
|
||||
WHERE ta.disabled = 0
|
||||
%s
|
||||
$agent_search_filter
|
||||
$agent_status_filter
|
||||
$module_status_filter
|
||||
$module_search_filter
|
||||
$group_acl
|
||||
GROUP BY id_grupo
|
||||
UNION ALL
|
||||
SELECT COUNT(DISTINCT(ta.id_agente)) AS total, id_group AS g
|
||||
FROM $table ta INNER JOIN $table_sec tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
$module_search_inner
|
||||
WHERE ta.disabled = 0
|
||||
%s
|
||||
$agent_search_filter
|
||||
$agent_status_filter
|
||||
$module_status_filter
|
||||
$module_search_filter
|
||||
$secondary_group_acl
|
||||
GROUP BY id_group
|
||||
) x GROUP BY g";
|
||||
$sql_array = array();
|
||||
foreach ($inside_fields as $inside_field) {
|
||||
$sql_array[] = sprintf(
|
||||
$sql_model,
|
||||
$inside_field['header'],
|
||||
$inside_field['condition'],
|
||||
$inside_field['condition']
|
||||
);
|
||||
}
|
||||
$sql = "SELECT $fields FROM (" . implode(" UNION ALL ", $sql_array) . ") x2
|
||||
RIGHT JOIN tgrupo tg
|
||||
ON x2.g = tg.id_grupo
|
||||
GROUP BY tg.id_grupo";
|
||||
$stats = db_get_all_rows_sql($sql);
|
||||
|
||||
$group_stats = array();
|
||||
foreach ($stats as $group) {
|
||||
$group_stats[$group['gid']]['total_count'] = (int)$group['total_count'];
|
||||
$group_stats[$group['gid']]['total_critical_count'] = (int)$group['total_critical_count'];
|
||||
$group_stats[$group['gid']]['total_unknown_count'] = (int)$group['total_unknown_count'];
|
||||
$group_stats[$group['gid']]['total_warning_count'] = (int)$group['total_warning_count'];
|
||||
$group_stats[$group['gid']]['total_not_init_count'] = (int)$group['total_not_init_count'];
|
||||
$group_stats[$group['gid']]['total_normal_count'] = (int)$group['total_normal_count'];
|
||||
$group_stats[$group['gid']]['total_fired_count'] = (int)$group['total_alerts_count'];
|
||||
$group_stats[$group['gid']]['name'] = $group['name'];
|
||||
$group_stats[$group['gid']]['parent'] = $group['parent'];
|
||||
$group_stats[$group['gid']]['icon'] = $group['icon'];
|
||||
$group_stats[$group['gid']]['id'] = $group['gid'];
|
||||
$group_stats[$group['gid']] = $this->getProcessedItem($group_stats[$group['gid']]);
|
||||
}
|
||||
|
||||
return $group_stats;
|
||||
}
|
||||
|
||||
protected function getFirstLevelFields() {
|
||||
$fields = parent::getFirstLevelFields();
|
||||
$parent = $this->getDisplayHierarchy() ? 'tg.parent' : '0 as parent';
|
||||
return "$fields, $parent";
|
||||
}
|
||||
|
||||
protected function getProcessedModules($modules_tree) {
|
||||
|
||||
$groups = array();
|
||||
foreach ($modules_tree as $group) {
|
||||
$groups[$group["id"]] = $group;
|
||||
}
|
||||
|
||||
// Build the module hierarchy
|
||||
foreach ($groups as $id => $group) {
|
||||
if (isset($groups[$id]['parent']) && ($groups[$id]['parent'] != 0)) {
|
||||
$parent = $groups[$id]['parent'];
|
||||
// Parent exists
|
||||
if (!isset($groups[$parent]['children'])) {
|
||||
$groups[$parent]['children'] = array();
|
||||
}
|
||||
// Store a reference to the group into the parent
|
||||
$groups[$parent]['children'][] = &$groups[$id];
|
||||
// This group was introduced into a parent
|
||||
$groups[$id]['have_parent'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the children groups
|
||||
foreach ($groups as $id => $group) {
|
||||
if (isset($groups[$id]['children'])) {
|
||||
usort($groups[$id]['children'], array("Tree", "cmpSortNames"));
|
||||
}
|
||||
}
|
||||
//Filter groups and eliminates the reference to children groups out of her parent
|
||||
$groups = array_filter($groups, function ($group) {
|
||||
return !$group['have_parent'];
|
||||
});
|
||||
|
||||
return array_values($groups);
|
||||
}
|
||||
|
||||
// FIXME: Hierarchy lops is broken
|
||||
protected function getProcessedModules_old($modules_tree) {
|
||||
|
||||
$tree_modules = array();
|
||||
$new_modules_root = array_filter($modules_tree, function ($module) {
|
||||
return (isset($module['parent']) && ($module['parent'] == 0));
|
||||
});
|
||||
|
||||
$new_modules_child = array_filter($modules_tree, function ($module) {
|
||||
return (isset($module['parent']) && ($module['parent'] != 0));
|
||||
});
|
||||
|
||||
$i = 0;
|
||||
while (!empty($new_modules_child)) {
|
||||
foreach ($new_modules_child as $i => $child) {
|
||||
TreeGroup::recursive_modules_tree_view($new_modules_root, $new_modules_child, $i, $child);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($new_modules_root as $m) {
|
||||
$tree_modules[] = $m;
|
||||
}
|
||||
return $tree_modules;
|
||||
}
|
||||
|
||||
// FIXME with getProcessedModules_old
|
||||
static function recursive_modules_tree_view (&$new_modules, &$new_modules_child, $i, $child) {
|
||||
foreach ($new_modules as $index => $module) {
|
||||
if ($module['id'] == $child['parent']) {
|
||||
$new_modules[$index]['children'][] = $child;
|
||||
unset($new_modules_child[$i]);
|
||||
break;
|
||||
}
|
||||
else if (isset($new_modules[$index]['children'])) {
|
||||
TreeGroup::recursive_modules_tree_view ($new_modules[$index]['children'], $new_modules_child, $i, $child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static function processCounters(&$groups) {
|
||||
$all_counters = array();
|
||||
foreach ($groups as $id => $group) {
|
||||
$child_counters = array();
|
||||
if (!empty($groups[$id]['children'])) {
|
||||
$child_counters = TreeGroup::processCounters($groups[$id]['children']);
|
||||
}
|
||||
if (!empty($child_counters)) {
|
||||
foreach($child_counters as $type => $value) {
|
||||
$groups[$id]['counters'][$type] += $value;
|
||||
}
|
||||
}
|
||||
foreach($groups[$id]['counters'] as $type => $value) {
|
||||
$all_counters[$type] += $value;
|
||||
}
|
||||
}
|
||||
return $all_counters;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Recursive function to remove the empty groups
|
||||
*
|
||||
* @param groups All groups structure
|
||||
*
|
||||
* @return new_groups A new groups structure without empty groups
|
||||
*/
|
||||
protected function deleteEmptyGroups ($groups) {
|
||||
if($this->displayAllGroups) return $groups;
|
||||
$new_groups = array();
|
||||
foreach ($groups as $group) {
|
||||
// If a group is empty, do not add to new_groups.
|
||||
if (!isset($group['counters']['total']) || $group['counters']['total'] == 0) {
|
||||
continue;
|
||||
}
|
||||
// Tray to remove the children groups
|
||||
if (!empty($group['children'])) {
|
||||
$children = $this->deleteEmptyGroups ($group['children']);
|
||||
if (empty($children)) unset($group['children']);
|
||||
else $group['children'] = $children;
|
||||
}
|
||||
$new_groups[] = $group;
|
||||
}
|
||||
return $new_groups;
|
||||
}
|
||||
|
||||
protected function deleteEmptyGroupsNotPropagate ($groups) {
|
||||
if($this->displayAllGroups) return $groups;
|
||||
$new_groups = array();
|
||||
foreach ($groups as $group) {
|
||||
// Tray to remove the children groups
|
||||
if (!empty($group['children'])) {
|
||||
$children = $this->deleteEmptyGroupsNotPropagate ($group['children']);
|
||||
if (empty($children)) {
|
||||
unset($group['children']);
|
||||
// If a group is empty, do not add to new_groups.
|
||||
if (isset($group['counters']['total']) && $group['counters']['total'] != 0) {
|
||||
$new_groups[] = $group;
|
||||
}
|
||||
} else {
|
||||
$group['children'] = $children;
|
||||
$new_groups[] = $group;
|
||||
}
|
||||
} else {
|
||||
// If a group is empty, do not add to new_groups.
|
||||
if (isset($group['counters']['total']) && $group['counters']['total'] != 0) {
|
||||
$new_groups[] = $group;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $new_groups;
|
||||
}
|
||||
|
||||
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)
|
||||
continue;
|
||||
|
||||
// Item found
|
||||
if ($strictACL && is_metaconsole()) {
|
||||
foreach ($item["id"] as $server_id => $id) {
|
||||
if ($id == $item_id)
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($item["id"] == $item_id)
|
||||
return $item;
|
||||
}
|
||||
|
||||
if ($item["type"] == "group" && !empty($item["children"])) {
|
||||
$result = self::extractItemWithID($item["children"], $item_id, $item_type, $strictACL);
|
||||
|
||||
// Item found on children
|
||||
if ($result !== false)
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
// Item not found
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function getDisplayHierarchy() {
|
||||
return $this->filter['searchHirearchy'] ||
|
||||
(empty($this->filter['searchAgent']) && empty($this->filter['searchModule']));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
//Pandora FMS- http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
global $config;
|
||||
|
||||
require_once($config['homedir']."/include/class/Tree.class.php");
|
||||
|
||||
class TreeGroupEdition extends TreeGroup {
|
||||
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand", $access = 'AR') {
|
||||
global $config;
|
||||
|
||||
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
}
|
||||
protected function getData() {
|
||||
if ($this->id == -1) {
|
||||
$this->getFirstLevel();
|
||||
}
|
||||
}
|
||||
|
||||
protected function getProcessedGroups () {
|
||||
$processed_groups = array();
|
||||
// Index and process the groups
|
||||
$groups = $this->getGroupCounters();
|
||||
|
||||
// If user have not permissions in parent, set parent node to 0 (all)
|
||||
// Avoid to do foreach for admins
|
||||
if (!users_can_manage_group_all("AR")) {
|
||||
foreach ($groups as $id => $group) {
|
||||
if (!isset($this->userGroups[$groups[$id]['parent']])) {
|
||||
$groups[$id]['parent'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Build the group hierarchy
|
||||
foreach ($groups as $id => $group) {
|
||||
if (isset($groups[$id]['parent']) && ($groups[$id]['parent'] != 0)) {
|
||||
$parent = $groups[$id]['parent'];
|
||||
// Parent exists
|
||||
if (!isset($groups[$parent]['children'])) {
|
||||
$groups[$parent]['children'] = array();
|
||||
}
|
||||
// Store a reference to the group into the parent
|
||||
$groups[$parent]['children'][] = &$groups[$id];
|
||||
// This group was introduced into a parent
|
||||
$groups[$id]['have_parent'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the children groups
|
||||
foreach ($groups as $id => $group) {
|
||||
if (isset($groups[$id]['children'])) {
|
||||
usort($groups[$id]['children'], array("Tree", "cmpSortNames"));
|
||||
}
|
||||
}
|
||||
//Filter groups and eliminates the reference to children groups out of her parent
|
||||
$groups = array_filter($groups, function ($group) {
|
||||
return !$group['have_parent'];
|
||||
});
|
||||
|
||||
usort($groups, array("Tree", "cmpSortNames"));
|
||||
return $groups;
|
||||
}
|
||||
|
||||
|
||||
protected function getGroupCounters() {
|
||||
$messages = array(
|
||||
'confirm' => __('Confirm'),
|
||||
'cancel' => __('Cancel'),
|
||||
'messg' => __('Are you sure?')
|
||||
);
|
||||
$sql = "SELECT id_grupo AS gid,
|
||||
nombre as name, parent, icon
|
||||
FROM tgrupo
|
||||
";
|
||||
|
||||
$stats = db_get_all_rows_sql($sql);
|
||||
$group_stats = array();
|
||||
foreach ($stats as $group) {
|
||||
$group_stats[$group['gid']]['name'] = $group['name'];
|
||||
$group_stats[$group['gid']]['parent'] = $group['parent'];
|
||||
$group_stats[$group['gid']]['icon'] = $group['icon'];
|
||||
$group_stats[$group['gid']]['id'] = $group['gid'];
|
||||
$group_stats[$group['gid']]['type'] = 'group';
|
||||
|
||||
$group_stats[$group['gid']] = $this->getProcessedItem($group_stats[$group['gid']]);
|
||||
$group_stats[$group['gid']]['delete']['messages'] = $messages;
|
||||
$group_stats[$group['gid']]['edit'] = 1;
|
||||
$group_stats[$group['gid']]['alerts'] = '';
|
||||
}
|
||||
|
||||
return $group_stats;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
//Pandora FMS- http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
global $config;
|
||||
|
||||
require_once($config['homedir']."/include/class/Tree.class.php");
|
||||
|
||||
class TreeModule extends Tree {
|
||||
|
||||
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand", $access = 'AR') {
|
||||
|
||||
global $config;
|
||||
|
||||
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
|
||||
$this->L1fieldName = 'name';
|
||||
$this->L1fieldNameSql = 'tam.nombre';
|
||||
$this->L1inner = '';
|
||||
$this->L1orderByFinal = 'name';
|
||||
|
||||
$this->L2condition = "AND tam.nombre = '" . $this->symbol2name($this->rootID) . "'";
|
||||
}
|
||||
|
||||
protected function getData() {
|
||||
if ($this->id == -1) {
|
||||
$this->getFirstLevel();
|
||||
} elseif ($this->type == 'module') {
|
||||
$this->getSecondLevel();
|
||||
} elseif ($this->type == 'agent') {
|
||||
$this->getThirdLevel();
|
||||
}
|
||||
}
|
||||
|
||||
protected function getProcessedItemsFirstLevel($items){
|
||||
$processed_items = array();
|
||||
foreach ($items as $key => $item) {
|
||||
$name = $this->name2symbol($item['name']);
|
||||
$processed_item = $this->getProcessedItem($item);
|
||||
$processed_item['id'] = $name;
|
||||
$processed_item['rootID'] = $name;
|
||||
$processed_items[] = $processed_item;
|
||||
}
|
||||
return $processed_items;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
//Pandora FMS- http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
global $config;
|
||||
|
||||
require_once($config['homedir']."/include/class/Tree.class.php");
|
||||
|
||||
class TreeModuleGroup extends Tree {
|
||||
|
||||
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand", $access = 'AR') {
|
||||
|
||||
global $config;
|
||||
|
||||
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
|
||||
$this->L1fieldName = 'id_module_group';
|
||||
$this->L1fieldNameSql = 'tam.id_module_group';
|
||||
$this->L1extraFields = array('tmg.name', 'tmg.id_mg AS id');
|
||||
$this->L1inner = 'INNER JOIN tmodule_group tmg ON tmg.id_mg = x2.g';
|
||||
$this->L1orderByFinal = 'tmg.name';
|
||||
|
||||
$this->L2condition = "AND tam.id_module_group = " . $this->rootID;
|
||||
}
|
||||
|
||||
protected function getData() {
|
||||
if ($this->id == -1) {
|
||||
$this->getFirstLevel();
|
||||
} elseif ($this->type == 'module_group') {
|
||||
$this->getSecondLevel();
|
||||
} elseif ($this->type == 'agent') {
|
||||
$this->getThirdLevel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
//Pandora FMS- http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
global $config;
|
||||
|
||||
require_once($config['homedir']."/include/class/Tree.class.php");
|
||||
|
||||
class TreeOS extends Tree {
|
||||
|
||||
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand", $access = 'AR') {
|
||||
|
||||
global $config;
|
||||
|
||||
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
|
||||
$this->L1fieldName = 'id_os';
|
||||
$this->L1fieldNameSql = 'ta.id_os';
|
||||
$this->L1extraFields = array('tco.name', 'tco.id_os AS id', 'tco.icon_name AS iconHTML');
|
||||
$this->L1inner = 'INNER JOIN tconfig_os tco ON tco.id_os = x2.g';
|
||||
$this->L1orderByFinal = 'tco.name';
|
||||
|
||||
$this->L2condition = "AND ta.id_os = " . $this->rootID;
|
||||
}
|
||||
|
||||
protected function getData() {
|
||||
if ($this->id == -1) {
|
||||
$this->getFirstLevel();
|
||||
} elseif ($this->type == 'os') {
|
||||
$this->getSecondLevel();
|
||||
} elseif ($this->type == 'agent') {
|
||||
$this->getThirdLevel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
//Pandora FMS- http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
global $config;
|
||||
|
||||
require_once($config['homedir']."/include/class/Tree.class.php");
|
||||
|
||||
class TreeTag extends Tree {
|
||||
|
||||
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand", $access = 'AR') {
|
||||
|
||||
global $config;
|
||||
|
||||
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
|
||||
$this->L1fieldName = 'id_tag';
|
||||
$this->L1fieldNameSql = 'ttm.id_tag';
|
||||
$this->L1innerInside = '
|
||||
INNER JOIN ttag_module ttm
|
||||
ON ttm.id_agente_modulo = tam.id_agente_modulo
|
||||
';
|
||||
$this->L1extraFields = array('tt.name', 'tt.id_tag AS id');
|
||||
$this->L1inner = 'INNER JOIN ttag tt ON tt.id_tag = x2.g';
|
||||
$this->L1orderByFinal = 'tt.name';
|
||||
|
||||
$this->L2condition = "AND ttm.id_tag = " . $this->rootID;
|
||||
$this->L2inner = $this->L1innerInside;
|
||||
}
|
||||
|
||||
protected function getData() {
|
||||
if ($this->id == -1) {
|
||||
$this->getFirstLevel();
|
||||
} elseif ($this->type == 'tag') {
|
||||
$this->getSecondLevel();
|
||||
} elseif ($this->type == 'agent') {
|
||||
$this->getThirdLevel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -22,8 +22,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC180718';
|
||||
$pandora_version = 'v7.0NG.724';
|
||||
$build_version = 'PC181001';
|
||||
$pandora_version = 'v7.0NG.727';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
|
@ -1360,11 +1360,41 @@ function safe_sql_string($string) {
|
|||
|
||||
function is_metaconsole() {
|
||||
global $config;
|
||||
|
||||
if ($config['metaconsole'])
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return (bool) $config['metaconsole'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if there is management operations are allowed in current context
|
||||
* (node // meta)
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_management_allowed() {
|
||||
global $config;
|
||||
return ( (is_metaconsole() && $config["centralized_management"])
|
||||
|| (!is_metaconsole() && !$config["centralized_management"]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if there is centralized management in metaconsole environment.
|
||||
* Usefull to display some policy features on metaconsole.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_central_policies() {
|
||||
global $config;
|
||||
return is_metaconsole() && $config["centralized_management"];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if there is centralized management in node environment. Usefull
|
||||
* to reduce the policy functionallity on nodes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_central_policies_on_node() {
|
||||
global $config;
|
||||
return (!is_metaconsole()) && $config["centralized_management"];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2517,15 +2547,9 @@ function set_when_empty (&$var, $default) {
|
|||
}
|
||||
}
|
||||
|
||||
function sort_by_column (&$array_ref, $column_parameter) {
|
||||
global $column;
|
||||
|
||||
$column = $column_parameter;
|
||||
|
||||
function sort_by_column (&$array_ref, $column) {
|
||||
if (!empty($column)) {
|
||||
usort($array_ref, function ($a, $b) {
|
||||
global $column;
|
||||
|
||||
usort($array_ref, function ($a, $b) use ($column) {
|
||||
return strcmp($a[$column], $b[$column]);
|
||||
});
|
||||
}
|
||||
|
@ -3250,7 +3274,7 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
|
|||
$img_url = $config["homeurl"] . "attachment/" . $img_file;
|
||||
|
||||
$width_img = 500;
|
||||
$height_img = (isset($config['graph_image_height'])) ? $config['graph_image_height'] : 350;
|
||||
$height_img = (isset($config['graph_image_height'])) ? $config['graph_image_height'] : 280;
|
||||
|
||||
$params['height'] = $height_img;
|
||||
|
||||
|
@ -3320,4 +3344,27 @@ function get_copyright_notice () {
|
|||
return $stored_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a random code to prevent cross site request fogery attacks
|
||||
*
|
||||
* @return string Generated code
|
||||
*/
|
||||
function generate_csrf_code() {
|
||||
// Start session to make this var permanent
|
||||
session_start();
|
||||
$_SESSION['csrf_code'] = md5(uniqid(mt_rand(), true));
|
||||
session_write_close();
|
||||
return $_SESSION['csrf_code'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the CSRF code
|
||||
*
|
||||
* @return bool True if code is valid
|
||||
*/
|
||||
function validate_csrf_code() {
|
||||
$code = get_parameter('csrf_code');
|
||||
return isset($code) && isset($_SESSION['csrf_code'])
|
||||
&& $_SESSION['csrf_code'] == $code;
|
||||
}
|
||||
?>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue