Merge remote-tracking branch 'origin/develop' into 1827-Graficas_TIP_eje_x_no_mantiene_ratio
Conflicts: pandora_console/include/functions_graph.php pandora_console/include/graphs/fgraph.php pandora_console/include/graphs/flot/pandora.flot.js pandora_console/include/graphs/functions_flot.php
This commit is contained in:
commit
e7a8706434
|
@ -1,3 +1,4 @@
|
|||
# Dockerfile for the Pandora FMS image.
|
||||
FROM debian:jessie
|
||||
|
||||
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
FROM pandorafms/pandorafms-base
|
||||
|
||||
# Build variables.
|
||||
ARG BRANCH=develop
|
||||
ARG DB_PASS=pandora
|
||||
|
||||
# Clone the Pandora FMS repo.
|
||||
RUN git clone --depth 1 -b "$BRANCH" https://github.com/pandorafms/pandorafms.git /tmp/pandorafms
|
||||
|
||||
# Install the Pandora FMS Server.
|
||||
RUN cd /tmp/pandorafms/pandora_server && \
|
||||
yes | ./pandora_server_installer --install && \
|
||||
sed -i "s/^dbuser.*/dbuser root/" /etc/pandora/pandora_server.conf && \
|
||||
sed -i "s/^dbpass.*/dbpass $DB_PASS/" /etc/pandora/pandora_server.conf
|
||||
|
||||
# Install the Pandora FMS Agent.
|
||||
RUN cd /tmp/pandorafms/pandora_agents/unix && \
|
||||
./pandora_agent_installer --install
|
||||
|
||||
# Set the server's name in Apache's configuration file to avoid warnings.
|
||||
RUN sed -i "s/#ServerName.*/ServerName localhost:80/" /etc/httpd/conf/httpd.conf
|
||||
|
||||
# Install the Pandora FMS Console.
|
||||
RUN service mysqld start && \
|
||||
/usr/bin/mysqladmin -u root password "$DB_PASS" && \
|
||||
service httpd start && \
|
||||
cp -r /tmp/pandorafms/pandora_console /var/www/html && \
|
||||
chown -R apache.apache /var/www/html/pandora_console/ && \
|
||||
python /tmp/pandorafms/tests/install_console.py
|
||||
|
||||
# Redirect HTTP requests to / to the Pandora FMS Console.
|
||||
RUN echo '<meta http-equiv="refresh" content="0;url=/pandora_console">' > /var/www/html/index.html
|
||||
|
||||
# Create the entrypoint script.
|
||||
RUN echo -e '#/bin/bash\n \
|
||||
service mysqld start &&\n \
|
||||
service httpd start &&\n \
|
||||
service crond start &&\n \
|
||||
/etc/init.d/pandora_agent_daemon start && \
|
||||
/etc/init.d/pandora_server start && \
|
||||
tail -f /var/log/pandora/pandora_server.log' \
|
||||
>> /entrypoint.sh && \
|
||||
chmod +x /entrypoint.sh
|
||||
|
||||
# Clean-up.
|
||||
RUN rm -rf /tmp/pandorafms
|
||||
RUN yum clean all
|
||||
|
||||
EXPOSE 80 3306 41121
|
||||
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
docker build --rm=true --build-arg BRANCH="develop" --build-arg DB_PASS="pandora" -t pandorafms/pandorafms:7 . && \
|
||||
docker push pandorafms/pandorafms:7
|
|
@ -65,7 +65,8 @@ $PANDHOME_ENT/pandora_plugins/MTL/pandora_mtl.pl \
|
|||
$PANDHOME_ENT/pandora_plugins/Informix/informix.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Ruckus/ruckus.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/UX/pandora_ux.pl \
|
||||
$PANDHOME_ENT/pandora_server/util/plugins/vmware-plugin.pl "
|
||||
$PANDHOME_ENT/pandora_plugins/JMX/pandora_plugin_jmx.pl \
|
||||
$PANDHOME_ENT/pandora_server/util/plugin/vmware-plugin.pl "
|
||||
PLUGIN_LIB_FILE="$CODEHOME/pandora_server/lib/PandoraFMS/PluginTools.pm"
|
||||
|
||||
# Update version in spec files
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719, AIX version
|
||||
# Version 7.0NG.722, 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.719, FreeBSD Version
|
||||
# Version 7.0NG.722, 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.719, HP-UX Version
|
||||
# Version 7.0NG.722, 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.719, GNU/Linux
|
||||
# Version 7.0NG.722, 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.719, GNU/Linux
|
||||
# Version 7.0NG.722, 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.719, Solaris Version
|
||||
# Version 7.0NG.722, 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.719
|
||||
# Version 7.0NG.722
|
||||
|
||||
# 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.719, AIX version
|
||||
# Version 7.0NG.722, 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.719
|
||||
# Version 7.0NG.722
|
||||
# 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.719, HPUX Version
|
||||
# Version 7.0NG.722, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719
|
||||
# Version 7.0NG.722
|
||||
# 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.719
|
||||
# Version 7.0NG.722
|
||||
# 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.719
|
||||
# Version 7.0NG.722
|
||||
# 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.719, Solaris version
|
||||
# Version 7.0NG.722, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719, AIX version
|
||||
# Version 7.0NG.722, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -102,6 +102,9 @@ transfer_mode tentacle
|
|||
# Agent mode: Learn (default), No-learn, Autodisable
|
||||
# agent_mode autodisable
|
||||
|
||||
# Secondary groups. You can select several groups separated by comma.
|
||||
# secondary_groups Group1,Group2
|
||||
|
||||
# Secondary server configuration
|
||||
# ==============================
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.719-180301
|
||||
Version: 7.0NG.722-180423
|
||||
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.719-180301"
|
||||
pandora_version="7.0NG.722-180423"
|
||||
|
||||
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.719, GNU/Linux
|
||||
# Version 7.0NG.722, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -143,6 +143,9 @@ transfer_mode tentacle
|
|||
# Agent mode: Learn (default), No-learn, Autodisable
|
||||
# agent_mode autodisable
|
||||
|
||||
# Secondary groups. You can select several groups separated by comma.
|
||||
# secondary_groups Group1,Group2
|
||||
|
||||
# Secondary server configuration
|
||||
# ==============================
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719, FreeBSD Version
|
||||
# Version 7.0NG.722, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -153,6 +153,9 @@ xml_buffer 1
|
|||
# Minimum available bytes in the temporal directory to enable the XML buffer
|
||||
temporal_min_size 1024
|
||||
|
||||
# Secondary groups. You can select several groups separated by comma.
|
||||
# secondary_groups Group1,Group2
|
||||
|
||||
#Secondary server configuration
|
||||
#==============================
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719, HP-UX Version
|
||||
# Version 7.0NG.722, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -104,6 +104,9 @@ transfer_mode tentacle
|
|||
# Agent mode: Learn (default), No-learn, Autodisable
|
||||
# agent_mode autodisable
|
||||
|
||||
# Secondary groups. You can select several groups separated by comma.
|
||||
# secondary_groups Group1,Group2
|
||||
|
||||
# Secondary server configuration
|
||||
# ==============================
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719, GNU/Linux
|
||||
# Version 7.0NG.722, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -167,6 +167,9 @@ temporal_min_size 1024
|
|||
# the eHorus agent's identifying key
|
||||
ehorus_conf /etc/ehorus/ehorus_agent.conf
|
||||
|
||||
# Secondary groups. You can select several groups separated by comma.
|
||||
# secondary_groups Group1,Group2
|
||||
|
||||
# Secondary server configuration
|
||||
# ==============================
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719, GNU/Linux
|
||||
# Version 7.0NG.722, 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.719, NetBSD Version
|
||||
# Version 7.0NG.722, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -116,6 +116,9 @@ transfer_mode tentacle
|
|||
# Agent mode: Learn (default), No-learn, Autodisable
|
||||
# agent_mode autodisable
|
||||
|
||||
# Secondary groups. You can select several groups separated by comma.
|
||||
# secondary_groups Group1,Group2
|
||||
|
||||
# Secondary server configuration
|
||||
# ==============================
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719, Solaris Version
|
||||
# Version 7.0NG.722, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -107,6 +107,9 @@ transfer_mode tentacle
|
|||
# Agent mode: Learn (default), No-learn, Autodisable
|
||||
# agent_mode autodisable
|
||||
|
||||
# Secondary groups. You can select several groups separated by comma.
|
||||
# secondary_groups Group1,Group2
|
||||
|
||||
# Secondary server configuration
|
||||
# ==============================
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.719';
|
||||
use constant AGENT_BUILD => '180301';
|
||||
use constant AGENT_VERSION => '7.0NG.722';
|
||||
use constant AGENT_BUILD => '180423';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -3066,6 +3066,10 @@ while (1) {
|
|||
$xml_header .= "' parent_agent_name='" .$Conf{'parent_agent_name'};
|
||||
}
|
||||
|
||||
if (defined ($Conf{'secondary_groups'})) {
|
||||
$xml_header .= "' secondary_groups='" .$Conf{'secondary_groups'};
|
||||
}
|
||||
|
||||
if (defined ($Conf{'agent_mode'})) {
|
||||
if ($Conf{'agent_mode'} =~ m/no.?learn/ig) {
|
||||
$xml_header .= "' agent_mode='0";
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.719
|
||||
%define release 180301
|
||||
%define version 7.0NG.722
|
||||
%define release 180423
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.719
|
||||
%define release 180301
|
||||
%define version 7.0NG.722
|
||||
%define release 180423
|
||||
|
||||
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.719"
|
||||
PI_BUILD="180301"
|
||||
PI_VERSION="7.0NG.722"
|
||||
PI_BUILD="180423"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -215,6 +215,7 @@ sub print_log (@) {
|
|||
$output .= "<source><![CDATA[" . $Module_name . "]]></source>\n";
|
||||
$output .= "<data><![CDATA[";
|
||||
foreach my $line (@data) {
|
||||
$line =~ s/\]\]/]]]]><![CDATA[/g;
|
||||
$output .= $line;
|
||||
}
|
||||
$output .= "]]></data>";
|
||||
|
@ -229,6 +230,7 @@ sub print_log (@) {
|
|||
$output .= "<type><![CDATA[async_string]]></type>\n";
|
||||
$output .= "<datalist>\n";
|
||||
foreach my $line (@data) {
|
||||
$line =~ s/\]\]/]]]]><![CDATA[/g;
|
||||
$output .= "<data><value><![CDATA[$line]]></value></data>\n";
|
||||
}
|
||||
$output .= "</datalist>\n";
|
||||
|
|
|
@ -201,6 +201,8 @@ sub get_software_module_data ($$) {
|
|||
$module{'program'} =~ s/;/,/g;
|
||||
$module{'version'} =~ s/;/,/g;
|
||||
$module{'description'} =~ s/;/,/g;
|
||||
# Replace ellipsis character to avoid encoding errors
|
||||
$module{'description'} =~ s/…/.../g;
|
||||
$module{'_keys'} = ['program', 'version','description'];
|
||||
push (@{$modules->{$name}}, \%module);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2017 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.719
|
||||
# Version 7.0NG.722
|
||||
|
||||
# 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
|
||||
|
@ -104,6 +104,9 @@ xml_buffer 1
|
|||
#It try to find the EKID and set it like a custom field.
|
||||
ehorus_conf "C:\Program Files\ehorus_agent\ehorus_agent.conf"
|
||||
|
||||
# Secondary groups. You can select several groups separated by comma.
|
||||
# secondary_groups Group1,Group2
|
||||
|
||||
# Secondary server configuration
|
||||
# ==============================
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.719}
|
||||
{Pandora FMS Windows Agent v7.0NG.722}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{180301}
|
||||
{180423}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -532,6 +532,7 @@ Pandora_Module::getXml () {
|
|||
try {
|
||||
data_clean = strreplace (this->getDataOutput (data),
|
||||
"%", "%%" );
|
||||
data_clean = strreplace (data_clean, "]]>", "]]><![CDATA[");
|
||||
} catch (Module_Exception e) {
|
||||
continue;
|
||||
}
|
||||
|
@ -542,6 +543,7 @@ Pandora_Module::getXml () {
|
|||
data = data_list->front ();
|
||||
try {
|
||||
data_clean = strreplace (this->getDataOutput (data), "%", "%%" );
|
||||
data_clean = strreplace (data_clean, "]]>", "]]><![CDATA[");
|
||||
module_xml += data_clean;
|
||||
|
||||
} catch (Module_Exception e) {
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.719(Build 180301)")
|
||||
#define PANDORA_VERSION ("7.0NG.722(Build 180423)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -635,6 +635,7 @@ Pandora_Windows_Service::getXmlHeader () {
|
|||
"\" os_version=\"" + os_version +
|
||||
"\" group=\"" + conf->getValue ("group") +
|
||||
"\" parent_agent_name=\"" + conf->getValue ("parent_agent_name") +
|
||||
"\" secondary_groups=\"" + conf->getValue ("secondary_groups") +
|
||||
"\" agent_mode=\"" + agent_mode +
|
||||
"\">\n";
|
||||
return xml;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.719(Build 180301))"
|
||||
VALUE "ProductVersion", "(7.0NG.722(Build 180423))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.719-180301
|
||||
Version: 7.0NG.722-180423
|
||||
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.719-180301"
|
||||
pandora_version="7.0NG.722-180423"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -122,7 +122,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") . '/hand_point.png" title="' . __("Use this OID") . '" style="vertical-align: middle;"></img></a>')), false);
|
||||
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 ('incremental_base', '0');
|
||||
|
||||
echo '<script type="text/javascript" src="extensions/realtime_graphs/realtime_graphs.js"></script>';
|
||||
|
|
|
@ -10,4 +10,55 @@ START TRANSACTION;
|
|||
EXECUTE pr_oum720;
|
||||
DEALLOCATE PREPARE pr_oum720;
|
||||
|
||||
INSERT INTO `tconfig_os` (`id_os`, `name`, `description`, `icon_name`) VALUES (100, 'Cluster', 'Cluster agent', 'so_cluster.png');
|
||||
|
||||
UPDATE `tagente` SET `id_os` = 100 WHERE `id_os` = 21 and (select `id_os` from `tconfig_os` WHERE `id_os` = 21 and `name` = 'Cluster');
|
||||
|
||||
DELETE FROM `tconfig_os` where `id_os` = 21 and `name` = 'Cluster';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tprovisioning`(
|
||||
`id` int unsigned NOT NULL auto_increment,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`description` TEXT default '',
|
||||
`order` int(11) NOT NULL default 0,
|
||||
`config` TEXT default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tprovisioning_rules`(
|
||||
`id` int unsigned NOT NULL auto_increment,
|
||||
`id_provisioning` int unsigned NOT NULL,
|
||||
`order` int(11) NOT NULL default 0,
|
||||
`operator` enum('AND','OR') default 'OR',
|
||||
`type` enum('alias','ip-range') default 'alias',
|
||||
`value` varchar(100) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_provisioning`) REFERENCES tprovisioning(`id`)
|
||||
ON DELETE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
create table IF NOT EXISTS `tmigration_queue`(
|
||||
`id` int unsigned not null auto_increment,
|
||||
`id_source_agent` int unsigned not null,
|
||||
`id_target_agent` int unsigned not null,
|
||||
`id_source_node` int unsigned not null,
|
||||
`id_target_node` int unsigned not null,
|
||||
`priority` int unsigned default 0,
|
||||
`step` int default 0,
|
||||
`running` tinyint(2) default 0,
|
||||
`active_db_only` tinyint(2) default 0,
|
||||
PRIMARY KEY(`id`)
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
create table IF NOT EXISTS `tmigration_module_queue`(
|
||||
`id` int unsigned not null auto_increment,
|
||||
`id_migration` int unsigned not null,
|
||||
`id_source_agentmodule` int unsigned not null,
|
||||
`id_target_agentmodule` int unsigned not null,
|
||||
`last_replication_timestamp` bigint(20) NOT NULL default 0,
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY(`id_migration`) REFERENCES tmigration_queue(`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
COMMIT;
|
|
@ -0,0 +1,54 @@
|
|||
START TRANSACTION;
|
||||
|
||||
UPDATE `tagente` SET `id_os` = 100 WHERE `id_os` = 21 and (select `id_os` from `tconfig_os` WHERE `id_os` = 21 and `name` = 'Cluster');
|
||||
|
||||
DELETE FROM `tconfig_os` where `id_os` = 21 and `name` = 'Cluster';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tagent_secondary_group`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
create table IF NOT EXISTS `tagent_secondary_group`(
|
||||
`id` int unsigned not null auto_increment,
|
||||
`id_agent` int(10) unsigned NOT NULL,
|
||||
`id_group` mediumint(4) unsigned NOT NULL,
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY(`id_agent`) REFERENCES tagente(`id_agente`)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(`id_group`) REFERENCES tgrupo(`id_grupo`)
|
||||
ON DELETE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmetaconsole_agent_secondary_group`
|
||||
-- ---------------------------------------------------------------------
|
||||
create table IF NOT EXISTS `tmetaconsole_agent_secondary_group`(
|
||||
`id` int unsigned not null auto_increment,
|
||||
`id_agent` int(10) unsigned NOT NULL,
|
||||
`id_tagente` int(10) unsigned NOT NULL,
|
||||
`id_tmetaconsole_setup` int(10) NOT NULL,
|
||||
`id_group` mediumint(4) unsigned NOT NULL,
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY(`id_agent`) REFERENCES tmetaconsole_agent(`id_agente`)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(`id_group`) REFERENCES tgrupo(`id_grupo`)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`)
|
||||
ON DELETE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
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';
|
||||
|
||||
SET @st_oum721 = (SELECT IF(
|
||||
(SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'tuser_task_scheduled') > 0,
|
||||
"ALTER TABLE tuser_task_scheduled ADD (id_grupo int(10) unsigned NOT NULL Default 0)",
|
||||
"0"
|
||||
));
|
||||
|
||||
PREPARE pr_oum721 FROM @st_oum721;
|
||||
EXECUTE pr_oum721;
|
||||
DEALLOCATE PREPARE pr_oum721;
|
||||
|
||||
COMMIT;
|
|
@ -1164,6 +1164,16 @@ UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.ph
|
|||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '720');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tconfig_os`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
INSERT INTO `tconfig_os` (`id_os`, `name`, `description`, `icon_name`) VALUES (100, 'Cluster', 'Cluster agent', 'so_cluster.png');
|
||||
|
||||
UPDATE `tagente` SET `id_os` = 100 WHERE `id_os` = 21 and (select `id_os` from `tconfig_os` WHERE `id_os` = 21 and `name` = 'Cluster');
|
||||
|
||||
DELETE FROM `tconfig_os` where `id_os` = 21 and `name` = 'Cluster';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tplanned_downtime_agents`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
@ -1358,6 +1368,7 @@ END IF;
|
|||
SET @vv2 = (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'tuser_task_scheduled');
|
||||
IF @vv2>0 THEN
|
||||
ALTER TABLE tuser_task_scheduled MODIFY args TEXT NOT NULL;
|
||||
ALTER TABLE tuser_task_scheduled ADD (id_grupo int(10) unsigned NOT NULL Default 0);
|
||||
END IF;
|
||||
END;
|
||||
//
|
||||
|
@ -1533,3 +1544,100 @@ create table IF NOT EXISTS `tcluster_agent`(
|
|||
FOREIGN KEY (`id_cluster`) REFERENCES tcluster(`id`)
|
||||
ON UPDATE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tprovisioning`
|
||||
-- ---------------------------------------------------------------------
|
||||
create table IF NOT EXISTS `tprovisioning`(
|
||||
`id` int unsigned NOT NULL auto_increment,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`description` TEXT default '',
|
||||
`order` int(11) NOT NULL default 0,
|
||||
`config` TEXT default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tprovisioning_rules`
|
||||
-- ---------------------------------------------------------------------
|
||||
create table IF NOT EXISTS `tprovisioning_rules`(
|
||||
`id` int unsigned NOT NULL auto_increment,
|
||||
`id_provisioning` int unsigned NOT NULL,
|
||||
`order` int(11) NOT NULL default 0,
|
||||
`operator` enum('AND','OR') default 'OR',
|
||||
`type` enum('alias','ip-range') default 'alias',
|
||||
`value` varchar(100) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_provisioning`) REFERENCES tprovisioning(`id`)
|
||||
ON DELETE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmigration_queue`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
create table IF NOT EXISTS `tmigration_queue`(
|
||||
`id` int unsigned not null auto_increment,
|
||||
`id_source_agent` int unsigned not null,
|
||||
`id_target_agent` int unsigned not null,
|
||||
`id_source_node` int unsigned not null,
|
||||
`id_target_node` int unsigned not null,
|
||||
`priority` int unsigned default 0,
|
||||
`step` int default 0,
|
||||
`running` tinyint(2) default 0,
|
||||
`active_db_only` tinyint(2) default 0,
|
||||
PRIMARY KEY(`id`)
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmigration_module_queue`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
create table IF NOT EXISTS `tmigration_module_queue`(
|
||||
`id` int unsigned not null auto_increment,
|
||||
`id_migration` int unsigned not null,
|
||||
`id_source_agentmodule` int unsigned not null,
|
||||
`id_target_agentmodule` int unsigned not null,
|
||||
`last_replication_timestamp` bigint(20) NOT NULL default 0,
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY(`id_migration`) REFERENCES tmigration_queue(`id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tagent_secondary_group`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
create table IF NOT EXISTS `tagent_secondary_group`(
|
||||
`id` int unsigned not null auto_increment,
|
||||
`id_agent` int(10) unsigned NOT NULL,
|
||||
`id_group` mediumint(4) unsigned NOT NULL,
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY(`id_agent`) REFERENCES tagente(`id_agente`)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(`id_group`) REFERENCES tgrupo(`id_grupo`)
|
||||
ON DELETE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmetaconsole_agent_secondary_group`
|
||||
-- ---------------------------------------------------------------------
|
||||
create table IF NOT EXISTS `tmetaconsole_agent_secondary_group`(
|
||||
`id` int unsigned not null auto_increment,
|
||||
`id_agent` int(10) unsigned NOT NULL,
|
||||
`id_tagente` int(10) unsigned NOT NULL,
|
||||
`id_tmetaconsole_setup` int(10) NOT NULL,
|
||||
`id_group` mediumint(4) unsigned NOT NULL,
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY(`id_agent`) REFERENCES tmetaconsole_agent(`id_agente`)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(`id_group`) REFERENCES tgrupo(`id_grupo`)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`)
|
||||
ON DELETE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
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';
|
||||
|
|
|
@ -49,8 +49,17 @@ ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no cl
|
|||
echo __('<b>Clusters to guarantee service</b>: these are active - passive (A/P) mode clusters. It means that one of the nodes (or machines that make up the cluster) will be running (primary) and another won\'t (secondary). When the primary goes down, the secondary must take over and give the service instead. Although many of the elements of this cluster are active-passive, it will also have active elements in both of them that indicate that the passive node is "online", so that in the case of a service failure in the master, the active node collects this information.');
|
||||
|
||||
?></p>
|
||||
|
||||
<?php
|
||||
if(check_acl ($config['id_user'], 0, "AW")) {
|
||||
?>
|
||||
|
||||
<form action="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&step=1" method="post">
|
||||
<input style="margin-bottom:20px;" type="submit" class="button_task" value="<?php echo __('Create Cluster'); ?>" />
|
||||
</form>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
|
@ -13,6 +13,16 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
|
||||
// Load global vars
|
||||
enterprise_include ('godmode/agentes/agent_manager.php');
|
||||
|
||||
require_once ('include/functions_clippy.php');
|
||||
require_once ('include/functions_servers.php');
|
||||
require_once ('include/functions_gis.php');
|
||||
require_once($config['homedir'] . "/include/functions_agents.php");
|
||||
require_once ($config['homedir'] . '/include/functions_users.php');
|
||||
|
||||
if (is_ajax ()) {
|
||||
|
||||
global $config;
|
||||
|
@ -89,16 +99,27 @@ if (is_ajax ()) {
|
|||
echo io_json_mb_encode($out);
|
||||
}
|
||||
|
||||
// And and remove groups use the same function
|
||||
$add_secondary_groups = get_parameter('add_secondary_groups');
|
||||
$remove_secondary_groups = get_parameter('remove_secondary_groups');
|
||||
if ($add_secondary_groups || $remove_secondary_groups) {
|
||||
$id_agent = get_parameter('id_agent');
|
||||
$groups_to_add = get_parameter('groups');
|
||||
if (enterprise_installed()) {
|
||||
enterprise_include('include/functions_agents.php');
|
||||
$ret = enterprise_hook(
|
||||
'agents_update_secondary_groups',
|
||||
array(
|
||||
$id_agent,
|
||||
$add_secondary_groups ? $groups_to_add : array(),
|
||||
$remove_secondary_groups ? $groups_to_add : array())
|
||||
);
|
||||
// Echo 0 in case of error. 0 Otherwise.
|
||||
echo $ret ? 1 : 0;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Load global vars
|
||||
enterprise_include ('godmode/agentes/agent_manager.php');
|
||||
|
||||
require_once ('include/functions_clippy.php');
|
||||
require_once ('include/functions_servers.php');
|
||||
require_once ('include/functions_gis.php');
|
||||
require_once($config['homedir'] . "/include/functions_agents.php");
|
||||
require_once ($config['homedir'] . '/include/functions_users.php');
|
||||
|
||||
ui_require_javascript_file('openlayers.pandora');
|
||||
|
||||
|
@ -251,8 +272,13 @@ if(is_array($modules)){
|
|||
}
|
||||
}
|
||||
|
||||
$table->data[4][0] = __('Group');
|
||||
$table->data[4][1] = html_print_select_groups(false, "AR", false, 'grupo', $grupo, '', '', 0, true);
|
||||
$table->data[4][0] = __('Primary group');
|
||||
// Cannot change primary group if user have not permission for that group
|
||||
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] .= ' <span id="group_preview">';
|
||||
$table->data[4][1] .= ui_print_group_icon ($grupo, true);
|
||||
$table->data[4][1] .= '</span>';
|
||||
|
@ -303,6 +329,54 @@ $table->style[0] = 'font-weight: bold; ';
|
|||
$table->style[4] = 'font-weight: bold;';
|
||||
$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'][1] = html_print_select_groups(
|
||||
false, // Use the current user to select the groups
|
||||
"AR", // ACL permission
|
||||
false, // Not all group
|
||||
'secondary_groups', // HTML id
|
||||
'', // No select any by default
|
||||
'', // Javascript onChange code
|
||||
'', // Do not user no selected value
|
||||
0, // Do not use no selected value
|
||||
true, // Return HTML (not echo)
|
||||
true, // Multiple selection
|
||||
true, // Sorting by default
|
||||
'', // CSS classnames (default)
|
||||
false, // Not disabled (default)
|
||||
false, // Inline styles (default)
|
||||
false, // Option style select (default)
|
||||
false, // Do not truncate the users tree (default)
|
||||
'id_grupo', // Key to get as value (default)
|
||||
false, // Not strict user (default)
|
||||
$secondary_groups_selected['plain'] // Do not show the primary group in this selection
|
||||
);
|
||||
|
||||
$table->data['secondary_groups'][2] =
|
||||
html_print_input_image ('add_secondary', 'images/darrowright.png', 1, '', true, array (
|
||||
'title' => __('Add secondary groups'),
|
||||
'onclick' => "agent_manager_add_secondary_groups(event, " . $id_agente . ");"
|
||||
)) .
|
||||
'<br /><br /><br /><br />' .
|
||||
html_print_input_image ('remove_secondary', 'images/darrowleft.png', 1, '', true, array (
|
||||
'title' => __('Remove secondary groups'),
|
||||
'onclick' => "agent_manager_remove_secondary_groups(event, " . $id_agente . ");"
|
||||
));
|
||||
|
||||
$table->data['secondary_groups'][3] = html_print_select (
|
||||
$secondary_groups_selected['for_select'], // Values
|
||||
'secondary_groups_selected', // HTML id
|
||||
'', // Selected
|
||||
'', // Javascript onChange code
|
||||
'', // Nothing selected
|
||||
0, // Nothing selected
|
||||
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);
|
||||
|
@ -575,6 +649,95 @@ ui_require_jquery_file('bgiframe');
|
|||
}
|
||||
}
|
||||
|
||||
function agent_manager_add_secondary_groups (event, id_agent) {
|
||||
event.preventDefault();
|
||||
var primary_value = $("#grupo").val()
|
||||
// The selected primary value cannot be selected like secondary
|
||||
if ($("#secondary_groups option:selected[value=" + primary_value + "]").length > 0) {
|
||||
alert("<?php echo __("Primary group cannot be secondary too.");?>")
|
||||
return
|
||||
}
|
||||
|
||||
var selected_items = new Array();
|
||||
$("#secondary_groups option:selected").each(function(){
|
||||
selected_items.push($(this).val())
|
||||
})
|
||||
|
||||
var data = {
|
||||
page: "godmode/agentes/agent_manager",
|
||||
id_agent: id_agent,
|
||||
groups: selected_items,
|
||||
add_secondary_groups: 1,
|
||||
}
|
||||
|
||||
// Make the AJAX call to update the secondary groups
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "html",
|
||||
data: data,
|
||||
success: function (data) {
|
||||
if (data == 1) {
|
||||
// Move from one input to the other
|
||||
$("#secondary_groups_selected option[value=0]").remove()
|
||||
$("#secondary_groups option:selected").each(function() {
|
||||
$(this).remove().appendTo("#secondary_groups_selected")
|
||||
})
|
||||
} else {
|
||||
console.error("Error in AJAX call to add secondary groups")
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
console.error("Fatal error in AJAX call to add secondary groups")
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function agent_manager_remove_secondary_groups (event, id_agent) {
|
||||
event.preventDefault();
|
||||
|
||||
var selected_items = new Array();
|
||||
$("#secondary_groups_selected option:selected").each(function(){
|
||||
selected_items.push($(this).val())
|
||||
})
|
||||
|
||||
var data = {
|
||||
page: "godmode/agentes/agent_manager",
|
||||
id_agent: id_agent,
|
||||
groups: selected_items,
|
||||
remove_secondary_groups: 1,
|
||||
}
|
||||
|
||||
// Make the AJAX call to update the secondary groups
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "html",
|
||||
data: data,
|
||||
success: function (data) {
|
||||
if (data == 1) {
|
||||
// Remove the groups selected if success
|
||||
$("#secondary_groups_selected option:selected").each(function(){
|
||||
$(this).remove().appendTo("#secondary_groups")
|
||||
})
|
||||
|
||||
// Add none if empty select
|
||||
if ($("#secondary_groups_selected option").length == 0) {
|
||||
$("#secondary_groups_selected").append($('<option>',{
|
||||
value: 0,
|
||||
text: "<?php echo __("None");?>"
|
||||
}))
|
||||
}
|
||||
} else {
|
||||
console.error("Error in AJAX call to add secondary groups")
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
console.error("Fatal error in AJAX call to add secondary groups")
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready (function() {
|
||||
$("select#id_os").pandoraSelectOS ();
|
||||
|
||||
|
|
|
@ -32,15 +32,18 @@ $tab = get_parameter ('tab', 'main');
|
|||
//See if id_agente is set (either POST or GET, otherwise -1
|
||||
$id_agente = (int) get_parameter ("id_agente");
|
||||
$group = 0;
|
||||
if ($id_agente)
|
||||
$all_groups = array($group);
|
||||
if ($id_agente) {
|
||||
$group = agents_get_agent_group ($id_agente);
|
||||
$all_groups = agents_get_all_groups_agent($id_agente, $group);
|
||||
}
|
||||
|
||||
if (!check_acl ($config["id_user"], $group, "AW", $id_agente)) {
|
||||
if (!check_acl_one_of_groups ($config["id_user"], $all_groups, "AW")) {
|
||||
$access_granted = false;
|
||||
switch ($tab) {
|
||||
case 'alert':
|
||||
case 'module':
|
||||
if (check_acl ($config["id_user"], $group, "AD", $id_agente)) {
|
||||
if (check_acl_one_of_groups ($config["id_user"], $all_groups, "AD")) {
|
||||
$access_granted = true;
|
||||
}
|
||||
break;
|
||||
|
@ -447,7 +450,7 @@ if ($id_agente) {
|
|||
$incidenttab['active'] = false;
|
||||
}
|
||||
|
||||
if (check_acl ($config["id_user"], $group, "AW", $id_agente)) {
|
||||
if (check_acl_one_of_groups ($config["id_user"], $all_groups, "AW")) {
|
||||
if ($has_remote_conf) {
|
||||
$agent_name = agents_get_name($id_agente);
|
||||
$agent_name = io_safe_output($agent_name);
|
||||
|
@ -555,7 +558,7 @@ if ($id_agente) {
|
|||
$help_header = 'plugins_tab';
|
||||
break;
|
||||
case "module":
|
||||
$type_module_t = (int) get_parameter ('moduletype', '');
|
||||
$type_module_t = get_parameter ('moduletype', '');
|
||||
$tab_description = '- '. __('Modules');
|
||||
if($type_module_t == 'webux'){
|
||||
$help_header = 'wux_console';
|
||||
|
@ -909,7 +912,7 @@ if ($update_agent) { // if modified some agent paramenter
|
|||
if ($id_agente) {
|
||||
//This has been done in the beginning of the page, but if an agent was created, this id might change
|
||||
$id_grupo = agents_get_agent_group ($id_agente);
|
||||
if (!check_acl ($config["id_user"], $id_grupo, "AW") && !check_acl ($config["id_user"], $id_grupo, "AD")) {
|
||||
if (!check_acl_one_of_groups ($config["id_user"], $all_groups, "AW") && !check_acl_one_of_groups ($config["id_user"], $all_groups, "AD")) {
|
||||
db_pandora_audit("ACL Violation","Trying to admin an agent without access");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
|
@ -1586,8 +1589,9 @@ if ($delete_module) { // DELETE agent module !
|
|||
WHERE tam.id_agente_modulo = tae.id_agente_modulo
|
||||
AND tam.id_agente_modulo = ' . $id_borrar_modulo);
|
||||
$id_grupo = (int) agents_get_agent_group($id_agente);
|
||||
$all_groups = agents_get_all_groups_agent ($id_agente, $id_grupo);
|
||||
|
||||
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 delete a module without admin rights");
|
||||
require ("general/noaccess.php");
|
||||
|
|
|
@ -79,16 +79,18 @@ $result = null;
|
|||
|
||||
if ($agent_to_delete) {
|
||||
$id_agente = $agent_to_delete;
|
||||
$agent_name = agents_get_name ($id_agente);
|
||||
$id_grupo = agents_get_agent_group($id_agente);
|
||||
if (check_acl ($config["id_user"], $id_grupo, "AW")) {
|
||||
if (check_acl_one_of_groups (
|
||||
$config["id_user"],
|
||||
agents_get_all_groups_agent($id_agente),
|
||||
"AW"
|
||||
)) {
|
||||
$id_agentes[0] = $id_agente;
|
||||
$result = agents_delete_agent($id_agentes);
|
||||
}
|
||||
else {
|
||||
// NO permissions.
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to delete agent \'$agent_name\'");
|
||||
"Trying to delete agent \'" . agents_get_name ($id_agente). "\'");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
@ -495,6 +497,8 @@ if ($agents !== false) {
|
|||
|
||||
$id_grupo = $agent["id_grupo"];
|
||||
|
||||
$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;
|
||||
|
||||
|
@ -564,22 +568,38 @@ if ($agents !== false) {
|
|||
|
||||
echo '</span><div class="left actions" style="visibility: hidden; clear: left">';
|
||||
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
|
||||
echo '<a href="index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&tab=main&
|
||||
id_agente='.$agent["id_agente"].'">'.__('Edit').'</a>';
|
||||
echo ' | ';
|
||||
if($agent["id_os"] == 21){
|
||||
$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>';
|
||||
echo ' | ';
|
||||
}
|
||||
else{
|
||||
echo '<a href="index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&tab=main&
|
||||
id_agente='.$agent["id_agente"].'">'.__('Edit').'</a>';
|
||||
echo ' | ';
|
||||
}
|
||||
}
|
||||
if($agent["id_os"] != 21){
|
||||
echo '<a href="index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&tab=module&
|
||||
id_agente='.$agent["id_agente"].'">'.__('Modules').'</a>';
|
||||
echo ' | ';
|
||||
}
|
||||
|
||||
echo '<a href="index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&tab=alert&
|
||||
id_agente='.$agent["id_agente"].'">'.__('Alerts').'</a>';
|
||||
echo ' | ';
|
||||
echo '<a href="index.php?sec=estado
|
||||
|
||||
if($agent["id_os"] == 21){
|
||||
echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id='.$cluster['id'].'">'.__('View').'</a>';
|
||||
}
|
||||
else{
|
||||
echo '<a href="index.php?sec=estado
|
||||
&sec2=operation/agentes/ver_agente
|
||||
&id_agente='.$agent["id_agente"].'">'.__('View').'</a>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
echo "</td>";
|
||||
|
@ -628,19 +648,41 @@ if ($agents !== false) {
|
|||
|
||||
if ($agent['disabled']) {
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
|
||||
enable_agent=".$agent["id_agente"]."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled''>".
|
||||
html_print_image('images/lightbulb_off.png', true, array('alt' => __('Enable agent'), 'title' => __('Enable agent'))) ."</a>";
|
||||
enable_agent=".$agent["id_agente"]."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";
|
||||
|
||||
if($agent["id_os"] != 21){
|
||||
echo ">";
|
||||
}
|
||||
else{
|
||||
echo ' onClick="if (!confirm(\' '.__('You are going to enable a cluster agent. Are you sure?').'\')) return false;">';
|
||||
}
|
||||
|
||||
echo html_print_image('images/lightbulb_off.png', true, array('alt' => __('Enable agent'), 'title' => __('Enable agent'))) ."</a>";
|
||||
}
|
||||
else {
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
|
||||
disable_agent=".$agent["id_agente"]."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'>".
|
||||
html_print_image('images/lightbulb.png', true, array('alt' => __('Disable agent'), 'title' => __('Disable agent'))) ."</a>";
|
||||
disable_agent=".$agent["id_agente"]."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";
|
||||
if($agent["id_os"] != 21){
|
||||
echo ">";
|
||||
}
|
||||
else{
|
||||
echo ' onClick="if (!confirm(\' '.__('You are going to disable a cluster agent. Are you sure?').'\')) return 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")) {
|
||||
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'";
|
||||
echo ' onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
|
||||
if($agent["id_os"] != 21){
|
||||
echo ' onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
}
|
||||
else{
|
||||
echo ' onClick="if (!confirm(\' '.__('You are going to delete a cluster agent. Are you sure?').'\')) return false;">';
|
||||
}
|
||||
|
||||
echo html_print_image('images/cross.png', true, array("border" => '0')) . "</a>";
|
||||
}
|
||||
|
||||
|
|
|
@ -111,7 +111,13 @@ if (($policy_page) || (isset($agent))) {
|
|||
$show_creation = true;
|
||||
}
|
||||
else {
|
||||
if (check_acl ($config['id_user'], $agent['id_grupo'], "AW"))
|
||||
if (!isset($all_groups)) {
|
||||
$all_groups = agents_get_all_groups_agent (
|
||||
$agent['id_agente'],
|
||||
$agent['id_grupo']
|
||||
);
|
||||
}
|
||||
if (check_acl_one_of_groups ($config['id_user'], $all_groups, "AW"))
|
||||
$show_creation = true;
|
||||
}
|
||||
|
||||
|
@ -164,8 +170,9 @@ if ($multiple_delete) {
|
|||
$count_correct_delete_modules = 0;
|
||||
foreach($id_agent_modules_delete as $id_agent_module_del) {
|
||||
$id_grupo = (int) agents_get_agent_group($id_agente);
|
||||
$all_groups = agents_get_all_groups_agent($id_agente, $id_grupo);
|
||||
|
||||
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 delete a module without admin rights");
|
||||
require ("general/noaccess.php");
|
||||
|
@ -604,7 +611,7 @@ if ($checked) {
|
|||
}
|
||||
|
||||
foreach ($modules as $module) {
|
||||
if (! check_acl ($config["id_user"], $group, "AW", $id_agente) && ! check_acl ($config["id_user"], $group, "AD", $id_agente)) {
|
||||
if (! check_acl_one_of_groups ($config["id_user"], $all_groups, "AW") && ! check_acl_one_of_groups ($config["id_user"], $all_groups, "AD")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -762,7 +769,7 @@ foreach ($modules as $module) {
|
|||
array('alt' => __('Disable module'), 'title' => __('Disable module'))) ."</a>";
|
||||
}
|
||||
|
||||
if (check_acl ($config['id_user'], $agent['id_grupo'], "AW") && $module['id_tipo_modulo'] != 25) {
|
||||
if (check_acl_one_of_groups ($config['id_user'], $all_groups, "AW") && $module['id_tipo_modulo'] != 25) {
|
||||
$data[8] .= ' <a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&duplicate_module='.$module['id_agente_modulo'].'"
|
||||
onClick="if (!confirm(\' ' . __('Are you sure?') . '\')) return false;">';
|
||||
$data[8] .= html_print_image ('images/copy.png', true,
|
||||
|
@ -798,7 +805,7 @@ foreach ($modules as $module) {
|
|||
}
|
||||
}
|
||||
|
||||
if (check_acl ($config['id_user'], $agent['id_grupo'], "AW")) {
|
||||
if (check_acl_one_of_groups ($config['id_user'], $all_groups, "AW")) {
|
||||
// Delete module
|
||||
$data[9] = html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
|
||||
$data[9] .= ' <a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
|
||||
|
@ -811,14 +818,14 @@ foreach ($modules as $module) {
|
|||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
if (check_acl ($config['id_user'], $agent['id_grupo'], "AW")) {
|
||||
if (check_acl_one_of_groups ($config['id_user'], $all_groups, "AW")) {
|
||||
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module"
|
||||
onsubmit="if (! confirm (\'' . __('Are you sure?') . '\')) return false">';
|
||||
}
|
||||
|
||||
html_print_table ($table);
|
||||
|
||||
if (check_acl ($config['id_user'], $agent['id_grupo'], "AW")) {
|
||||
if (check_acl_one_of_groups ($config['id_user'], $all_groups, "AW")) {
|
||||
echo '<div class="action-buttons" style="width: ' . $table->width . '">';
|
||||
html_print_input_hidden ('multiple_delete', 1);
|
||||
html_print_submit_button (__('Delete'), 'multiple_delete', false, 'class="sub delete"');
|
||||
|
|
|
@ -27,7 +27,7 @@ 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") . '/hand_point.png" title="' . __("Use this OID") . '" style="vertical-align: middle;"></img></a>')), false);
|
||||
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);
|
||||
|
||||
$isFunctionPolicies = enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
|
|
|
@ -1186,6 +1186,7 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri
|
|||
|
||||
$(document).ready (function () {
|
||||
$("#id_agents").change(agent_changed_by_multiple_agents);
|
||||
$("#modules_selection_mode").change(agent_changed_by_multiple_agents);
|
||||
|
||||
change_type_downtime();
|
||||
change_type_execution();
|
||||
|
|
|
@ -168,9 +168,8 @@ if ($create_action) {
|
|||
$result = alerts_create_alert_action ($name, $id_alert_command,
|
||||
$values);
|
||||
|
||||
$info = 'Name: ' . $name . ' ID alert Command: ' . $id_alert_command .
|
||||
$info_fields . ' Group: ' . $values['id_group'] .
|
||||
' Action threshold: ' . $values['action_threshold'];
|
||||
$info = '{"Name":"'.$name.'", "ID alert Command":"'.$id_alert_command.'", "Field information":"'.$info_fields.'", "Group":"'.$values['id_group'].'",
|
||||
"Action threshold":"'.$values['action_threshold'].'"}';
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
|
@ -245,10 +244,6 @@ if ($update_action) {
|
|||
}
|
||||
else {
|
||||
$result = alerts_update_alert_action ($id, $values);
|
||||
|
||||
$info = 'Name: ' . $name . ' ID alert Command: ' . $id_alert_command .
|
||||
$info_fields . ' Group: ' . $group .
|
||||
' Action threshold: ' . $action_threshold;
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
|
|
|
@ -294,7 +294,7 @@ if ($create_command) {
|
|||
$result = alerts_create_alert_command ($name, $command,
|
||||
$values);
|
||||
|
||||
$info = 'Name: ' . $name . ' Command: ' . $command . ' Description: ' . $description. ' ' .$info_fields;
|
||||
$info = '{"Name":"'.$name.'","Command":"'.$command.'","Description":"'.$description. ' '.$info_fields.'"}';
|
||||
}
|
||||
else {
|
||||
$result = '';
|
||||
|
|
|
@ -141,6 +141,12 @@ echo '<form class="add_alert_form" method="post">';
|
|||
html_print_table ($table);
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
||||
if($id_cluster){
|
||||
echo "<input onclick='window.location.replace(\"index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id=".$id_cluster."\");' type=button style='float:right;margin-left:20px;' name='store' class='sub upd' value='".__('Finish and view cluster')."'>";
|
||||
}
|
||||
|
||||
|
||||
html_print_submit_button (__('Add alert'), 'add', false, 'class="sub wand"');
|
||||
html_print_input_hidden ('create_alert', 1);
|
||||
echo '</div></form>';
|
||||
|
|
|
@ -160,7 +160,13 @@ $form_filter .= "</form>";
|
|||
if ( defined("METACONSOLE"))
|
||||
echo "<br>";
|
||||
|
||||
ui_toggle($form_filter, __('Alert control filter'), __('Toggle filter(s)'));
|
||||
if(!$id_cluster){
|
||||
ui_toggle($form_filter, __('Alert control filter'), __('Toggle filter(s)'));
|
||||
}
|
||||
else{
|
||||
unset($form_filter);
|
||||
}
|
||||
|
||||
|
||||
$simple_alerts = array();
|
||||
|
||||
|
@ -443,12 +449,11 @@ foreach ($simple_alerts as $alert) {
|
|||
|
||||
if (! $id_agente) {
|
||||
$id_agent = modules_get_agentmodule_agent ($alert['id_agent_module']);
|
||||
|
||||
$agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $id_agent);
|
||||
$all_groups = agents_get_all_groups_agent($id_agent);
|
||||
|
||||
$data[0] = '';
|
||||
|
||||
if (check_acl ($config['id_user'], $agent_group, "AW")) {
|
||||
if (check_acl_one_of_groups ($config['id_user'], $all_groups, "AW")) {
|
||||
$main_tab = 'main';
|
||||
}
|
||||
else {
|
||||
|
@ -467,7 +472,7 @@ foreach ($simple_alerts as $alert) {
|
|||
$data[0] .= '</a>';
|
||||
}
|
||||
else {
|
||||
$agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $id_agente);
|
||||
$all_groups = agents_get_all_groups_agent($id_agente);
|
||||
}
|
||||
|
||||
$module_name = modules_get_agentmodule_name ($alert['id_agent_module']);
|
||||
|
@ -544,7 +549,7 @@ foreach ($simple_alerts as $alert) {
|
|||
$data[2] .= '</ul>';
|
||||
|
||||
// Is possible manage actions if have LW permissions in the agent group of the alert module
|
||||
if (check_acl ($config['id_user'], $agent_group, "LW")) {
|
||||
if (check_acl_one_of_groups ($config['id_user'], $all_groups, "LW")) {
|
||||
//~ $data[2] .= '<form method="post" action="' . $url . '" class="delete_link" style="display: inline; vertical-align: -50%;">';
|
||||
$data[2] .= '<form method="post" action="' . $url . '" class="delete_link" style="display: inline;">';
|
||||
$data[2] .= html_print_input_image ('delete',
|
||||
|
@ -568,7 +573,7 @@ foreach ($simple_alerts as $alert) {
|
|||
$data[2] .= '</div>';
|
||||
$data[2] .= '</table>';
|
||||
// Is possible manage actions if have LW permissions in the agent group of the alert module
|
||||
if (check_acl ($config['id_user'], $agent_group, "LW") || check_acl ($config['id_user'], $template_group, "LM")) {
|
||||
if (check_acl_one_of_groups ($config['id_user'], $all_groups, "LW") || check_acl ($config['id_user'], $template_group, "LM")) {
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
if (check_acl ($config['id_user'], $template_group, "LW"))
|
||||
$own_groups = users_get_groups($config['id_user'], 'LW', true);
|
||||
|
@ -666,7 +671,7 @@ foreach ($simple_alerts as $alert) {
|
|||
$data[4] .= '</form>';
|
||||
|
||||
// To manage alert is necessary LW permissions in the agent group
|
||||
if(check_acl ($config['id_user'], $agent_group, "LW")) {
|
||||
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LW")) {
|
||||
$data[4] .= ' <form class="standby_alert_form" action="' . $url . '" method="post" style="display: inline;">';
|
||||
if (!$alert['standby']) {
|
||||
$data[4] .= html_print_input_image ('standby_off', 'images/bell.png', 1, 'padding:0px;', true);
|
||||
|
@ -681,7 +686,7 @@ foreach ($simple_alerts as $alert) {
|
|||
}
|
||||
|
||||
// To access to policy page is necessary have AW permissions in the agent
|
||||
if(check_acl ($config['id_user'], $agent_group, "AW")) {
|
||||
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "AW")) {
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$policyInfo = policies_is_alert_in_policy2($alert['id'], false);
|
||||
if ($policyInfo === false)
|
||||
|
@ -697,7 +702,7 @@ foreach ($simple_alerts as $alert) {
|
|||
}
|
||||
|
||||
// To manage alert is necessary LW permissions in the agent group
|
||||
if(check_acl ($config['id_user'], $agent_group, "LW")) {
|
||||
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',
|
||||
|
@ -714,7 +719,7 @@ foreach ($simple_alerts as $alert) {
|
|||
$data[4] .= '</form>';
|
||||
}
|
||||
|
||||
if(check_acl ($config['id_user'], $agent_group, "LM")) {
|
||||
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LM")) {
|
||||
$data[4] .= '<form class="view_alert_form" method="post" style="display: inline;" action="index.php?sec=galertas&sec2=godmode/alerts/alert_view">';
|
||||
$data[4] .= html_print_input_image ('view_alert', 'images/eye.png', 1, '', true, array('title' => __('View alert advanced details')));
|
||||
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
|
||||
|
@ -737,7 +742,7 @@ if (isset($dont_display_alert_create_bttn))
|
|||
if ($dont_display_alert_create_bttn)
|
||||
$display_create = false;
|
||||
|
||||
if ($display_create && (check_acl ($config['id_user'], 0, "LW") || check_acl ($config['id_user'], $template_group, "LM"))) {
|
||||
if ($display_create && (check_acl ($config['id_user'], 0, "LW") || check_acl ($config['id_user'], $template_group, "LM")) && !$id_cluster) {
|
||||
echo '<div class="action-buttons" style="width: ' . $table->width . '">';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">';
|
||||
html_print_submit_button (__('Create'), 'crtbtn', false, 'class="sub next"');
|
||||
|
|
|
@ -143,6 +143,20 @@ if ($delete_alert) {
|
|||
|
||||
$messageAction = ui_print_result_message ($result,
|
||||
__('Successfully deleted'), __('Could not be deleted'), '', true);
|
||||
|
||||
$id_cluster = db_get_all_rows_sql('select id,cluster_type from tcluster where id_agent = '.$id_agente);
|
||||
|
||||
if($id_cluster){
|
||||
|
||||
if($id_cluster[0]['cluster_type'] == 'AA'){
|
||||
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=5&update=1&message_delete_alert='.$result);
|
||||
}
|
||||
else{
|
||||
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=7&update=1&message_delete_alert='.$result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($add_action) {
|
||||
|
@ -211,6 +225,20 @@ if ($delete_action) {
|
|||
|
||||
$messageAction = ui_print_result_message ($result,
|
||||
__('Successfully deleted'), __('Could not be deleted'), '', true);
|
||||
|
||||
$id_cluster = db_get_all_rows_sql('select id,cluster_type from tcluster where id_agent = '.$id_agente);
|
||||
|
||||
if($id_cluster){
|
||||
|
||||
if($id_cluster[0]['cluster_type'] == 'AA'){
|
||||
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=5&update=1&message_delete_action='.$result);
|
||||
}
|
||||
else{
|
||||
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=7&update=1&message_delete_action='.$result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($enable_alert) {
|
||||
|
@ -228,6 +256,19 @@ if ($enable_alert) {
|
|||
|
||||
$messageAction = ui_print_result_message ($result,
|
||||
__('Successfully enabled'), __('Could not be enabled'), '', true);
|
||||
|
||||
$id_cluster = db_get_all_rows_sql('select id,cluster_type from tcluster where id_agent = '.$id_agente);
|
||||
|
||||
if($id_cluster){
|
||||
|
||||
if($id_cluster[0]['cluster_type'] == 'AA'){
|
||||
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=5&update=1&message_enable_alert='.$result);
|
||||
}
|
||||
else{
|
||||
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=7&update=1&message_enable_alert='.$result);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($disable_alert) {
|
||||
|
@ -245,6 +286,20 @@ if ($disable_alert) {
|
|||
|
||||
$messageAction = ui_print_result_message ($result,
|
||||
__('Successfully disabled'), __('Could not be disabled'), '', true);
|
||||
|
||||
$id_cluster = db_get_all_rows_sql('select id,cluster_type from tcluster where id_agent = '.$id_agente);
|
||||
|
||||
if($id_cluster){
|
||||
|
||||
if($id_cluster[0]['cluster_type'] == 'AA'){
|
||||
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=5&update=1&message_disable_alert='.$result);
|
||||
}
|
||||
else{
|
||||
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=7&update=1&message_disable_alert='.$result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($standbyon_alert) {
|
||||
|
@ -262,6 +317,19 @@ if ($standbyon_alert) {
|
|||
|
||||
$messageAction = ui_print_result_message ($result,
|
||||
__('Successfully set standby'), __('Could not be set standby'), '', true);
|
||||
|
||||
$id_cluster = db_get_all_rows_sql('select id,cluster_type from tcluster where id_agent = '.$id_agente);
|
||||
|
||||
if($id_cluster){
|
||||
|
||||
if($id_cluster[0]['cluster_type'] == 'AA'){
|
||||
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=5&update=1&message_standbyon='.$result);
|
||||
}
|
||||
else{
|
||||
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=7&update=1&message_standbyon='.$result);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($standbyoff_alert) {
|
||||
|
@ -279,6 +347,19 @@ if ($standbyoff_alert) {
|
|||
|
||||
$messageAction = ui_print_result_message ($result,
|
||||
__('Successfully set off standby'), __('Could not be set off standby'), '', true);
|
||||
|
||||
$id_cluster = db_get_all_rows_sql('select id,cluster_type from tcluster where id_agent = '.$id_agente);
|
||||
|
||||
if($id_cluster){
|
||||
|
||||
if($id_cluster[0]['cluster_type'] == 'AA'){
|
||||
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=5&update=1&message_standbyoff='.$result);
|
||||
}
|
||||
else{
|
||||
header('Location: index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$id_cluster[0]['id'].'&step=7&update=1&message_standbyoff='.$result);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($id_agente) {
|
||||
|
@ -294,8 +375,8 @@ if ($id_agente) {
|
|||
echo $messageAction;
|
||||
|
||||
require_once('godmode/alerts/alert_list.list.php');
|
||||
|
||||
if(check_acl ($config['id_user'], $agent['id_grupo'], "LW") || check_acl ($config['id_user'], $agent['id_grupo'], "LM")) {
|
||||
$all_groups = agents_get_all_groups_agent ($id_agente, $agent['id_grupo']);
|
||||
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LW") || check_acl_one_of_groups ($config['id_user'], $all_groups, "LM")) {
|
||||
require_once('godmode/alerts/alert_list.builder.php');
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ if ($create_special_day) {
|
|||
}
|
||||
else {
|
||||
$result = alerts_create_alert_special_day ($date, $same_day, $values);
|
||||
$info = 'Date: ' . $date . ' Same day of the week: ' . $same_day . ' Description: ' . $values['description'];
|
||||
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$values['description'].'"}';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,12 +186,12 @@ if ($update_special_day) {
|
|||
}
|
||||
else {
|
||||
$result = alerts_update_alert_special_day ($id, $values);
|
||||
$info = 'Date: ' . $date . ' Same day of the week: ' . $same_day . ' Description: ' . $description;
|
||||
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$description.'"}';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$result = alerts_update_alert_special_day ($id, $values);
|
||||
$info = 'Date: ' . $date . ' Same day of the week: ' . $same_day . ' Description: ' . $description;
|
||||
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$description.'"}';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -156,7 +156,6 @@ $table->data[5][1] = html_print_textarea ('command_preview', 5, 30, '',
|
|||
$table->data[5][2] = html_print_textarea ('command_recovery_preview', 5, 30, '',
|
||||
'disabled="disabled"', true);
|
||||
|
||||
$row = 6;
|
||||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||
$table->data['field' . $i][0] = html_print_image(
|
||||
'images/spinner.gif', true);
|
||||
|
@ -178,6 +177,7 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
|||
true);
|
||||
}
|
||||
|
||||
|
||||
echo '<form method="post" action="' .
|
||||
'index.php?sec=' . $sec . '&' .
|
||||
'sec2=godmode/alerts/alert_actions&' .
|
||||
|
|
|
@ -79,7 +79,7 @@ if ($update_command) {
|
|||
}
|
||||
else {
|
||||
$result = alerts_update_alert_command ($id, $values);
|
||||
$info = 'Name: ' . $name . ' Command: ' . $command . ' Description: ' . $description. ' ' .$info_fields;
|
||||
$info = '{"Name":"'.$name.'","Command":"'.$command.'","Description":"'.$description. ' '.$info_fields.'"}';
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
|
|
|
@ -418,13 +418,11 @@ if ($create_template) {
|
|||
$result = '';
|
||||
}
|
||||
if ($result) {
|
||||
//db_pandora_audit("Command management", "Create alert command " . $result, false, false, json_encode($values));
|
||||
db_pandora_audit("Template alert management",
|
||||
"Create alert template #" . $result, false, false,
|
||||
json_encode($values));
|
||||
}
|
||||
else {
|
||||
//db_pandora_audit("Command management", "Fail try to create alert command", false, false, json_encode($values));
|
||||
db_pandora_audit("Template alert management",
|
||||
"Fail try to create alert template", false, false,
|
||||
json_encode($values));
|
||||
|
|
|
@ -104,11 +104,12 @@ if ($add) {
|
|||
$results = false;
|
||||
}
|
||||
}
|
||||
|
||||
db_pandora_audit("Massive management", "Add alert action " . json_encode($id_agents), false, false, 'Agents: ' .
|
||||
json_encode($id_agents) . ' Alerts : ' . json_encode($agent_alerts) .
|
||||
' Fires Min: ' . $fires_min . ' Fires Max: ' . $fires_max . ' Actions: ' . implode(',',$actions));
|
||||
|
||||
$info = array('Agents' => implode(',',$id_agents),
|
||||
'Alerts' => addslashes(io_json_mb_encode($agent_alerts)),
|
||||
'Fires Min' => $fires_min,
|
||||
'Fires_max' => $fires_max,
|
||||
'Actions' => implode(',',$actions));
|
||||
db_pandora_audit("Massive management", "Add alert action " . json_encode($id_agents), false, false, json_encode($info));
|
||||
ui_print_result_message ($results, __('Successfully added'), __('Could not be added'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,15 +43,18 @@ $do_operation = (bool) get_parameter ('do_operation');
|
|||
if ($do_operation) {
|
||||
$result = agents_process_manage_config($source_id_agent,
|
||||
$destiny_id_agents);
|
||||
|
||||
$info = array('Source agent' => $source_id_agent,
|
||||
'Destinity agent' => implode(",",$destiny_id_agents));
|
||||
if ($result) {
|
||||
|
||||
|
||||
db_pandora_audit("Massive management", "Copy modules", false,
|
||||
false,
|
||||
'Source agent: ' . json_encode($source_id_agent) . ' Destinity agent: ' . json_encode($destiny_id_agents));
|
||||
false, json_encode($info));
|
||||
}
|
||||
else {
|
||||
db_pandora_audit("Massive management",
|
||||
"Fail to try copy modules", false, false,
|
||||
'Source agent: ' . json_encode($source_id_agent) . ' Destinity agent: ' . json_encode($destiny_id_agents));
|
||||
"Fail to try copy modules", false, false,json_encode($info));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -98,16 +98,15 @@ if ($delete) {
|
|||
}
|
||||
}
|
||||
}
|
||||
$info = array('Agents' => implode(',',$id_agents),
|
||||
'Alert templates' => implode(",",$id_alert_templates),
|
||||
'Actions' => implode(',',$actions));
|
||||
|
||||
if ($results) {
|
||||
db_pandora_audit("Massive management", "Delete alert action", false, false,
|
||||
'Agent: ' . json_encode($id_agents) . ' Alert templates: ' . json_encode($id_alert_templates) .
|
||||
' Actions: ' . implode(',',$actions));
|
||||
db_pandora_audit("Massive management", "Delete alert action", false, false,json_encode($info));
|
||||
}
|
||||
else {
|
||||
db_pandora_audit("Massive management", "Fail try to delete alert action", false, false,
|
||||
'Agent: ' . json_encode($id_agents) . ' Alert templates: ' . json_encode($id_alert_templates) .
|
||||
' Actions: ' . implode(',',$actions));
|
||||
db_pandora_audit("Massive management", "Fail try to delete alert action", false, false, json_encode($info));
|
||||
}
|
||||
|
||||
ui_print_result_message ($results,
|
||||
|
|
|
@ -76,13 +76,12 @@ $delete = (bool) get_parameter_post ('delete');
|
|||
if ($delete) {
|
||||
$result = process_manage_delete ($id_agents);
|
||||
|
||||
$info = '{"Agent":"'.implode(",",$id_agents).'"}';
|
||||
if ($result) {
|
||||
db_pandora_audit("Massive management", "Delete agent ", false, false,
|
||||
'Agent: ' . json_encode($id_agents));
|
||||
db_pandora_audit("Massive management", "Delete agent ", false, false,$info);
|
||||
}
|
||||
else {
|
||||
db_pandora_audit("Massive management", "Fail try to delete agent", false, false,
|
||||
'Agent: ' . json_encode($id_agents));
|
||||
db_pandora_audit("Massive management", "Fail try to delete agent", false, false,$info);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -170,13 +170,14 @@ $delete = (bool) get_parameter_post ('delete');
|
|||
if ($delete) {
|
||||
$result = process_manage_delete ($id_alert_template, $id_agents, $module_names);
|
||||
|
||||
$info = array('Agent' => implode(",",$id_agents),
|
||||
'Template' => $id_alert_template, 'Module' => implode(",",$module_names));
|
||||
|
||||
if ($result) {
|
||||
db_pandora_audit("Massive management", "Delete alert ", false, false,
|
||||
'Agent: ' . json_encode($id_agents) . ' Template: ' . $id_alert_template . ' Module: ' . $module_names);
|
||||
db_pandora_audit("Massive management", "Delete alert ", false, false,json_encode($info));
|
||||
}
|
||||
else {
|
||||
db_pandora_audit("Massive management", "Fail try to delete alert", false, false,
|
||||
'Agent: ' . json_encode($id_agents) . ' Template: ' . $id_alert_template . ' Module: ' . $module_names);
|
||||
db_pandora_audit("Massive management", "Fail try to delete alert", false, false,json_encode($info));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -349,13 +349,12 @@ if ($delete) {
|
|||
$result = process_manage_delete ($modules_, $agents_, $modules_selection_mode);
|
||||
}
|
||||
|
||||
$info = array('Agent' => implode(",",$agents_), 'Module' => implode(",",$modules_));
|
||||
if ($result) {
|
||||
db_pandora_audit("Massive management", "Delete module ", false, false,
|
||||
'Agent: ' . json_encode($agents_) . ' Module: ' . $module_name);
|
||||
db_pandora_audit("Massive management", "Delete module ", false, false, json_encode($info));
|
||||
}
|
||||
else {
|
||||
db_pandora_audit("Massive management", "Fail try to delete module", false, false,
|
||||
'Agent: ' . json_encode($agents_) . ' Module: ' . $module_name);
|
||||
db_pandora_audit("Massive management", "Fail try to delete module", false, false, json_encode($info));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,13 +74,12 @@ if ($delete_profiles) {
|
|||
}
|
||||
}
|
||||
|
||||
$info = array('Profiles' => implode(",",$profiles_id), 'Groups' => implode(",",$groups_id), 'Users' => implode(",",$users_id));
|
||||
if ($result) {
|
||||
db_pandora_audit("Massive management", "Delete profile ", false, false,
|
||||
'Profiles: ' . json_encode($profiles_id) . ' Groups: ' . $groups_id . ' Users: ' . $users_id);
|
||||
db_pandora_audit("Massive management", "Delete profile ", false, false, json_encode($info));
|
||||
}
|
||||
else {
|
||||
db_pandora_audit("Massive management", "Fail try to delete profile", false, false,
|
||||
'Profiles: ' . json_encode($profiles_id) . ' Groups: ' . $groups_id . ' Users: ' . $users_id);
|
||||
db_pandora_audit("Massive management", "Fail try to delete profile", false, false, json_encode($info));
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
|
|
|
@ -197,14 +197,18 @@ if ($update_agents) {
|
|||
}
|
||||
}
|
||||
|
||||
$info = array();
|
||||
// Update Custom Fields
|
||||
foreach ($fields as $field) {
|
||||
$info[$field['id_field']] = $field['name'];
|
||||
if (get_parameter_post ('customvalue_' . $field['id_field'], '') != '') {
|
||||
$key = $field['id_field'];
|
||||
$value = get_parameter_post ('customvalue_' . $field['id_field'], '');
|
||||
|
||||
$old_value = db_get_all_rows_filter('tagent_custom_data', array('id_agent' => $id_agent, 'id_field' => $key));
|
||||
|
||||
|
||||
|
||||
if ($old_value === false) {
|
||||
// Create custom field if not exist
|
||||
$result = db_process_sql_insert ('tagent_custom_data',
|
||||
|
@ -225,11 +229,11 @@ if ($update_agents) {
|
|||
|
||||
|
||||
if ($result !== false) {
|
||||
db_pandora_audit("Massive management", "Update agent " . $id_agent, false, false, json_encode($fields));
|
||||
db_pandora_audit("Massive management", "Update agent " . $id_agent, false, false, json_encode($info));
|
||||
}
|
||||
else {
|
||||
if (isset ($id_agent)) {
|
||||
db_pandora_audit("Massive management", "Try to update agent " . $id_agent, false, false, json_encode($fields));
|
||||
db_pandora_audit("Massive management", "Try to update agent " . $id_agent, false, false, json_encode($info));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ if ($update) {
|
|||
__('Successfully updated') . "(" . $success . "/" . $count . ")",
|
||||
$error_msg);
|
||||
|
||||
$info = 'Modules: ' . json_encode($modules_) . ' Agents: ' . json_encode($agents_);
|
||||
$info = '{"Modules":"'.implode(",",$modules_).'","Agents":"'.implode(",",$agents_).'"}';
|
||||
if ($success > 0) {
|
||||
db_pandora_audit("Massive management", "Edit module", false, false, $info);
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ switch ($action) {
|
|||
|
||||
ui_print_result_message ($result, __('Successfully enabled'), __('Could not be enabled'));
|
||||
|
||||
$info = 'Alert: ' . json_encode($id_disabled_alerts);
|
||||
$info = '{"Alert":"'.implode(",",$id_disabled_alerts).'"}';
|
||||
if ($result) {
|
||||
db_pandora_audit("Massive management", "Enable alert", false, false, $info);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ switch ($action) {
|
|||
|
||||
ui_print_result_message ($result, __('Successfully disabled'), __('Could not be disabled'));
|
||||
|
||||
$info = 'Alert: ' . json_encode($id_enabled_alerts);
|
||||
$info = '{"Alert":"'.implode(",",$id_enabled_alerts).'"}';
|
||||
if ($result) {
|
||||
db_pandora_audit("Massive management", "Disable alert", false, false, $info);
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ switch($action) {
|
|||
|
||||
ui_print_result_message ($result, __('Successfully set off standby'), __('Could not be set off standby'));
|
||||
|
||||
$info = 'Alert: ' . json_encode($id_standby_alerts);
|
||||
$info = '{"Alert":"'.implode(",",$id_standby_alerts).'"}';
|
||||
if ($result) {
|
||||
db_pandora_audit("Massive management", "Set off standby alerts", false, false, $info);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ switch($action) {
|
|||
|
||||
ui_print_result_message ($result, __('Successfully set standby'), __('Could not be set standby'));
|
||||
|
||||
$info = 'Alert: ' . json_encode($id_not_standby_alerts);
|
||||
$info = '{"Alert":"'.implode(",",$id_not_standby_alerts).'"}';
|
||||
if ($result) {
|
||||
db_pandora_audit("Massive management", "Set on standby alerts", false, false, $info);
|
||||
}
|
||||
|
|
|
@ -290,24 +290,31 @@ if (!defined('METACONSOLE')) {
|
|||
else {
|
||||
$url = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&recursion='.$recursion.'&ag_group='.$ag_group.'&search='.$search.'&pagination='.$pagination;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($own_info['is_admin'] || $vconsoles_read) {
|
||||
if($ag_group){
|
||||
$maps = visual_map_get_user_layouts (0,false,$filters,false);
|
||||
$maps = visual_map_get_user_layouts ($config['id_user'],false,$filters,false);
|
||||
unset($filters['offset']);
|
||||
unset($filters['limit']);
|
||||
$total_maps = count($maps);
|
||||
$count_maps = visual_map_get_user_layouts ($config['id_user'],false,$filters,false);
|
||||
$total_maps = count($count_maps);
|
||||
}else{
|
||||
$maps = visual_map_get_user_layouts (0,false,$filters, false);
|
||||
$maps = visual_map_get_user_layouts ($config['id_user'],false,$filters, false);
|
||||
unset($filters['offset']);
|
||||
unset($filters['limit']);
|
||||
$total_maps = count($maps);
|
||||
$count_maps = visual_map_get_user_layouts ($config['id_user'],false,$filters,false);
|
||||
$total_maps = count($count_maps);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$maps = visual_map_get_user_layouts ($config['id_user'], false, $filters, false);
|
||||
unset($filters['offset']);
|
||||
unset($filters['limit']);
|
||||
$total_maps = count($maps);
|
||||
$count_maps = visual_map_get_user_layouts ($config['id_user'],false,$filters,false);
|
||||
$total_maps = count($count_maps);
|
||||
}
|
||||
if (!$maps && !is_metaconsole()) {
|
||||
$total = count(visual_map_get_user_layouts ($config['id_user'], false, false, false));
|
||||
|
|
|
@ -130,8 +130,10 @@ switch ($action) {
|
|||
$show_in_same_row = 0;
|
||||
$show_in_landscape = 0;
|
||||
$hide_notinit_agents = 0;
|
||||
$priority_mode = REPORT_PRIORITY_MODE_OK;
|
||||
$server_name = '';
|
||||
$server_id = 0;
|
||||
$dyn_height = 230;
|
||||
break;
|
||||
case 'save':
|
||||
default:
|
||||
|
@ -173,6 +175,7 @@ switch ($action) {
|
|||
$server_name = '';
|
||||
$server_id = 0;
|
||||
$get_data_editor = false;
|
||||
$dyn_height = 230;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -196,6 +199,7 @@ switch ($action) {
|
|||
$show_in_two_columns = $style['show_in_two_columns'];
|
||||
$show_in_landscape = $style['show_in_landscape'];
|
||||
$hide_notinit_agents = $style['hide_notinit_agents'];
|
||||
$dyn_height = $style['dyn_height'];
|
||||
$type = $item['type'];
|
||||
$name = $item['name'];
|
||||
|
||||
|
@ -269,6 +273,9 @@ switch ($action) {
|
|||
$time_from = $item['time_from'];
|
||||
$time_to = $item['time_to'];
|
||||
$show_graph = $item['show_graph'];
|
||||
$priority_mode = isset($style['priority_mode'])
|
||||
? $style['priority_mode']
|
||||
: REPORT_PRIORITY_MODE_OK;
|
||||
// 'top_n' filed will be reused for SLA sort option
|
||||
$sla_sorted_by = $item['top_n'];
|
||||
$period = $item['period'];
|
||||
|
@ -361,33 +368,16 @@ switch ($action) {
|
|||
$text = $item['text'];
|
||||
break;
|
||||
case 'sql':
|
||||
$description = $item['description'];
|
||||
$sql_query_report = $item['external_source'];
|
||||
$idCustom = $item['treport_custom_sql_id'];
|
||||
$header = $item['header_definition'];
|
||||
$historical_db = $item['historical_db'];
|
||||
$period = 0;
|
||||
break;
|
||||
case 'sql_graph_pie':
|
||||
$description = $item['description'];
|
||||
$sql_query_report = $item['external_source'];
|
||||
$idCustom = $item['treport_custom_sql_id'];
|
||||
$historical_db = $item['historical_db'];
|
||||
$period = 0;
|
||||
break;
|
||||
case 'sql_graph_vbar':
|
||||
$description = $item['description'];
|
||||
$sql_query_report = $item['external_source'];
|
||||
$idCustom = $item['treport_custom_sql_id'];
|
||||
$historical_db = $item['historical_db'];
|
||||
$period = 0;
|
||||
break;
|
||||
case 'sql_graph_hbar':
|
||||
$description = $item['description'];
|
||||
$sql_query_report = $item['external_source'];
|
||||
$idCustom = $item['treport_custom_sql_id'];
|
||||
$historical_db = $item['historical_db'];
|
||||
$period = 0;
|
||||
$top_n_value = $item['top_n_value'];
|
||||
break;
|
||||
case 'url':
|
||||
$description = $item['description'];
|
||||
|
@ -1284,6 +1274,16 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
<td style="" id="sql_example"></td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_max_items" style="" class="datos">
|
||||
<td style="font-weight:bold;"><?php echo __('Max items'); ?></td>
|
||||
<td style="">
|
||||
<?php
|
||||
html_print_input_text('max_items', $top_n_value, '', 7, 7);
|
||||
?>
|
||||
</td>
|
||||
<td style="" id="max_items_example"></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
if ($meta) {
|
||||
?>
|
||||
|
@ -1548,6 +1548,11 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
<td><?php html_print_checkbox('show_in_two_columns', 1, $show_in_two_columns);?></td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_dyn_height" style="" class="datos">
|
||||
<td style="font-weight:bold;"><?php echo __('Height (dynamic graphs)');?></td>
|
||||
<td><?php html_print_input_text('dyn_height', $dyn_height, '', 7, 7);?></td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_show_in_same_row" style="" class="datos">
|
||||
<td style="font-weight:bold;" class="datos">
|
||||
<?php
|
||||
|
@ -1588,6 +1593,33 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_priority_mode" style="" class="datos">
|
||||
<td style="font-weight:bold;"><?php echo __('Priority mode');?></td>
|
||||
<td>
|
||||
<?php
|
||||
echo __('Priority ok mode').'<span style="margin-left:5px;"></span>';
|
||||
html_print_radio_button (
|
||||
'priority_mode',
|
||||
REPORT_PRIORITY_MODE_OK,
|
||||
'',
|
||||
$priority_mode == REPORT_PRIORITY_MODE_OK,
|
||||
''
|
||||
);
|
||||
|
||||
echo ('<span style="margin:30px;"></span>');
|
||||
|
||||
echo __('Priority unknown mode').'<span style="margin-left:5px;"></span>';
|
||||
html_print_radio_button (
|
||||
'priority_mode',
|
||||
REPORT_PRIORITY_MODE_UNKNOWN,
|
||||
'',
|
||||
$priority_mode == REPORT_PRIORITY_MODE_UNKNOWN,
|
||||
''
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_filter_search" style="" class="datos">
|
||||
<td style="font-weight:bold;"><?php echo __('Free search');?></td>
|
||||
<td>
|
||||
|
@ -2766,6 +2798,7 @@ function chooseType() {
|
|||
$("#row_custom_graph").hide();
|
||||
$("#row_text").hide();
|
||||
$("#row_query").hide();
|
||||
$("#row_max_items").hide();
|
||||
$("#row_header").hide();
|
||||
$("#row_custom").hide();
|
||||
$("#row_url").hide();
|
||||
|
@ -2791,6 +2824,7 @@ function chooseType() {
|
|||
$("#row_exception_condition_value").hide();
|
||||
$("#row_exception_condition").hide();
|
||||
$("#row_show_in_two_columns").hide();
|
||||
$("#row_dyn_height").hide();
|
||||
$("#row_show_in_same_row").hide();
|
||||
$("#row_historical_db_check").hide();
|
||||
$("#row_lapse_calc").hide();
|
||||
|
@ -2798,6 +2832,7 @@ function chooseType() {
|
|||
$("#row_visual_format").hide();
|
||||
$("#row_show_in_landscape").hide();
|
||||
$('#row_hide_notinit_agents').hide();
|
||||
$('#row_priority_mode').hide();
|
||||
$("#row_module_group").hide();
|
||||
$("#row_servers").hide();
|
||||
$("#row_sort").hide();
|
||||
|
@ -2943,6 +2978,7 @@ function chooseType() {
|
|||
$("#sla_list").show();
|
||||
$("#row_working_time").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
$("#row_priority_mode").show();
|
||||
break;
|
||||
|
||||
case 'module_histogram_graph':
|
||||
|
@ -2960,6 +2996,7 @@ function chooseType() {
|
|||
$("#sla_list").show();
|
||||
$("#row_working_time").show();
|
||||
$("#row_sort").show();
|
||||
$("#row_priority_mode").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
|
@ -3061,37 +3098,24 @@ function chooseType() {
|
|||
case 'sql':
|
||||
$("#row_description").show();
|
||||
$("#row_query").show();
|
||||
$("#row_max_items").show();
|
||||
$("#row_header").show();
|
||||
$("#row_custom").show();
|
||||
$("#row_custom_example").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_dyn_height").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").show();
|
||||
break;
|
||||
|
||||
case 'sql_graph_pie':
|
||||
$("#row_description").show();
|
||||
$("#row_query").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_show_in_landscape").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").show();
|
||||
|
||||
break;
|
||||
|
||||
case 'sql_graph_hbar':
|
||||
$("#row_description").show();
|
||||
$("#row_query").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_show_in_landscape").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").show();
|
||||
break;
|
||||
|
||||
case 'sql_graph_vbar':
|
||||
$("#row_description").show();
|
||||
$("#row_query").show();
|
||||
$("#row_max_items").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
$("#row_dyn_height").show();
|
||||
$("#row_show_in_landscape").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").show();
|
||||
|
|
|
@ -352,9 +352,8 @@ foreach ($items as $item) {
|
|||
|
||||
$row[1] = get_report_name($item['type']);
|
||||
|
||||
$custom_graph_name = db_get_row_sql('select name from tgraph where id_graph = '.$item['id_gs']);
|
||||
|
||||
if($item['type'] == 'custom_graph'){
|
||||
$custom_graph_name = db_get_row_sql('select name from tgraph where id_graph = '.$item['id_gs']);
|
||||
$row[1] = get_report_name($item['type']).' ('.$custom_graph_name['name'].')';
|
||||
}
|
||||
|
||||
|
|
|
@ -1194,6 +1194,7 @@ switch ($action) {
|
|||
$values['external_source'] = get_parameter('sql');
|
||||
}
|
||||
$values['historical_db'] = get_parameter('historical_db_check');
|
||||
$values['top_n_value'] = get_parameter('max_items');
|
||||
}
|
||||
else if ($values['type'] == 'url') {
|
||||
$values['external_source'] = get_parameter('url');
|
||||
|
@ -1211,6 +1212,8 @@ switch ($action) {
|
|||
$style['show_in_same_row'] = get_parameter('show_in_same_row', 0);
|
||||
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
|
||||
$style['hide_notinit_agents'] = get_parameter('hide_notinit_agents', 0);
|
||||
$style['priority_mode'] = get_parameter('priority_mode', REPORT_PRIORITY_MODE_OK);
|
||||
$style['dyn_height'] = get_parameter('dyn_height', 230);
|
||||
|
||||
switch ($values['type']) {
|
||||
case 'event_report_agent':
|
||||
|
@ -1532,6 +1535,7 @@ switch ($action) {
|
|||
$values['external_source'] = get_parameter('sql');
|
||||
}
|
||||
$values['historical_db'] = get_parameter('historical_db_check');
|
||||
$values['top_n_value'] = get_parameter('max_items');
|
||||
}
|
||||
elseif ($values['type'] == 'url') {
|
||||
$values['external_source'] = get_parameter('url');
|
||||
|
@ -1549,6 +1553,8 @@ switch ($action) {
|
|||
$style['show_in_same_row'] = get_parameter('show_in_same_row', 0);
|
||||
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
|
||||
$style['hide_notinit_agents'] = get_parameter('hide_notinit_agents', 0);
|
||||
$style['priority_mode'] = get_parameter('priority_mode', REPORT_PRIORITY_MODE_OK);
|
||||
$style['dyn_height'] = get_parameter('dyn_height', 230);
|
||||
|
||||
switch ($values['type']) {
|
||||
case 'event_report_agent':
|
||||
|
|
|
@ -35,6 +35,7 @@ var img_handler_end;
|
|||
function toggle_advance_options_palette(close) {
|
||||
if ($("#advance_options").css('display') == 'none') {
|
||||
$("#advance_options").css('display', '');
|
||||
$("#advance_options *").css('display', '');
|
||||
}
|
||||
else {
|
||||
$("#advance_options").css('display', 'none');
|
||||
|
@ -3762,6 +3763,8 @@ function updateDB_visual(type, idElement , values, event, top, left) {
|
|||
set_static_graph_status(idElement, values['image']);
|
||||
}
|
||||
}
|
||||
$("#" + idElement).css('left', left + 'px');
|
||||
$("#" + idElement).css('top', top + 'px');
|
||||
break;
|
||||
case 'percentile_item':
|
||||
case 'simple_value':
|
||||
|
@ -3848,8 +3851,8 @@ function updateDB_visual(type, idElement , values, event, top, left) {
|
|||
function updateDB(type, idElement , values, event) {
|
||||
metaconsole = $("input[name='metaconsole']").val();
|
||||
|
||||
var top = 0;
|
||||
var left = 0;
|
||||
var top = typeof(values.top) != 'undefined' ? values.top : 0;
|
||||
var left = typeof(values.left) != 'undefined' ? values.left : 0;
|
||||
|
||||
action = "update";
|
||||
|
||||
|
@ -5020,8 +5023,10 @@ function showPreviewIcon(icon) {
|
|||
params.push("get_image_path=1");
|
||||
params.push("img_src=" + imgBase + ".png");
|
||||
params.push("page=include/ajax/skins.ajax");
|
||||
parameter.push ({name: "id_visual_console",
|
||||
value: id_visual_console});
|
||||
params.push ({
|
||||
name: "id_visual_console",
|
||||
value: id_visual_console
|
||||
});
|
||||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
|
|
|
@ -24,6 +24,7 @@ include_once($config['homedir'] . "/include/functions_profile.php");
|
|||
include_once($config['homedir'] . '/include/functions_users.php');
|
||||
include_once ($config['homedir'] . '/include/functions_groups.php');
|
||||
include_once ($config['homedir'] . '/include/functions_visual_map.php');
|
||||
enterprise_include_once('include/functions_profile.php');
|
||||
|
||||
$meta = false;
|
||||
if(enterprise_installed() && defined("METACONSOLE")) {
|
||||
|
@ -444,6 +445,7 @@ 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);
|
||||
|
||||
foreach ($tags as $k => $tag) {
|
||||
if(empty($tag)) {
|
||||
|
@ -451,15 +453,22 @@ if ($add_profile) {
|
|||
}
|
||||
}
|
||||
|
||||
$tags = implode(',', $tags);
|
||||
$tags = $is_secondary ? '' : implode(',', $tags);
|
||||
|
||||
db_pandora_audit("User management",
|
||||
"Added profile for user ".io_safe_input($id2), false, false, 'Profile: ' . $profile2 . ' Group: ' . $group2 . ' Tags: ' . $tags);
|
||||
$return = profile_create_user_profile($id2, $profile2, $group2, false, $tags);
|
||||
|
||||
ui_print_result_message ($return,
|
||||
__('Profile added successfully'),
|
||||
__('Profile cannot be added'));
|
||||
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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($delete_profile) {
|
||||
|
@ -714,110 +723,8 @@ echo '<br />';
|
|||
|
||||
/* Don't show anything else if we're creating an user */
|
||||
if (!empty ($id) && !$new_user) {
|
||||
if (!defined("METACONSOLE"))
|
||||
echo '<h4>'. __('Profiles/Groups assigned to this user') . '</h4>';
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox data';
|
||||
if (defined("METACONSOLE")) {
|
||||
$table->head_colspan[0] = 0;
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox_tactical data';
|
||||
$table->title = __('Profiles/Groups assigned to this user');
|
||||
}
|
||||
$table->data = array ();
|
||||
$table->head = array ();
|
||||
$table->align = array ();
|
||||
$table->style = array ();
|
||||
if (!defined("METACONSOLE")) {
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->style[1] = 'font-weight: bold';
|
||||
}
|
||||
$table->head[0] = __('Profile name');
|
||||
$table->head[1] = __('Group');
|
||||
$table->head[2] = __('Tags');
|
||||
$table->head[3] = __('Action');
|
||||
$table->align[3] = 'center';
|
||||
|
||||
/*
|
||||
if ($enterprise_include) {
|
||||
add_enterprise_column_user_profile_form($table);
|
||||
}
|
||||
*/
|
||||
|
||||
$result = db_get_all_rows_field_filter ("tusuario_perfil", "id_usuario", $id);
|
||||
|
||||
if ($result === false) {
|
||||
$result = array ();
|
||||
}
|
||||
|
||||
foreach ($result as $profile) {
|
||||
if($profile["id_grupo"] == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$data = array ();
|
||||
|
||||
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.profile_get_name ($profile['id_perfil']).'</a>';
|
||||
$data[1] = ui_print_group_icon($profile["id_grupo"], true);
|
||||
if (!defined('METACONSOLE'))
|
||||
$data[1] .= '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$profile['id_grupo'].'&pure='.$pure.'">';
|
||||
|
||||
$data[1] .= ' ' . ui_print_truncate_text(groups_get_name ($profile['id_grupo'], True), GENERIC_SIZE_TEXT);
|
||||
if (!defined('METACONSOLE'))
|
||||
$data[1] .= '</a>';
|
||||
|
||||
if(empty($profile["tags"])) {
|
||||
$data[2] = '';
|
||||
}
|
||||
else {
|
||||
$tags_ids = explode(',',$profile["tags"]);
|
||||
$tags = tags_get_tags($tags_ids);
|
||||
|
||||
$data[2] = tags_get_tags_formatted($tags);
|
||||
}
|
||||
|
||||
$data[3] = '<form method="post" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
|
||||
$data[3] .= html_print_input_hidden ('delete_profile', 1, true);
|
||||
$data[3] .= html_print_input_hidden ('id_user_profile', $profile['id_up'], true);
|
||||
$data[3] .= html_print_input_hidden ('id_user', $id, true);
|
||||
$data[3] .= html_print_input_image ('del', 'images/cross.png', 1, '', true);
|
||||
$data[3] .= '</form>';
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
$data = array ();
|
||||
|
||||
$data[0] = '<form method="post">';
|
||||
if (check_acl ($config['id_user'], 0, "PM")) {
|
||||
$data[0] .= html_print_select (profile_get_profiles (), 'assign_profile', 0, '',
|
||||
__('None'), 0, true, false, false);
|
||||
}
|
||||
else {
|
||||
$data[0] .= html_print_select (profile_get_profiles (array ('pandora_management' => '<> 1',
|
||||
'db_management' => '<> 1')), 'assign_profile', 0, '', __('None'), 0,
|
||||
true, false, false);
|
||||
}
|
||||
|
||||
$data[1] = html_print_select_groups($config['id_user'], "UM",
|
||||
$own_info['is_admin'], 'assign_group', -1, '', __('None'), -1, true,
|
||||
false, false);
|
||||
|
||||
$tags = tags_get_all_tags();
|
||||
|
||||
$data[2] = html_print_select($tags, 'assign_tags[]', '', '', __('Any'), '', true, true);
|
||||
|
||||
$data[3] = html_print_input_image ('add', 'images/add.png', 1, '', true);
|
||||
$data[3] .= html_print_input_hidden ('id', $id, true);
|
||||
$data[3] .= html_print_input_hidden ('add_profile', 1, true);
|
||||
$data[3] .= '</form>';
|
||||
|
||||
array_push ($table->data, $data);
|
||||
|
||||
html_print_table ($table);
|
||||
unset ($table);
|
||||
profile_print_profile_table($id, __('Profiles/Groups assigned to this user'));
|
||||
enterprise_hook('profile_print_profile_secondary_table', array($id));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -182,40 +182,30 @@ if ($update_profile) {
|
|||
if ($name) {
|
||||
$ret = db_process_sql_update('tperfil', $values, array('id_perfil' => $id_profile));
|
||||
if ($ret !== false) {
|
||||
$info = 'Name: ' . $name .
|
||||
|
||||
' Incident view: ' . $incident_view .
|
||||
' Incident edit: ' . $incident_edit .
|
||||
' Incident management: ' . $incident_management .
|
||||
|
||||
' Agent view: ' . $agent_view .
|
||||
' Agent edit: ' . $agent_edit .
|
||||
' Agent disable: ' . $agent_disable .
|
||||
|
||||
' Alert edit: ' . $alert_edit .
|
||||
' Alert management: ' . $alert_management .
|
||||
|
||||
' User management: ' . $user_management .
|
||||
|
||||
' DB management: ' . $db_management .
|
||||
|
||||
' Event view: ' . $event_view .
|
||||
' Event edit: ' . $event_edit .
|
||||
' Event management: ' . $event_management .
|
||||
|
||||
' Report view: ' . $report_view .
|
||||
' Report edit: ' . $report_edit .
|
||||
' Report management: ' . $report_management .
|
||||
|
||||
' Network map view: ' . $map_view .
|
||||
' Network map edit: ' . $map_edit .
|
||||
' Network map management: ' . $map_management .
|
||||
|
||||
' Visual console view: ' . $vconsole_view .
|
||||
' Visual console edit: ' . $vconsole_edit .
|
||||
' Visual console management: ' . $vconsole_management .
|
||||
|
||||
' Pandora Management: ' . $pandora_management;
|
||||
$info = '{"Name":"'.$incident_view.'",
|
||||
"Incident view":"'.$incident_view.'",
|
||||
"Incident edit":"'.$incident_edit.'",
|
||||
"Incident management":"'.$incident_management.'",
|
||||
"Agent view":"'.$agent_view.'",
|
||||
"Agent edit":"'.$agent_edit.'",
|
||||
"Agent disable":"'.$agent_disable.'",
|
||||
"Alert edit":"'.$alert_edit.'",
|
||||
"Alert management":"'.$alert_management.'",
|
||||
"User management":"'.$user_management.'",
|
||||
"DB management":"'.$db_management.'",
|
||||
"Event view":"'.$event_view.'",
|
||||
"Event edit":"'.$event_edit.'",
|
||||
"Event management":"'.$event_management.'",
|
||||
"Report view":"'.$report_view.'",
|
||||
"Report edit":"'.$report_edit.'",
|
||||
"Report management":"'.$report_management.'",
|
||||
"Network map view":"'.$map_view.'",
|
||||
"Network map edit":"'.$map_edit.'",
|
||||
"Network map management":"'.$map_management.'",
|
||||
"Visual console view":"'.$vconsole_view.'",
|
||||
"Visual console edit":"'.$vconsole_edit.'",
|
||||
"Visual console management":"'.$vconsole_management.'",
|
||||
"Pandora Management":"'.$pandora_management.'"}';
|
||||
|
||||
db_pandora_audit("User management",
|
||||
"Update profile ". $name, false, false, $info);
|
||||
|
@ -239,41 +229,30 @@ if ($create_profile) {
|
|||
|
||||
if ($ret !== false) {
|
||||
ui_print_success_message(__('Successfully created'));
|
||||
|
||||
$info = 'Name: ' . $name .
|
||||
|
||||
' Incident view: ' . $incident_view .
|
||||
' Incident edit: ' . $incident_edit .
|
||||
' Incident management: ' . $incident_management .
|
||||
|
||||
' Agent view: ' . $agent_view .
|
||||
' Agent edit: ' . $agent_edit .
|
||||
' Agent disable: ' . $agent_disable .
|
||||
|
||||
' Alert edit: ' . $alert_edit .
|
||||
' Alert management: ' . $alert_management .
|
||||
|
||||
' User management: ' . $user_management .
|
||||
|
||||
' DB management: ' . $db_management .
|
||||
|
||||
' Event view: ' . $event_view .
|
||||
' Event edit: ' . $event_edit .
|
||||
' Event management: ' . $event_management .
|
||||
|
||||
' Report view: ' . $report_view .
|
||||
' Report edit: ' . $report_edit .
|
||||
' Report management: ' . $report_management .
|
||||
|
||||
' Network map view: ' . $map_view .
|
||||
' Network map edit: ' . $map_edit .
|
||||
' Network map management: ' . $map_management .
|
||||
|
||||
' Visual console view: ' . $vconsole_view .
|
||||
' Visual console edit: ' . $vconsole_edit .
|
||||
' Visual console management: ' . $vconsole_management .
|
||||
|
||||
' Pandora Management: ' . $pandora_management;
|
||||
$info = '{"Name":"'.$incident_view.'",
|
||||
"Incident view":"'.$incident_view.'",
|
||||
"Incident edit":"'.$incident_edit.'",
|
||||
"Incident management":"'.$incident_management.'",
|
||||
"Agent view":"'.$agent_view.'",
|
||||
"Agent edit":"'.$agent_edit.'",
|
||||
"Agent disable":"'.$agent_disable.'",
|
||||
"Alert edit":"'.$alert_edit.'",
|
||||
"Alert management":"'.$alert_management.'",
|
||||
"User management":"'.$user_management.'",
|
||||
"DB management":"'.$db_management.'",
|
||||
"Event view":"'.$event_view.'",
|
||||
"Event edit":"'.$event_edit.'",
|
||||
"Event management":"'.$event_management.'",
|
||||
"Report view":"'.$report_view.'",
|
||||
"Report edit":"'.$report_edit.'",
|
||||
"Report management":"'.$report_management.'",
|
||||
"Network map view":"'.$map_view.'",
|
||||
"Network map edit":"'.$map_edit.'",
|
||||
"Network map management":"'.$map_management.'",
|
||||
"Visual console view":"'.$vconsole_view.'",
|
||||
"Visual console edit":"'.$vconsole_edit.'",
|
||||
"Visual console management":"'.$vconsole_management.'",
|
||||
"Pandora Management":"'.$pandora_management.'"}';
|
||||
|
||||
db_pandora_audit("User management",
|
||||
"Created profile ". $name, false, false, $info);
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 81 KiB |
Binary file not shown.
After Width: | Height: | Size: 565 KiB |
Binary file not shown.
After Width: | Height: | Size: 184 B |
Binary file not shown.
After Width: | Height: | Size: 512 B |
Binary file not shown.
After Width: | Height: | Size: 426 B |
|
@ -51,6 +51,9 @@ $correctLogin = false;
|
|||
$user_in_db = null;
|
||||
$no_login_msg = "";
|
||||
|
||||
// Clean unwanted output
|
||||
ob_clean();
|
||||
|
||||
// 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
|
||||
|
@ -102,6 +105,62 @@ if ($correctLogin) {
|
|||
}
|
||||
else {
|
||||
$function_name = 'api_' . $op . '_' . $op2;
|
||||
|
||||
if ($op == "set" && $id){
|
||||
switch ($op2) {
|
||||
case "update_agent":
|
||||
|
||||
case "add_module_in_conf":
|
||||
case "update_module_in_conf":
|
||||
case "delete_module_in_conf":
|
||||
|
||||
$id_os = db_get_value_sql('select id_os from tagente where id_agente = '.$id);
|
||||
|
||||
if($id_os == 21){
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "create_network_module":
|
||||
case "create_plugin_module":
|
||||
case "create_data_module":
|
||||
case "create_synthetic_module":
|
||||
case "create_snmp_module":
|
||||
case "delete_module":
|
||||
case "delete_agent":
|
||||
|
||||
$id_os = db_get_value_sql('select id_os from tagente where nombre = "'.$id.'"');
|
||||
|
||||
html_debug($id_os);
|
||||
|
||||
if($id_os == 21){
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "update_network_module":
|
||||
case "update_plugin_module":
|
||||
case "update_data_module":
|
||||
case "update_snmp_module":
|
||||
|
||||
$id_os = db_get_value_sql('select id_os from tagente where id_agente = (select id_agente from tagente_modulo where id_agente_modulo ='.$id.')');
|
||||
|
||||
if($id_os == 21){
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
// break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the function exists
|
||||
|
|
|
@ -154,6 +154,15 @@ function process_user_login_local ($login, $pass, $api = false) {
|
|||
// We get DB nick to put in PHP Session variable,
|
||||
// to avoid problems with case-sensitive usernames.
|
||||
// Thanks to David Muñiz for Bug discovery :)
|
||||
|
||||
$filter = array("id_usuario" => $login);
|
||||
$user_profile = db_get_row_filter ("tusuario_perfil", $filter);
|
||||
if(!users_is_admin($login) && !$user_profile){
|
||||
$mysql_cache["auth_error"] = "User does not have any profile";
|
||||
$config["auth_error"] = "User does not have any profile";
|
||||
return false;
|
||||
}
|
||||
|
||||
return $row["id_user"];
|
||||
}
|
||||
else {
|
||||
|
@ -340,7 +349,7 @@ function process_user_login_remote ($login, $pass, $api = false) {
|
|||
$attributes = $ldap_adv_perm['groups_ldap'];
|
||||
|
||||
foreach ($attributes as $attr) {
|
||||
$attr = explode('=',$attr);
|
||||
$attr = explode('=', $attr, 2);
|
||||
if(in_array($attr[1],$sr[$attr[0]])) {
|
||||
$permissions[$i]["profile"] = $ldap_adv_perm['profile'];
|
||||
$permissions[$i]["groups"] = $ldap_adv_perm['group'];
|
||||
|
|
|
@ -48,6 +48,7 @@ class Tree {
|
|||
include_once($config['homedir']."/include/functions_servers.php");
|
||||
include_once($config['homedir']."/include/functions_modules.php");
|
||||
require_once($config['homedir']."/include/functions_tags.php");
|
||||
enterprise_include_once("include/functions_agents.php");
|
||||
|
||||
if (is_metaconsole()) enterprise_include_once("meta/include/functions_ui_meta.php");
|
||||
|
||||
|
@ -114,9 +115,17 @@ class Tree {
|
|||
$agents_normal_count = "($agent_table
|
||||
$agent_normal_filter) AS total_normal_count";
|
||||
// Not init
|
||||
$agent_not_init_filter = $this->getAgentStatusFilter(AGENT_STATUS_NOT_INIT);
|
||||
$agents_not_init_count = "($agent_table
|
||||
$agent_not_init_filter) AS total_not_init_count";
|
||||
|
||||
if($this->filter['show_not_init_agents']){
|
||||
$agent_not_init_filter = $this->getAgentStatusFilter(AGENT_STATUS_NOT_INIT);
|
||||
$agents_not_init_count = "($agent_table
|
||||
$agent_not_init_filter) AS total_not_init_count";
|
||||
}
|
||||
else{
|
||||
$agent_not_init_filter = 0;
|
||||
$agents_not_init_count = 0;
|
||||
}
|
||||
|
||||
// Alerts fired
|
||||
$agents_fired_count = "($agent_table
|
||||
AND ta.fired_count > 0) AS total_fired_count";
|
||||
|
@ -287,13 +296,19 @@ class Tree {
|
|||
// Modules join
|
||||
$modules_join = "";
|
||||
$module_status_join = "";
|
||||
if (!empty($module_search_filter) || !empty($module_status_filter)) {
|
||||
if (!empty($module_search_filter) || !empty($module_status_filter) || !$this->filter['show_not_init_agents']) {
|
||||
|
||||
if (!empty($module_status_filter)) {
|
||||
if (!empty($module_status_filter) || !$this->filter['show_not_init_agents']) {
|
||||
$module_status_join = "INNER JOIN tagente_estado tae
|
||||
ON tam.id_agente_modulo IS NOT NULL
|
||||
AND tam.id_agente_modulo = tae.id_agente_modulo
|
||||
$module_status_filter";
|
||||
|
||||
if(!$this->filter['show_not_init_modules'] || ($this->filter['show_not_init_modules'] && !$this->filter['show_not_init_agents'])){
|
||||
if($type != 'agent' || ($type == 'agent' && !$this->filter['show_not_init_modules'] && !$this->filter['show_not_init_agents'])){
|
||||
$module_status_join .= ' AND tae.estado <> '.AGENT_MODULE_STATUS_NO_DATA.' AND tae.estado <> '.AGENT_MODULE_STATUS_NOT_INIT.' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$modules_join = "INNER JOIN tagente_modulo tam
|
||||
|
@ -304,8 +319,22 @@ class Tree {
|
|||
}
|
||||
|
||||
if (empty($module_status_join)) {
|
||||
$module_status_join = "LEFT JOIN tagente_estado tae
|
||||
ON tam.id_agente_modulo = tae.id_agente_modulo";
|
||||
if(!$this->filter['show_not_init_modules'] || !$this->filter['show_not_init_agents']){
|
||||
if($type == "agent"){
|
||||
$module_status_join = 'INNER JOIN tagente_estado tae
|
||||
ON tam.id_agente_modulo = tae.id_agente_modulo ';
|
||||
}
|
||||
else{
|
||||
$module_status_join = 'LEFT JOIN tagente_estado tae
|
||||
ON tam.id_agente_modulo = tae.id_agente_modulo ';
|
||||
}
|
||||
|
||||
$module_status_join .= ' AND 1=1 AND tae.estado <> '.AGENT_MODULE_STATUS_NO_DATA.' AND tae.estado <> '.AGENT_MODULE_STATUS_NOT_INIT.' ';
|
||||
}
|
||||
else{
|
||||
$module_status_join = 'LEFT JOIN tagente_estado tae
|
||||
ON tam.id_agente_modulo = tae.id_agente_modulo ';
|
||||
}
|
||||
}
|
||||
|
||||
$sql = false;
|
||||
|
@ -315,63 +344,77 @@ class Tree {
|
|||
// ACL Group
|
||||
$user_groups_str = "-1";
|
||||
$group_filter = "";
|
||||
if (!$this->strictACL) {
|
||||
if (empty($this->userGroups)) {
|
||||
|
||||
if (empty($this->userGroups)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Asking for a specific group.
|
||||
if ($item_for_count !== false) {
|
||||
if (!isset($this->userGroups[$item_for_count])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Asking for a specific group.
|
||||
if ($item_for_count !== false) {
|
||||
if (!isset($this->userGroups[$item_for_count])) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Asking for all groups.
|
||||
else {
|
||||
$user_groups_str = implode(",", array_keys($this->userGroups));
|
||||
$group_filter = "AND ta.id_grupo IN ($user_groups_str)";
|
||||
}
|
||||
}
|
||||
// Asking for all groups.
|
||||
else {
|
||||
if (!empty($this->acltags)) {
|
||||
$groups = array();
|
||||
foreach ($this->acltags as $group_id => $tags_str) {
|
||||
if (empty($tags_str)) {
|
||||
$hierarchy_groups = groups_get_id_recursive($group_id);
|
||||
$groups = array_merge($groups, $hierarchy_groups);
|
||||
}
|
||||
}
|
||||
if (!empty($groups)) {
|
||||
if (array_search(0, $groups) === false) {
|
||||
$user_groups_str = implode(",", $groups);
|
||||
}
|
||||
}
|
||||
}
|
||||
$group_filter = "AND ta.id_grupo IN ($user_groups_str)";
|
||||
$user_groups_str = implode(",", array_keys($this->userGroups));
|
||||
$group_filter = "AND (
|
||||
ta.id_grupo IN ($user_groups_str)
|
||||
OR tasg.id_group IN ($user_groups_str)
|
||||
)";
|
||||
}
|
||||
|
||||
if(!$search_hirearchy && (!empty($agent_search_filter) || !empty($module_search_filter))){
|
||||
|
||||
if(is_metaconsole()){
|
||||
$query_agent_search = " SELECT DISTINCT(ta.id_grupo)
|
||||
FROM tmetaconsole_agent ta
|
||||
WHERE ta.disabled = 0
|
||||
$agent_search_filter";
|
||||
$id_groups_agents = db_get_all_rows_sql($query_agent_search);
|
||||
$id_groups_agents = db_get_all_rows_sql(
|
||||
" SELECT DISTINCT(ta.id_grupo)
|
||||
FROM tmetaconsole_agent ta
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE ta.disabled = 0
|
||||
$agent_search_filter"
|
||||
);
|
||||
$id_secondary_groups_agents = db_get_all_rows_sql(
|
||||
" SELECT DISTINCT(tasg.id_group)
|
||||
FROM tmetaconsole_agent ta
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE ta.disabled = 0
|
||||
$agent_search_filter"
|
||||
);
|
||||
}
|
||||
else{
|
||||
$query_agent_search = " SELECT DISTINCT(ta.id_grupo)
|
||||
FROM tagente ta, tagente_modulo tam
|
||||
WHERE tam.id_agente = ta.id_agente
|
||||
AND ta.disabled = 0
|
||||
$agent_search_filter
|
||||
$module_search_filter";
|
||||
$id_groups_agents = db_get_all_rows_sql($query_agent_search);
|
||||
$id_groups_agents = db_get_all_rows_sql(
|
||||
" SELECT DISTINCT(ta.id_grupo)
|
||||
FROM tagente ta
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
, tagente_modulo tam
|
||||
WHERE tam.id_agente = ta.id_agente
|
||||
AND ta.disabled = 0
|
||||
$agent_search_filter
|
||||
$module_search_filter"
|
||||
);
|
||||
$id_secondary_groups_agents = db_get_all_rows_sql(
|
||||
" SELECT DISTINCT(tasg.id_group)
|
||||
FROM tagente ta
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
, tagente_modulo tam
|
||||
WHERE tam.id_agente = ta.id_agente
|
||||
AND ta.disabled = 0
|
||||
$agent_search_filter
|
||||
$module_search_filter"
|
||||
);
|
||||
}
|
||||
|
||||
if($id_groups_agents != false){
|
||||
foreach ($id_groups_agents as $key => $value) {
|
||||
$id_groups_agents_array[] = $value['id_grupo'];
|
||||
$id_groups_agents_array[$value['id_grupo']] = $value['id_grupo'];
|
||||
}
|
||||
foreach ($id_secondary_groups_agents as $key => $value) {
|
||||
$id_groups_agents_array[$value['id_group']] = $value['id_group'];
|
||||
}
|
||||
$user_groups_array = explode(",", $user_groups_str);
|
||||
$user_groups_array = array_intersect($user_groups_array, $id_groups_agents_array);
|
||||
|
@ -407,13 +450,18 @@ class Tree {
|
|||
else {
|
||||
$agent_table = "SELECT COUNT(DISTINCT(ta.id_agente))
|
||||
FROM tagente ta
|
||||
INNER JOIN tagente_modulo tam
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente=tasg.id_agent
|
||||
LEFT JOIN tagente_modulo tam
|
||||
ON tam.disabled = 0
|
||||
AND ta.id_agente = tam.id_agente
|
||||
$module_search_filter
|
||||
$module_status_join
|
||||
WHERE ta.disabled = 0
|
||||
AND ta.id_grupo = $item_for_count
|
||||
AND (
|
||||
ta.id_grupo = $item_for_count
|
||||
OR tasg.id_group = $item_for_count
|
||||
)
|
||||
$group_filter
|
||||
$agent_search_filter
|
||||
$agent_status_filter";
|
||||
|
@ -433,8 +481,13 @@ class Tree {
|
|||
else {
|
||||
$agent_table = "SELECT COUNT(DISTINCT(ta.id_agente))
|
||||
FROM tmetaconsole_agent ta
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE ta.disabled = 0
|
||||
AND ta.id_grupo = $item_for_count
|
||||
AND (
|
||||
ta.id_grupo = $item_for_count
|
||||
OR tasg.id_group = $item_for_count
|
||||
)
|
||||
$group_filter
|
||||
$agent_search_filter
|
||||
$agent_status_filter";
|
||||
|
@ -443,7 +496,7 @@ class Tree {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (! is_metaconsole() || $this->strictACL) {
|
||||
if (! is_metaconsole()) {
|
||||
$columns = 'ta.id_agente AS id, ta.nombre AS name, ta.alias,
|
||||
ta.fired_count, ta.normal_count, ta.warning_count,
|
||||
ta.critical_count, ta.unknown_count, ta.notinit_count,
|
||||
|
@ -456,13 +509,18 @@ class Tree {
|
|||
|
||||
$sql = "SELECT $columns
|
||||
FROM tagente ta
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON tasg.id_agent = ta.id_agente
|
||||
LEFT JOIN tagente_modulo tam
|
||||
ON tam.disabled = 0
|
||||
AND ta.id_agente = tam.id_agente
|
||||
$module_search_filter
|
||||
$module_status_join
|
||||
WHERE ta.disabled = 0
|
||||
AND ta.id_grupo = $rootID
|
||||
AND (
|
||||
ta.id_grupo = $rootID
|
||||
OR tasg.id_group = $rootID
|
||||
)
|
||||
$group_filter
|
||||
$agent_search_filter
|
||||
$agent_status_filter
|
||||
|
@ -473,13 +531,18 @@ class Tree {
|
|||
$columns = 'ta.id_tagente AS id, ta.nombre AS name, ta.alias,
|
||||
ta.fired_count, ta.normal_count, ta.warning_count,
|
||||
ta.critical_count, ta.unknown_count, ta.notinit_count,
|
||||
ta.total_count, ta.quiet, id_tmetaconsole_setup AS server_id';
|
||||
ta.total_count, ta.quiet, ta.id_tmetaconsole_setup AS server_id';
|
||||
$order_fields = 'ta.alias ASC, ta.id_tagente ASC';
|
||||
|
||||
$sql = "SELECT $columns
|
||||
FROM tmetaconsole_agent ta
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE ta.disabled = 0
|
||||
AND ta.id_grupo = $rootID
|
||||
AND (
|
||||
ta.id_grupo = $rootID
|
||||
OR tasg.id_group = $rootID
|
||||
)
|
||||
$group_filter
|
||||
$agent_search_filter
|
||||
$agent_status_filter
|
||||
|
@ -514,12 +577,14 @@ class Tree {
|
|||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT $columns
|
||||
$sql = "SELECT DISTINCT $columns
|
||||
FROM tagente_modulo tam
|
||||
$tag_join
|
||||
$module_status_join
|
||||
INNER JOIN tagente ta
|
||||
ON ta.disabled = 0
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
AND tam.id_agente = ta.id_agente
|
||||
AND ta.id_grupo = $rootID
|
||||
$group_filter
|
||||
|
@ -1120,11 +1185,11 @@ class Tree {
|
|||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$sql = $this->getSqlExtended($item_for_count, $type, $rootType, $parent, $rootID,
|
||||
$agent_search_filter, $agent_status_filter, $agents_join,
|
||||
$module_search_filter, $module_status_filter, $modules_join,
|
||||
$module_status_join);
|
||||
default:
|
||||
$sql = $this->getSqlExtended($item_for_count, $type, $rootType, $parent, $rootID,
|
||||
$agent_search_filter, $agent_status_filter, $agents_join,
|
||||
$module_search_filter, $module_status_filter, $modules_join,
|
||||
$module_status_join);
|
||||
}
|
||||
|
||||
return $sql;
|
||||
|
@ -1147,6 +1212,23 @@ class Tree {
|
|||
if (empty($data))
|
||||
return array();
|
||||
|
||||
foreach ($data[0] as $key => $value) {
|
||||
|
||||
if($key != 'total_count' && $key != 'total_fired_count' && strpos($key, 'count')){
|
||||
$zero_counter += $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!$zero_counter){
|
||||
$data[0]['total_count'] = 0;
|
||||
}
|
||||
else{
|
||||
$data[0]['total_count'] = $zero_counter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// [26/10/2017] It seems the module hierarchy should be only available into the tree by group
|
||||
if ($this->rootType == 'group' && $this->type == 'agent') {
|
||||
$data = $this->getProcessedModules($data);
|
||||
|
@ -1161,7 +1243,6 @@ class Tree {
|
|||
if (!empty($counters)) {
|
||||
$counters = array_pop($counters);
|
||||
}
|
||||
|
||||
return $counters;
|
||||
}
|
||||
|
||||
|
@ -1599,6 +1680,15 @@ class Tree {
|
|||
'url' => $moduleGraphURL,
|
||||
'handle' => $winHandle
|
||||
);
|
||||
|
||||
// Info to be able to open the snapshot image new page
|
||||
$module['snapshot'] = ui_get_snapshot_link(array(
|
||||
'id_module' => $module['id'],
|
||||
'last_data' => $module['datos'],
|
||||
'timestamp' => $module['timestamp'],
|
||||
'interval' => $module['current_interval'],
|
||||
'module_name' => $module['name']
|
||||
), true);
|
||||
}
|
||||
|
||||
// Alerts fired image
|
||||
|
@ -2037,6 +2127,18 @@ class Tree {
|
|||
$items = $this->getItems();
|
||||
$this->processModules($items);
|
||||
$processed_items = $items;
|
||||
|
||||
if(!$this->filter['show_not_init_modules']){
|
||||
|
||||
foreach ($items as $key => $value) {
|
||||
if($items[$key]['total_count'] != $items[$key]['notinit_count']){
|
||||
$items[$key]['total_count'] = $items[$key]['total_count'] - $items[$key]['notinit_count'];
|
||||
$items[$key]['notinit_count'] = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
$items = array();
|
||||
|
@ -2252,6 +2354,28 @@ class Tree {
|
|||
// Agents
|
||||
else {
|
||||
$items = $this->getItems();
|
||||
|
||||
|
||||
if(!$this->filter['show_not_init_modules']){
|
||||
|
||||
foreach ($items as $key => $value) {
|
||||
$items[$key]['total_count'] = $items[$key]['total_count'] - $items[$key]['notinit_count'];
|
||||
$items[$key]['notinit_count'] = 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!$this->filter['show_not_init_agents']){
|
||||
|
||||
foreach ($items as $key => $value) {
|
||||
if($items[$key]['total_count'] == $items[$key]['notinit_count']){
|
||||
unset($items[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->processAgents($items);
|
||||
$processed_items = $items;
|
||||
}
|
||||
|
@ -2706,6 +2830,10 @@ class Tree {
|
|||
protected function getGroupCounters($group_id) {
|
||||
global $config;
|
||||
static $group_stats = false;
|
||||
// FIXME: Avoid to use cache when secondary groups is used
|
||||
if (enterprise_hook('agents_is_using_secondary_groups')) {
|
||||
return $this->getCounters($group_id);
|
||||
}
|
||||
# Do not use the group stat cache when using tags or real time group stats.
|
||||
if ($config['realtimestats'] == 1 ||
|
||||
(isset($this->userGroups[$group_id]['tags']) && $this->userGroups[$group_id]['tags'] != "") ||
|
||||
|
@ -2717,14 +2845,18 @@ class Tree {
|
|||
if ( $group_stats === false) {
|
||||
$group_stats = array();
|
||||
$stats = db_get_all_rows_sql('SELECT * FROM tgroup_stat');
|
||||
|
||||
foreach ($stats as $group) {
|
||||
if ($group['modules'] > 0) {
|
||||
$group_stats[$group['id_group']]['total_count'] = $group['modules'] > 0 ? $group['agents'] : 0;
|
||||
$group_stats[$group['id_group']]['total_critical_count'] = $group['critical'];
|
||||
$group_stats[$group['id_group']]['total_unknown_count'] = $group['unknown'];
|
||||
$group_stats[$group['id_group']]['total_warning_count'] = $group['warning'];
|
||||
$group_stats[$group['id_group']]['total_not_init_count'] = $group['non-init'];
|
||||
if($this->filter['show_not_init_modules']){
|
||||
$group_stats[$group['id_group']]['total_not_init_count'] = $group['non-init'];
|
||||
}
|
||||
else{
|
||||
$group_stats[$group['id_group']]['total_not_init_count'] = 0;
|
||||
}
|
||||
$group_stats[$group['id_group']]['total_normal_count'] = $group['normal'];
|
||||
$group_stats[$group['id_group']]['total_fired_count'] = $group['alerts_fired'];
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC180301';
|
||||
$pandora_version = 'v7.0NG.719';
|
||||
$build_version = 'PC180423';
|
||||
$pandora_version = 'v7.0NG.722';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
|
@ -129,6 +129,8 @@ define('COL_WARNING_DARK', '#FFB900');
|
|||
define('COL_NORMAL', '#80BA27');
|
||||
define('COL_NOTINIT', '#3BA0FF');
|
||||
define('COL_UNKNOWN', '#B2B2B2');
|
||||
define('COL_DOWNTIME', '#976DB1');
|
||||
define('COL_IGNORED', '#DDD');
|
||||
define('COL_ALERTFIRED', '#FFA631');
|
||||
define('COL_MINOR', '#F099A2');
|
||||
define('COL_MAJOR', '#C97A4A');
|
||||
|
|
|
@ -1832,6 +1832,22 @@ function check_acl($id_user, $id_group, $access, $onlyOneGroup = false) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the ACL of a list of groups.
|
||||
*
|
||||
* @param string $id_user to check the ACL
|
||||
* @param Array $groups. All groups to check
|
||||
* @param string $access. Profile to check
|
||||
*
|
||||
* @return bool True if at least one of this groups check the ACL
|
||||
*/
|
||||
function check_acl_one_of_groups($id_user, $groups, $access) {
|
||||
foreach ($groups as $group) {
|
||||
if (check_acl($id_user, $group, $access)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the database column of one access flag
|
||||
*
|
||||
|
@ -2273,6 +2289,10 @@ function get_news($arguments) {
|
|||
$limit = get_argument ('limit', $arguments, 99999999);
|
||||
|
||||
$id_group = array_keys(users_get_groups($id_user, false, true));
|
||||
|
||||
// Empty groups
|
||||
if (empty($id_group)) return array();
|
||||
|
||||
$id_group = implode(',',$id_group);
|
||||
$current_datetime = date('Y-m-d H:i:s', time());
|
||||
$modal = (int) $modal;
|
||||
|
|
|
@ -180,8 +180,6 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f
|
|||
}
|
||||
|
||||
if (($id_agent !== false) && ($idGroup !== false)) {
|
||||
$groups = users_get_groups($config["id_user"]);
|
||||
|
||||
if ($idGroup != 0) { //All group
|
||||
$subQuery = 'SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
|
@ -191,17 +189,6 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f
|
|||
$subQuery = 'SELECT id_agente_modulo
|
||||
FROM tagente_modulo WHERE delete_pending = 0';
|
||||
}
|
||||
|
||||
if ($strict_user) {
|
||||
$where_tags = tags_get_acl_tags($config['id_user'], $groups, 'AR', 'module_condition', 'AND', 'tagente_modulo');
|
||||
// If there are any errors add imposible condition
|
||||
if(in_array($where_tags, array(ERR_WRONG_PARAMETERS, ERR_ACL))) {
|
||||
$subQuery .= ' AND 1 = 0';
|
||||
}
|
||||
else {
|
||||
$subQuery .= $where_tags;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($id_agent === false || empty($id_agent)) {
|
||||
if ($allModules)
|
||||
|
@ -256,7 +243,6 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f
|
|||
$limit_sql = " LIMIT $offset, $limit ";
|
||||
}
|
||||
$sql = sprintf("%s %s", $sql, $limit_sql);
|
||||
|
||||
$alerts = db_get_all_rows_sql($sql);
|
||||
break;
|
||||
case "postgresql":
|
||||
|
@ -411,9 +397,11 @@ function agents_get_agents ($filter = false, $fields = false,
|
|||
return false;
|
||||
}
|
||||
}
|
||||
$filter['id_group'] = $filter['id_grupo'];
|
||||
|
||||
if (in_array (0, $filter['id_grupo'])) {
|
||||
unset ($filter['id_grupo']);
|
||||
unset ($filter['id_group']);
|
||||
}
|
||||
|
||||
if (!is_array ($fields)) {
|
||||
|
@ -439,7 +427,23 @@ function agents_get_agents ($filter = false, $fields = false,
|
|||
unset($filter['id_agente']);
|
||||
}
|
||||
|
||||
$where = db_format_array_where_clause_sql ($filter, 'AND', '');
|
||||
// Group filter with secondary groups
|
||||
$where_secondary = '';
|
||||
if (isset($filter['id_group']) && isset($filter['id_grupo'])) {
|
||||
$where_secondary .= db_format_array_where_clause_sql (array(
|
||||
'tagent_secondary_group.id_group' => $filter['id_group'],
|
||||
'id_grupo' => $filter['id_grupo']
|
||||
) , 'OR', '');
|
||||
unset($filter['id_group']);
|
||||
unset($filter['id_grupo']);
|
||||
unset($filter_nogroup['id_grupo']);
|
||||
unset($filter_nogroup['id_group']);
|
||||
}
|
||||
// Add the group filter to
|
||||
$where = db_format_array_where_clause_sql ($filter, 'AND', "(" . $where_secondary . ") AND ");
|
||||
if ($where == '' && $where_secondary != '') {
|
||||
$where = $where_secondary;
|
||||
}
|
||||
|
||||
$where_nogroup = db_format_array_where_clause_sql(
|
||||
$filter_nogroup, 'AND', '');
|
||||
|
@ -471,49 +475,17 @@ function agents_get_agents ($filter = false, $fields = false,
|
|||
$where = sprintf('%s AND %s AND (%s) %s AND %s %s',
|
||||
$where, $where_nogroup, $status_sql, $search, $disabled, $search_custom);
|
||||
}
|
||||
$sql = sprintf('SELECT %s
|
||||
FROM tagente
|
||||
$sql = sprintf('SELECT DISTINCT %s
|
||||
FROM tagente LEFT JOIN tagent_secondary_group ON tagent_secondary_group.id_agent=tagente.id_agente
|
||||
WHERE %s %s', implode(',',$fields), $where, $order);
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$limit_sql = '';
|
||||
if (isset($offset) && isset($limit)) {
|
||||
$limit_sql = " LIMIT $offset, $limit ";
|
||||
}
|
||||
$sql = sprintf("%s %s", $sql, $limit_sql);
|
||||
|
||||
if ($return)
|
||||
return $sql;
|
||||
else
|
||||
$agents = db_get_all_rows_sql($sql);
|
||||
break;
|
||||
case "postgresql":
|
||||
$limit_sql = '';
|
||||
if (isset($offset) && isset($limit)) {
|
||||
$limit_sql = " OFFSET $offset LIMIT $limit ";
|
||||
}
|
||||
$sql = sprintf("%s %s", $sql, $limit_sql);
|
||||
|
||||
if ($return)
|
||||
return $sql;
|
||||
else
|
||||
$agents = db_get_all_rows_sql($sql);
|
||||
|
||||
break;
|
||||
case "oracle":
|
||||
$set = array();
|
||||
if (isset($offset) && isset($limit)) {
|
||||
$set['limit'] = $limit;
|
||||
$set['offset'] = $offset;
|
||||
}
|
||||
|
||||
if ($return)
|
||||
return $sql;
|
||||
else
|
||||
$agents = oracle_recode_query ($sql, $set, 'AND', false);
|
||||
break;
|
||||
$limit_sql = '';
|
||||
if (isset($offset) && isset($limit)) {
|
||||
$limit_sql = " LIMIT $offset, $limit ";
|
||||
}
|
||||
$sql = sprintf("%s %s", $sql, $limit_sql);
|
||||
if ($return) return $sql;
|
||||
else $agents = db_get_all_rows_sql($sql);
|
||||
|
||||
return $agents;
|
||||
}
|
||||
|
@ -1098,7 +1070,6 @@ function agents_get_modules ($id_agent = null, $details = false,
|
|||
$id_agent = safe_int ($id_agent, 1);
|
||||
}
|
||||
|
||||
|
||||
$where = "(
|
||||
1 = (
|
||||
SELECT is_admin
|
||||
|
@ -1108,10 +1079,15 @@ function agents_get_modules ($id_agent = null, $details = false,
|
|||
OR
|
||||
tagente_modulo.id_agente IN (
|
||||
SELECT id_agente
|
||||
FROM tagente
|
||||
WHERE id_grupo IN (
|
||||
FROM tagente tas LEFT JOIN tagent_secondary_group tasgs
|
||||
ON tas.id_agente = tasgs.id_agent
|
||||
WHERE (tas.id_grupo IN (
|
||||
" . implode(',', $id_userGroups) . "
|
||||
) OR
|
||||
tasgs.id_group IN (
|
||||
" . implode(',', $id_userGroups) . "
|
||||
)
|
||||
)
|
||||
)
|
||||
OR 0 IN (
|
||||
SELECT id_grupo
|
||||
|
@ -1354,7 +1330,11 @@ function agents_get_name ($id_agent, $case = "none") {
|
|||
* @return string Alias of the given agent.
|
||||
*/
|
||||
function agents_get_alias ($id_agent, $case = 'none') {
|
||||
$alias = (string) db_get_value ('alias', 'tagente', 'id_agente', (int) $id_agent);
|
||||
if(is_metaconsole()){
|
||||
$alias = (string) db_get_value ('alias', 'tmetaconsole_agent', 'id_tagente', (int) $id_agent);
|
||||
} else {
|
||||
$alias = (string) db_get_value ('alias', 'tagente', 'id_agente', (int) $id_agent);
|
||||
}
|
||||
|
||||
switch ($case) {
|
||||
case 'upper':
|
||||
|
@ -1859,8 +1839,8 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
|
|||
$agent_alias = io_safe_output(agents_get_alias($id_agent));
|
||||
|
||||
/* Check for deletion permissions */
|
||||
$id_group = agents_get_agent_group ($id_agent);
|
||||
if ((! check_acl ($config['id_user'], $id_group, "AW")) && !$disableACL) {
|
||||
$all_groups = agents_get_all_groups_agent ($id_agent);
|
||||
if ((! check_acl_one_of_groups ($config['id_user'], $all_groups, "AW")) && !$disableACL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2678,4 +2658,26 @@ function agents_generate_name ($alias, $address = '') {
|
|||
return hash('sha256', $alias . '|' . $address . '|' . time() . '|' . sprintf('%04d', rand(0, 10000)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the groups related to an agent. It includes all secondary groups.
|
||||
*
|
||||
* @param int $id_agent
|
||||
* @param int $id_group. By default it will search for it in dtabase
|
||||
*
|
||||
* @return Array with the main and secondary groups
|
||||
*/
|
||||
function agents_get_all_groups_agent ($id_agent, $group = false) {
|
||||
// Get the group if is not defined
|
||||
if ($group === false) $group = agents_get_group_agents($id_agent);
|
||||
|
||||
$secondary_groups = enterprise_hook('agents_get_secondary_groups', array($id_agent));
|
||||
|
||||
// Return only an array with the group in open version
|
||||
if ($secondary_groups == ENTERPRISE_NOT_HOOK) return array($group);
|
||||
|
||||
// Add a list of groups
|
||||
$secondary_groups['plain'][] = $group;
|
||||
return $secondary_groups['plain'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -84,6 +84,10 @@ function returnError($typeError, $returnType = 'string') {
|
|||
returnData($returnType,
|
||||
array('type' => 'string', 'data' => __('Id does not exist in BD.')));
|
||||
break;
|
||||
case 'not_allowed_operation_cluster':
|
||||
returnData($returnType,
|
||||
array('type' => 'string', 'data' => __('This operation can not be used in cluster elements.')));
|
||||
break;
|
||||
default:
|
||||
returnData("string",
|
||||
array('type' => 'string', 'data' => __($returnType)));
|
||||
|
@ -10142,4 +10146,472 @@ function api_set_metaconsole_synch($keys) {
|
|||
|
||||
}
|
||||
|
||||
function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) {
|
||||
global $config;
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$name = $other['data'][0];
|
||||
$cluster_type = $other['data'][1];
|
||||
$description = $other['data'][2];
|
||||
$idGroup = $other['data'][3];
|
||||
|
||||
|
||||
$server_name = db_process_sql('select name from tserver where server_type=5 limit 1');
|
||||
|
||||
$server_name_agent = $server_name[0]['name'];
|
||||
|
||||
$values_agent = array(
|
||||
'nombre' => $name,
|
||||
'alias' => $name,
|
||||
'comentarios' => $description,
|
||||
'id_grupo' => $idGroup,
|
||||
'id_os' => 100,
|
||||
'server_name' => $server_name_agent
|
||||
);
|
||||
|
||||
if (trim($name) != "") {
|
||||
|
||||
// $id_agent = db_process_sql_insert('tagente',$values_agent);
|
||||
|
||||
$id_agent = agents_create_agent($values_agent['nombre'],$values_agent['id_grupo'],300,'127.0.0.1',$values_agent);
|
||||
|
||||
// Create cluster
|
||||
$values_cluster = array(
|
||||
'name' => $name,
|
||||
'cluster_type' => $cluster_type,
|
||||
'description' => $description,
|
||||
'group' => $idGroup,
|
||||
'id_agent' => $id_agent
|
||||
);
|
||||
|
||||
$id_cluster = db_process_sql_insert('tcluster', $values_cluster);
|
||||
|
||||
|
||||
$values_module = array(
|
||||
'nombre' => 'Cluster status',
|
||||
'id_modulo' => 5,
|
||||
'prediction_module' => 5,
|
||||
'id_agente' =>$id_agent,
|
||||
'custom_integer_1' =>$id_cluster,
|
||||
'id_tipo_modulo' => 1,
|
||||
'descripcion' => 'Cluster status information module',
|
||||
'min_warning' => 1,
|
||||
'min_critical' => 2
|
||||
);
|
||||
|
||||
$id_module = modules_create_agent_module($values_module['id_agente'],$values_module['nombre'],$values_module);
|
||||
|
||||
|
||||
if ($id_cluster !== false)
|
||||
db_pandora_audit("Report management", "Create cluster #$id_cluster");
|
||||
else
|
||||
db_pandora_audit("Report management", "Fail try to create cluster");
|
||||
|
||||
if ($id_agent !== false)
|
||||
db_pandora_audit("Report management", "Create cluster #$id_agent");
|
||||
else
|
||||
db_pandora_audit("Report management", "Fail try to create agent");
|
||||
|
||||
returnData('string',
|
||||
array('type' => 'string', 'data' => (int)((bool)$id_cluster)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function api_set_add_cluster_agent($thrash1, $thrash2, $other, $thrash3) {
|
||||
|
||||
$array_json = json_decode(base64_decode(io_safe_output($other['data'][0])), true);
|
||||
|
||||
if(!empty($array_json)){
|
||||
$results = false;
|
||||
|
||||
foreach ($array_json as $key => $element) {
|
||||
|
||||
if($element['id'] == 0){
|
||||
continue;
|
||||
}
|
||||
|
||||
$tcluster_agent = db_process_sql('insert into tcluster_agent values ('.$element["id"].','.$element["id_agent"].')');
|
||||
|
||||
}
|
||||
|
||||
if($result && !$results){
|
||||
$results = $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($tcluster_agent){
|
||||
returnData('string', array('type' => 'string', 'data' => 1));
|
||||
} else {
|
||||
returnError('error_add_cluster_element', __('Error adding elements to cluster'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3) {
|
||||
|
||||
$array_json = json_decode(base64_decode(io_safe_output($other['data'][0])), true);
|
||||
|
||||
if(!empty($array_json)){
|
||||
$results = false;
|
||||
}
|
||||
|
||||
//
|
||||
foreach ($array_json as $key => $element) {
|
||||
//
|
||||
if($element["type"] == "AA"){
|
||||
//
|
||||
$tcluster_module = db_process_sql_insert('tcluster_item',array('name'=>$element["name"],'id_cluster'=>$element["id_cluster"],'critical_limit'=>$element["critical_limit"],'warning_limit'=>$element["warning_limit"]));
|
||||
|
||||
$id_agent = db_process_sql('select id_agent from tcluster where id = '.$element["id_cluster"]);
|
||||
|
||||
$id_parent_modulo = db_process_sql('select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent[0]['id_agent'].' and nombre = "Cluster status"');
|
||||
|
||||
$get_module_type = db_process_sql('select id_tipo_modulo,descripcion,min_warning,min_critical,module_interval from tagente_modulo where nombre = "'.$element["name"].'" limit 1');
|
||||
|
||||
$get_module_type_value = $get_module_type[0]['id_tipo_modulo'];
|
||||
|
||||
$get_module_description_value = $get_module_type[0]['descripcion'];
|
||||
|
||||
$get_module_warning_value = $get_module_type[0]['min_warning'];
|
||||
|
||||
$get_module_critical_value = $get_module_type[0]['min_critical'];
|
||||
|
||||
$get_module_interval_value = $get_module_type[0]['module_interval'];
|
||||
|
||||
$values_module = array(
|
||||
'nombre' => $element["name"],
|
||||
'id_modulo' => 0,
|
||||
'prediction_module' => 6,
|
||||
'id_agente' => $id_agent[0]['id_agent'],
|
||||
'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'],
|
||||
'custom_integer_1' =>$element["id_cluster"],
|
||||
'custom_integer_2' =>$tcluster_module,
|
||||
'id_tipo_modulo' =>1,
|
||||
'descripcion' => $get_module_description_value,
|
||||
'min_warning' => $element["warning_limit"],
|
||||
'min_critical' => $element["critical_limit"],
|
||||
'tcp_port' => 1,
|
||||
'module_interval' => $get_module_interval_value
|
||||
);
|
||||
|
||||
|
||||
$id_module = modules_create_agent_module($values_module['id_agente'],$values_module['nombre'],$values_module);
|
||||
|
||||
if ($tcluster_module !== false){
|
||||
db_pandora_audit("Report management", "Module #".$element["name"]." assigned to cluster #".$element["id_cluster"]);
|
||||
}
|
||||
else{
|
||||
db_pandora_audit("Report management", "Fail try to assign module to cluster");
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($element["type"] == "AP") {
|
||||
|
||||
|
||||
$id_agent = db_process_sql('select id_agent from tcluster where id = '.$element["id_cluster"]);
|
||||
|
||||
$id_parent_modulo = db_process_sql('select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent[0]['id_agent'].' and nombre = "Cluster status"');
|
||||
|
||||
$tcluster_balanced_module = db_process_sql_insert('tcluster_item',array('name'=>$element["name"],'id_cluster'=>$element["id_cluster"],'item_type'=>"AP",'is_critical'=>$element["is_critical"]));
|
||||
|
||||
$get_module_type = db_process_sql('select id_tipo_modulo,descripcion,min_warning,min_critical,module_interval from tagente_modulo where nombre = "'.$element["name"].'" limit 1');
|
||||
|
||||
$get_module_type_value = $get_module_type[0]['id_tipo_modulo'];
|
||||
|
||||
$get_module_description_value = $get_module_type[0]['descripcion'];
|
||||
|
||||
$get_module_warning_value = $get_module_type[0]['min_warning'];
|
||||
|
||||
$get_module_critical_value = $get_module_type[0]['min_critical'];
|
||||
|
||||
$get_module_interval_value = $get_module_type[0]['module_interval'];
|
||||
|
||||
$get_module_type_nombre = db_process_sql('select nombre from ttipo_modulo where id_tipo = '.$get_module_type_value);
|
||||
|
||||
$get_module_type_nombre_value = $get_module_type_nombre[0]['nombre'];
|
||||
|
||||
|
||||
if(strpos($get_module_type_nombre_value,'inc') != false){
|
||||
$get_module_type_value_normal = 4;
|
||||
}
|
||||
elseif (strpos($get_module_type_nombre_value,'proc') != false) {
|
||||
$get_module_type_value_normal = 2;
|
||||
}
|
||||
elseif (strpos($get_module_type_nombre_value,'data') != false) {
|
||||
$get_module_type_value_normal = 1;
|
||||
}
|
||||
elseif (strpos($get_module_type_nombre_value,'string') != false) {
|
||||
$get_module_type_value_normal = 3;
|
||||
}
|
||||
else{
|
||||
$get_module_type_value_normal = 1;
|
||||
}
|
||||
|
||||
$values_module = array(
|
||||
'nombre' => $element["name"],
|
||||
'id_modulo' => 5,
|
||||
'prediction_module' => 7,
|
||||
'id_agente' => $id_agent[0]['id_agent'],
|
||||
'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'],
|
||||
'custom_integer_1' => $element["id_cluster"],
|
||||
'custom_integer_2' => $tcluster_balanced_module,
|
||||
'id_tipo_modulo' => $get_module_type_value_normal,
|
||||
'descripcion' => $get_module_description_value,
|
||||
'min_warning' => $get_module_warning_value,
|
||||
'min_critical' => $get_module_critical_value,
|
||||
'tcp_port' => $element["is_critical"],
|
||||
'module_interval' => $get_module_interval_value
|
||||
);
|
||||
|
||||
$id_module = modules_create_agent_module($values_module['id_agente'],$values_module['nombre'],$values_module);
|
||||
|
||||
if ($tcluster_balanced_module !== false){
|
||||
db_pandora_audit("Report management", "Module #".$element["name"]." assigned to cluster #".$element["id_cluster"]);
|
||||
}
|
||||
else{
|
||||
db_pandora_audit("Report management", "Fail try to assign module to cluster");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($result && !$results){
|
||||
$results = $result;
|
||||
}
|
||||
|
||||
if($id_module){
|
||||
returnData('string', array('type' => 'string', 'data' => 1));
|
||||
} else {
|
||||
returnError('error_add_cluster_element', __('Error adding elements to cluster'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function api_set_delete_cluster($id, $thrash1, $thrast2, $thrash3) {
|
||||
|
||||
global $config;
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$temp_id_cluster = db_process_sql('select id_agent from tcluster where id ='.$id);
|
||||
|
||||
$tcluster_modules_delete_get = db_process_sql('select id_agente_modulo from tagente_modulo where custom_integer_1 = '.$id);
|
||||
|
||||
foreach ($tcluster_modules_delete_get as $key => $value) {
|
||||
$tcluster_modules_delete_get_values[] = $value['id_agente_modulo'];
|
||||
}
|
||||
|
||||
$tcluster_modules_delete = modules_delete_agent_module($tcluster_modules_delete_get_values);
|
||||
|
||||
$tcluster_items_delete = db_process_sql('delete from tcluster_item where id_cluster = '.$id);
|
||||
|
||||
$tcluster_agents_delete = db_process_sql('delete from tcluster_agent where id_cluster = '.$id);
|
||||
|
||||
$tcluster_delete = db_process_sql('delete from tcluster where id = '.$id);
|
||||
|
||||
$tcluster_agent_delete = agents_delete_agent($temp_id_cluster[0]['id_agent']);
|
||||
|
||||
if (!$tcluster_modules_delete || !$tcluster_items_delete || !$tcluster_agents_delete || !$tcluster_delete || !$tcluster_agent_delete)
|
||||
returnError('error_delete', 'Error in delete operation.');
|
||||
else
|
||||
returnData('string', array('type' => 'string', 'data' => __('Correct Delete')));
|
||||
|
||||
}
|
||||
|
||||
|
||||
function api_set_delete_cluster_agent($thrash1, $thrast2, $other, $thrash3) {
|
||||
|
||||
global $config;
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$id_agent = $other['data'][0];
|
||||
$id_cluster = $other['data'][1];
|
||||
|
||||
$tcluster_agent_delete = db_process_sql('delete from tcluster_agent where id_agent = '.$id_agent.' and id_cluster = '.$id_cluster);
|
||||
|
||||
|
||||
if (!$tcluster_agent_delete)
|
||||
returnError('error_delete', 'Error in delete operation.');
|
||||
else
|
||||
returnData('string', array('type' => 'string', 'data' => __('Correct Delete')));
|
||||
|
||||
}
|
||||
|
||||
|
||||
function api_set_delete_cluster_item($id, $thrash1, $thrast2, $thrast3) {
|
||||
|
||||
global $config;
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$delete_module_aa_get = db_process_sql('select id_agente_modulo from tagente_modulo where custom_integer_2 = '.$id);
|
||||
|
||||
$delete_module_aa_get_result = modules_delete_agent_module($delete_module_aa_get[0]['id_agente_modulo']);
|
||||
|
||||
$delete_item = db_process_sql('delete from tcluster_item where id = '.$id);
|
||||
|
||||
if (!$delete_item)
|
||||
returnError('error_delete', 'Error in delete operation.');
|
||||
else
|
||||
returnData('string', array('type' => 'string', 'data' => __('Correct Delete')));
|
||||
|
||||
}
|
||||
|
||||
function api_set_apply_module_template($id_template, $id_agent, $thrash3, $thrash4) {
|
||||
|
||||
if (isset ($id_template)) {
|
||||
// Take agent data
|
||||
$row = db_get_row ("tagente", "id_agente", $id_agent);
|
||||
|
||||
if ($row !== false) {
|
||||
$intervalo = $row["intervalo"];
|
||||
$nombre_agente = $row["nombre"];
|
||||
$direccion_agente =$row["direccion"];
|
||||
$ultima_act = $row["ultimo_contacto"];
|
||||
$ultima_act_remota =$row["ultimo_contacto_remoto"];
|
||||
$comentarios = $row["comentarios"];
|
||||
$id_grupo = $row["id_grupo"];
|
||||
$id_os= $row["id_os"];
|
||||
$os_version = $row["os_version"];
|
||||
$agent_version = $row["agent_version"];
|
||||
$disabled= $row["disabled"];
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
$id_np = $id_template;
|
||||
$name_template = db_get_value ('name', 'tnetwork_profile', 'id_np', $id_np);
|
||||
$npc = db_get_all_rows_field_filter ("tnetwork_profile_component", "id_np", $id_np);
|
||||
|
||||
if ($npc === false) {
|
||||
$npc = array ();
|
||||
}
|
||||
|
||||
$success_count = $error_count = 0;
|
||||
$modules_already_added = array();
|
||||
|
||||
foreach ($npc as $row) {
|
||||
$nc = db_get_all_rows_field_filter ("tnetwork_component", "id_nc", $row["id_nc"]);
|
||||
|
||||
if ($nc === false) {
|
||||
$nc = array ();
|
||||
}
|
||||
foreach ($nc as $row2) {
|
||||
// Insert each module from tnetwork_component into agent
|
||||
$values = array(
|
||||
'id_agente' => $id_agent,
|
||||
'id_tipo_modulo' => $row2["type"],
|
||||
'descripcion' => __('Created by template ').$name_template. ' . '.$row2["description"],
|
||||
'max' => $row2["max"],
|
||||
'min' => $row2["min"],
|
||||
'module_interval' => $row2["module_interval"],
|
||||
'tcp_port' => $row2["tcp_port"],
|
||||
'tcp_send' => $row2["tcp_send"],
|
||||
'tcp_rcv' => $row2["tcp_rcv"],
|
||||
'snmp_community' => $row2["snmp_community"],
|
||||
'snmp_oid' => $row2["snmp_oid"],
|
||||
'ip_target' => $direccion_agente,
|
||||
'id_module_group' => $row2["id_module_group"],
|
||||
'id_modulo' => $row2["id_modulo"],
|
||||
'plugin_user' => $row2["plugin_user"],
|
||||
'plugin_pass' => $row2["plugin_pass"],
|
||||
'plugin_parameter' => $row2["plugin_parameter"],
|
||||
'unit' => $row2["unit"],
|
||||
'max_timeout' => $row2["max_timeout"],
|
||||
'max_retries' => $row2["max_retries"],
|
||||
'id_plugin' => $row2['id_plugin'],
|
||||
'post_process' => $row2['post_process'],
|
||||
'dynamic_interval' => $row2['dynamic_interval'],
|
||||
'dynamic_max' => $row2['dynamic_max'],
|
||||
'dynamic_min' => $row2['dynamic_min'],
|
||||
'dynamic_two_tailed' => $row2['dynamic_two_tailed'],
|
||||
'min_warning' => $row2['min_warning'],
|
||||
'max_warning' => $row2['max_warning'],
|
||||
'str_warning' => $row2['str_warning'],
|
||||
'min_critical' => $row2['min_critical'],
|
||||
'max_critical' => $row2['max_critical'],
|
||||
'str_critical' => $row2['str_critical'],
|
||||
'critical_inverse' => $row2['critical_inverse'],
|
||||
'warning_inverse' => $row2['warning_inverse'],
|
||||
'critical_instructions' => $row2['critical_instructions'],
|
||||
'warning_instructions' => $row2['warning_instructions'],
|
||||
'unknown_instructions' => $row2['unknown_instructions'],
|
||||
'id_category' => $row2['id_category'],
|
||||
'macros' => $row2['macros'],
|
||||
'each_ff' => $row2['each_ff'],
|
||||
'min_ff_event' => $row2['min_ff_event'],
|
||||
'min_ff_event_normal' => $row2['min_ff_event_normal'],
|
||||
'min_ff_event_warning' => $row2['min_ff_event_warning'],
|
||||
'min_ff_event_critical' => $row2['min_ff_event_critical']
|
||||
);
|
||||
|
||||
$name = $row2["name"];
|
||||
|
||||
// Put tags in array if the component has to add them later
|
||||
if(!empty($row2["tags"])) {
|
||||
$tags = explode(',', $row2["tags"]);
|
||||
}
|
||||
else {
|
||||
$tags = array();
|
||||
}
|
||||
|
||||
// Check if this module exists in the agent
|
||||
$module_name_check = db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('delete_pending' => 0, 'nombre' => $name, 'id_agente' => $id_agent));
|
||||
|
||||
if ($module_name_check !== false) {
|
||||
$modules_already_added[] = $row2["name"];
|
||||
$error_count++;
|
||||
}
|
||||
else {
|
||||
$id_agente_modulo = modules_create_agent_module($id_agent, $name, $values);
|
||||
|
||||
if ($id_agente_modulo === false) {
|
||||
$error_count++;
|
||||
}
|
||||
else {
|
||||
if(!empty($tags)) {
|
||||
// Creating tags
|
||||
$tag_ids = array();
|
||||
foreach ($tags as $tag_name) {
|
||||
$tag_id = tags_get_id($tag_name);
|
||||
|
||||
//If tag exists in the system we store to create it
|
||||
$tag_ids[] = $tag_id;
|
||||
}
|
||||
|
||||
tags_insert_module_tag ($id_agente_modulo, $tag_ids);
|
||||
}
|
||||
|
||||
$success_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($error_count > 0) {
|
||||
if (empty($modules_already_added))
|
||||
ui_print_error_message(__('Error adding modules') . sprintf(' (%s)', $error_count));
|
||||
else
|
||||
ui_print_error_message(__('Error adding modules. The following errors already exists: ') . implode(', ', $modules_already_added));
|
||||
}
|
||||
if ($success_count > 0)
|
||||
ui_print_success_message(__('Modules successfully added'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -20,7 +20,13 @@
|
|||
*/
|
||||
require_once ('include/functions_graph.php');
|
||||
function folder_get_folders(){
|
||||
$folders = io_safe_output(db_get_all_rows_in_table ('tcontainer','parent, name'));
|
||||
$folders = io_safe_output(db_get_all_rows_filter (
|
||||
'tcontainer',
|
||||
array (
|
||||
'id_group' => array_keys(users_get_groups()),
|
||||
'order' => 'parent, name'
|
||||
)
|
||||
));
|
||||
|
||||
$ordered_folders = array();
|
||||
foreach ($folders as $folder) {
|
||||
|
|
|
@ -144,7 +144,7 @@ function events_get_events_grouped($sql_post, $offset = 0,
|
|||
db_process_sql ('SET group_concat_max_len = 9999999');
|
||||
if ($total) {
|
||||
$sql = "SELECT COUNT(*) FROM (SELECT *
|
||||
FROM $table te
|
||||
FROM $table te LEFT JOIN tagent_secondary_group tasg ON te.id_grupo = tasg.id_group
|
||||
WHERE 1=1 " . $sql_post . "
|
||||
GROUP BY estado, evento, id_agente, id_agentmodule" . $groupby_extra . ") AS t";
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ function events_get_events_grouped($sql_post, $offset = 0,
|
|||
(SELECT id_agente FROM $table WHERE id_evento = MAX(te.id_evento)) id_agente,
|
||||
(SELECT criticity FROM $table WHERE id_evento = MAX(te.id_evento)) AS criticity,
|
||||
(SELECT ack_utimestamp FROM $table WHERE id_evento = MAX(te.id_evento)) AS ack_utimestamp
|
||||
FROM $table te
|
||||
FROM $table te LEFT JOIN tagent_secondary_group tasg ON te.id_grupo = tasg.id_group
|
||||
WHERE 1=1 " . $sql_post . "
|
||||
GROUP BY estado, evento, id_agente, id_agentmodule" . $groupby_extra . "
|
||||
ORDER BY timestamp_rep " . $order . " LIMIT " . $offset . "," . $pagination;
|
||||
|
@ -845,8 +845,8 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
|
|||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$sql = sprintf ("SELECT *
|
||||
FROM tevento
|
||||
$sql = sprintf ("SELECT DISTINCT tevento.*
|
||||
FROM tevento LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent
|
||||
WHERE %s %s
|
||||
ORDER BY utimestamp DESC LIMIT %d", $agent_condition, $filter, $limit);
|
||||
break;
|
||||
|
@ -914,8 +914,16 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
|
|||
$table->align[5] = "left";
|
||||
$table->size[5] = "15%";
|
||||
|
||||
$all_groups = array();
|
||||
if ($agent_id != 0) {
|
||||
$all_groups = agents_get_all_groups_agent ($agent_id);
|
||||
}
|
||||
|
||||
foreach ($result as $event) {
|
||||
if (! check_acl ($config["id_user"], $event["id_grupo"], "ER")) {
|
||||
// Copy all groups of the agent and append the event group
|
||||
$check_events = $all_groups;
|
||||
$check_events[] = $event["id_grupo"];
|
||||
if (! check_acl_one_of_groups ($config["id_user"], $check_events, "ER")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2042,9 +2050,17 @@ function events_page_custom_fields ($event) {
|
|||
$data = array();
|
||||
$data[0] = $field['name'];
|
||||
|
||||
$data[1] = empty($fields_data[$field['id_field']])
|
||||
? '<i>'.__('N/A').'</i>'
|
||||
: ui_bbcode_to_html($fields_data[$field['id_field']]);
|
||||
if(empty($fields_data[$field['id_field']])){
|
||||
$data[1] = '<i>'.__('N/A').'</i>';
|
||||
}
|
||||
else{
|
||||
if($field['is_password_type']){
|
||||
$data[1] = '••••••••';
|
||||
}
|
||||
else{
|
||||
$data[1] = ui_bbcode_to_html($fields_data[$field['id_field']]);
|
||||
}
|
||||
}
|
||||
|
||||
$field['id_field'];
|
||||
|
||||
|
@ -3299,40 +3315,14 @@ function events_get_events_grouped_by_agent($sql_post, $offset = 0,
|
|||
$fields_extra = '';
|
||||
}
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
if ($total) {
|
||||
$sql = "SELECT COUNT(*) FROM (select id_agente from $table WHERE 1=1
|
||||
$sql_post GROUP BY id_agente, event_type$groupby_extra ORDER BY id_agente ) AS t";
|
||||
}
|
||||
else {
|
||||
$sql = "select id_agente, count(*) as total$fields_extra from $table
|
||||
WHERE id_agente > 0 $sql_post GROUP BY id_agente$groupby_extra ORDER BY id_agente LIMIT $offset,$pagination";
|
||||
}
|
||||
break;
|
||||
case 'postgresql':
|
||||
if ($total) {
|
||||
|
||||
}
|
||||
else {
|
||||
$sql = "select id_agente, count(*) as total$fields_extra from $table
|
||||
WHERE id_agente > 0 $sql_post GROUP BY id_agente$groupby_extra ORDER BY id_agente LIMIT $offset,$pagination";
|
||||
}
|
||||
break;
|
||||
case 'oracle':
|
||||
if ($total) {
|
||||
|
||||
}
|
||||
else {
|
||||
$set = array();
|
||||
$set['limit'] = $pagination;
|
||||
$set['offset'] = $offset;
|
||||
|
||||
$sql = "select id_agente, count(*) as total$fields_extra from $table
|
||||
WHERE id_agente > 0 $sql_post GROUP BY id_agente, event_type$groupby_extra ORDER BY id_agente ";
|
||||
$sql = oracle_recode_query ($sql, $set);
|
||||
}
|
||||
break;
|
||||
if ($total) {
|
||||
$sql = "SELECT COUNT(*) FROM (select id_agente from $table WHERE 1=1
|
||||
$sql_post GROUP BY id_agente, event_type$groupby_extra ORDER BY id_agente ) AS t";
|
||||
}
|
||||
else {
|
||||
$sql = "select id_agente, count(*) as total$fields_extra from $table te LEFT JOIN tagent_secondary_group tasg
|
||||
ON te.id_grupo = tasg.id_group
|
||||
WHERE id_agente > 0 $sql_post GROUP BY id_agente$groupby_extra ORDER BY id_agente LIMIT $offset,$pagination";
|
||||
}
|
||||
|
||||
$result = array();
|
||||
|
@ -3356,7 +3346,9 @@ function events_get_events_grouped_by_agent($sql_post, $offset = 0,
|
|||
'event_type' => $resultado['event_type']);
|
||||
}
|
||||
else {
|
||||
$sql = "select event_type from $table
|
||||
$sql = "SELECT event_type FROM $table te
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON te.id_agente = tasg.id_agent
|
||||
WHERE id_agente = ".$event['id_agente']." $sql_post ORDER BY utimestamp DESC ";
|
||||
$resultado = db_get_row_sql($sql);
|
||||
|
||||
|
|
|
@ -196,55 +196,45 @@ function gis_make_layer($name, $visible = true, $dot = null, $idLayer = null, $p
|
|||
layer.events.on({
|
||||
"featureselected": function(e) {
|
||||
if (e.feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
|
||||
var feature = e.feature;
|
||||
var featureData = feature.data;
|
||||
var long_lat = featureData.long_lat;
|
||||
var popup;
|
||||
var featureData = e.feature.data;
|
||||
|
||||
var img_src = null;
|
||||
var img_src = "<?php echo ui_get_full_url('images/spinner.gif', false, false, false, false); ?>";
|
||||
var $details = $('<div />');
|
||||
|
||||
$details
|
||||
.prop("id", 'cloudContent_' + featureData.id)
|
||||
.css("text-align", "center")
|
||||
.html('<img src="' + img_src + '" />')
|
||||
.dialog({
|
||||
title: "<?php echo __('Agent'); ?> #" + featureData.id,
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
close: function () {
|
||||
$details.remove();
|
||||
}
|
||||
});
|
||||
|
||||
jQuery.ajax ({
|
||||
url: "<?php echo ui_get_full_url('ajax.php', false, false, false, false); ?>",
|
||||
data: {
|
||||
page: "include/ajax/skins.ajax",
|
||||
get_image_path: 1,
|
||||
img_src: "images/spinner.gif"
|
||||
page: "operation/gis_maps/ajax",
|
||||
opt: featureData.type,
|
||||
id: featureData.id,
|
||||
hash: "<?php echo $hash; ?>",
|
||||
id_user: "<?php echo $config['id_user']; ?>",
|
||||
map_id: <?php echo (int)$id_map; ?>
|
||||
},
|
||||
type: 'GET',
|
||||
dataType: 'html',
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
img_src = data;
|
||||
|
||||
popup = new OpenLayers.Popup.FramedCloud('cloud00',
|
||||
long_lat,
|
||||
null,
|
||||
'<div class="cloudContent' + featureData.id + '" style="text-align: center;">' + img_src + '</div>',
|
||||
null,
|
||||
true,
|
||||
function () { popup.destroy(); });
|
||||
feature.popup = popup;
|
||||
map.addPopup(popup);
|
||||
|
||||
jQuery.ajax ({
|
||||
url: "<?php echo ui_get_full_url('ajax.php', false, false, false, false); ?>",
|
||||
data: {
|
||||
page: "operation/gis_maps/ajax",
|
||||
opt: featureData.type,
|
||||
id: featureData.id,
|
||||
hash: "<?php echo $hash; ?>",
|
||||
id_user: "<?php echo $config['id_user']; ?>",
|
||||
map_id: <?php echo (int)$id_map; ?>
|
||||
},
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
if (data.correct) {
|
||||
$('.cloudContent' + featureData.id).css('text-align', 'left');
|
||||
$('.cloudContent' + featureData.id).html(data.content);
|
||||
popup.updateSize();
|
||||
}
|
||||
}
|
||||
});
|
||||
if (data.correct) {
|
||||
$details.css("text-align", "left").html(data.content);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1906,7 +1906,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
}
|
||||
|
||||
foreach ($module_list as $key => $value) {
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() && is_array($value)) {
|
||||
$server = metaconsole_get_connection_by_id ($value['server']);
|
||||
metaconsole_connect($server);
|
||||
$value = $value['module'];
|
||||
|
@ -1926,14 +1926,14 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
$module_name_list[$key] = $alias . " / " . $module_name;
|
||||
}
|
||||
}
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() && is_array($value)) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_null($percentil) && $percentil) {
|
||||
foreach ($module_list as $key => $value) {
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() && is_array($value)) {
|
||||
$server = metaconsole_get_connection_by_id ($value['server']);
|
||||
metaconsole_connect($server);
|
||||
$value = $value['module'];
|
||||
|
@ -1943,7 +1943,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
$alias = db_get_value ("alias","tagente","nombre",$agent_name);
|
||||
$module_name = io_safe_output( modules_get_agentmodule_name ($value) );
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() && is_array($value)) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
|
@ -2352,7 +2352,7 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts, $p
|
|||
$array_percentil = array();
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() && is_array($value_module)) {
|
||||
$server = metaconsole_get_connection_by_id ($value_module['server']);
|
||||
metaconsole_connect($server);
|
||||
$previous_data = modules_get_previous_data ($value_module['module'], $datelimit);
|
||||
|
@ -2367,7 +2367,10 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts, $p
|
|||
foreach ($data_uncompress as $key_data => $value_data) {
|
||||
foreach ($value_data['data'] as $k => $v) {
|
||||
$real_date = $v['utimestamp'];
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> origin/develop
|
||||
if(!isset($v['datos'])){
|
||||
$v['datos'] = $previous_data;
|
||||
}
|
||||
|
@ -2553,25 +2556,25 @@ function truncate_negatives(&$element) {
|
|||
function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $return = false, $show_not_init = false, $data_agents=false) {
|
||||
global $config;
|
||||
|
||||
|
||||
$filter = array('disabled' => 0, 'id_grupo' => array_keys(users_get_groups(false, 'AR', false)));
|
||||
|
||||
|
||||
if (!empty($id_agent)) {
|
||||
$filter['id_agente'] = $id_agent;
|
||||
}
|
||||
|
||||
$fields = array('SUM(critical_count) AS Critical',
|
||||
'SUM(warning_count) AS Warning',
|
||||
'SUM(normal_count) AS Normal',
|
||||
'SUM(unknown_count) AS Unknown');
|
||||
|
||||
if ($show_not_init) {
|
||||
$fields[] = 'SUM(notinit_count) "Not init"';
|
||||
}
|
||||
|
||||
if ($data_agents == false) {
|
||||
$data = db_get_row_filter('tagente', $filter, $fields);
|
||||
$groups = implode(',', array_keys(users_get_groups(false, 'AR', false)));
|
||||
$data = db_get_row_sql(sprintf('SELECT
|
||||
SUM(critical_count) AS Critical,
|
||||
SUM(warning_count) AS Warning,
|
||||
SUM(normal_count) AS Normal,
|
||||
SUM(unknown_count) AS Unknown
|
||||
%s
|
||||
FROM tagente ta LEFT JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE
|
||||
ta.disabled = 0 AND
|
||||
%s
|
||||
(ta.id_grupo IN (%s) OR tasg.id_group IN (%s))',
|
||||
$show_not_init ? ', SUM(notinit_count) "Not init"' : '',
|
||||
empty($id_agent) ? '' : "ta.id_agente = $id_agent AND",
|
||||
$groups,
|
||||
$groups
|
||||
));
|
||||
} else {
|
||||
$data = $data_agents;
|
||||
}
|
||||
|
@ -2772,9 +2775,9 @@ function graph_sla_slicebar ($id, $period, $sla_min, $sla_max, $date, $daysWeek
|
|||
2 => COL_WARNING,
|
||||
3 => COL_CRITICAL,
|
||||
4 => COL_UNKNOWN,
|
||||
5 => "#ff8400",//COL_MINOR,
|
||||
5 => COL_DOWNTIME,
|
||||
6 => COL_NOTINIT,
|
||||
7 => "#ddd");//COL_MAJOR);
|
||||
7 => COL_IGNORED);
|
||||
|
||||
return slicesbar_graph($data, $period, $width, $height, $colors,
|
||||
$config['fontpath'], $round_corner, $home_url, $ttl);
|
||||
|
@ -3514,7 +3517,8 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
|
|||
//is required if both DISTINCT() and COUNT() are in the statement
|
||||
$sql = sprintf ('SELECT DISTINCT(id_agente) AS id_agente,
|
||||
COUNT(id_agente) AS count'.$field_extra.'
|
||||
FROM '.$event_table.'
|
||||
FROM '.$event_table.' te LEFT JOIN tagent_secondary_group tasg
|
||||
ON te.id_grupo = tasg.id_group
|
||||
WHERE 1=1 %s %s
|
||||
GROUP BY id_agente'.$groupby_extra.'
|
||||
ORDER BY count DESC LIMIT 8', $url, $tags_condition);
|
||||
|
@ -3786,9 +3790,10 @@ function grafico_eventos_usuario ($width, $height) {
|
|||
*/
|
||||
function graph_custom_sql_graph ($id, $width, $height,
|
||||
$type = 'sql_graph_vbar', $only_image = false, $homeurl = '',
|
||||
$ttl = 1) {
|
||||
$ttl = 1, $max_num_elements = 8) {
|
||||
|
||||
global $config;
|
||||
$SQL_GRAPH_MAX_LABEL_SIZE = 20;
|
||||
|
||||
$report_content = db_get_row ('treport_content', 'id_rc', $id);
|
||||
if($id != null){
|
||||
|
@ -3847,18 +3852,38 @@ function graph_custom_sql_graph ($id, $width, $height,
|
|||
if (!empty($data_item["value"])) {
|
||||
$value = $data_item["value"];
|
||||
}
|
||||
$label = __('Data');
|
||||
if (!empty($data_item["label"])) {
|
||||
$label = $data_item["label"];
|
||||
}
|
||||
switch ($type) {
|
||||
case 'sql_graph_vbar': // vertical bar
|
||||
case 'sql_graph_hbar': // horizontal bar
|
||||
$data[$label."_".$count]['g'] = $value;
|
||||
break;
|
||||
case 'sql_graph_pie': // Pie
|
||||
$data[$label."_".$count] = $value;
|
||||
break;
|
||||
if ($count <= $max_num_elements) {
|
||||
$label = __('Data');
|
||||
if (!empty($data_item["label"])) {
|
||||
$label = io_safe_output($data_item["label"]);
|
||||
if (strlen($label) > $SQL_GRAPH_MAX_LABEL_SIZE) {
|
||||
$first_label = $label;
|
||||
$label = substr($first_label, 0, floor($SQL_GRAPH_MAX_LABEL_SIZE/2));
|
||||
$label .= '...';
|
||||
$label .= substr($first_label, floor(-$SQL_GRAPH_MAX_LABEL_SIZE/2));
|
||||
}
|
||||
}
|
||||
switch ($type) {
|
||||
case 'sql_graph_vbar': // vertical bar
|
||||
case 'sql_graph_hbar': // horizontal bar
|
||||
$data[$label."_".$count]['g'] = $value;
|
||||
break;
|
||||
case 'sql_graph_pie': // Pie
|
||||
$data[$label."_".$count] = $value;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ($type) {
|
||||
case 'sql_graph_vbar': // vertical bar
|
||||
case 'sql_graph_hbar': // horizontal bar
|
||||
if (!isset($data[__('Other')]['g'])) $data[__('Other')]['g'] = 0;
|
||||
$data[__('Other')]['g'] += $value;
|
||||
break;
|
||||
case 'sql_graph_pie': // Pie
|
||||
if (!isset($data[__('Other')])) $data[__('Other')] = 0;
|
||||
$data[__('Other')] += $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3876,16 +3901,50 @@ function graph_custom_sql_graph ($id, $width, $height,
|
|||
|
||||
switch ($type) {
|
||||
case 'sql_graph_vbar': // vertical bar
|
||||
return vbar_graph($flash_charts, $data, $width, $height, array(),
|
||||
array(), "", "", $homeurl, $water_mark,
|
||||
$config['fontpath'], $config['font_size'], false, $ttl, "", "white", false, false, "black");
|
||||
return vbar_graph(
|
||||
$flash_charts,
|
||||
$data,
|
||||
$width,
|
||||
$height,
|
||||
array(),
|
||||
array(),
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
$water_mark,
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
"",
|
||||
$ttl,
|
||||
$homeurl,
|
||||
"white",
|
||||
false,
|
||||
false,
|
||||
"black"
|
||||
);
|
||||
break;
|
||||
case 'sql_graph_hbar': // horizontal bar
|
||||
return hbar_graph($flash_charts, $data, $width, $height, array(),
|
||||
array(), "", "", true, $homeurl, $water_mark,
|
||||
$config['fontpath'], $config['font_size'], false, $ttl,$config['homeurl'],
|
||||
'white',
|
||||
'black');
|
||||
return hbar_graph(
|
||||
$flash_charts,
|
||||
$data,
|
||||
$width,
|
||||
$height,
|
||||
array(),
|
||||
array(),
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
$water_mark,
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
false,
|
||||
$ttl,
|
||||
$homeurl,
|
||||
'white',
|
||||
'black'
|
||||
);
|
||||
break;
|
||||
case 'sql_graph_pie': // Pie
|
||||
return pie3d_graph($flash_charts, $data, $width, $height, __("other"), $homeurl,
|
||||
|
@ -5084,313 +5143,4 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) {
|
|||
return d3_sunburst_graph ($graph_data, $width, $height, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw a graph of Module string data of agent
|
||||
* @param integer id_agent_modulo Agent Module ID
|
||||
* @param integer show_event show event (1 or 0)
|
||||
* @param integer height graph height
|
||||
* @param integer width graph width
|
||||
* @param string title graph title
|
||||
* @param string unit_name String of unit name
|
||||
* @param integer show alerts (1 or 0)
|
||||
* @param integer avg_only calcules avg only (1 or 0)
|
||||
* @param integer pure Fullscreen (1 or 0)
|
||||
* @param integer date date
|
||||
*/
|
||||
function grafico_modulo_string ($agent_module_id, $period, $show_events,
|
||||
$width, $height, $title, $unit_name, $show_alerts, $avg_only = 0, $pure = 0,
|
||||
$date = 0, $only_image = false, $homeurl = '', $adapt_key = '', $ttl = 1, $menu = true) {
|
||||
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
global $max_value;
|
||||
|
||||
// Set variables
|
||||
if ($date == 0){
|
||||
$date = get_system_time();
|
||||
}
|
||||
|
||||
$datelimit = $date - $period;
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
$resolution = $config['graph_res'] * 50; //Number of points of the graph
|
||||
$interval = (int) ($period / $resolution);
|
||||
$agent_name = modules_get_agentmodule_agent_name ($agent_module_id);
|
||||
$agent_id = agents_get_agent_id ($agent_name);
|
||||
$module_name = modules_get_agentmodule_name ($agent_module_id);
|
||||
$id_module_type = modules_get_agentmodule_type ($agent_module_id);
|
||||
$module_type = modules_get_moduletype_name ($id_module_type);
|
||||
$uncompressed_module = is_module_uncompressed ($module_type);
|
||||
|
||||
if ($uncompressed_module) {
|
||||
$avg_only = 1;
|
||||
}
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
// Get event data (contains alert data too)
|
||||
if ($show_events == 1 || $show_alerts == 1) {
|
||||
$events = db_get_all_rows_filter ('tevento',
|
||||
array ('id_agentmodule' => $agent_module_id,
|
||||
"utimestamp > $datelimit",
|
||||
"utimestamp < $date",
|
||||
'order' => 'utimestamp ASC'),
|
||||
array ('evento', 'utimestamp', 'event_type'));
|
||||
if ($events === false) {
|
||||
$events = array ();
|
||||
}
|
||||
}
|
||||
|
||||
// Get module data
|
||||
$data = db_get_all_rows_filter ('tagente_datos_string',
|
||||
array ('id_agente_modulo' => $agent_module_id,
|
||||
"utimestamp > $datelimit",
|
||||
"utimestamp < $date",
|
||||
'order' => 'utimestamp ASC'),
|
||||
array ('datos', 'utimestamp'), 'AND', $search_in_history_db);
|
||||
if ($data === false) {
|
||||
$data = array ();
|
||||
}
|
||||
|
||||
// Uncompressed module data
|
||||
if ($uncompressed_module) {
|
||||
$min_necessary = 1;
|
||||
}
|
||||
else {
|
||||
// Compressed module data
|
||||
|
||||
// Get previous data
|
||||
$previous_data = modules_get_previous_data ($agent_module_id, $datelimit, 1);
|
||||
if ($previous_data !== false) {
|
||||
$previous_data['utimestamp'] = $datelimit;
|
||||
array_unshift ($data, $previous_data);
|
||||
}
|
||||
|
||||
// Get next data
|
||||
$nextData = modules_get_next_data ($agent_module_id, $date, 1);
|
||||
if ($nextData !== false) {
|
||||
array_push ($data, $nextData);
|
||||
}
|
||||
else if (count ($data) > 0) {
|
||||
// Propagate the last known data to the end of the interval
|
||||
$nextData = array_pop ($data);
|
||||
array_push ($data, $nextData);
|
||||
$nextData['utimestamp'] = $date;
|
||||
array_push ($data, $nextData);
|
||||
}
|
||||
|
||||
$min_necessary = 2;
|
||||
}
|
||||
|
||||
// Check available data
|
||||
if (count ($data) < $min_necessary) {
|
||||
if (!$graphic_type) {
|
||||
return fs_error_image ($width, $height);
|
||||
}
|
||||
graphic_error ();
|
||||
}
|
||||
|
||||
// Data iterator
|
||||
$j = 0;
|
||||
|
||||
// Event iterator
|
||||
$k = 0;
|
||||
|
||||
// Set initial conditions
|
||||
$chart = array();
|
||||
if ($data[0]['utimestamp'] == $datelimit) {
|
||||
$previous_data = 1;
|
||||
$j++;
|
||||
}
|
||||
else {
|
||||
$previous_data = 0;
|
||||
}
|
||||
|
||||
// Calculate chart data
|
||||
$last_known = $previous_data;
|
||||
for ($i = 0; $i < $resolution; $i++) {
|
||||
$timestamp = $datelimit + ($interval * $i);
|
||||
|
||||
$count = 0;
|
||||
$total = 0;
|
||||
// Read data that falls in the current interval
|
||||
while (isset($data[$j]) &&
|
||||
isset ($data[$j]) !== null &&
|
||||
$data[$j]['utimestamp'] >= $timestamp &&
|
||||
$data[$j]['utimestamp'] <= ($timestamp + $interval)) {
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// FIX TICKET #1749
|
||||
$last_known = $count;
|
||||
// ---------------------------------------------------------
|
||||
$count++;
|
||||
$j++;
|
||||
}
|
||||
|
||||
if ($max_value < $count) {
|
||||
$max_value = $count;
|
||||
}
|
||||
|
||||
// Read events and alerts that fall in the current interval
|
||||
$event_value = 0;
|
||||
$alert_value = 0;
|
||||
while (isset ($events[$k]) && $events[$k]['utimestamp'] >= $timestamp && $events[$k]['utimestamp'] <= ($timestamp + $interval)) {
|
||||
if ($show_events == 1) {
|
||||
$event_value++;
|
||||
}
|
||||
if ($show_alerts == 1 && substr ($events[$k]['event_type'], 0, 5) == 'alert') {
|
||||
$alert_value++;
|
||||
}
|
||||
$k++;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Set the title and time format
|
||||
if ($period <= SECONDS_6HOURS) {
|
||||
$time_format = 'H:i:s';
|
||||
}
|
||||
elseif ($period < SECONDS_1DAY) {
|
||||
$time_format = 'H:i';
|
||||
}
|
||||
elseif ($period < SECONDS_15DAYS) {
|
||||
$time_format = 'M d H:i';
|
||||
}
|
||||
elseif ($period < SECONDS_1MONTH) {
|
||||
$time_format = 'M d H\h';
|
||||
}
|
||||
elseif ($period < SECONDS_6MONTHS) {
|
||||
$time_format = "M d H\h";
|
||||
}
|
||||
else {
|
||||
$time_format = "Y M d H\h";
|
||||
}
|
||||
|
||||
$timestamp_short = date($time_format, $timestamp);
|
||||
$long_index[$timestamp_short] = date(
|
||||
html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp);
|
||||
$timestamp = $timestamp_short;
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
// Data in the interval
|
||||
//The order in chart array is very important!!!!
|
||||
if ($show_events) {
|
||||
$chart[$timestamp]['event'] = $event_value;
|
||||
}
|
||||
|
||||
if ($show_alerts) {
|
||||
$chart[$timestamp]['alert'] = $alert_value;
|
||||
}
|
||||
|
||||
if (!$avg_only) {
|
||||
$chart[$timestamp]['max'] = 0;
|
||||
}
|
||||
|
||||
if ($count > 0) {
|
||||
$chart[$timestamp]['sum'] = $count;
|
||||
}
|
||||
else {
|
||||
// Compressed data
|
||||
$chart[$timestamp]['sum'] = $last_known;
|
||||
}
|
||||
|
||||
if (!$avg_only) {
|
||||
$chart[$timestamp]['min'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$graph_stats = get_statwin_graph_statistics($chart);
|
||||
|
||||
// Fix event and alert scale
|
||||
$event_max = 2 + (float)$max_value * 1.05;
|
||||
foreach ($chart as $timestamp => $chart_data) {
|
||||
if (!empty($chart_data['event']) && $chart_data['event'] > 0) {
|
||||
$chart[$timestamp]['event'] = $event_max;
|
||||
}
|
||||
if (!empty($chart_data['alert']) && $chart_data['alert'] > 0) {
|
||||
$chart[$timestamp]['alert'] = $event_max;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($unit_name)) {
|
||||
$unit = modules_get_unit($agent_module_id);
|
||||
}
|
||||
else
|
||||
$unit = $unit_name;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
$color = array();
|
||||
|
||||
if ($show_events) {
|
||||
$color['event'] = array('border' => '#ff0000',
|
||||
'color' => '#ff0000', 'alpha' => CHART_DEFAULT_ALPHA);
|
||||
}
|
||||
if ($show_alerts) {
|
||||
$color['alert'] = array('border' => '#ff7f00',
|
||||
'color' => '#ff7f00', 'alpha' => CHART_DEFAULT_ALPHA);
|
||||
}
|
||||
|
||||
if (!$avg_only) {
|
||||
$color['max'] = array('border' => '#000000',
|
||||
'color' => $config['graph_color3'],
|
||||
'alpha' => CHART_DEFAULT_ALPHA);
|
||||
}
|
||||
$color['sum'] = array('border' => '#000000',
|
||||
'color' => $config['graph_color2'],
|
||||
'alpha' => CHART_DEFAULT_ALPHA);
|
||||
|
||||
if (!$avg_only) {
|
||||
$color['min'] = array('border' => '#000000',
|
||||
'color' => $config['graph_color1'],
|
||||
'alpha' => CHART_DEFAULT_ALPHA);
|
||||
}
|
||||
|
||||
//$color['baseline'] = array('border' => null, 'color' => '#0097BD', 'alpha' => 10);
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$flash_chart = $config['flash_charts'];
|
||||
if ($only_image) {
|
||||
$flash_chart = false;
|
||||
}
|
||||
|
||||
$legend = array();
|
||||
|
||||
if ($show_events) {
|
||||
$legend['event'] = __('Events');
|
||||
}
|
||||
|
||||
if ($show_alerts) {
|
||||
$legend['alert'] = __('Alerts');
|
||||
}
|
||||
|
||||
if (!$avg_only) {
|
||||
$legend['max'] = __('Max').': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['max']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['max']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['max']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['max']['min'], $config['graph_precision'])).' '.$unit;
|
||||
}
|
||||
|
||||
$legend['sum'] = __('Avg').': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['sum']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['sum']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['sum']['min'], $config['graph_precision'])).' '.$unit;
|
||||
|
||||
if (!$avg_only) {
|
||||
$legend['min'] = __('Min').': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['min']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['min']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['min']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['min']['min'], $config['graph_precision'])).' '.$unit;
|
||||
}
|
||||
|
||||
if($config["fixed_graph"] == false){
|
||||
$water_mark = array('file' =>
|
||||
$config['homedir'] . "/images/logo_vertical_water.png",
|
||||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||
}
|
||||
|
||||
if ($type_graph === 'area') {
|
||||
return area_graph($flash_chart, $chart, $width, $height, $color,
|
||||
$legend, array(), '', $title, $unit, $homeurl,
|
||||
$water_mark, $config['fontpath'], $config['font_size'], $unit,
|
||||
1, array(), array(), 0, 0, $adapt_key, true, '', $menu);
|
||||
}
|
||||
else {
|
||||
return
|
||||
line_graph($flash_chart, $chart, $width, $height, $color,
|
||||
$legend, $long_index,
|
||||
ui_get_full_url("images/image_problem_area_small.png", false, false, false),
|
||||
$title, $unit, $water_mark, $config['fontpath'],
|
||||
$config['font_size'], $unit, $ttl, $homeurl, $backgroundColor);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -41,7 +41,7 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
|
|||
$user_groups_ids = implode(',', array_keys($acltags));
|
||||
|
||||
if (!empty($user_groups_ids)) {
|
||||
if (is_metaconsole() && (!$user_strict)) {
|
||||
if (is_metaconsole()) {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$list_groups = db_get_all_rows_sql("
|
||||
|
@ -123,7 +123,7 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
|
|||
* Agent cache for metaconsole.
|
||||
* Retrieve the statistic data from the cache table.
|
||||
*/
|
||||
if (!$user_strict && is_metaconsole()) {
|
||||
if (is_metaconsole()) {
|
||||
foreach ($list_groups as $group) {
|
||||
$group_agents = db_get_row_sql("SELECT SUM(warning_count) AS _monitors_warning_,
|
||||
SUM(critical_count) AS _monitors_critical_,
|
||||
|
@ -133,7 +133,13 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
|
|||
SUM(fired_count) AS _monitors_alerts_fired_,
|
||||
COUNT(*) AS _total_agents_, id_grupo, intervalo,
|
||||
ultimo_contacto, disabled
|
||||
FROM tmetaconsole_agent WHERE id_grupo = " . $group['id_grupo'] . " AND disabled = 0 GROUP BY id_grupo");
|
||||
FROM tmetaconsole_agent ta
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE (
|
||||
ta.id_grupo = " . $group['id_grupo'] . "
|
||||
OR tasg.id_group = " . $group['id_grupo'] . "
|
||||
) AND disabled = 0 GROUP BY id_grupo");
|
||||
$list[$group['id_grupo']]['_monitors_critical_'] = (int)$group_agents['_monitors_critical_'];
|
||||
$list[$group['id_grupo']]['_monitors_warning_'] = (int)$group_agents['_monitors_warning_'];
|
||||
$list[$group['id_grupo']]['_monitors_unknown_'] = (int)$group_agents['_monitors_unknown_'];
|
||||
|
@ -181,7 +187,7 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (($config["realtimestats"] == 0) && !$user_strict) {
|
||||
else if (false) { //FIXME: The cached group view is wasted. Avoid to reach this code.
|
||||
|
||||
$group_stat = db_get_all_rows_sql ("SELECT
|
||||
SUM(ta.normal_count) as normal, SUM(ta.critical_count) as critical,
|
||||
|
@ -253,24 +259,24 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
|
|||
'disabled' => 0,
|
||||
'id_grupo' => $group['id_grupo'],
|
||||
'status' => AGENT_STATUS_NOT_INIT),
|
||||
array ('COUNT(*) as total'), $access, false);
|
||||
array ('COUNT(DISTINCT id_agente) as total'), $access, false);
|
||||
$list[$group['id_grupo']]['_agents_not_init_'] = isset ($agent_not_init[0]['total']) ? $agent_not_init[0]['total'] : 0;
|
||||
$agent_unknown = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $group['id_grupo'],
|
||||
'status' => AGENT_STATUS_UNKNOWN),
|
||||
array ('COUNT(*) as total'), $access, false);
|
||||
array ('COUNT(DISTINCT id_agente) as total'), $access, false);
|
||||
$list[$group['id_grupo']]['_agents_unknown_'] = isset ($agent_unknown[0]['total']) ? $agent_unknown[0]['total'] : 0;
|
||||
$agent_critical = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $group['id_grupo'],
|
||||
'status' => AGENT_STATUS_CRITICAL),
|
||||
array ('COUNT(*) as total'), $access, false);
|
||||
array ('COUNT(DISTINCT id_agente) as total'), $access, false);
|
||||
$list[$group['id_grupo']]['_agents_critical_'] = isset ($agent_critical[0]['total']) ? $agent_critical[0]['total'] : 0;
|
||||
$agent_total = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $group['id_grupo']),
|
||||
array ('COUNT(*) as total'), $access, false);
|
||||
array ('COUNT(DISTINCT id_agente) as total'), $access, false);
|
||||
$list[$group['id_grupo']]['_total_agents_'] = isset ($agent_total[0]['total']) ? $agent_total[0]['total'] : 0;
|
||||
$list[$group['id_grupo']]["_monitor_not_normal_"] = $list[$group['id_grupo']]["_monitor_checks_"] - $list[$group['id_grupo']]["_monitors_ok_"];
|
||||
$list[$group['id_grupo']]['_monitors_alerts_fired_'] = groupview_monitor_fired_alerts ($group['id_grupo'], $user_strict,array($group['id_grupo']));
|
||||
|
@ -328,41 +334,6 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
|
|||
GROUP BY estado");
|
||||
$list[$group['id_grupo']]['_monitors_not_init_'] = isset ($result_not_init['contado']) ? $result_not_init['contado'] : 0;
|
||||
}
|
||||
|
||||
if ($user_strict) {
|
||||
$i = 1;
|
||||
foreach ($user_tags as $group_id => $tag_name) {
|
||||
$id = db_get_value('id_tag', 'ttag', 'name', $tag_name);
|
||||
|
||||
$list[$i]['_id_'] = $id;
|
||||
$list[$i]['_name_'] = $tag_name;
|
||||
$list[$i]['_iconImg_'] = html_print_image ("images/tag_red.png", true, array ("style" => 'vertical-align: middle;'));
|
||||
$list[$i]['_is_tag_'] = 1;
|
||||
|
||||
$list[$i]['_total_agents_'] = (int) tags_get_total_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
|
||||
$list[$i]['_agents_unknown_'] = (int) tags_get_unknown_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
|
||||
$list[$i]['_agents_critical_'] = (int) tags_get_critical_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
|
||||
$list[$i]['_agents_not_init_'] = (int) tags_get_not_init_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
|
||||
$list[$i]['_monitors_ok_'] = (int) tags_get_normal_monitors ($id, $acltags, $agent_filter, $module_filter);
|
||||
$list[$i]['_monitors_critical_'] = (int) tags_get_critical_monitors ($id, $acltags, $agent_filter, $module_filter);
|
||||
$list[$i]['_monitors_warning_'] = (int) tags_get_warning_monitors ($id, $acltags, $agent_filter, $module_filter);
|
||||
$list[$i]['_monitors_not_init_'] = (int) tags_get_not_init_monitors ($id, $acltags, $agent_filter, $module_filter);
|
||||
$list[$i]['_monitors_unknown_'] = (int) tags_get_unknown_monitors ($id, $acltags, $agent_filter, $module_filter);
|
||||
$list[$i]['_monitors_alerts_fired_'] = tags_monitors_fired_alerts($id, $acltags);
|
||||
|
||||
if (! defined ('METACONSOLE')) {
|
||||
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) {
|
||||
unset($list[$i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0)) {
|
||||
unset($list[$i]);
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
@ -377,63 +348,9 @@ function groupview_status_modules_agents($id_user = false, $user_strict = false,
|
|||
//$acltags = tags_get_user_groups_and_tags ($id_user, $access, $user_strict);
|
||||
$acltags = users_get_groups ($id_user, $access, true, true);
|
||||
|
||||
// If using metaconsole, the strict users will use the agent table of every node
|
||||
if (is_metaconsole() && $user_strict) {
|
||||
$servers = metaconsole_get_servers();
|
||||
|
||||
$result_list = array ();
|
||||
foreach ($servers as $server) {
|
||||
|
||||
if (metaconsole_connect($server) != NOERR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$server_list = groupview_get_all_data($id_user, $user_strict,
|
||||
$acltags, $returnAllGroup);
|
||||
|
||||
foreach ($server_list as $server_item) {
|
||||
if (! isset ($result_list[$server_item['_name_']])) {
|
||||
|
||||
$result_list[$server_item['_name_']] = $server_item;
|
||||
}
|
||||
else {
|
||||
$result_list[$server_item['_name_']]['_monitors_ok_'] += $server_item['_monitors_ok_'];
|
||||
$result_list[$server_item['_name_']]['_monitors_critical_'] += $server_item['_monitors_critical_'];
|
||||
$result_list[$server_item['_name_']]['_monitors_warning_'] += $server_item['_monitors_warning_'];
|
||||
$result_list[$server_item['_name_']]['_agents_unknown_'] += $server_item['_agents_unknown_'];
|
||||
$result_list[$server_item['_name_']]['_total_agents_'] += $server_item['_total_agents_'];
|
||||
$result_list[$server_item['_name_']]['_monitors_alerts_fired_'] += $server_item['_monitors_alerts_fired_'];
|
||||
|
||||
$result_list[$server_item['_name_']]['_agents_ok_'] += $server_item['_agents_ok_'];
|
||||
$result_list[$server_item['_name_']]['_agents_critical_'] += $server_item['_agents_critical_'];
|
||||
$result_list[$server_item['_name_']]['_agents_warning_'] += $server_item['_agents_warning_'];
|
||||
$result_list[$server_item['_name_']]['_monitors_alerts_'] += $server_item['_monitors_alerts_'];
|
||||
|
||||
$result_list[$server_item['_name_']]["_monitor_checks_"] += $server_item["_monitor_checks_"];
|
||||
$result_list[$server_item['_name_']]["_monitor_not_normal_"] += $server_item["_monitor_not_normal_"];
|
||||
$result_list[$server_item['_name_']]["_monitor_health_"] += $server_item["_monitor_health_"];
|
||||
$result_list[$server_item['_name_']]["_module_sanity_"] += $server_item["_module_sanity_"];
|
||||
$result_list[$server_item['_name_']]["_alerts_"] += $server_item["_alerts_"];
|
||||
$result_list[$server_item['_name_']]["_alert_level_"] += $server_item["_alert_level_"];
|
||||
$result_list[$server_item['_name_']]["_monitor_bad_"] += $server_item["_monitor_bad_"];
|
||||
$result_list[$server_item['_name_']]["_global_health_"] += $server_item["_global_health_"];
|
||||
$result_list[$server_item['_name_']]["_server_sanity_"] += $server_item["_server_sanity_"];
|
||||
$result_list[$server_item['_name_']]["_monitor_alerts_fire_count_"] += $server_item["_monitor_alerts_fire_count_"];
|
||||
$result_list[$server_item['_name_']]["_total_checks_"] += $server_item["_total_checks_"];
|
||||
$result_list[$server_item['_name_']]["_total_alerts_"] += $server_item["_total_alerts_"];
|
||||
}
|
||||
}
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
return $result_list;
|
||||
}
|
||||
else {
|
||||
|
||||
$result_list = groupview_get_all_data ($id_user, $user_strict,
|
||||
$acltags, false, array(), array(), $access);
|
||||
return $result_list;
|
||||
}
|
||||
$result_list = groupview_get_all_data ($id_user, $user_strict,
|
||||
$acltags, false, array(), array(), $access);
|
||||
return $result_list;
|
||||
}
|
||||
|
||||
function groupview_monitor_alerts ($group_array, $strict_user = false, $id_group_strict = false) {
|
||||
|
@ -521,52 +438,11 @@ function groupview_get_groups_list($id_user = false, $user_strict = false, $acce
|
|||
$id_user = $config['id_user'];
|
||||
}
|
||||
|
||||
//$acltags = tags_get_user_groups_and_tags ($id_user, $access, $user_strict);
|
||||
//
|
||||
|
||||
|
||||
$acltags = users_get_groups($id_user, $access, true, true);
|
||||
$result_list = groupview_get_data ($id_user, $user_strict, $acltags,
|
||||
$returnAllGroup, array(), array(), $access);
|
||||
|
||||
// If using metaconsole, the strict users will use the agent table of every node
|
||||
if (is_metaconsole() && $user_strict) {
|
||||
$servers = metaconsole_get_servers();
|
||||
|
||||
$result_list = array ();
|
||||
foreach ($servers as $server) {
|
||||
|
||||
if (metaconsole_connect($server) != NOERR) {
|
||||
continue;
|
||||
}
|
||||
$server_list = groupview_get_data ($id_user, $user_strict,
|
||||
$acltags, $returnAllGroup);
|
||||
|
||||
foreach ($server_list as $server_item) {
|
||||
if (! isset ($result_list[$server_item['_name_']])) {
|
||||
|
||||
$result_list[$server_item['_name_']] = $server_item;
|
||||
}
|
||||
else {
|
||||
$result_list[$server_item['_name_']]['_monitors_ok_'] += $server_item['_monitors_ok_'];
|
||||
$result_list[$server_item['_name_']]['_monitors_critical_'] += $server_item['_monitors_critical_'];
|
||||
$result_list[$server_item['_name_']]['_monitors_warning_'] += $server_item['_monitors_warning_'];
|
||||
$result_list[$server_item['_name_']]['_agents_unknown_'] += $server_item['_agents_unknown_'];
|
||||
$result_list[$server_item['_name_']]['_total_agents_'] += $server_item['_total_agents_'];
|
||||
$result_list[$server_item['_name_']]['_monitors_alerts_fired_'] += $server_item['_monitors_alerts_fired_'];
|
||||
}
|
||||
}
|
||||
metaconsole_restore_db();
|
||||
|
||||
}
|
||||
|
||||
return $result_list;
|
||||
}
|
||||
// If using metaconsole, the not strict users will use the metaconsole's agent cache table
|
||||
else {
|
||||
$result_list = groupview_get_data ($id_user, $user_strict, $acltags,
|
||||
$returnAllGroup, array(), array(), $access);
|
||||
|
||||
return $result_list;
|
||||
}
|
||||
return $result_list;
|
||||
}
|
||||
|
||||
function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $returnAllGroup = false, $agent_filter = array(), $module_filter = array(), $access = 'AR') {
|
||||
|
@ -598,14 +474,17 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
|
|||
$user_groups_ids = implode(',', array_keys($acltags));
|
||||
|
||||
if (!empty($user_groups_ids)) {
|
||||
if (is_metaconsole() && (!$user_strict)) {
|
||||
if (is_metaconsole()) {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$list_groups = db_get_all_rows_sql("
|
||||
SELECT *
|
||||
FROM tgrupo
|
||||
WHERE id_grupo IN (" . $user_groups_ids . ")
|
||||
AND id_grupo IN (SELECT id_grupo FROM tmetaconsole_agent WHERE disabled = 0)
|
||||
AND (
|
||||
id_grupo IN (SELECT id_grupo FROM tmetaconsole_agent WHERE disabled = 0)
|
||||
OR id_grupo IN (SELECT id_group FROM tmetaconsole_agent_secondary_group WHERE id_group IN (" . $user_groups_ids . "))
|
||||
)
|
||||
ORDER BY nombre COLLATE utf8_general_ci ASC");
|
||||
break;
|
||||
case "postgresql":
|
||||
|
@ -633,7 +512,10 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
|
|||
SELECT *
|
||||
FROM tgrupo
|
||||
WHERE id_grupo IN (" . $user_groups_ids . ")
|
||||
AND id_grupo IN (SELECT id_grupo FROM tagente WHERE disabled = 0)
|
||||
AND (
|
||||
id_grupo IN (SELECT id_grupo FROM tagente WHERE disabled = 0)
|
||||
OR id_grupo IN (SELECT id_group FROM tagent_secondary_group WHERE id_group IN (" . $user_groups_ids . "))
|
||||
)
|
||||
ORDER BY nombre COLLATE utf8_general_ci ASC");
|
||||
break;
|
||||
case "postgresql":
|
||||
|
@ -659,7 +541,11 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
|
|||
//Add the group "All" at first
|
||||
$group_all = array('id_grupo'=>0, 'nombre'=>'All', 'icon'=>'', 'parent'=>'', 'propagate'=>0, 'disabled'=>0,
|
||||
'custom_id'=>'', 'id_skin'=>0, 'description'=>'', 'contact'=>'', 'other'=>'', 'password'=>'');
|
||||
array_unshift($list_groups, $group_all);
|
||||
if ($list_groups !== false) {
|
||||
array_unshift($list_groups, $group_all);
|
||||
} else {
|
||||
$list_groups = array($group_all);
|
||||
}
|
||||
|
||||
if (!$user_strict) {
|
||||
//Takes the parents even without agents, first ids
|
||||
|
@ -744,8 +630,12 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
|
|||
$list_groups = array();
|
||||
}
|
||||
|
||||
if (!$user_strict && is_metaconsole()) { // Agent cache
|
||||
if (is_metaconsole()) { // Agent cache
|
||||
foreach ($list_groups as $group) {
|
||||
// If id group is 0 get all accesses groups
|
||||
$group_id = $group['id_grupo'] == 0
|
||||
? $user_groups_ids
|
||||
: $group['id_grupo'];
|
||||
$group_agents = db_get_row_sql("SELECT SUM(warning_count) AS _monitors_warning_,
|
||||
SUM(critical_count) AS _monitors_critical_,
|
||||
SUM(normal_count) AS _monitors_ok_,
|
||||
|
@ -754,8 +644,14 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
|
|||
SUM(fired_count) AS _monitors_alerts_fired_,
|
||||
COUNT(*) AS _total_agents_, id_grupo, intervalo,
|
||||
ultimo_contacto, disabled
|
||||
FROM tmetaconsole_agent WHERE id_grupo = " . $group['id_grupo'] . " AND disabled = 0 GROUP BY id_grupo");
|
||||
|
||||
FROM tmetaconsole_agent ta
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group tasg
|
||||
ON tasg.id_agent = ta.id_agente
|
||||
WHERE (
|
||||
ta.id_grupo IN (" . $group_id . ")
|
||||
OR tasg.id_group IN (" . $group_id . ")
|
||||
)
|
||||
AND disabled = 0");
|
||||
|
||||
$list[$group['id_grupo']]['_monitors_critical_'] = (int)$group_agents['_monitors_critical_'];
|
||||
$list[$group['id_grupo']]['_monitors_warning_'] = (int)$group_agents['_monitors_warning_'];
|
||||
|
@ -778,16 +674,19 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
|
|||
|
||||
$total_agents = $list[$group['id_grupo']]['_total_agents_'];
|
||||
|
||||
if (($group['id_grupo'] != 0) && ($total_agents > 0)) {
|
||||
$agents = db_get_all_rows_sql("SELECT warning_count,
|
||||
if ($total_agents > 0) {
|
||||
$agents = db_get_all_rows_sql(sprintf ("SELECT warning_count,
|
||||
critical_count,
|
||||
normal_count,
|
||||
unknown_count,
|
||||
notinit_count,
|
||||
fired_count,
|
||||
disabled
|
||||
FROM tmetaconsole_agent
|
||||
WHERE id_grupo = " . $group['id_grupo'] );
|
||||
FROM tmetaconsole_agent ta
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE ta.id_grupo IN (%s) OR tasg.id_group IN (%s)",
|
||||
$group_id, $group_id));
|
||||
foreach ($agents as $agent) {
|
||||
if ($agent['critical_count'] > 0) {
|
||||
$list[$group['id_grupo']]['_agents_critical_'] += 1;
|
||||
|
@ -808,7 +707,7 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (($config["realtimestats"] == 0) && !$user_strict) {
|
||||
else if (false) { //FIXME: The cached group view is wasted. Avoid to reach this code.
|
||||
|
||||
$group_stat = db_get_all_rows_sql ("SELECT
|
||||
SUM(ta.normal_count) as normal, SUM(ta.critical_count) as critical,
|
||||
|
@ -876,28 +775,32 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
|
|||
}
|
||||
else {
|
||||
foreach ($list_groups as $group) {
|
||||
// If id group is 0 get all accesses groups
|
||||
$group_id = $group['id_grupo'] == 0
|
||||
? $user_groups_ids
|
||||
: $group['id_grupo'];
|
||||
$agent_not_init = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $group['id_grupo'],
|
||||
'status' => AGENT_STATUS_NOT_INIT),
|
||||
array ('COUNT(*) as total'), $access, false);
|
||||
array ('COUNT(DISTINCT id_agente) as total'), $access, false);
|
||||
$list[$group['id_grupo']]['_agents_not_init_'] = isset ($agent_not_init[0]['total']) ? $agent_not_init[0]['total'] : 0;
|
||||
$agent_unknown = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $group['id_grupo'],
|
||||
'status' => AGENT_STATUS_UNKNOWN),
|
||||
array ('COUNT(*) as total'), $access, false);
|
||||
array ('COUNT(DISTINCT id_agente) as total'), $access, false);
|
||||
$list[$group['id_grupo']]['_agents_unknown_'] = isset ($agent_unknown[0]['total']) ? $agent_unknown[0]['total'] : 0;
|
||||
$agent_critical = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $group['id_grupo'],
|
||||
'status' => AGENT_STATUS_CRITICAL),
|
||||
array ('COUNT(*) as total'), $access, false);
|
||||
array ('COUNT(DISTINCT id_agente) as total'), $access, false);
|
||||
$list[$group['id_grupo']]['_agents_critical_'] = isset ($agent_critical[0]['total']) ? $agent_critical[0]['total'] : 0;
|
||||
$agent_total = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $group['id_grupo']),
|
||||
array ('COUNT(*) as total'), $access, false);
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $group['id_grupo']),
|
||||
array ('COUNT(DISTINCT id_agente) as total'), $access, false);
|
||||
$list[$group['id_grupo']]['_total_agents_'] = isset ($agent_total[0]['total']) ? $agent_total[0]['total'] : 0;
|
||||
$list[$group['id_grupo']]["_monitor_not_normal_"] = $list[$group['id_grupo']]["_monitor_checks_"] - $list[$group['id_grupo']]["_monitors_ok_"];
|
||||
$list[$group['id_grupo']]["_monitor_not_normal_"] = $list[$group['id_grupo']]["_monitor_checks_"] - $list[$group['id_grupo']]["_monitors_ok_"];
|
||||
|
@ -906,11 +809,16 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
|
|||
FROM tagente_estado tae INNER JOIN tagente ta
|
||||
ON tae.id_agente = ta.id_agente
|
||||
AND ta.disabled = 0
|
||||
AND ta.id_grupo = " . $group['id_grupo'] . "
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON tasg.id_agent = ta.id_agente
|
||||
INNER JOIN tagente_modulo tam
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||
AND tam.disabled = 0
|
||||
WHERE tae.utimestamp > 0
|
||||
AND (
|
||||
ta.id_grupo IN (" . $group_id . ")
|
||||
OR tasg.id_group IN (" . $group_id . ")
|
||||
)
|
||||
GROUP BY estado");
|
||||
if ($result_list) {
|
||||
foreach ($result_list as $result) {
|
||||
|
@ -934,12 +842,17 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
|
|||
FROM tagente_estado tae INNER JOIN tagente ta
|
||||
ON tae.id_agente = ta.id_agente
|
||||
AND ta.disabled = 0
|
||||
AND ta.id_grupo = " . $group['id_grupo'] . "
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON tasg.id_agent = ta.id_agente
|
||||
INNER JOIN tagente_modulo tam
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||
AND tam.disabled = 0
|
||||
WHERE tae.estado = 0
|
||||
AND (tae.utimestamp > 0 OR tam.id_tipo_modulo IN(21,22,23,100))
|
||||
AND (tae.utimestamp > 0 OR tam.id_tipo_modulo IN(21,22,23,100))
|
||||
AND (
|
||||
ta.id_grupo IN (" . $group_id . ")
|
||||
OR tasg.id_group IN (" . $group_id . ")
|
||||
)
|
||||
GROUP BY estado");
|
||||
$list[$group['id_grupo']]['_monitors_ok_'] = isset ($result_normal['contado']) ? $result_normal['contado'] : 0;
|
||||
|
||||
|
@ -947,53 +860,23 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
|
|||
FROM tagente_estado tae INNER JOIN tagente ta
|
||||
ON tae.id_agente = ta.id_agente
|
||||
AND ta.disabled = 0
|
||||
AND ta.id_grupo = " . $group['id_grupo'] . "
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON tasg.id_agent = ta.id_agente
|
||||
INNER JOIN tagente_modulo tam
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||
AND tam.disabled = 0
|
||||
WHERE tae.utimestamp = 0 AND
|
||||
tae.estado IN (".AGENT_MODULE_STATUS_NO_DATA.",".AGENT_MODULE_STATUS_NOT_INIT." )
|
||||
AND tam.id_tipo_modulo NOT IN (21,22,23,100)
|
||||
AND (
|
||||
ta.id_grupo IN (" . $group_id . ")
|
||||
OR tasg.id_group IN (" . $group_id . ")
|
||||
)
|
||||
GROUP BY estado");
|
||||
$list[$group['id_grupo']]['_monitors_not_init_'] = isset ($result_not_init['contado']) ? $result_not_init['contado'] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ($user_strict) {
|
||||
$i = 1;
|
||||
foreach ($user_tags as $group_id => $tag_name) {
|
||||
$id = db_get_value('id_tag', 'ttag', 'name', $tag_name);
|
||||
|
||||
$list[$i]['_id_'] = $id;
|
||||
$list[$i]['_name_'] = $tag_name;
|
||||
$list[$i]['_iconImg_'] = html_print_image ("images/tag_red.png", true, array ("style" => 'vertical-align: middle;'));
|
||||
$list[$i]['_is_tag_'] = 1;
|
||||
|
||||
$list[$i]['_total_agents_'] = (int) tags_get_total_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
|
||||
$list[$i]['_agents_unknown_'] = (int) tags_get_unknown_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
|
||||
$list[$i]['_agents_not_init_'] = (int) tags_get_not_init_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
|
||||
$list[$i]['_agents_critical_'] = (int) tags_get_critical_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
|
||||
$list[$i]['_monitors_ok_'] = (int) tags_get_normal_monitors ($id, $acltags, $agent_filter, $module_filter);
|
||||
$list[$i]['_monitors_critical_'] = (int) tags_get_critical_monitors ($id, $acltags, $agent_filter, $module_filter);
|
||||
$list[$i]['_monitors_warning_'] = (int) tags_get_warning_monitors ($id, $acltags, $agent_filter, $module_filter);
|
||||
$list[$i]['_monitors_not_init_'] = (int) tags_get_not_init_monitors ($id, $acltags, $agent_filter, $module_filter);
|
||||
$list[$i]['_monitors_unknown_'] = (int) tags_get_unknown_monitors ($id, $acltags, $agent_filter, $module_filter);
|
||||
$list[$i]['_monitors_alerts_fired_'] = tags_monitors_fired_alerts($id, $acltags);
|
||||
|
||||
if (! defined ('METACONSOLE')) {
|
||||
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) {
|
||||
unset($list[$i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0)) {
|
||||
unset($list[$i]);
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
|
|
@ -798,7 +798,7 @@ function html_print_extended_select_for_post_process($name, $selected = '',
|
|||
function html_print_extended_select_for_time ($name, $selected = '',
|
||||
$script = '', $nothing = '', $nothing_value = '0', $size = false,
|
||||
$return = false, $select_style = false, $unique_name = true, $class='',
|
||||
$readonly = false, $custom_fields = false,$style_icon = '') {
|
||||
$readonly = false, $custom_fields = false,$style_icon = '',$no_change = false) {
|
||||
|
||||
global $config;
|
||||
$admin = is_user_admin($config['id_user']);
|
||||
|
@ -808,6 +808,9 @@ function html_print_extended_select_for_time ($name, $selected = '',
|
|||
$fields = get_periods();
|
||||
}
|
||||
|
||||
if($no_change){
|
||||
$fields['-2'] = __('No change');
|
||||
}
|
||||
|
||||
if ( ! $selected ) {
|
||||
foreach( $fields as $t_key => $t_value){
|
||||
|
|
|
@ -1087,20 +1087,13 @@ function modules_get_agentmodule_descripcion ($id_agente_modulo) {
|
|||
*
|
||||
* @return string Module type of the given agent module.
|
||||
*/
|
||||
function modules_get_agentmodule_type ($id_agentmodule, $metaconsole = false, $id_server = null) {
|
||||
|
||||
if ($metaconsole) {
|
||||
$server = db_get_row('tmetaconsole_setup', 'id', $id_server);
|
||||
|
||||
$return = db_get_value ('id_tipo_modulo',
|
||||
'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
else {
|
||||
$return = db_get_value ('id_tipo_modulo',
|
||||
'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
|
||||
}
|
||||
function modules_get_agentmodule_type ($id_agentmodule) {
|
||||
$return = db_get_value (
|
||||
'id_tipo_modulo',
|
||||
'tagente_modulo',
|
||||
'id_agente_modulo',
|
||||
(int) $id_agentmodule
|
||||
);
|
||||
|
||||
return (int) $return;
|
||||
}
|
||||
|
@ -2322,7 +2315,7 @@ function modules_get_first_date($id_agent_module, $datelimit = 0) {
|
|||
|
||||
//check datatype string or normal
|
||||
$table = "tagente_datos";
|
||||
$module_type_str = modules_get_type_name ($id_agent_module);
|
||||
$module_type_str = modules_get_agentmodule_type($id_agent_module);
|
||||
if (strstr ($module_type_str, 'string') !== false) {
|
||||
$table = "tagente_datos_string";
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue