Merge branch 'develop' into feature/log_in_reports

Conflicts:
	pandora_console/godmode/reporting/reporting_builder.item_editor.php
	pandora_console/include/functions_reporting_html.php
This commit is contained in:
Arturo Gonzalez 2017-02-21 12:06:24 +01:00
commit 5190228010
450 changed files with 165446 additions and 128193 deletions

6
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,6 @@
variables:
GIT_STRATEGY: clone
test:
script:
- docker run --rm -h pandorafms -t -v "$CI_PROJECT_DIR:/tmp/pandorafms" pandorafms/pandorafms-base /tmp/pandorafms/tests/test.sh

View File

@ -1,6 +1,6 @@
[![Build Status](https://travis-ci.org/pandorafms/pandorafms.svg?branch=develop)](https://travis-ci.org/pandorafms/pandorafms)
[![Pandora logo](http://pandorafms.com/github/logo_2.png)](http://pandorafms.org)
[![Pandora logo](http://wolf359.artica.es/public_images/logo_pandora_community.png)](http://pandorafms.org)
Pandora FMS is a monitoring software for IT infrastructure management which includes network equipment, Windows and Unix servers, virtual infrastructure and all different kind of applications. It has a large amount of features, making it a new generation software which discovers all the monitoring issues that an organization may need.
@ -33,13 +33,13 @@ Pandora FMS is a monitoring tool that not only measures if a parameter is right
* Multiuser, several levels of ACL management.
### Screenshots
![screenshot 1](http://pandorafms.com/github/agent_list.png)
![screenshot 1](http://wolf359.artica.es/public_images/captura-pantalla-pandora3.png)
<br />
<br />
![screenshot 2](http://pandorafms.com/github/captura_pantalla5.png)
![screenshot 2](http://wolf359.artica.es/public_images/pandora6.0sp3-monitor-view.png)
<br />
<br />
![screenshot 3](http://pandorafms.com/github/pandora_sla_report2.png)
![screenshot 3](http://wolf359.artica.es/public_images/pandora6.0sp3-agentview.png)
<br />
<br />
![screenshot 4](http://pandorafms.com/github/services.png)
![screenshot 4](http://wolf359.artica.es/public_images/pandora6.0sp3-sample-visual-console.png)

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 6.1dev, AIX version
# Version 7.0dev, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 6.1dev, FreeBSD Version
# Version 7.0dev, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 6.1dev, HP-UX Version
# Version 7.0dev, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 6.1dev, GNU/Linux
# Version 7.0dev, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 6.1dev, GNU/Linux
# Version 7.0dev, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 6.1dev, Solaris Version
# Version 7.0dev, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 6.1dev
# Version 7.0dev
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 6.1dev, AIX version
# Version 7.0dev, AIX version
# General Parameters
# ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 6.1dev
# Version 7.0dev
# FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 6.1dev, HPUX Version
# Version 7.0dev, HPUX Version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 6.1dev
# Version 7.0dev
# Licensed under GPL license v2,
# (c) 2003-2010 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 6.1dev
# Version 7.0dev
# Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 6.1dev
# Version 7.0dev
# Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 6.1dev, Solaris version
# Version 7.0dev, Solaris version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 6.1dev, AIX version
# Version 7.0dev, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -28,6 +28,9 @@ debug 0
# Group assigned for this agent (descriptive, p.e: Servers)
#group Servers
# Group password (if defined).
#group_password
# Autotime: Enforce to server to ignore timestamp coming from this
# agent, used when agents has no timer or it's inestable. 1 to enable
# this feature

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 6.1dev-161107
Version: 7.0dev-170221
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="6.1dev-161107"
pandora_version="7.0dev-170221"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 6.1dev, GNU/Linux
# Version 7.0dev, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -42,6 +42,9 @@ udp_server_auth_address 0.0.0.0
# Group assigned for this agent (descriptive, p.e: Servers)
#group Servers
# Group password (if defined).
#group_password
# address: Enforce to server a ip address to this agent
# You can also try to detect the first IP using "auto", for example
#address auto

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 6.1dev, FreeBSD Version
# Version 7.0dev, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -11,6 +11,7 @@ server_ip localhost
server_path /var/spool/pandora/data_in
temporal /tmp
logfile /var/log/pandora/pandora_agent.log
#include /etc/pandora/pandora_agent_alt.conf
#broker_agent name_agent
@ -49,10 +50,19 @@ udp_server_auth_address 0.0.0.0
# Group assigned for this agent (descriptive, p.e: Servers)
group Servers
# Group password (if defined).
#group_password
# address: Enforce to server a ip address to this agent
# You can also try to detect the first IP using "auto", for example
address auto
# or setting a fixed IP address, like for example:
#address 192.168.36.73
# Autotime: Enforce to server to ignore timestamp coming from this
# agent, used when agents has no timer or it's inestable. 1 to enable
# this feature
# autotime 1
#autotime 1
# Timezone offset: Difference with the server timezone
#timezone_offset 0
@ -139,9 +149,6 @@ xml_buffer 1
# Minimum available bytes in the temporal directory to enable the XML buffer
temporal_min_size 1024
# Agent mode: Learn (default), No-learn, Autodisable
# agent_mode autodisable
#Secondary server configuration
#==============================
@ -242,7 +249,7 @@ module_end
# This plugin detects all disk and report free space (%)
module_plugin pandora_df_used
module_plugin pandora_df_free
# This parses /var/log/auth.log file, under the module name "syslog"
# And search for "sshd" string into it, sending only that information.

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 6.1dev, HP-UX Version
# Version 7.0dev, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -30,6 +30,9 @@ debug 0
# Group assigned for this agent (descriptive, p.e: Servers)
#group Servers
# Group password (if defined).
#group_password
# Autotime: Enforce to server to ignore timestamp coming from this
# agent, used when agents has no timer or it's inestable. 1 to enable
# this feature

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 6.1dev, GNU/Linux
# Version 7.0dev, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -50,6 +50,9 @@ udp_server_auth_address 0.0.0.0
# Group assigned for this agent (descriptive, p.e: Servers)
group Servers
# Group password (if defined).
#group_password
# address: Enforce to server a ip address to this agent
# You can also try to detect the first IP using "auto", for example
address auto

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 6.1dev, GNU/Linux
# Version 7.0dev, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -41,6 +41,9 @@ udp_server_auth_address 0.0.0.0
# Group assigned for this agent (descriptive, p.e: Servers)
#group Servers
# Group password (if defined).
#group_password
# Autotime: Enforce to server to ignore timestamp coming from this
# agent, used when agents has no timer or it's inestable. 1 to enable

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 6.1dev, NetBSD Version
# Version 7.0dev, NetBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -33,6 +33,9 @@ debug 0
# Group assigned for this agent (descriptive, p.e: Servers)
group Servers
# Group password (if defined).
#group_password
# Autotime: Enforce to server to ignore timestamp coming from this
# agent, used when agents has no timer or it's inestable. 1 to enable
# this feature

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 6.1dev, Solaris Version
# Version 7.0dev, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -30,6 +30,9 @@ debug 0
# Group assigned for this agent (descriptive, p.e: Servers)
#group Servers
# Group password (if defined).
#group_password
# Autotime: Enforce to server to ignore timestamp coming from this
# agent, used when agents has no timer or it's inestable. 1 to enable
# this feature

View File

@ -40,8 +40,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '6.1dev';
use constant AGENT_BUILD => '161107';
use constant AGENT_VERSION => '7.0dev';
use constant AGENT_BUILD => '170221';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -131,10 +131,13 @@ my %DefaultConf = (
'temporal' => '/var/spool/pandora',
'interval' => 300,
'debug' => 0,
'ehorus_conf' => undef,
'agent_name' => hostname (),
'agent_name_cmd' => '',
'description' => '',
'group' => '',
'group_id' => undef,
'group_password' => undef,
'encoding' => 'UTF-8',
'server_port' => 41121,
'transfer_mode' => 'tentacle',
@ -630,6 +633,16 @@ sub parse_conf_modules($) {
# FF interval
} elsif ($line =~ /^\s*module_ff_interval\s+(\S+)\s*$/) {
$module->{'module_ff_interval'} = $1;
} elsif ($line =~ /^\s*module_min_ff_event_normal\s+(\S+)\s*$/) {
$module->{'min_ff_event_normal'} = $1;
} elsif ($line =~ /^\s*module_min_ff_event_warning\s+(\S+)\s*$/) {
$module->{'min_ff_event_warning'} = $1;
} elsif ($line =~ /^\s*module_min_ff_event_critical\s+(\S+)\s*$/) {
$module->{'min_ff_event_critical'} = $1;
} elsif ($line =~ /^\s*module_ff_timeout\s+(\S+)\s*$/) {
$module->{'ff_timeout'} = $1;
} elsif ($line =~ /^\s*module_each_ff\s+(\S+)\s*$/) {
$module->{'each_ff'} = $1;
# Macros
} elsif ($line =~ /^\s*module_macro(\S+)\s+(.*)\s*$/) {
$module->{'macros'}{$1} = $2;
@ -2183,6 +2196,39 @@ sub init_module ($) {
$module->{'alert_template'} = undef;
}
################################################################################
# Get the eHorus key from the eHorus agent configuration file.
################################################################################
sub get_ehkey {
my $fh;
return '' unless defined($Conf{'ehorus_conf'});
# Open the eHorus configuration file.
if (!open($fh, '<', $Conf{'ehorus_conf'})) {
# Do not write to the log, since ehorus_conf points to the default eHorus configuration file by default.
return '';
}
# Look for the eHorus key.
while (my $line = <$fh>) {
# Skip comments.
next if ($line =~ m/^\s*#/);
if ($line =~ m/\s*eh_key\s+(\S+)/) {
my $eh_key = $1;
close($fh);
return $eh_key;
}
}
# Not found.
close($fh);
return '';
}
################################################################################
# Main.
################################################################################
@ -2336,12 +2382,15 @@ while (1) {
if(defined($Conf{'address'})) {
# Check if address is auto to get the local ip
if ($Conf{'address'} eq 'auto') {
# Tested on Ubuntu, debian, Suse, Solaris 10 and AIX 5.1
my @address_list = `ifconfig -a 2>$DevNull | grep -v '127.0.0' | grep '[0-9]*\\.[0-9]*\\.[0-9]*' | awk '{ print \$2 }' | awk -F':' '{ print \$2 }'`;
if ($#address_list < 0) {
# Tested on Red Hat 7
@address_list = `ip addr show 2>$DevNull | grep -v '127.0.0' | grep '[0-9]*\\.[0-9]*\\.[0-9]*' | awk '{print \$2}' | cut -d/ -f1`;
my @address_list;
if( -x "/bin/ip" || -x "/sbin/ip" || -x "/usr/sbin/ip" ) {
@address_list = `ip addr show 2>$DevNull | sed -e '/127.0.0/d' -e '/[0-9]*\\.[0-9]*\\.[0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/\\/.*//'`;
}
else {
@address_list = `ifconfig -a 2>$DevNull | sed -e '/127.0.0/d' -e '/[0-9]*\\.[0-9]*\\.[0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/.*://'`;
}
for (my $i = 0; $i <= $#address_list; $i++) {
chomp($address_list[$i]);
if ($i > 0) {
@ -2359,11 +2408,14 @@ while (1) {
# Clear the XML
$Xml = "";
# Get the eHorus key.
my $eh_key = get_ehkey();
# Custom fields
my @customfieldskeys = keys(%Customfields);
if ($#customfieldskeys > -1) {
if ($#customfieldskeys > -1 || $eh_key ne '') {
$Xml .= "<custom_fields>\n";
foreach my $customfieldkey (@customfieldskeys) {
if($customfieldkey =~ m/^(custom_field\d+_)name/) {
if(defined($Customfields{$1."value"})) {
@ -2374,6 +2426,15 @@ while (1) {
}
}
}
# Add the eHorus key as a custom field.
if ($eh_key ne '') {
$Xml .= " <field>\n";
$Xml .= " <name>eHorusID</name>\n";
$Xml .= " <value><![CDATA[". $eh_key ."]]></value>\n";
$Xml .= " </field>\n";
}
$Xml .= "</custom_fields>\n";
}
@ -2406,7 +2467,9 @@ while (1) {
# Compose the XML
my $xml_header = "<?xml version='1.0' encoding='" . $Conf{'encoding'} . "'?>\n" .
"<agent_data description='" . $Conf{'description'} ."' group='" . $Conf{'group'} .
"<agent_data description='" . $Conf{'description'} . "' group='" . $Conf{'group'} .
(defined($Conf{'group_password'}) ? ("' group_password='" . $Conf{'group_password'}) : '') .
(defined($Conf{'group_id'}) ? ("' group_id='" . $Conf{'group_id'}) : '') .
"' os_name='$OS' os_version='$OS_VERSION' interval='" . $Conf{'interval'} .
"' version='" . AGENT_VERSION . '(Build ' . AGENT_BUILD . ')' . ($Conf{'autotime'} eq '1' ? '' : "' timestamp='" . strftime ('%Y/%m/%d %H:%M:%S', localtime ())) .
"' agent_name='" . $Conf{'agent_name'} . "' timezone_offset='". $Conf{'timezone_offset'} .
@ -2460,6 +2523,7 @@ while (1) {
$xml_header .= "' position_description='" .$Conf{'position_description'};
}
}
$xml_header .= "'>\n";
$Xml = $xml_header . $Xml . "</agent_data>";

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 6.1dev
%define release 161107
%define version 7.0dev
%define release 170221
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
@ -24,7 +24,7 @@ Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: fileutils textutils unzip
Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk
Requires: perl perl(Sys::Syslog)
Requires: perl perl(Sys::Syslog) perl(IO::Socket::SSL)
# Required by plugins
#Requires: sh-utils sed passwd net-tools rpm
AutoReq: 0

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 6.1dev
%define release 161107
%define version 7.0dev
%define release 170221
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="6.1dev"
PI_BUILD="161107"
PI_VERSION="7.0dev"
PI_BUILD="170221"
OS_NAME=`uname -s`
FORCE=0

View File

@ -33,7 +33,7 @@ my $freemem=`cat /proc/meminfo | grep 'MemFree' | awk '{ print \$2 } '`;
my $cached=`cat /proc/meminfo | grep '^Cached:' | awk '{ print \$2 } '`;
my $cachedswap=`cat /proc/meminfo | grep '^SwapCached:' | awk '{ print \$2 }'`;
my $total_meminfo=`cat /proc/meminfo | grep 'MemTotal:' | awk '{ print \$2 }'`;
my $available=$freemem+$cached+$cachedwap;
my $available=$freemem+$cached+$cachedswap;
my $available_percent = floor(($available / $total_meminfo)*100);

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2014 Artica Soluciones Tecnologicas
# Version 6.1dev
# Version 7.0dev
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -25,25 +25,24 @@ For Each objItem in colItems
If argc = 0 Or argv.Exists(objItem.Name) Then
' Include only harddrivers (type 3)
If (objItem.FreeSpace <> "") AND (objItem.DriveType =3) Then
Percent = round ((objItem.FreeSpace / objItem.Size) * 100, 2)
Percent = round ((objItem.FreeSpace / objItem.Size) * 100, 2)
Wscript.StdOut.WriteLine "<module>"
Wscript.StdOut.WriteLine " <name><![CDATA[DiskFree%_" & objItem.Name & "]]></name>"
Wscript.StdOut.WriteLine " <description><![CDATA[Drive " & objItem.Name & " % free space ]]></description>"
If (Percent > 99.99) then
Wscript.StdOut.WriteLine " <description><![CDATA[Drive " & objItem.Name & " free space: " & Int(objItem.FreeSpace /1048576) & " MB]]></description>"
If (Percent > 99.99) then
Wscript.StdOut.WriteLine " <data><![CDATA[" & 100 & "]]></data>"
Elseif (Percent < 0.01) then
Elseif (Percent < 0.01) then
Wscript.StdOut.WriteLine " <data><![CDATA[" & 0 & "]]></data>"
Else
Else
Wscript.StdOut.WriteLine " <data><![CDATA[" & Percent & "]]></data>"
End If
Wscript.StdOut.WriteLine "<unit>%</unit>"
Wscript.StdOut.WriteLine "<min_warning>5</min_warning>"
Wscript.StdOut.WriteLine "<max_warning>10</max_warning>"
Wscript.StdOut.WriteLine "<min_critical>0</min_critical>"
Wscript.StdOut.WriteLine "<max_critical>5</max_critical>"
Wscript.StdOut.WriteLine "</module>"
Wscript.StdOut.flush
End If
Wscript.StdOut.WriteLine " <unit>%</unit>"
Wscript.StdOut.WriteLine " <min_warning>5</min_warning>"
Wscript.StdOut.WriteLine " <max_warning>10</max_warning>"
Wscript.StdOut.WriteLine " <min_critical>0</min_critical>"
Wscript.StdOut.WriteLine " <max_critical>5</max_critical>"
Wscript.StdOut.WriteLine "</module>"
Wscript.StdOut.flush
End If
End If
Next

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes}
AppName
{Pandora FMS Windows Agent v6.1dev}
{Pandora FMS Windows Agent v7.0dev}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -75,7 +75,7 @@ InstallPassword
{}
InstallVersion
{6.1.0.0}
{7.0.0.0}
Language,ca
{No}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{161107}
{170221}
ViewReadme
{Yes}

View File

@ -213,6 +213,8 @@ Pandora_Module::parseModuleTypeFromString (string type) {
return TYPE_ASYNC_STRING;
} else if (type == module_log_str) {
return TYPE_LOG;
} else if (type == module_generic_data_inc_abs_str) {
return TYPE_GENERIC_DATA_INC_ABS;
} else {
return TYPE_0;
}

View File

@ -50,7 +50,9 @@ namespace Pandora_Modules {
TYPE_ASYNC_DATA, /**< Asynchronous generic_data */
TYPE_ASYNC_PROC, /**< Asynchronous generic_proc */
TYPE_ASYNC_STRING, /**< Asynchronous generic_data_string */
TYPE_LOG /**< Log data */
TYPE_LOG, /**< Log data */
TYPE_GENERIC_DATA_INC_ABS /**< The value is an integer with
* incremental diferences (timestamps are ignored) */
} Module_Type;
const string module_generic_data_str = "generic_data";
@ -61,6 +63,7 @@ namespace Pandora_Modules {
const string module_async_proc_str = "async_proc";
const string module_async_string_str = "async_string";
const string module_log_str = "log";
const string module_generic_data_inc_abs_str = "generic_data_inc_abs";
/**
* Defines the kind of the module.

View File

@ -80,6 +80,9 @@ Pandora_Module_Exec::Pandora_Module_Exec (string name, string exec, string nativ
} else {
this->output_encoding = "";
}
/*allways change input encoding from UTF-8 to ANSI*/
changeInputEncoding();
}
void
@ -147,9 +150,6 @@ Pandora_Module_Exec::run () {
to find the GNU W32 tools */
working_dir = getPandoraInstallDir () + "util\\";
/*allways change input encoding from UTF-8 to ANSI*/
changeInputEncoding();
/* Create the child process. */
if (! CreateProcess (NULL, (CHAR *) this->module_exec.c_str (), NULL,
NULL, TRUE, CREATE_SUSPENDED | CREATE_NO_WINDOW, NULL,

View File

@ -1288,6 +1288,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
switch (type) {
case TYPE_GENERIC_DATA:
case TYPE_GENERIC_DATA_INC:
case TYPE_GENERIC_DATA_INC_ABS:
case TYPE_GENERIC_PROC:
case TYPE_ASYNC_DATA:
case TYPE_ASYNC_PROC:

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("6.1dev(Build 161107)")
#define PANDORA_VERSION ("7.0dev(Build 170221)")
string pandora_path;
string pandora_dir;

View File

@ -385,6 +385,7 @@ Pandora_Windows_Service::getXmlHeader () {
char timestamp[20];
string agent_name, os_name, os_version, encoding, value, xml, address, parent_agent_name, agent_name_cmd;
string custom_id, url_address, latitude, longitude, altitude, position_description, gis_exec, gis_result, agent_mode;
string group_password, group_id, ehorus_conf;
time_t ctime;
struct tm *ctime_tm = NULL;
int pos;
@ -477,6 +478,20 @@ Pandora_Windows_Service::getXmlHeader () {
xml += "\" url_address=\"";
xml += url_address;
}
// Get group password
group_password = conf->getValue ("group_password");
if (group_password != "") {
xml += "\" group_password=\"";
xml += group_password;
}
// Get Group ID
group_id = conf->getValue ("group_id");
if (group_id != "") {
xml += "\" group_id=\"";
xml += group_id;
}
// Get Coordinates
gis_exec = conf->getValue ("gis_exec");
@ -1626,6 +1641,7 @@ Pandora_Windows_Service::sendXml (Pandora_Module_List *modules) {
string xml_filename, random_integer;
string tmp_filename, tmp_filepath;
string encoding;
string ehorus_conf, eh_key;
static HANDLE mutex = 0;
ULARGE_INTEGER free_bytes;
double min_free_bytes = 0;
@ -1645,6 +1661,12 @@ Pandora_Windows_Service::sendXml (Pandora_Module_List *modules) {
data_xml = getXmlHeader ();
/* Get the eHorus key. */
ehorus_conf = conf->getValue ("ehorus_conf");
if (ehorus_conf != "") {
eh_key = getEHKey(ehorus_conf);
}
/* Write custom fields */
int c = 1;
@ -1654,8 +1676,8 @@ Pandora_Windows_Service::sendXml (Pandora_Module_List *modules) {
sprintf(token_value_token, "custom_field%d_value", c);
string token_name = conf->getValue (token_name_token);
string token_value = conf->getValue (token_value_token);
if(token_name != "" && token_value != "") {
if((token_name != "" && token_value != "") || eh_key != "") {
data_xml += "<custom_fields>\n";
while(token_name != "" && token_value != "") {
data_xml += " <field>\n";
@ -1669,6 +1691,15 @@ Pandora_Windows_Service::sendXml (Pandora_Module_List *modules) {
token_name = conf->getValue (token_name_token);
token_value = conf->getValue (token_value_token);
}
/* Add the eHorus key as a custom field. */
if (eh_key != "") {
data_xml += " <field>\n";
data_xml += " <name>eHorusID</name>\n";
data_xml += " <value><![CDATA["+ eh_key +"]]></value>\n";
data_xml += " </field>\n";
}
data_xml += "</custom_fields>\n";
}
@ -2026,6 +2057,37 @@ Pandora_Windows_Service::getConf () {
return this->conf;
}
string
Pandora_Windows_Service::getEHKey (string ehorus_conf) {
string buffer, eh_key;
std::ifstream ifs(ehorus_conf.c_str());
int pos;
if (! ifs.is_open ()) {
pandoraDebug ("Error opening eHorus configuration file %s", ehorus_conf.c_str ());
return eh_key;
}
/* Look for the eHorus key. */
while (ifs.good ()) {
getline (ifs, buffer);
/* Skip comments. */
if (buffer.empty() || buffer.at(0) == '#') {
continue;
}
pos = buffer.find("eh_key");
if (pos != string::npos){
eh_key = buffer.substr(pos + 7); /* pos + strlen("eh_key ") */
eh_key = trim(eh_key);
return eh_key;
}
}
return eh_key;
}
long
Pandora_Windows_Service::getInterval () {
return this->interval;

View File

@ -114,6 +114,7 @@ namespace Pandora {
int sendXml (Pandora_Module_List *modules);
void sendBufferedXml (string path);
Pandora_Agent_Conf *getConf ();
string getEHKey (string ehorus_conf);
long getInterval ();
long getIntensiveInterval ();

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(6.1dev(Build 161107))"
VALUE "ProductVersion", "(7.0dev(Build 170221))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 6.1dev-161107
Version: 7.0dev-170221
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="6.1dev-161107"
pandora_version="7.0dev-170221"
package_pear=0
package_pandora=1

View File

@ -35,7 +35,7 @@ if (isset ($_GET["loginhash"])) {
if ($config["loginhash_pwd"] != ""
&& $loginhash_data == md5($loginhash_user.io_output_password($config["loginhash_pwd"]))) {
db_logon ($loginhash_user, $_SERVER['REMOTE_ADDR']);
$_SESSION[$config['homeurl_static']]['id_usuario'] = $loginhash_user;
$_SESSION['id_usuario'] = $loginhash_user;
$config["id_user"] = $loginhash_user;
}
else {
@ -61,7 +61,7 @@ $config["remote_addr"] = $_SERVER['REMOTE_ADDR'];
$page = (string) get_parameter ('page');
$page = safe_url_extraclean ($page);
$page .= '.php';
$config["id_user"] = $_SESSION[$config['homeurl_static']]["id_usuario"];
$config["id_user"] = $_SESSION["id_usuario"];
$isFunctionSkins = enterprise_include_once ('include/functions_skins.php');
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK)
$config["relative_path"] = enterprise_hook('skins_set_image_skin_path',array($config['id_user']));

View File

@ -69,20 +69,34 @@ function mainAgentsModules() {
$offset = (int)get_parameter('offset', 0);
$hor_offset = (int)get_parameter('hor_offset', 0);
$block = $config['block_size'];
$agents_id = (array)get_parameter('id_agents2', -1);
$selection_a_m = (int)get_parameter('selection_agent_module');
$modules_selected = (array)get_parameter('module', 0);
$update_item = (string)get_parameter('edit_item','');
$save_serialize = (int)get_parameter('save_serialize', 0);
$groups = users_get_groups ();
$filter_module_groups = '<form method="post" action="' . ui_get_url_refresh (array ('offset' => $offset, 'hor_offset' => $offset,'group_id' => $group_id, 'modulegroup' => $modulegroup)).'">';
$filter_module_groups .= '<b>'.__('Module group').'</b>';
$filter_module_groups .= html_print_select_from_sql ("SELECT * FROM tmodule_group ORDER BY name",
'modulegroup', $modulegroup, 'this.form.submit()',__('All'), 0, true, false, true, false, 'width: auto;');
$filter_module_groups .= '</form>';
$filter_groups = '<form method="post" action="' . ui_get_url_refresh (array ('offset' => $offset, 'hor_offset' => $offset,'group_id' => $group_id, 'modulegroup' => $modulegroup)).'">';
$filter_groups .= '<b>'.__('Group').'</b>';
$filter_groups .= html_print_select_groups(false, "AR", true, 'group_id', $group_id, 'this.form.submit()', '', '', true, false, true, '', false , 'width: auto;');
$filter_groups .= '</form>';
if($save_serialize && $update_item == ''){
$unserialize_modules_selected = unserialize_in_temp($config['id_user']."_agent_module", true, 1);
$unserialize_agents_id = unserialize_in_temp($config['id_user']."_agents", true, 1);
if($unserialize_modules_selected){
$modules_selected = $unserialize_modules_selected;
}
if($unserialize_agents_id){
$agents_id = $unserialize_agents_id;
}
}
else{
unserialize_in_temp($config['id_user']."_agent_module", true, 1);
unserialize_in_temp($config['id_user']."_agents", true, 1);
}
if($modules_selected[0]){
serialize_in_temp($modules_selected, $config['id_user']."_agent_module", 1);
}
if($agents_id[0] != -1 ){
serialize_in_temp($agents_id, $config['id_user']."_agents", 1);
}
$comborefr = '<form method="post" action="' . ui_get_url_refresh (array ('offset' => $offset, 'hor_offset' => $offset,'group_id' => $group_id, 'modulegroup' => $modulegroup)).'">';
$comborefr .= '<b>'.__('Refresh').'</b>';
$comborefr .= html_print_select (
@ -107,7 +121,50 @@ function mainAgentsModules() {
. "</a>";
$config['refr'] = $refr;
}
$groups = users_get_groups ();
//groups
$filter_groups_label = '<b>'.__('Group').'</b>';
$filter_groups = html_print_select_groups(false, "AR", true, 'group_id', $group_id, '', '', '', true, false, true, '', false , 'width: auto;');
//groups module
$filter_module_groups_label = '<b>'.__('Module group').'</b>';
$filter_module_groups = html_print_select_from_sql ("SELECT * FROM tmodule_group ORDER BY name",
'modulegroup', $modulegroup, '',__('All'), 0, true, false, true, false, 'width: auto;');
$agents_select = array();
if (is_array($id_agents) || is_object($id_agents)){
foreach ($id_agents as $id) {
foreach ($agents as $key => $a) {
if ($key == (int)$id) {
$agents_select[$key] = $key;
}
}
}
}
//agent
$agents = agents_get_group_agents($group_id);
if ((empty($agents)) || $agents == -1) $agents = array();
$filter_agents_label = '<b>'.__('Agents').'</b>';
$filter_agents = html_print_select($agents, 'id_agents2[]', $agents_id, '', '', 0, true, true, true, '', false, "min-width: 180px");
//type show
$selection = array(0 => __('Show common modules'),
1=> __('Show all modules'));
$filter_type_show_label = '<b>'.__('Show common modules').'</b>';
$filter_type_show = html_print_select($selection, 'selection_agent_module', $selection_a_m, '', "", 0, true, false, true, '', false, "min-width: 180px");
//modules
$all_modules = db_get_all_rows_sql("SELECT DISTINCT nombre, id_agente_modulo FROM tagente_modulo WHERE id_agente IN (" . implode(',', array_keys($agents)) . ")");
$filter_modules_label = '<b>'.__('Module').'</b>';
$filter_modules = html_print_select($all_modules, 'module[]', $modules_selected, '', __('None'), 0, true, true, true, '', false, "min-width: 180px");
//update
$filter_update = html_print_submit_button(__('Update item'), 'edit_item', false, 'class="sub upd"', true);
$onheader = array('updated_time' => $updated_time, 'fullscreen' => $fullscreen,
'combo_module_groups' => $filter_module_groups,
'combo_groups' => $filter_groups);
@ -121,38 +178,94 @@ function mainAgentsModules() {
// Old style table, we need a lot of special formatting,don't use table function
// Prepare old-style table
echo '<table class="databox filters" cellpadding="0" cellspacing="0" border="0" style="width:100%;">';
echo '<table style="width:100%;">';
echo "<tr>";
echo "<td>" . $filter_module_groups . "</td>";
echo "<td>" . $filter_groups . "</td>";
if ($config['pure'] == 1)
echo "<td>" . $comborefr . "</td>";
echo "<td> <strong>" . __("Full screen") . "</strong>" . $fullscreen['text'] . "</td>";
if ($config['pure'] == 1){
echo "<td>" . $comborefr . "</td>";
echo "<td>" . $fullscreen['text'] . "</td>";
}
else{
echo "<td> <span style='float: right;'>" . $fullscreen['text'] . "</span> </td>";
}
echo "</tr>";
echo "</table>";
$agents = '';
$agents = agents_get_group_agents($group_id,array('disabled' => 0));
$agents = array_keys($agents);
if($config['pure'] != 1){
echo '<form method="post" action="' . ui_get_url_refresh (array ('offset' => $offset, 'hor_offset' => $offset,'group_id' => $group_id, 'modulegroup' => $modulegroup)).'">';
echo '<table class="databox filters" cellpadding="0" cellspacing="0" border="0" style="width:100%;">';
echo "<tr>";
echo "<td>" . $filter_groups_label . "</td>";
echo "<td>" . $filter_groups . "</td>";
echo "<td></td>";
echo "<td></td>";
echo "<td>" . $filter_module_groups_label . "</td>";
echo "<td>" . $filter_module_groups . "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $filter_agents_label . "</td>";
echo "<td>" . $filter_agents . "</td>";
echo "<td>" . $filter_type_show_label . "</td>";
echo "<td>" . $filter_type_show . "</td>";
echo "<td>" . $filter_modules_label . "</td>";
echo "<td>" . $filter_modules . "</td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan=6 ><span style='float: right; padding-right: 20px;'>" . $filter_update . "</sapn></td>";
echo "</tr>";
echo "</table>";
echo '</form>';
}
if($agents_id[0] != -1){
$agents = $agents_id;
}
else {
$agents = '';
$agents = agents_get_group_agents($group_id,array('disabled' => 0));
$agents = array_keys($agents);
}
$filter_module_group = array('disabled' => 0);
if ($modulegroup > 0) {
$filter_module_group['id_module_group'] = $modulegroup;
}
$count = 0;
foreach ($agents as $agent) {
$module = agents_get_modules($agent, false,
$filter_module_group, true, false);
$filter_module_group, true, true);
if ($module == false) {
unset($agents[$count]);
}
$count++;
}
$total_pagination = count($agents);
$all_modules = agents_get_modules($agents, false,
$filter_module_group, true, false);
if($agents_id[0] != -1){
$all_modules = array();
foreach ($modules_selected as $key => $value) {
//$all_modules[$value] = io_safe_output(modules_get_agentmodule_name($value));
$name = modules_get_agentmodule_name($value);
$sql = "SELECT id_agente_modulo
FROM tagente_modulo
WHERE nombre = '". $name ."';";
$result_sql = db_get_all_rows_sql($sql);
if(is_array($result_sql)){
foreach ($result_sql as $key => $value) {
$all_modules[$value['id_agente_modulo']] = io_safe_output($name);
}
}
}
}
else{
$all_modules = agents_get_modules($agents, false,
$filter_module_group, true, true);
}
$modules_by_name = array();
$name = '';
$cont = 0;
@ -173,9 +286,15 @@ function mainAgentsModules() {
$block = count($modules_by_name);
}
$filter_groups = array ('offset' => (int) $offset,
'limit' => (int) $config['block_size'], 'disabled' => 0,'id_agente'=>$agents);
if($update_item == ''){
$filter_groups = array ('offset' => (int) $offset,
'limit' => (int) $config['block_size'], 'disabled' => 0,'id_agente'=>$agents);
}
else{
$filter_groups = array ('offset' => 0,
'limit' => (int) $config['block_size'], 'disabled' => 0,'id_agente'=>$agents);
}
if ($group_id > 0) {
$filter_groups['id_grupo'] = $group_id;
}
@ -204,10 +323,11 @@ function mainAgentsModules() {
"sec=extensions&" .
"sec2=extensions/agents_modules&" .
"refr=0&" .
"save_serialize=1&" .
"selection_a_m=" . $selection_a_m . "&" .
"hor_offset=" . $new_hor_offset . "&" .
"offset=" . $offset . "&" .
"group_id=" . $group_id . "&" .
"modulegroup=" . $modulegroup . "'>" .
"offset=" . $offset .
"'>" .
html_print_image("images/arrow_left.png", true,
array('title' => __('Previous modules'))) .
"</a>" .
@ -241,10 +361,11 @@ function mainAgentsModules() {
"extension_in_menu=estado&" .
"sec=extensions&".
"sec2=extensions/agents_modules&".
"save_serialize=1&" .
"selection_a_m=" . $selection_a_m . "&" .
"hor_offset=" . $new_hor_offset . "&".
"offset=" . $offset . "&" .
"group_id=" . $group_id . "&" .
"modulegroup=" . $modulegroup . "'>" .
"offset=" . $offset .
"'>" .
html_print_image(
"images/arrow.png", true,
array('title' => __('More modules'))) .
@ -259,7 +380,8 @@ function mainAgentsModules() {
$filter_agents['id_grupo'] = $group_id;
}
// Prepare pagination
ui_pagination ($total_pagination);
$url = 'index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&' . "hor_offset=" . $hor_offset ."&selection_a_m=" . $selection_a_m;
ui_pagination ($total_pagination, $url);
foreach ($agents as $agent) {
// Get stats for this group
@ -291,7 +413,7 @@ function mainAgentsModules() {
<a class='$rowcolor' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$agent['id_agente']."'>" .
ui_print_truncate_text(io_safe_output($agent['nombre']), 'agent_size_text_small', true, true, true, '...', 'font-size:10px; font-weight: bold;') .
"</a></td>";
$agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, false);
$agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, true);
$nmodules = 0;
@ -303,6 +425,7 @@ function mainAgentsModules() {
}
$match = false;
foreach ($module['id'] as $module_id) {
if (!$match && array_key_exists($module_id,$agent_modules)) {
$status = modules_get_agentmodule_status($module_id);
@ -333,9 +456,14 @@ function mainAgentsModules() {
case AGENT_MODULE_STATUS_UNKNOWN:
ui_print_status_image ('module_unknown.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
break;
case 4:
case AGENT_MODULE_STATUS_NORMAL_ALERT:
case AGENT_MODULE_STATUS_WARNING_ALERT:
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
ui_print_status_image ('module_alertsfired.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
break;
case 4:
ui_print_status_image ('module_no_data.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
break;
}
echo '</a>';
echo "</td>";
@ -362,6 +490,7 @@ function mainAgentsModules() {
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_WARNING . ";'></div></td><td>" . __("Yellow cell when the module has a warning status") . "</td></tr>";
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_NORMAL . ";'></div></td><td>" . __("Green cell when the module has a normal status") . "</td></tr>";
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_UNKNOWN . ";'></div></td><td>" . __("Grey cell when the module has an unknown status") . "</td></tr>";
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_NOTINIT . ";'></div></td><td>" . __("Cell turns grey when the module is in 'not initialize' status") . "</td></tr>";
echo "</table>";
echo "</div>";
@ -407,3 +536,107 @@ extensions_add_operation_menu_option(__("Agents/Modules view"), 'estado', 'agent
extensions_add_main_function('mainAgentsModules');
?>
<script type="text/javascript">
$(document).ready (function () {
$("#group_id").change (function () {
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_agents_group_json" : 1,
"id_group" : this.value,
"privilege" : "AW",
"keys_prefix" : "_"
},
function (data, status) {
$("#id_agents2").html('');
$("#module").html('');
jQuery.each (data, function (id, value) {
// Remove keys_prefix from the index
id = id.substring(1);
option = $("<option></option>")
.attr ("value", value["id_agente"])
.html (value["nombre"]);
$("#id_agents").append (option);
$("#id_agents2").append (option);
});
},
"json"
);
});
$("#modulegroup").change (function () {
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_modules_group_json" : 1,
"id_module_group" : this.value,
"id_agents" : $("#id_agents2").val(),
"selection" : $("#selection_agent_module").val()
},
function (data, status) {
$("#module").html('');
if(data){
jQuery.each (data, function (id, value) {
option = $("<option></option>")
.attr ("value", value["id_agente_modulo"])
.html (value["nombre"]);
$("#module").append (option);
});
}
},
"json"
);
});
$("#id_agents2").click (function(){
selection_agent_module();
});
$("#selection_agent_module").change(function() {
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_modules_group_json" : 1,
"id_module_group" : $("#modulegroup").val(),
"id_agents" : $("#id_agents2").val(),
"selection" : $("#selection_agent_module").val()
},
function (data, status) {
$("#module").html('');
if(data){
jQuery.each (data, function (id, value) {
option = $("<option></option>")
.attr ("value", value["id_agente_modulo"])
.html (value["nombre"]);
$("#module").append (option);
});
}
},
"json"
);
});
selection_agent_module();
});
function selection_agent_module() {
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_modules_group_json" : 1,
"id_module_group" : $("#modulegroup").val(),
"id_agents" : $("#id_agents2").val(),
"selection" : $("#selection_agent_module").val()
},
function (data, status) {
$("#module").html('');
if(data){
jQuery.each (data, function (id, value) {
option = $("<option></option>")
.attr ("value", value["id_agente_modulo"])
.html (value["nombre"]);
$("#module").append (option);
});
}
},
"json"
);
}
</script>

View File

@ -14,7 +14,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
function dbmanager_query ($sql, &$error) {
function dbmanager_query ($sql, &$error, $dbconnection) {
global $config;
switch ($config["dbtype"]) {
@ -25,22 +25,49 @@ function dbmanager_query ($sql, &$error) {
return false;
$sql = html_entity_decode($sql, ENT_QUOTES);
$result = mysql_query ($sql);
if ($result === false) {
$backtrace = debug_backtrace ();
$error = mysql_error ();
return false;
if ($config["mysqli"]) {
$result = mysqli_query ($dbconnection, $sql);
if ($result === false) {
$backtrace = debug_backtrace ();
$error = mysqli_error ($dbconnection);
return false;
}
}
else{
$result = mysql_query ($sql, $dbconnection);
if ($result === false) {
$backtrace = debug_backtrace ();
$error = mysql_error ();
return false;
}
}
if ($result === true) {
return mysql_affected_rows ();
if($config["mysqli"]){
return mysqli_affected_rows ($dbconnection);
}
else{
return mysql_affected_rows ();
}
}
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
array_push ($retval, $row);
if($config["mysqli"]){
while ($row = mysqli_fetch_array ($result, MYSQL_ASSOC)) {
array_push ($retval, $row);
}
}
else{
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
array_push ($retval, $row);
}
}
if($config["mysqli"]){
mysqli_free_result ($result);
}
else{
mysql_free_result ($result);
}
mysql_free_result ($result);
if (! empty ($retval))
return $retval;
@ -131,8 +158,10 @@ function dbmgr_extension_main () {
echo "<hr />";
echo "<br />";
$dbconnection = $config['dbconnection'];
$error = '';
$result = dbmanager_query ($sql, $error);
$result = dbmanager_query ($sql, $error, $dbconnection);
if ($result === false) {
echo '<strong>An error has occured when querying the database.</strong><br />';
@ -152,6 +181,7 @@ function dbmgr_extension_main () {
}
echo "<div style='overflow: auto;'>";
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->head = array_keys ($result[0]);

View File

@ -256,7 +256,7 @@ function main_net_tools () {
function godmode_net_tools() {
global $config;
check_config ();
check_login();
if (! check_acl ($config['id_user'], 0, "PM")) {
db_pandora_audit("ACL Violation",
@ -292,7 +292,8 @@ function godmode_net_tools() {
else {
if (isset($config['network_tools_config'])) {
$network_tools_config = json_decode($config['network_tools_config'], true);
$network_tools_config_output = io_safe_output($config['network_tools_config']);
$network_tools_config = json_decode($network_tools_config_output, true);
$traceroute_path = $network_tools_config['traceroute_path'];
$ping_path = $network_tools_config['ping_path'];
$nmap_path = $network_tools_config['nmap_path'];

View File

@ -25,11 +25,11 @@ if (isset($_GET['get_ptr'])) {
require_once ($ownDir.'../include/config.php');
// Login check
if (!isset($_SESSION[$config['homeurl_static']]["id_usuario"])) {
if (!isset($_SESSION["id_usuario"])) {
$config['id_user'] = null;
}
else {
$config['id_user'] = $_SESSION[$config['homeurl_static']]["id_usuario"];
$config['id_user'] = $_SESSION["id_usuario"];
}
@ -68,8 +68,10 @@ function output_xml_resource($hook_enterprise) {
output_xml_visual_console($id);
break;
default:
if ($hook_enterprise === true)
return enterprise_output_xml_resource($type, $id);
if ($hook_enterprise === true) {
$include_agents = get_parameter('include_agents', 0);
return enterprise_output_xml_resource($type, $id, $include_agents);
}
break;
}
}
@ -330,7 +332,7 @@ function resource_exportation_extension_main() {
}
$hook_enterprise = enterprise_include ('extensions/resource_exportation/functions.php');
ui_print_page_header (__('Resource exportation'), "images/extensions.png", false, "", true, "" );
echo "<div class=notify>";
@ -362,8 +364,16 @@ function resource_exportation_extension_main() {
function export_to_ptr(type) {
id = $("select#" + type + " option:selected").val();
url = location.href.split('index');
url = url[0] + 'extensions/resource_exportation.php?get_ptr=1&type=' + type
+ '&id=' + id;
if (type == "policy") {
var include_agents = $("#checkbox-export_agents").prop("checked")
url = url[0] + 'extensions/resource_exportation.php?get_ptr=1&type=' + type
+ '&id=' + id + '&include_agents=' + include_agents;
}
else {
url = url[0] + 'extensions/resource_exportation.php?get_ptr=1&type=' + type
+ '&id=' + id;
}
location.href=url;
}

4
pandora_console/extras/mr/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Ignorar todo en este directorio
*
# Excepto este archivo
!.gitignore

View File

@ -1,115 +0,0 @@
-- ---------------------------------------------------------------------
-- Table `talert_templates`
-- ---------------------------------------------------------------------
ALTER TABLE talert_templates ADD COLUMN `min_alerts_reset_counter` tinyint(1) DEFAULT 0;
-- ----------------------------------------------------------------------
-- Table `tserver`
-- ----------------------------------------------------------------------
ALTER TABLE tserver ADD COLUMN `server_keepalive` int(11) DEFAULT 0;
-- ----------------------------------------------------------------------
-- Table `tagente_estado`
-- ----------------------------------------------------------------------
ALTER TABLE tagente_estado MODIFY `status_changes` tinyint(4) unsigned default 0;
ALTER TABLE tagente_estado CHANGE `last_known_status` `known_status` tinyint(4) default 0;
ALTER TABLE tagente_estado ADD COLUMN `last_known_status` tinyint(4) default 0;
-- ---------------------------------------------------------------------
-- Table `talert_actions`
-- ---------------------------------------------------------------------
UPDATE talert_actions SET `field4` = 'integria',
`field5` = '_agent_:&#x20;_alert_name_',
`field6` = '1',
`field7` = '3',
`field8` = 'copy@dom.com',
`field9` = 'admin',
`field10` = '_alert_description_'
WHERE `id` = 4 AND `id_alert_command` = 11;
-- ---------------------------------------------------------------------
-- Table `talert_commands`
-- ---------------------------------------------------------------------
UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Integria&#x20;IMS&#x20;user&#x20;pass\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Email&#x20;copy\",\"Ticket&#x20;owner\",\"Ticket&#x20;description\"]', `fields_values` = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\",\"\",\"\"]' WHERE `id` = 11 AND `name` = 'Integria&#x20;IMS&#x20;Ticket';
-- ---------------------------------------------------------------------
-- Table `tmap`
-- ---------------------------------------------------------------------
ALTER TABLE tmap MODIFY `id_user` varchar(128);
-- ---------------------------------------------------------------------
-- Table `titem`
-- ---------------------------------------------------------------------
ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
-- ---------------------------------------------------------------------
-- Table `trel_item`
-- ---------------------------------------------------------------------
ALTER TABLE trel_item ADD `id_parent_source_data` int(11) NOT NULL DEFAULT 0;
ALTER TABLE trel_item ADD `id_child_source_data` int(11) NOT NULL DEFAULT 0;
ALTER TABLE trel_item ADD `id_map` int(11) NOT NULL DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `tconfig`
-- ---------------------------------------------------------------------
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
-- ---------------------------------------------------------------------
-- Table `tplanned_downtime_agents`
-- ---------------------------------------------------------------------
ALTER TABLE tplanned_downtime_agents ADD COLUMN `manually_disabled` tinyint(1) DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `tlink`
-- ---------------------------------------------------------------------
UPDATE `tlink` SET `link` = 'http://library.pandorafms.com/' WHERE `name` = 'Module library';
UPDATE `tlink` SET `name` = 'Enterprise Edition' WHERE `id_link` = 0000000002;
UPDATE `tlink` SET `name` = 'Documentation', `link` = 'http://wiki.pandorafms.com/' WHERE `id_link` = 0000000001;
UPDATE `tlink` SET `link` = 'http://forums.pandorafms.com/index.php?board=22.0' WHERE `id_link` = 0000000004;
UPDATE `tlink` SET `link` = 'https://github.com/pandorafms/pandorafms/issues' WHERE `id_link` = 0000000003;
-- ---------------------------------------------------------------------
-- Table `tevent_filter`
-- ---------------------------------------------------------------------
ALTER TABLE tevent_filter ADD COLUMN `date_from` date DEFAULT NULL;
ALTER TABLE tevent_filter ADD COLUMN `date_to` date DEFAULT NULL;
-- ---------------------------------------------------------------------
-- Table `tusuario`
-- ---------------------------------------------------------------------
ALTER TABLE tusuario ADD (`id_filter` int(10) unsigned NULL default NULL);
ALTER TABLE tusuario ADD CONSTRAINT fk_id_filter FOREIGN KEY (id_filter) REFERENCES tevent_filter(id_filter) ON DELETE SET NULL;
-- ---------------------------------------------------------------------
-- Table `tagente_modulo`
-- ---------------------------------------------------------------------
ALTER TABLE tagente_modulo ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
ALTER TABLE tagente_modulo ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
-- ---------------------------------------------------------------------
-- Table `tagente_datos`
-- ---------------------------------------------------------------------
ALTER TABLE tagente_datos MODIFY `datos` double(22,5);
-- ---------------------------------------------------------------------
-- Table `tagente_datos_inc`
-- ---------------------------------------------------------------------
ALTER TABLE tagente_datos_inc MODIFY `datos` double(22,5);
-- ---------------------------------------------------------------------
-- Table `tnetwork_component`
-- ---------------------------------------------------------------------
ALTER TABLE tnetwork_component ADD COLUMN `dynamic_interval` int(4) unsigned default '0';
ALTER TABLE tnetwork_component ADD COLUMN `dynamic_max` int(4) default '0';
ALTER TABLE tnetwork_component ADD COLUMN `dynamic_min` int(4) default '0';
ALTER TABLE tnetwork_component ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
ALTER TABLE tnetwork_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
-- ---------------------------------------------------------------------
-- Table `tagente`
-- ---------------------------------------------------------------------
ALTER TABLE tagente ADD `transactional_agent` tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD `remote` tinyint(1) NOT NULL default 0;

View File

@ -1,30 +0,0 @@
-- ----------------------------------------------------------------------
-- Table `tagente_estado`
-- ----------------------------------------------------------------------
ALTER TABLE tagente_estado RENAME COLUMN last_known_status TO known_status;
ALTER TABLE tagente_estado ADD COLUMN last_known_status NUMBER(10, 0) DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `tagente_modulo`
-- ---------------------------------------------------------------------
ALTER TABLE tagente_modulo ADD COLUMN dynamic_interval int(4) unsigned default 0;
ALTER TABLE tagente_modulo ADD COLUMN dynamic_max bigint(20) default 0;
ALTER TABLE tagente_modulo ADD COLUMN dynamic_min bigint(20) default 0;
ALTER TABLE tagente_modulo ADD COLUMN dynamic_next bigint(20) NOT NULL default 0;
ALTER TABLE tagente_modulo ADD COLUMN dynamic_two_tailed tinyint(1) unsigned default 0;
-- ---------------------------------------------------------------------
-- Table `tnetwork_component`
-- ---------------------------------------------------------------------
ALTER TABLE tnetwork_component ADD COLUMN dynamic_interval int(4) unsigned default 0;
ALTER TABLE tnetwork_component ADD COLUMN dynamic_max int(4) default 0;
ALTER TABLE tnetwork_component ADD COLUMN dynamic_min int(4) default 0;
ALTER TABLE tnetwork_component ADD COLUMN dynamic_next bigint(20) NOT NULL default 0;
ALTER TABLE tnetwork_component ADD COLUMN dynamic_two_tailed tinyint(1) unsigned default 0;
-- ---------------------------------------------------------------------
-- Table `tagente`
-- ---------------------------------------------------------------------
ALTER TABLE tagente ADD transactional_agent tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD remote tinyint(1) NOT NULL default 0;

View File

@ -0,0 +1,253 @@
-- ---------------------------------------------------------------------
-- Table `titem`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `titem` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`id_map` int(10) unsigned NOT NULL default 0,
`x` INTEGER NOT NULL default 0,
`y` INTEGER NOT NULL default 0,
`z` INTEGER NOT NULL default 0,
`deleted` INTEGER(1) unsigned NOT NULL default 0,
`type` INTEGER UNSIGNED NOT NULL default 0,
`refresh` INTEGER UNSIGNED NOT NULL default 0,
`source` INTEGER UNSIGNED NOT NULL default 0,
`source_data` varchar(250) default '',
`options` TEXT,
`style` TEXT,
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `tmap`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tmap` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`id_group` int(10) unsigned NOT NULL default 0,
`id_user` varchar(250) NOT NULL default '',
`type` int(10) unsigned NOT NULL default 0,
`subtype` int(10) unsigned NOT NULL default 0,
`name` varchar(250) default '',
`description` TEXT,
`height` INTEGER UNSIGNED NOT NULL default 0,
`width` INTEGER UNSIGNED NOT NULL default 0,
`center_x` INTEGER NOT NULL default 0,
`center_y` INTEGER NOT NULL default 0,
`background` varchar(250) default '',
`background_options` INTEGER UNSIGNED NOT NULL default 0,
`source_period` INTEGER UNSIGNED NOT NULL default 0,
`source` INTEGER UNSIGNED NOT NULL default 0,
`source_data` varchar(250) default '',
`generation_method` INTEGER UNSIGNED NOT NULL default 0,
`generated` INTEGER UNSIGNED NOT NULL default 0,
`filter` TEXT,
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `trel_item`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `trel_item` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`id_parent` int(10) unsigned NOT NULL default 0,
`id_child` int(10) unsigned NOT NULL default 0,
`id_map` int(10) unsigned NOT NULL default 0,
`id_parent_source_data` int(10) unsigned NOT NULL default 0,
`id_child_source_data` int(10) unsigned NOT NULL default 0,
`parent_type` int(10) unsigned NOT NULL default 0,
`child_type` int(10) unsigned NOT NULL default 0,
`id_item` int(10) unsigned NOT NULL default 0,
`deleted` int(1) unsigned NOT NULL default 0,
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `talert_templates`
-- ---------------------------------------------------------------------
ALTER TABLE talert_templates ADD COLUMN `min_alerts_reset_counter` tinyint(1) DEFAULT 0;
ALTER TABLE talert_templates ADD COLUMN `field11` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field12` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field13` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field14` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field15` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field11_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field12_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field13_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field14_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_snmp`
-- ---------------------------------------------------------------------
ALTER TABLE talert_snmp ADD COLUMN `al_field11` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN `al_field12` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN `al_field13` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN `al_field14` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN `al_field15` TEXT NOT NULL DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_snmp_action`
-- ---------------------------------------------------------------------
ALTER TABLE talert_snmp_action ADD COLUMN `al_field11` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN `al_field12` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN `al_field13` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN `al_field14` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN `al_field15` TEXT NOT NULL DEFAULT "";
-- ----------------------------------------------------------------------
-- Table `tserver`
-- ----------------------------------------------------------------------
ALTER TABLE tserver ADD COLUMN `server_keepalive` int(11) DEFAULT 0;
-- ----------------------------------------------------------------------
-- Table `tagente_estado`
-- ----------------------------------------------------------------------
ALTER TABLE tagente_estado MODIFY `status_changes` tinyint(4) unsigned default 0;
ALTER TABLE tagente_estado CHANGE `last_known_status` `known_status` tinyint(4) default 0;
ALTER TABLE tagente_estado ADD COLUMN `last_known_status` tinyint(4) default 0;
-- ---------------------------------------------------------------------
-- Table `talert_actions`
-- ---------------------------------------------------------------------
UPDATE talert_actions SET `field4` = 'integria',
`field5` = '_agent_:&#x20;_alert_name_',
`field6` = '1',
`field7` = '3',
`field8` = 'copy@dom.com',
`field9` = 'admin',
`field10` = '_alert_description_'
WHERE `id` = 4 AND `id_alert_command` = 11;
ALTER TABLE talert_actions ADD COLUMN `field11` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field12` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field13` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field14` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field15` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field11_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field12_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field13_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field14_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_commands`
-- ---------------------------------------------------------------------
UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Integria&#x20;IMS&#x20;user&#x20;pass\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Email&#x20;copy\",\"Ticket&#x20;owner\",\"Ticket&#x20;description\"]', `fields_values` = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\",\"\",\"\"]' WHERE `id` = 11 AND `name` = 'Integria&#x20;IMS&#x20;Ticket';
-- ---------------------------------------------------------------------
-- Table `tmap`
-- ---------------------------------------------------------------------
ALTER TABLE tmap MODIFY `id_user` varchar(128);
-- ---------------------------------------------------------------------
-- Table `titem`
-- ---------------------------------------------------------------------
ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
-- ---------------------------------------------------------------------
-- Table `trel_item`
-- ---------------------------------------------------------------------
ALTER TABLE trel_item ADD `id_parent_source_data` int(11) NOT NULL DEFAULT 0;
ALTER TABLE trel_item ADD `id_child_source_data` int(11) NOT NULL DEFAULT 0;
ALTER TABLE trel_item ADD `id_map` int(11) NOT NULL DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `tconfig`
-- ---------------------------------------------------------------------
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 0);
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
-- ---------------------------------------------------------------------
-- Table `tplanned_downtime_agents`
-- ---------------------------------------------------------------------
ALTER TABLE tplanned_downtime_agents ADD COLUMN `manually_disabled` tinyint(1) DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `tlink`
-- ---------------------------------------------------------------------
UPDATE `tlink` SET `link` = 'http://library.pandorafms.com/' WHERE `name` = 'Module library';
UPDATE `tlink` SET `name` = 'Enterprise Edition' WHERE `id_link` = 0000000002;
UPDATE `tlink` SET `name` = 'Documentation', `link` = 'http://wiki.pandorafms.com/' WHERE `id_link` = 0000000001;
UPDATE `tlink` SET `link` = 'http://forums.pandorafms.com/index.php?board=22.0' WHERE `id_link` = 0000000004;
UPDATE `tlink` SET `link` = 'https://github.com/pandorafms/pandorafms/issues' WHERE `id_link` = 0000000003;
-- ---------------------------------------------------------------------
-- Table `tevent_filter`
-- ---------------------------------------------------------------------
ALTER TABLE tevent_filter ADD COLUMN `date_from` date DEFAULT NULL;
ALTER TABLE tevent_filter ADD COLUMN `date_to` date DEFAULT NULL;
-- ---------------------------------------------------------------------
-- Table `tusuario`
-- ---------------------------------------------------------------------
ALTER TABLE tusuario ADD COLUMN `id_filter` int(10) unsigned NULL default NULL;
ALTER TABLE tusuario ADD COLUMN CONSTRAINT `fk_id_filter` FOREIGN KEY (id_filter) REFERENCES tevent_filter(id_filter) ON DELETE SET NULL;
ALTER TABLE tusuario ADD COLUMN `session_time` int(10) signed NOT NULL default '0';
-- ---------------------------------------------------------------------
-- Table `tagente_modulo`
-- ---------------------------------------------------------------------
ALTER TABLE tagente_modulo ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
ALTER TABLE tagente_modulo ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
ALTER TABLE tagente_modulo ADD COLUMN `parent_module_id` int(10) unsigned NOT NULL;
-- ---------------------------------------------------------------------
-- Table `tagente_datos`
-- ---------------------------------------------------------------------
ALTER TABLE tagente_datos MODIFY `datos` double(22,5);
-- ---------------------------------------------------------------------
-- Table `tagente_datos_inc`
-- ---------------------------------------------------------------------
ALTER TABLE tagente_datos_inc MODIFY `datos` double(22,5);
-- ---------------------------------------------------------------------
-- Table `tnetwork_component`
-- ---------------------------------------------------------------------
ALTER TABLE tnetwork_component ADD COLUMN `dynamic_interval` int(4) unsigned default '0';
ALTER TABLE tnetwork_component ADD COLUMN `dynamic_max` int(4) default '0';
ALTER TABLE tnetwork_component ADD COLUMN `dynamic_min` int(4) default '0';
ALTER TABLE tnetwork_component ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
ALTER TABLE tnetwork_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
-- ---------------------------------------------------------------------
-- Table `tagente`
-- ---------------------------------------------------------------------
ALTER TABLE tagente ADD `transactional_agent` tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD `remote` tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD `cascade_protection_module` int(10) unsigned default '0';
-- ---------------------------------------------------------------------
-- Table `tlayout`
-- ---------------------------------------------------------------------
ALTER TABLE tlayout ADD `background_color` varchar(50) NOT NULL default '#FFF';
-- ---------------------------------------------------------------------
-- Table `tlayout_data`
-- ---------------------------------------------------------------------
ALTER TABLE tlayout_data ADD `type_graph` varchar(50) NOT NULL default 'area';
ALTER TABLE tlayout_data ADD `label_position` varchar(50) NOT NULL default 'down';
-- ---------------------------------------------------------------------
-- Table `tagent_custom_fields`
-- ---------------------------------------------------------------------
INSERT INTO `tagent_custom_fields` (`name`) VALUES ('eHorusID');
-- ---------------------------------------------------------------------
-- Table `tagente_modulo` Fixed problems with blank space
-- in cron interval and problems with process data from pandora server
-- ---------------------------------------------------------------------
UPDATE tagente_modulo SET cron_interval = '' WHERE cron_interval LIKE '% %';
-- ---------------------------------------------------------------------
-- Table `tgraph`
-- ---------------------------------------------------------------------
ALTER TABLE tgraph ADD COLUMN `percentil` int(4) unsigned default '0';
-- ---------------------------------------------------------------------
-- Table `tnetflow_filter`
-- ---------------------------------------------------------------------
ALTER TABLE tnetflow_filter ADD COLUMN `router_ip` TEXT NOT NULL DEFAULT "";

View File

@ -3,6 +3,34 @@
-- ---------------------------------------------------------------------
ALTER TABLE talert_templates ADD COLUMN min_alerts_reset_counter NUMBER(5, 0) DEFAULT 0;
ALTER TABLE talert_templates ADD COLUMN field11 CLOB DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field12 CLOB DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field13 CLOB DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field14 CLOB DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field15 CLOB DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field11_recovery CLOB DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field12_recovery CLOB DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field13_recovery CLOB DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field14_recovery CLOB DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field15_recovery CLOB DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_snmp`
-- ---------------------------------------------------------------------
ALTER TABLE talert_snmp ADD COLUMN al_field11 CLOB DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN al_field12 CLOB DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN al_field13 CLOB DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN al_field14 CLOB DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN al_field15 CLOB DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_snmp_action`
-- ---------------------------------------------------------------------
ALTER TABLE talert_snmp_action ADD COLUMN al_field11 CLOB DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN al_field12 CLOB DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN al_field13 CLOB DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN al_field14 CLOB DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN al_field15 CLOB DEFAULT "";
-- ----------------------------------------------------------------------
-- Table `tserver`
@ -28,6 +56,16 @@ UPDATE talert_actions SET field4 = 'integria',
field9 = 'admin',
field10 = '_alert_description_'
WHERE id = 4 AND id_alert_command = 11;
ALTER TABLE talert_actions ADD COLUMN field11 CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field12 CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field13 CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field14 CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field15 CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field11_recovery CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field12_recovery CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field13_recovery CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field14_recovery CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field15_recovery CLOB DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_commands`
@ -41,6 +79,8 @@ UPDATE talert_commands SET fields_descriptions = '[\"Integria&#x20;IMS&#x20;API&
INSERT INTO tconfig (token, value) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO tconfig (token, value) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO tconfig (token, value) VALUES ('days_autodisable_deletion', '30');
INSERT INTO tconfig (token, value) VALUES ('MR', 0);
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
-- ---------------------------------------------------------------------
-- Table `tplanned_downtime_agents`
@ -65,8 +105,9 @@ ALTER TABLE tevent_filter ADD COLUMN date_to date DEFAULT NULL;
-- ---------------------------------------------------------------------
-- Table `tusuario`
-- ---------------------------------------------------------------------
ALTER TABLE tusuario ADD (id_filter int(10) unsigned NULL default NULL);
ALTER TABLE tusuario ADD CONSTRAINT fk_id_filter FOREIGN KEY (id_filter) REFERENCES tevent_filter(id_filter) ON DELETE SET NULL;
ALTER TABLE tusuario ADD COLUMN id_filter int(10) unsigned default NULL;
ALTER TABLE tusuario ADD COLUMN CONSTRAINT fk_id_filter FOREIGN KEY (id_filter) REFERENCES tevent_filter(id_filter) ON DELETE SET NULL;
ALTER TABLE tusuario ADD COLUMN session_time INTEGER NOT NULL default '0';
-- ---------------------------------------------------------------------
-- Table `tagente_modulo`
@ -76,6 +117,7 @@ ALTER TABLE tagente_modulo ADD COLUMN dynamic_max bigint(20) default '0';
ALTER TABLE tagente_modulo ADD COLUMN dynamic_min bigint(20) default '0';
ALTER TABLE tagente_modulo ADD COLUMN dynamic_next bigint(20) NOT NULL default '0';
ALTER TABLE tagente_modulo ADD COLUMN dynamic_two_tailed tinyint(1) unsigned default '0';
ALTER TABLE tagente_modulo ADD COLUMN parent_module_id NUMBER(10, 0);
-- ---------------------------------------------------------------------
-- Table `tnetwork_component`
@ -91,3 +133,30 @@ ALTER TABLE tnetwork_component ADD COLUMN dynamic_two_tailed tinyint(1) unsigned
-- ---------------------------------------------------------------------
ALTER TABLE tagente ADD transactional_agent tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD remoteto tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD cascade_protection_module int(10) unsigned default '0';
-- ---------------------------------------------------------------------
-- Table `tlayout`
-- ---------------------------------------------------------------------
ALTER TABLE tlayout ADD COLUMN background_color varchar(50) NOT NULL default '#FFF';
-- ---------------------------------------------------------------------
-- Table `tlayout_data`
-- ---------------------------------------------------------------------
ALTER TABLE tlayout_data ADD COLUMN type_graph varchar(50) NOT NULL default 'area';
ALTER TABLE tlayout_data ADD COLUMN label_position varchar(50) NOT NULL default 'down';
-- ---------------------------------------------------------------------
-- Table `tagent_custom_fields`
-- ---------------------------------------------------------------------
INSERT INTO tagent_custom_fields (name) VALUES ('eHorusID');
-- ---------------------------------------------------------------------
-- Table `tgraph`
-- ---------------------------------------------------------------------
ALTER TABLE tgraph ADD COLUMN percentil int(4) unsigned default '0';
-- ---------------------------------------------------------------------
-- Table `tnetflow_filter`
-- ---------------------------------------------------------------------
ALTER TABLE tnetflow_filter ADD COLUMN router_ip CLOB DEFAULT "";

View File

@ -0,0 +1,101 @@
-- ----------------------------------------------------------------------
-- Table `tagente_estado`
-- ----------------------------------------------------------------------
ALTER TABLE tagente_estado RENAME COLUMN last_known_status TO known_status;
ALTER TABLE tagente_estado ADD COLUMN last_known_status NUMBER(10, 0) DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `tusuario`
-- ---------------------------------------------------------------------
ALTER TABLE tusuario ADD COLUMN id_filter int(10) unsigned default NULL;
ALTER TABLE tusuario ADD COLUMN CONSTRAINT fk_id_filter FOREIGN KEY (id_filter) REFERENCES tevent_filter(id_filter) ON DELETE SET NULL;
ALTER TABLE tusuario ADD COLUMN session_time int(10) NOT NULL default 0;
-- ---------------------------------------------------------------------
-- Table `tagente_modulo`
-- ---------------------------------------------------------------------
ALTER TABLE tagente_modulo ADD COLUMN dynamic_interval int(4) unsigned default 0;
ALTER TABLE tagente_modulo ADD COLUMN dynamic_max bigint(20) default 0;
ALTER TABLE tagente_modulo ADD COLUMN dynamic_min bigint(20) default 0;
ALTER TABLE tagente_modulo ADD COLUMN dynamic_next bigint(20) NOT NULL default 0;
ALTER TABLE tagente_modulo ADD COLUMN dynamic_two_tailed tinyint(1) unsigned default 0;
-- ---------------------------------------------------------------------
-- Table `tnetwork_component`
-- ---------------------------------------------------------------------
ALTER TABLE tnetwork_component ADD COLUMN dynamic_interval int(4) unsigned default 0;
ALTER TABLE tnetwork_component ADD COLUMN dynamic_max int(4) default 0;
ALTER TABLE tnetwork_component ADD COLUMN dynamic_min int(4) default 0;
ALTER TABLE tnetwork_component ADD COLUMN dynamic_next bigint(20) NOT NULL default 0;
ALTER TABLE tnetwork_component ADD COLUMN dynamic_two_tailed tinyint(1) unsigned default 0;
-- ---------------------------------------------------------------------
-- Table `tagente`
-- ---------------------------------------------------------------------
ALTER TABLE tagente ADD transactional_agent tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD remote tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD cascade_protection_module int(10) unsigned default '0';
-- ---------------------------------------------------------------------
-- Table `tlayout`
-- ---------------------------------------------------------------------
ALTER TABLE tlayout ADD COLUMN background_color varchar(50) NOT NULL default '#FFF';
-- ---------------------------------------------------------------------
-- Table `tlayout_data`
-- ---------------------------------------------------------------------
ALTER TABLE tlayout_data ADD COLUMN type_graph varchar(50) NOT NULL default 'area';
ALTER TABLE tlayout_data ADD COLUMN label_position varchar(50) NOT NULL default 'down';
-- ---------------------------------------------------------------------
-- Table `talert_templates`
-- ---------------------------------------------------------------------
ALTER TABLE talert_templates ADD COLUMN field11 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field12 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field13 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field14 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field15 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field11_recovery TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field12_recovery TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field13_recovery TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field14_recovery TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field15_recovery TEXT NOT NULL DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_snmp`
-- ---------------------------------------------------------------------
ALTER TABLE talert_snmp ADD COLUMN al_field11 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN al_field12 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN al_field13 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN al_field14 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN al_field15 TEXT NOT NULL DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_snmp_action`
-- ---------------------------------------------------------------------
ALTER TABLE talert_snmp_action ADD COLUMN al_field11 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN al_field12 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN al_field13 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN al_field14 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN al_field15 TEXT NOT NULL DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_actions`
-- ---------------------------------------------------------------------
ALTER TABLE talert_actions ADD COLUMN field11 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field12 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field13 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field14 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field15 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field11_recovery TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field12_recovery TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field13_recovery TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field14_recovery TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field15_recovery TEXT NOT NULL DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `tnetflow_filter`
-- ---------------------------------------------------------------------
ALTER TABLE tnetflow_filter ADD COLUMN router_ip TEXT NOT NULL DEFAULT "";

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -42,6 +42,9 @@ switch ($tipo) {
case "infomodal":
echo "icono_info.png";
break;
case "helpmodal":
echo "icono_info.png";
break;
case "modulemodal":
echo "icono_popup.png";
break;
@ -88,6 +91,13 @@ echo "'>
switch ($tipo) {
case "helpmodal":
echo __("This is the online help for Pandora FMS console. This help is -in best cases- just a brief contextual help, not intented to teach you how to use Pandora FMS. Official documentation of Pandora FMS is about 900 pages, and you probably don't need to read it entirely, but sure, you should download it and take a look.<br><br>
<a href='https://pandorafms.org/en/docs/monitoring-documentation/' target='_blanck'>Download the official documentation</a>");
break;
case "noaccess":
echo __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance. <br/> <br/>

View File

@ -26,7 +26,9 @@ ui_require_css_file ('firts_task');
</div>
<div class="text_task">
<h3> <?php echo __('Create Transactions'); ?></h3>
<p id="description_task"> <?php echo __("Text."); ?></p>
<p id="description_task"> <?php echo __("The new transactional server allows you to execute tasks dependent on the others following a user-defined design. This means that it is possible to coordinate several executions to check a target at a given time.
Transaction graphs represent the different processes within our infrastructure that we use to deliver our service."); ?></p>
<form action="index.php?sec=network&sec2=enterprise/operation/agentes/manage_transmap_creation&create_transaction=1" method="post">
<input type="submit" class="button_task" value="<?php echo __('Create Transactions'); ?>" />
</form>

View File

@ -26,8 +26,14 @@ if (! file_exists ($config["homedir"] . $license_file)) {
$license_file = 'general/license/pandora_info_en.html';
}
if (!$config["MR"]) {
$config["MR"] = 0;
}
echo '<a class="white_bold footer" target="_blank" href="' . $config["homeurl"] . $license_file. '">';
echo sprintf(__('Pandora FMS %s - Build %s', $pandora_version, $build_version));
echo sprintf(__('Pandora FMS %s - Build %s - MR %s', $pandora_version, $build_version, $config["MR"]));
echo '</a><br />';
echo '<a class="white footer">'. __('Page generated at') . ' '. ui_print_timestamp ($time, true, array ("prominent" => "timestamp")); //Always use timestamp here
echo '</a>';

View File

@ -233,12 +233,18 @@ config_check();
//======================================================
$check_minor_release_available = false;
$pandora_management = check_acl($config['id_user'], 0, "PM");
$check_minor_release_available = db_check_minor_relase_available ();
if ($check_minor_release_available) {
set_pandora_error_for_header('There are one or more minor releases waiting for update, there are required administrator permissions', 'minor release/s available');
}
echo '<div id="alert_messages" style="display: none"></div>';
if ($config["alert_cnt"] > 0) {
echo '<div id="alert_messages" style="display: none"></div>';
$maintenance_link = 'javascript:';
$maintenance_title = __("System alerts detected - Please fix as soon as possible");
$maintenance_class = $maintenance_id = 'show_systemalert_dialog white';
@ -273,7 +279,11 @@ config_check();
$table->data[0][3] = $maintenance_img;
// Main help icon
$table->data[0][4] = ui_print_help_icon ("main_help", true, '', 'images/header_help.png');
$table->data[0][4] = '<a href="#" class="modalpopup" id="helpmodal">'.html_print_image("images/header_help.png",
true, array(
"title" => __('Main help'),
"id" => "helpmodal",
"class" => "modalpopup")).'</a>';
// Logout
$table->data[0][5] = '<a class="white" href="' . ui_get_full_url('index.php?bye=bye') . '">';

View File

@ -24,6 +24,7 @@ if (is_ajax()) {
$save_identification = get_parameter ('save_required_wizard', 0);
$change_language = get_parameter ('change_language', 0);
$cancel_wizard = get_parameter ('cancel_wizard', 0);
// Updates the values get on the identification wizard
if ($save_identification) {
@ -52,6 +53,10 @@ if (is_ajax()) {
config_update_value ('language', $change_language);
}
if ($cancel_wizard !== 0) {
config_update_value ('initial_wizard', 1);
}
return;
}
@ -118,6 +123,9 @@ echo '<div id="login_id_dialog" title="' .
echo '<div style="float: right; width: 20%;">';
html_print_submit_button(__("Register"), 'id_dialog_button', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok" style="width:100px;"');
echo '</div>';
echo '<div style="float: right; width: 20%;">';
html_print_button(__("Cancel"), 'cancel', false, '', 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok" style="width:100px;"');
echo '</div>';
echo '<div id="all-required" style="float: right; margin-right: 30px; display: none; color: red;">';
echo __("All fields required");
echo '</div>';
@ -215,6 +223,16 @@ $(document).ready (function () {
$(".ui-widget-overlay").css("opacity", 0.6);
$(".ui-draggable").css("cursor", "inherit");
$("#button-cancel").click (function () {
jQuery.post ("ajax.php",
{"page": "general/login_required",
"cancel_wizard": 1},
function (data) {}
);
$("#login_id_dialog" ).dialog('close');
});
});
/* ]]> */

View File

@ -75,6 +75,18 @@ var id_user = "<?php echo $config['id_user']; ?>";
var cookie_name = id_user + '-pandora_menu_state';
var cookie_name_encoded = btoa(cookie_name);
var click_display = "<?php echo $config["click_display"]; ?>";
var classic_menu = parseInt("<?php echo $config["classic_menu"]; ?>");
if ((isNaN(classic_menu)) || (classic_menu == 0)) {
classic_menu = false;
}
else {
classic_menu = true;
}
if (classic_menu) {
autohidden_menu = 1;
}
var menuState = $.cookie(cookie_name_encoded);
if (!menuState) {
@ -226,29 +238,31 @@ $(document).ready( function() {
*/
handsInMenu = 0;
openTimeMenu = 0;
if(!click_display){
$('#menu').mouseenter(function() {
$('div#title_menu').show();
handsInMenu = 1;
openTimeMenu = new Date().getTime();
$('#menu').css('width', '145px');
$('li.menu_icon').addClass( " no_hidden_menu" );
$('ul.submenu').css('left', '144px');
}).mouseleave(function() {
if (classic_menu) {
$('div#title_menu').show();
handsInMenu = 1;
openTimeMenu = new Date().getTime();
$('#menu').css('width', '145px');
$('#menu').css('position', 'block');
$('li.menu_icon').addClass( " no_hidden_menu" );
$('ul.submenu').css('left', '144px');
$('#menu').mouseleave(function() {
handsInMenu = 0;
setTimeout(function() {
openedMenu = new Date().getTime() - openTimeMenu;
if(openedMenu > 1000 && handsInMenu == 0) {
$('#menu').css('width', '45px');
$('li.menu_icon').removeClass( " no_hidden_menu");
$('ul.submenu').css('left', '44px');
$('div#title_menu').hide();
$('#menu').css('width', '145px');
$('#menu').css('position', 'block');
$('li.menu_icon').addClass( " no_hidden_menu" );
$('ul.submenu').css('left', '144px');
}
}, 2500);
});
}else{
$(document).ready(function() {
$('#menu').on("click", function() {
}
else {
if(!click_display){
$('#menu').mouseenter(function() {
$('div#title_menu').show();
handsInMenu = 1;
openTimeMenu = new Date().getTime();
@ -267,29 +281,34 @@ $(document).ready( function() {
$('ul.submenu').css('left', '44px');
$('div#title_menu').hide();
}
}, 5500);
}, 2500);
});
});
}else{
$(document).ready(function() {
$('#menu').on("click", function() {
$('div#title_menu').show();
handsInMenu = 1;
openTimeMenu = new Date().getTime();
$('#menu').css('width', '145px');
$('li.menu_icon').addClass( " no_hidden_menu" );
$('li.menu_icon').find('li').addClass( " no_hidden_menu" );
$('ul.submenu').css('left', '144px');
}).mouseleave(function() {
handsInMenu = 0;
setTimeout(function() {
openedMenu = new Date().getTime() - openTimeMenu;
if(openedMenu > 1000 && handsInMenu == 0) {
$('#menu').css('width', '45px');
$('li.menu_icon').removeClass( " no_hidden_menu");
$('li.menu_icon').find('li').removeClass( " no_hidden_menu" );
$('ul.submenu').css('left', '44px');
$('div#title_menu').hide();
}
}, 5500);
});
});
}
}
/*$('#menu').mouseenter(function() {
$('div#title_menu').show();
handsInMenu = 1;
openTimeMenu = new Date().getTime();
$('#menu').css('width', '145px');
$('li.menu_icon').addClass( " no_hidden_menu" );
$('ul.submenu').css('left', '144px');
}).mouseleave(function() {
handsInMenu = 0;
setTimeout(function() {
openedMenu = new Date().getTime() - openTimeMenu;
if(openedMenu > 1000 && handsInMenu == 0) {
$('#menu').css('width', '45px');
$('li.menu_icon').removeClass( " no_hidden_menu");
$('ul.submenu').css('left', '44px');
$('div#title_menu').hide();
}
}, 1500);
});*/
}
else {
$('div#title_menu').hide();
@ -416,9 +435,80 @@ $(document).ready( function() {
});
$(document).ready(function() {
//Daniel maya 02/06/2016 Display menu with click --INI
if(!click_display){
$('#container').click(function() {
if (!classic_menu) {
//Daniel maya 02/06/2016 Display menu with click --INI
if(!click_display){
$('#container').click(function() {
openTime = 4000;
if( typeof(table_hover) != 'undefined')
$("ul#sub"+table_hover[0].id).hide();
if( typeof(table_hover2) != 'undefined')
$("ul#sub"+table_hover2[0].id).hide();
$('#menu').css('width', '45px');
$('li.menu_icon').removeClass( " no_hidden_menu");
$('ul.submenu').css('left', '44px');
$('div#title_menu').hide();
});
}else{
$('#main').click(function() {
openTime = 4000;
if( typeof(table_hover) != 'undefined')
$("ul#sub"+table_hover[0].id).hide();
if( typeof(table_hover2) != 'undefined')
$("ul#sub"+table_hover2[0].id).hide();
$('#menu').css('width', '45px');
$('li.menu_icon').removeClass( " no_hidden_menu");
$('ul.submenu').css('left', '44px');
$('div#title_menu').hide();
});
}
//Daniel maya 02/06/2016 Display menu with click --END
}
else {
if(!click_display){
$('#container').click(function() {
openTime = 4000;
if( typeof(table_hover) != 'undefined')
$("ul#sub"+table_hover[0].id).hide();
if( typeof(table_hover2) != 'undefined')
$("ul#sub"+table_hover2[0].id).hide();
$('#menu').css('width', '145px');
$('ul.submenu').css('left', '144px');
});
}else{
$('#main').click(function() {
openTime = 4000;
if( typeof(table_hover) != 'undefined')
$("ul#sub"+table_hover[0].id).hide();
if( typeof(table_hover2) != 'undefined')
$("ul#sub"+table_hover2[0].id).hide();
$('#menu').css('width', '145px');
$('ul.submenu').css('left', '144px');
});
}
}
if (classic_menu) {
$('div.menu>ul>li>ul>li>a').click(function() {
openTime = 4000;
if( typeof(table_hover) != 'undefined')
$("ul#sub"+table_hover[0].id).hide();
if( typeof(table_hover2) != 'undefined')
$("ul#sub"+table_hover2[0].id).hide();
$('ul.submenu').css('left', '144px');
});
$('div.menu>ul>li>ul>li>ul>li>a').click(function() {
openTime = 4000;
if( typeof(table_hover) != 'undefined')
$("ul#sub"+table_hover[0].id).hide();
if( typeof(table_hover2) != 'undefined')
$("ul#sub"+table_hover2[0].id).hide();
$('ul.submenu').css('left', '144px');
});
}
else {
$('div.menu>ul>li>ul>li>a').click(function() {
openTime = 4000;
if( typeof(table_hover) != 'undefined')
$("ul#sub"+table_hover[0].id).hide();
@ -428,9 +518,9 @@ $(document).ready( function() {
$('li.menu_icon').removeClass( " no_hidden_menu");
$('ul.submenu').css('left', '44px');
$('div#title_menu').hide();
});
}else{
$('#main').click(function() {
});
$('div.menu>ul>li>ul>li>ul>li>a').click(function() {
openTime = 4000;
if( typeof(table_hover) != 'undefined')
$("ul#sub"+table_hover[0].id).hide();
@ -442,30 +532,6 @@ $(document).ready( function() {
$('div#title_menu').hide();
});
}
//Daniel maya 02/06/2016 Display menu with click --END
$('div.menu>ul>li>ul>li>a').click(function() {
openTime = 4000;
if( typeof(table_hover) != 'undefined')
$("ul#sub"+table_hover[0].id).hide();
if( typeof(table_hover2) != 'undefined')
$("ul#sub"+table_hover2[0].id).hide();
$('#menu').css('width', '45px');
$('li.menu_icon').removeClass( " no_hidden_menu");
$('ul.submenu').css('left', '44px');
$('div#title_menu').hide();
});
$('div.menu>ul>li>ul>li>ul>li>a').click(function() {
openTime = 4000;
if( typeof(table_hover) != 'undefined')
$("ul#sub"+table_hover[0].id).hide();
if( typeof(table_hover2) != 'undefined')
$("ul#sub"+table_hover2[0].id).hide();
$('#menu').css('width', '45px');
$('li.menu_icon').removeClass( " no_hidden_menu");
$('ul.submenu').css('left', '44px');
$('div#title_menu').hide();
});
});

View File

@ -32,12 +32,12 @@ require_once ("../include/functions_html.php");
$id = get_parameter ('id');
if (! isset($_SESSION['id_usuario'])) {
if (! isset($_SESSION[$config['homeurl_static']]['id_usuario'])) {
session_start();
session_write_close();
}
$user_language = get_user_language ($_SESSION['id_usuario']);
$user_language = get_user_language ($_SESSION[$config['homeurl_static']]['id_usuario']);
if (file_exists ('../include/languages/'.$user_language.'.mo')) {
$l10n = new gettext_reader (new CachedFileReader ('../include/languages/'.$user_language.'.mo'));

View File

@ -1,409 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
// Login check
check_login ();
require_once("include/functions_reporting.php");
require_once("include/functions_events.php");
if (is_ajax()) {
$save_item_shorcut = (bool) get_parameter("save_item_shorcut");
$update_shortcut_state = (bool) get_parameter('update_shortcut_state');
$get_alerts_fired = (bool) get_parameter('get_alerts_fired');
$get_critical_events = (bool) get_parameter('get_critical_events');
$get_opened_incidents = (bool) get_parameter('get_opened_incidents');
if ($save_item_shorcut) {
$result = false;
$data = get_parameter("data", '');
$id_user = get_parameter('id_user', 0);
if ($config['id_user'] != $id_user) return;
$shortcut_data = db_get_value('shortcut_data', 'tusuario', 'id_user', $id_user);
if ($shortcut_data !== false) {
$serialize = $shortcut_data;
$unserialize = json_decode($serialize, true);
$unserialize['item_shorcut'][] = $data;
$shortcut_data = array();
$shortcut_data['shortcut_data'] = json_encode($unserialize);
db_process_sql_update('tusuario', $shortcut_data, array('id_user' => $id_user));
}
echo json_encode($result);
return;
}
// Update if shortcut is visible or hidden
if ($update_shortcut_state) {
$value = (int) get_parameter('value');
$result = db_process_sql_update('tusuario', array('shortcut' => $value), array('id_user' => $config['id_user']));
echo json_encode($result);
return;
}
// Get critical events (realtime update)
if ($get_alerts_fired) {
echo sc_get_alerts_fired();
return;
}
// Get critical events (realtime update)
if ($get_critical_events) {
echo sc_get_critical_events();
return;
}
// Select only opened incidents
if ($get_opened_incidents) {
echo sc_get_opened_incidents();
return;
}
return;
}
function sc_get_alerts_fired () {
global $config;
$data_reporting = reporting_get_group_stats();
return $data_reporting['monitor_alerts_fired'];
}
function sc_get_critical_events () {
global $config;
$own_info = get_user_info ($config['id_user']);
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
$own_groups = array_keys(users_get_groups($config['id_user'], "IR"));
else
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
// Get events in the last 8 hours
$shortcut_events_update = events_get_group_events($own_groups, 28800, time());
if ($shortcut_events_update == false)
$shortcut_events_update = array();
$critical_events_update = 0;
foreach ($shortcut_events_update as $event_update) {
if ($event_update['criticity'] == 4 and $event_update['estado'] == 0) {
$critical_events_update++;
}
}
return $critical_events_update;
}
function sc_get_opened_incidents () {
global $config;
$own_info = get_user_info ($config['id_user']);
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) {
$sql = "SELECT count(*) total_incidents
FROM tincidencia
WHERE estado = 0
ORDER BY actualizacion";
$result_incidents_update = db_get_all_rows_sql ($sql);
}
else {
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
$sql = "SELECT count(*) total_incidents
FROM tincidencia
WHERE id_grupo IN (".implode (",",array_keys ($own_groups)).")
AND estado = 0
ORDER BY actualizacion";
if (!empty($own_groups)) {
$result_incidents_update = db_get_all_rows_sql($sql);
}
else {
$result_incidents_update = false;
}
}
if ($result_incidents_update === false)
$shortcut_incidents = 0;
else
$shortcut_incidents = $result_incidents_update[0]['total_incidents'];
return $shortcut_incidents;
}
$shortcut_state = db_get_value_filter('shortcut', 'tusuario', array('id_user' => $config['id_user']));
// If shortcut bar is disabled return to index.php
if ($shortcut_state == 0)
return;
$own_info = get_user_info ($config['id_user']);
$shortcut_html = "<div id='shortcut_container'>";
$shortcut_html .= "<div id='shortcut_button'>";
$shortcut_html .= html_print_image("images/control_play.png", true, array("title" => __("Press here to activate shortcut bar")));
$shortcut_html .= "</div>";
$shortcut_html .= "<div id='shortcut_bar'>";
$num_shortcut_items = 0;
// Alerts item
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM") || check_acl ($config['id_user'], 0, "AR")) {
$alerts_fired = sc_get_alerts_fired();
$shortcut_html .= "<a class='shortcut_item' href='index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=120&filter=fired&filter_button=Filter'>";
$shortcut_html .= html_print_image("images/op_alerts.png", true, array("title" => __("Alerts fired"), "style" => "margin-bottom: 0px;"));
$shortcut_html .= "&nbsp;";
$shortcut_html .= "<span id='shortcut_alerts_fired' title='" . __('Alerts fired') . "'>" . $alerts_fired . "</span>";
$shortcut_html .= "</a>";
$num_shortcut_items++;
}
// Events item
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM") || check_acl ($config['id_user'], 0, "IR")) {
$critical_events = sc_get_critical_events();
$shortcut_html .= "<a class='shortcut_item' href='index.php?sec=eventos&sec2=operation/events/events&status=3&severity=4&event_view_hr=8&id_group=0&group_rep=1&filter_only_alert=-1'>";
$shortcut_html .= html_print_image("images/op_events.png", true, array("title" => __("Critical events"), "style" => "margin-bottom: 0px;"));
$shortcut_html .= "&nbsp;";
$shortcut_html .= "<span id='shortcut_critical_events' title='" . __('Critical events') . "'>" . $critical_events . "</span>";
$shortcut_html .= "</a>";
$num_shortcut_items++;
}
// Calculate opened incidents (id integria incidents are not enabled)
if ($config['integria_enabled'] == 0) {
$shortcut_incidents = sc_get_opened_incidents();
$shortcut_html .= "<a class='shortcut_item' href='index.php?sec=incidencias&sec2=operation/incidents/incident&estado=0'>";
$shortcut_html .= html_print_image("images/incidents.png", true, array("title" => __("Incidents opened"), "style" => "margin-bottom: 0px;"));
$shortcut_html .= "&nbsp;";
$shortcut_html .= "<span id='shortcut_incidents_opened' title='" . __('Incidents opened') . "'>" . $shortcut_incidents . "</span>";
$shortcut_html .= "</a>";
$num_shortcut_items++;
}
if ($num_shortcut_items > 0) {
$shortcut_html .= "<span class='shortcut_item' href='javascript:;'>";
$shortcut_html .= "<span>|</span>";
$shortcut_html .= "</span>";
}
$shortcut_html .= "<a class='shortcut_item' href='index.php?sec=reporting&sec2=operation/reporting/custom_reporting'>";
$shortcut_html .= html_print_image("images/op_reporting.png", true, array("title" => __("View reports"), "style" => "margin-bottom: 0px;"));
$shortcut_html .= "</a>";
$num_shortcut_items++;
$shortcut_html .= "<a class='shortcut_item' href='index.php?sec=workspace&sec2=operation/messages/message_list'>";
$shortcut_html .= html_print_image("images/email_mc.png", true, array("title" => __("Create new message"), "style" => "margin-bottom: 0px;"));
$shortcut_html .= "</a>";
$num_shortcut_items++;
//Quick access
// $shortcut_data = db_get_value('shortcut_data', 'tusuario', 'id_user', $config['id_user']);
// if (!empty($shortcut_data)) {
// $serialize = $shortcut_data;
// $unserialize = json_decode($serialize, true);
// $items = $unserialize['item_shorcut'];
// }
// else {
// $items = array();
// }
// $shortcut_html .= "<div id='shortcut_icons_box' style='font-size: 9pt; color:#696969; font-weight: bold; display: inline; float: right; padding-right: 20px;'>" .
// __("Shortcut: ");
// $shortcut_html .= "<ul style='display: inline; font-size: 9pt; color:#000;'>";
// foreach ($items as $item) {
// $shortcut_html .= "<li style='display: inline; padding-right: 10px;'>" . io_safe_output($item) . "</li>";
// }
// $shortcut_html .= "</ul>";
$shortcut_html .= "</div>";
$shortcut_html .= "</div>";
echo $shortcut_html;
// Login in Console and shortcut bar is disabled
// This will show and hide the shortcut value in Javascript code
if (isset($_POST['nick']) and $shortcut_state != 2) {
html_print_input_hidden("login_console", 1);
}
else {
html_print_input_hidden("login_console", 0);
}
html_print_input_hidden("shortcut_id_user", $config['id_user']);
?>
<script type='text/javascript'>
$(function() {
if (<?php echo json_encode((int) $shortcut_state); ?> < 2) {
$('#shortcut_bar').hide();
$('#shortcut_button>img')
.css('transform', 'rotate(-90deg)')
.css('-o-transform', 'rotate(-90deg)')
.css('-ms-transform', 'rotate(-90deg)')
.css('-moz-transform', 'rotate(-90deg)')
.css('-webkit-transform', 'rotate(-90deg)');
}
else {
$('#shortcut_button>img')
.css('transform', 'rotate(90deg)')
.css('-o-transform', 'rotate(90deg)')
.css('-ms-transform', 'rotate(90deg)')
.css('-moz-transform', 'rotate(90deg)')
.css('-webkit-transform', 'rotate(90deg)');
}
$('#shortcut_button').click (function () {
if ($('#shortcut_bar').is(":visible")) {
$('#shortcut_bar').slideUp();
$('#shortcut_button>img')
.css('transform', 'rotate(-90deg)')
.css('-o-transform', 'rotate(-90deg)')
.css('-ms-transform', 'rotate(-90deg)')
.css('-moz-transform', 'rotate(-90deg)')
.css('-webkit-transform', 'rotate(-90deg)');
jQuery.post (
"ajax.php",
{
"page" : "general/shortcut_bar",
"update_shortcut_state" : 1,
"value" : 1
},
function (data) {}
);
}
else {
$('#shortcut_bar').slideDown();
$('#shortcut_button>img')
.css('transform', 'rotate(90deg)')
.css('-o-transform', 'rotate(90deg)')
.css('-ms-transform', 'rotate(90deg)')
.css('-moz-transform', 'rotate(90deg)')
.css('-webkit-transform', 'rotate(90deg)');
jQuery.post (
"ajax.php",
{
"page" : "general/shortcut_bar",
"update_shortcut_state" : 1,
"value" : 2
},
function (data) {}
);
}
});
});
var id_user = $('#hidden-shortcut_id_user').val();
function shortcut_check_alerts() {
jQuery.post (
"ajax.php",
{
"page" : "general/shortcut_bar",
"get_alerts_fired": 1
},
function (data) {
$('#shortcut_alerts_fired').html(data);
}
);
}
function shortcut_check_events() {
jQuery.post (
"ajax.php",
{
"page" : "general/shortcut_bar",
"get_critical_events": 1
},
function (data) {
$('#shortcut_critical_events').html(data);
}
);
}
function shortcut_check_incidents() {
jQuery.post (
"ajax.php",
{
"page" : "general/shortcut_bar",
"get_opened_incidents": 1
},
function (data) {
$('#shortcut_incidents_opened').html(data);
}
);
}
$(document).ready (function () {
setInterval("shortcut_check_alerts()", (10 * 1000)); //10 seconds between ajax request
setInterval("shortcut_check_events()", (10 * 1000)); //10 seconds between ajax request
setInterval("shortcut_check_incidents()", (10 * 1000)); //10 seconds between ajax request
//To make a link as item for drag only put "item_drag_shortcut" as class.
//TODO: In the future show better as icons and the handle some icon.
//TODO: Remove the class "item_drag_shortcut" for avoid drag.
//TODO: Method for remove items.
$("#shortcut_icons_box").droppable({
drop: function( event, ui ) {
var item = ui.draggable.clone();
//unescape for avoid change returns
var content_item = unescape($('<div id="content_item"></div>').html(item).html()); //hack
//Add the element
$("<li style='display: inline; padding-right: 10px;'></li>").html(item).appendTo($("#shortcut_icons_box > ul"));
jQuery.post ('ajax.php',
{"page": "general/shortcut_bar",
"save_item_shorcut": 1,
"id_user": "<?php echo $config['id_user'];?>",
"data": content_item
},
function (data) {
}
);
}
});
$(".item_drag_shortcut").draggable({
appendTo: 'body',
helper: "clone",
scroll: false
});
});
</script>

View File

@ -245,7 +245,7 @@ foreach ($result as $row) {
}
$data[1] = ui_print_session_action_icon ($row['accion'], true);
$data[1] .= $row["accion"];
$data[2] = ui_print_help_tip($row['fecha'], true) . human_time_comparation($row['utimestamp']);
$data[2] = ui_print_help_tip($row['fecha'], true) . ui_print_timestamp($row['utimestamp'], true);
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
@ -299,7 +299,7 @@ html_print_table ($table);
echo '<div style="width: '.$table->width.'" class="action-buttons">';
echo '<a href="' .
ui_get_full_url(false, false, false, false) . 'index.php?sec=gextensions&sec2=godmode/audit_log_csv&tipo_log='.$tipo_log.'&user_filter='.$user_filter.'&filter_text='.$filter_text.'&filter_hours_old='.$filter_hours_old.'&filter_ip='.$filter_ip.'"'.
'target="_new">' .
'>' .
html_print_button (__('Export to CSV '), 'export_csv', false, '', 'class=sub upd', true, false). '</a>';
echo '</div>';

View File

@ -230,6 +230,15 @@ else {
$groups = users_get_groups ($config["id_user"], "AR",false);
$agents = agents_get_group_agents (array_keys ($groups));
$modules = db_get_all_rows_sql("SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
WHERE id_agente = " . $id_parent);
$modules_values = array();
$modules_values[0] = __('Any');
foreach ($modules as $m) {
$modules_values[$m['id_module']] = $m['name'];
}
$table->data[2][0] = __('Parent');
$params = array();
$params['return'] = true;
@ -240,6 +249,8 @@ $table->data[2][1] = ui_print_agent_autocomplete_input($params);
$table->data[2][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). "&nbsp;" . ui_print_help_icon("cascade_protection", true);
$table->data[2][1] .= "&nbsp;&nbsp;" . __('Module') . "&nbsp;" . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true);
$table->data[3][0] = __('Group');
$table->data[3][1] = html_print_select_groups(false, "AR", false, 'grupo', $grupo, '', '', 0, true);
$table->data[3][1] .= ' <span id="group_preview">';
@ -525,6 +536,57 @@ ui_require_jquery_file('bgiframe');
$(document).ready (function() {
$("select#id_os").pandoraSelectOS ();
var checked = $("#checkbox-cascade_protection").is(":checked");
if (checked) {
$("#cascade_protection_module").removeAttr("disabled");
}
else {
$("#cascade_protection_module").attr("disabled", 'disabled');
}
$("#checkbox-cascade_protection").change(function () {
var checked = $("#checkbox-cascade_protection").is(":checked");
if (checked) {
$("#cascade_protection_module").removeAttr("disabled");
}
else {
$("#cascade_protection_module").val(0);
$("#cascade_protection_module").attr("disabled", 'disabled');
}
});
$("#text-id_parent").on("autocompletechange", function () {
agent_name = $("#text-id_parent").val();
var params = {};
params["get_agent_modules_json_by_name"] = 1;
params["agent_name"] = agent_name;
params["page"] = "include/ajax/module";
jQuery.ajax ({
data: params,
dataType: "json",
type: "POST",
url: "ajax.php",
success: function (data) {
$('#cascade_protection_module').empty();
$('#cascade_protection_module')
.append ($('<option></option>')
.html("Any")
.prop("value", 0)
.prop("selected", 'selected'));
jQuery.each (data, function (i, val) {
$('#cascade_protection_module')
.append ($('<option></option>')
.html(val['name'])
.prop("value", val['id_module'])
.prop("selected", 'selected'));
});
}
});
});
paint_qrcode(
"<?php

View File

@ -81,6 +81,7 @@ if (isset ($_POST["template_id"])) {
'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'],

View File

@ -31,6 +31,7 @@ $ipAgent = db_get_value('direccion', 'tagente', 'id_agente', $idAgent);
check_login ();
$ip_target = (string) get_parameter ('ip_target', $ipAgent);
$use_agent = get_parameter ('use_agent');
$snmp_community = (string) get_parameter ('snmp_community', 'public');
$snmp_version = get_parameter('snmp_version', '1');
$snmp3_auth_user = get_parameter('snmp3_auth_user');
@ -305,7 +306,13 @@ if ($create_modules) {
$common_values['tcp_port'] = $tcp_port;
}
$common_values['snmp_community'] = $snmp_community;
$common_values['ip_target'] = $ip_target;
if($use_agent){
$common_values['ip_target'] = 'auto';
}
else{
$common_values['ip_target'] = $ip_target;
}
$common_values['tcp_send'] = $snmp_version;
if ($snmp_version == '3') {
@ -696,18 +703,22 @@ $table->data[0][1] = html_print_input_text ('ip_target', $ip_target, '', 15, 60,
$table->data[0][2] = '<b>' . __('Port') . '</b>';
$table->data[0][3] = html_print_input_text ('tcp_port', $tcp_port, '', 5, 20, true);
$table->data[1][0] = '<b>' . __('Use agent ip') . '</b>';
$table->data[1][1] = html_print_checkbox ('use_agent', 1, $use_agent, true);
$snmp_versions['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2';
$snmp_versions['2c'] = 'v. 2c';
$snmp_versions['3'] = 'v. 3';
$table->data[1][0] = '<b>' . __('SNMP community') . '</b>';
$table->data[1][1] = html_print_input_text ('snmp_community', $snmp_community, '', 15, 60, true);
$table->data[2][0] = '<b>' . __('SNMP community') . '</b>';
$table->data[2][1] = html_print_input_text ('snmp_community', $snmp_community, '', 15, 60, true);
$table->data[1][2] = '<b>' . __('SNMP version') . '</b>';
$table->data[1][3] = html_print_select ($snmp_versions, 'snmp_version', $snmp_version, '', '', '', true, false, false, '');
$table->data[2][2] = '<b>' . __('SNMP version') . '</b>';
$table->data[2][3] = html_print_select ($snmp_versions, 'snmp_version', $snmp_version, '', '', '', true, false, false, '');
$table->data[2][3] .= '<div id="spinner_modules" style="float: left; display: none;">' . html_print_image("images/spinner.gif", true) . '</div>';
$table->data[1][3] .= '<div id="spinner_modules" style="float: left; display: none;">' . html_print_image("images/spinner.gif", true) . '</div>';
html_print_input_hidden('snmpwalk', 1);
html_print_table($table);
@ -760,9 +771,10 @@ if (!$fail) {
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
echo "<form method='post' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_explorer&id_agente=$id_agent'>";
echo '<span id="form_interfaces">';
html_print_input_hidden('create_modules', 1);
html_print_input_hidden('ip_target', $ip_target);
html_print_input_hidden('use_agent', $use_agent);
html_print_input_hidden('tcp_port', $tcp_port);
html_print_input_hidden('snmp_community', $snmp_community);
html_print_input_hidden('snmp_version', $snmp_version);

View File

@ -28,6 +28,7 @@ $ipAgent = db_get_value('direccion', 'tagente', 'id_agente', $idAgent);
check_login ();
$ip_target = (string) get_parameter ('ip_target', $ipAgent);
$use_agent = get_parameter ('use_agent');
$snmp_community = (string) get_parameter ('snmp_community', 'public');
$snmp_version = get_parameter('snmp_version', '1');
$snmp3_auth_user = get_parameter('snmp3_auth_user');
@ -136,7 +137,12 @@ if ($create_modules) {
$values['tcp_port'] = $tcp_port;
}
$values['snmp_community'] = $snmp_community;
$values['ip_target'] = $ip_target;
if($use_agent){
$values['ip_target'] = 'auto';
}
else{
$values['ip_target'] = $ip_target;
}
$values['tcp_send'] = $snmp_version;
if ($snmp_version == '3') {
@ -200,7 +206,7 @@ if ($create_modules) {
// Get the name
$name_array = explode('::', $oid_array[0]);
$name = $name_array[1] . "_" . $ifname;
$name = $ifname . "_" . $name_array[1];
// Clean the name
$name = str_replace ( "\"" , "" , $name);
@ -336,18 +342,21 @@ $table->data[0][1] = html_print_input_text ('ip_target', $ip_target, '', 15, 60,
$table->data[0][2] = '<b>' . __('Port') . '</b>';
$table->data[0][3] = html_print_input_text ('tcp_port', $tcp_port, '', 5, 20, true);
$table->data[1][0] = '<b>' . __('Use agent ip') . '</b>';
$table->data[1][1] = html_print_checkbox ('use_agent', 1, $use_agent, true);
$snmp_versions['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2';
$snmp_versions['2c'] = 'v. 2c';
$snmp_versions['3'] = 'v. 3';
$table->data[1][0] = '<b>' . __('SNMP community') . '</b>';
$table->data[1][1] = html_print_input_text ('snmp_community', $snmp_community, '', 15, 60, true);
$table->data[2][0] = '<b>' . __('SNMP community') . '</b>';
$table->data[2][1] = html_print_input_text ('snmp_community', $snmp_community, '', 15, 60, true);
$table->data[1][2] = '<b>' . __('SNMP version') . '</b>';
$table->data[1][3] = html_print_select ($snmp_versions, 'snmp_version', $snmp_version, '', '', '', true, false, false, '');
$table->data[2][2] = '<b>' . __('SNMP version') . '</b>';
$table->data[2][3] = html_print_select ($snmp_versions, 'snmp_version', $snmp_version, '', '', '', true, false, false, '');
$table->data[1][3] .= '<div id="spinner_modules" style="float: left; display: none;">' . html_print_image("images/spinner.gif", true) . '</div>';
$table->data[2][3] .= '<div id="spinner_modules" style="float: left; display: none;">' . html_print_image("images/spinner.gif", true) . '</div>';
html_print_input_hidden('snmpwalk', 1);
html_print_table($table);
@ -409,6 +418,7 @@ if (!empty($interfaces_list)) {
html_print_input_hidden('create_modules', 1);
html_print_input_hidden('ip_target', $ip_target);
html_print_input_hidden('use_agent', $use_agent);
html_print_input_hidden('tcp_port', $tcp_port);
html_print_input_hidden('snmp_community', $snmp_community);
html_print_input_hidden('snmp_version', $snmp_version);

View File

@ -132,6 +132,7 @@ $grupo = 0;
$id_os = 9; // Windows
$custom_id = "";
$cascade_protection = 0;
$cascade_protection_modules = 0;
$icon_path = '';
$update_gis_data = 0;
$unit = "";
@ -161,6 +162,7 @@ if ($create_agent) {
$disabled = (int) get_parameter_post ("disabled");
$custom_id = (string) get_parameter_post ("custom_id",'');
$cascade_protection = (int) get_parameter_post ("cascade_protection", 0);
$cascade_protection_module = (int) get_parameter_post("cascade_protection_module", 0);
$icon_path = (string) get_parameter_post ("icon_path",'');
$update_gis_data = (int) get_parameter_post("update_gis_data", 0);
$url_description = (string) get_parameter("url_description");
@ -197,6 +199,7 @@ if ($create_agent) {
'id_os' => $id_os,
'disabled' => $disabled,
'cascade_protection' => $cascade_protection,
'cascade_protection_module' => $cascade_protection_module,
'server_name' => $server_name,
'id_parent' => $id_parent,
'custom_id' => $custom_id,
@ -230,7 +233,8 @@ if ($create_agent) {
' ID os: ' . $id_os .
' Disabled: ' . $disabled .
' Custom ID: ' . $custom_id .
' Cascade protection: ' . $cascade_protection .
' Cascade protection: ' . $cascade_protection .
' Cascade protection module: ' . $cascade_protection_module .
' Icon path: ' . $icon_path .
' Update GIS data: ' . $update_gis_data .
' Url description: ' . $url_description .
@ -388,7 +392,7 @@ if ($id_agente) {
$total_incidents = agents_get_count_incidents($id_agente);
/* Incident tab */
if ($config['integria_enabled'] == 0 and $total_incidents > 0) {
if ($total_incidents > 0) {
$incidenttab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=incident&amp;id_agente='.$id_agente.'">'
. html_print_image ("images/book_edit.png", true, array ("title" =>__('Incidents')))
. '</a>';
@ -666,6 +670,7 @@ if ($update_agent) { // if modified some agent paramenter
$id_parent = (int) agents_get_agent_id ($parent_name);
$custom_id = (string) get_parameter_post ("custom_id", "");
$cascade_protection = (int) get_parameter_post ("cascade_protection", 0);
$cascade_protection_module = (int) get_parameter ("cascade_protection_module", 0);
$icon_path = (string) get_parameter_post ("icon_path",'');
$update_gis_data = (int) get_parameter_post("update_gis_data", 0);
$url_description = (string) get_parameter("url_description");
@ -733,6 +738,7 @@ if ($update_agent) { // if modified some agent paramenter
'intervalo' => $intervalo,
'comentarios' => $comentarios,
'cascade_protection' => $cascade_protection,
'cascade_protection_module' => $cascade_protection_module,
'server_name' => $server_name,
'custom_id' => $custom_id,
'icon_path' => $icon_path,
@ -764,6 +770,7 @@ if ($update_agent) { // if modified some agent paramenter
' ID OS: ' . $id_os . ' Disabled: ' . $disabled .
' Server Name: ' . $server_name . ' ID parent: ' . $id_parent .
' Custom ID: ' . $custom_id . ' Cascade Protection: ' . $cascade_protection .
' Cascade protection module: ' . $cascade_protection_module .
' Icon Path: ' . $icon_path . 'Update GIS data: ' .$update_gis_data .
' Url description: ' . $url_description .
' Quiet: ' . (int)$quiet;
@ -808,6 +815,7 @@ if ($id_agente) {
$id_parent = $agent["id_parent"];
$custom_id = $agent["custom_id"];
$cascade_protection = $agent["cascade_protection"];
$cascade_protection_module = $agent["cascade_protection_module"];
$icon_path = $agent["icon_path"];
$update_gis_data = $agent["update_gis_data"];
$url_description = $agent["url_address"];
@ -971,8 +979,12 @@ if ($update_module || $create_module) {
$plugin_parameter = (string) get_parameter ('plugin_parameter');
}
$parent_module_id = (int) get_parameter('parent_module_id');
$ip_target = (string) get_parameter ('ip_target');
if($ip_target == ''){
$ip_target = 'auto';
}
$custom_id = (string) get_parameter ('custom_id');
$history_data = (int) get_parameter('history_data');
$dynamic_interval = (int) get_parameter('dynamic_interval');
@ -1002,12 +1014,53 @@ if ($update_module || $create_module) {
$id_category = (int) get_parameter('id_category');
$hour = get_parameter('hour');
$minute = get_parameter('minute');
$mday = get_parameter('mday');
$month = get_parameter('month');
$wday = get_parameter('wday');
$cron_interval = "$minute $hour $mday $month $wday";
$hour_from = get_parameter('hour_from');
$minute_from = get_parameter('minute_from');
$mday_from = get_parameter('mday_from');
$month_from = get_parameter('month_from');
$wday_from = get_parameter('wday_from');
$hour_to = get_parameter('hour_to');
$minute_to = get_parameter('minute_to');
$mday_to = get_parameter('mday_to');
$month_to = get_parameter('month_to');
$wday_to = get_parameter('wday_to');
if ($hour_to != "*") {
$hour_to = "-" . $hour_to;
}
else {
$hour_to = "";
}
if ($minute_to != "*") {
$minute_to = "-" . $minute_to;
}
else {
$minute_to = "";
}
if ($mday_to != "*") {
$mday_to = "-" . $mday_to;
}
else {
$mday_to = "";
}
if ($month_to != "*") {
$month_to = "-" . $month_to;
}
else {
$month_to = "";
}
if ($wday_to != "*") {
$wday_to = "-" . $wday_to;
}
else {
$wday_to = "";
}
$cron_interval = $minute_from . $minute_to . " " . $hour_from . $hour_to . " " . $mday_from . $mday_to . " " . $month_from . $month_to . " " . $wday_from . $wday_to;
if (!cron_check_syntax($cron_interval)) {
$cron_interval = '';
}
if ($prediction_module != MODULE_PREDICTION_SYNTHETIC) {
unset($serialize_ops);
@ -1077,6 +1130,7 @@ if ($update_module) {
'dynamic_max' => $dynamic_max,
'dynamic_min' => $dynamic_min,
'dynamic_two_tailed' => $dynamic_two_tailed,
'parent_module_id' => $parent_module_id,
'min_warning' => $min_warning,
'max_warning' => $max_warning,
'str_warning' => $str_warning,
@ -1224,6 +1278,7 @@ if ($create_module) {
'dynamic_max' => $dynamic_max,
'dynamic_min' => $dynamic_min,
'dynamic_two_tailed' => $dynamic_two_tailed,
'parent_module_id' => $parent_module_id,
'min_warning' => $min_warning,
'max_warning' => $max_warning,
'str_warning' => $str_warning,

View File

@ -282,8 +282,8 @@ if ($search != "") {
$id = db_get_all_rows_sql($sql);
if($id != ''){
$aux = $id[0]['id_agent'];
$search_sql = " AND ( nombre " . $order_collation . "
LIKE '%$search%' OR tagente.id_agente = $aux";
$search_sql = " AND ( LOWER(nombre) " . $order_collation . "
LIKE LOWER('%$search%') OR tagente.id_agente = $aux";
if(count($id)>=2){
for ($i = 1; $i < count($id); $i++){
$aux = $id[$i]['id_agent'];
@ -292,8 +292,8 @@ if ($search != "") {
}
$search_sql .= ")";
}else{
$search_sql = " AND ( nombre " . $order_collation . "
LIKE '%$search%') ";
$search_sql = " AND ( LOWER(nombre) " . $order_collation . "
LIKE LOWER('%$search%')) ";
}
}
@ -499,7 +499,7 @@ if ($agents !== false) {
/* Begin Update tagente.remote 0/1 with remote agent function return */
if(config_agents_has_remote_configuration($agent['id_agente'])){
if(enterprise_hook('config_agents_has_remote_configuration',array($agent['id_agente']))){
db_process_sql_update('tagente', array('remote' => 1),'id_agente = '.$agent['id_agente'].'');
}
else{
@ -584,7 +584,7 @@ if ($agents !== false) {
// Has remote configuration ?
if (enterprise_installed()) {
enterprise_include_once('include/functions_config_agents.php');
if (config_agents_has_remote_configuration($agent["id_agente"])) {
if (enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"]))) {
echo "<a href='index.php?" .
"sec=gagente&" .
"sec2=godmode/agentes/configurar_agente&" .

View File

@ -101,6 +101,7 @@ if (strstr($sec2, "enterprise/godmode/policies/policies") !== false) {
}
$show_creation = false;
$checked = get_parameter("checked");
if (($policy_page) || (isset($agent))) {
if ($policy_page) {
@ -114,6 +115,18 @@ if (($policy_page) || (isset($agent))) {
if ($show_creation) {
// Create module/type combo
echo '<form id="create_module_type" method="post" action="'.$url.'">';
if (!$policy_page) {
echo '<td class="datos" style="font-weight: bold;">';
echo __('Show in hierachy mode');
if ($checked == "true") {
$checked = true;
}
else {
$checked = false;
}
html_print_checkbox ('status_hierachy_mode', "", $checked, false, false, "onChange=change_mod_filter();");
echo '</td>';
}
echo '<td class="datos" style="font-weight: bold;">';
echo __("Type");
html_print_select ($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;' );
@ -450,12 +463,23 @@ switch ($config["dbtype"]) {
else {
$limit_sql = '';
}
$sql = sprintf("SELECT %s
FROM tagente_modulo
LEFT JOIN tmodule_group
ON tagente_modulo.id_module_group = tmodule_group.id_mg
WHERE %s %s %s %s %s",
$params, $basic_where, $where, $where_tags, $order_sql, $limit_sql);
if ($checked) {
$sql = sprintf("SELECT *
FROM tagente_modulo
LEFT JOIN tmodule_group
ON tagente_modulo.id_module_group = tmodule_group.id_mg
WHERE %s %s %s %s %s",
$basic_where, $where, $where_tags, $order_sql, $limit_sql);
}
else {
$sql = sprintf("SELECT %s
FROM tagente_modulo
LEFT JOIN tmodule_group
ON tagente_modulo.id_module_group = tmodule_group.id_mg
WHERE %s %s %s %s %s",
$params, $basic_where, $where, $where_tags, $order_sql, $limit_sql);
}
$modules = db_get_all_rows_sql($sql);
break;
@ -465,12 +489,24 @@ switch ($config["dbtype"]) {
$set['limit'] = $limit;
$set['offset'] = $offset;
}
$sql = sprintf("SELECT %s
FROM tagente_modulo
LEFT JOIN tmodule_group
ON tmodule_group.id_mg = tagente_modulo.id_module_group
WHERE %s %s %s %s",
$params, $basic_where, $where, $where_tags, $order_sql);
if ($checked) {
$sql = sprintf("SELECT *
FROM tagente_modulo
LEFT JOIN tmodule_group
ON tmodule_group.id_mg = tagente_modulo.id_module_group
WHERE %s %s %s %s",
$basic_where, $where, $where_tags, $order_sql);
}
else {
$sql = sprintf("SELECT %s
FROM tagente_modulo
LEFT JOIN tmodule_group
ON tmodule_group.id_mg = tagente_modulo.id_module_group
WHERE %s %s %s %s",
$params, $basic_where, $where, $where_tags, $order_sql);
}
$modules = oracle_recode_query ($sql, $set, 'AND', false);
break;
}
@ -555,6 +591,15 @@ foreach($tempRows as $row) {
$numericModules[$row['id_tipo']] = true;
}
if ($checked) {
$modules_hierachy = array();
$modules_hierachy = get_hierachy_modules_tree($modules);
$modules_dt = get_dt_from_modules_tree($modules_hierachy);
$modules = $modules_dt;
}
foreach ($modules as $module) {
if (! check_acl ($config["id_user"], $group, "AW", $id_agente) && ! check_acl ($config["id_user"], $group, "AD", $id_agente)) {
continue;
@ -570,20 +615,29 @@ foreach ($modules as $module) {
$module_group2 = $module["id_module_group"];
$data = array ();
if ($module['id_module_group'] != $last_modulegroup) {
$last_modulegroup = $module['id_module_group'];
$data[0] = '<strong>'.modules_get_modulegroup_name ($last_modulegroup).'</strong>';
$i = array_push ($table->data, $data);
$table->rowstyle[$i - 1] = 'text-align: center';
$table->rowclass[$i - 1] = 'datos3';
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK)
$table->colspan[$i - 1][0] = 10;
else
$table->colspan[$i - 1][0] = 8;
$data = array ();
if (!$checked) {
if ($module['id_module_group'] != $last_modulegroup) {
$last_modulegroup = $module['id_module_group'];
$data[0] = '<strong>'.modules_get_modulegroup_name ($last_modulegroup).'</strong>';
$i = array_push ($table->data, $data);
$table->rowstyle[$i - 1] = 'text-align: center';
$table->rowclass[$i - 1] = 'datos3';
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK)
$table->colspan[$i - 1][0] = 10;
else
$table->colspan[$i - 1][0] = 8;
$data = array ();
}
}
$data[0] = "";
if (isset($module['deep']) && ($module['deep'] != 0)) {
$data[0] .= str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $module['deep']);
$data[0] .= html_print_image("images/icono_escuadra.png", true, array("style" => 'padding-bottom: inherit;')) . "&nbsp;&nbsp;";
}
if ($module['quiet']) {
$data[0] .= html_print_image("images/dot_green.disabled.png",
true, array("border" => '0', "title" => __('Quiet'),
@ -764,3 +818,22 @@ if (check_acl ($config['id_user'], $agent['id_grupo'], "AW")) {
echo '</form>';
}
?>
<script type="text/javascript">
function change_mod_filter() {
var checked = $("#checkbox-status_hierachy_mode").is(":checked");
if (/checked/.test(window.location)) {
var url = window.location.toString();
if (checked) {
window.location = url.replace("checked=false", "checked=true");
}
else {
window.location = url.replace("checked=true", "checked=false");
}
}
else {
window.location = window.location + "&checked=true";
}
}
</script>

View File

@ -30,7 +30,7 @@ if (is_ajax ()) {
$component = db_get_row ('tnetwork_component', 'id_nc', $id_component);
$component['throw_unknown_events'] =
!network_components_is_disable_type_event($id_component, EVENTS_GOING_UNKNOWN);
network_components_is_disable_type_event($id_component, EVENTS_GOING_UNKNOWN);
// Decrypt passwords in the component.
$component['plugin_pass'] = io_output_password($component['plugin_pass']);
@ -201,6 +201,7 @@ if ($id_agent_module) {
$dynamic_interval = $module['dynamic_interval'];
$dynamic_max = $module['dynamic_max'];
$dynamic_min = $module['dynamic_min'];
$parent_module_id = $module['parent_module_id'];
$dynamic_two_tailed = $module['dynamic_two_tailed'];
$min_warning = $module['min_warning'];
$max_warning = $module['max_warning'];
@ -228,18 +229,53 @@ if ($id_agent_module) {
$cron_interval = explode (" ", $module['cron_interval']);
if (isset ($cron_interval[4])) {
$minute = $cron_interval[0];
$hour = $cron_interval[1];
$mday = $cron_interval[2];
$month = $cron_interval[3];
$wday = $cron_interval[4];
$minute_from = $cron_interval[0];
$min = explode("-", $minute_from);
$minute_from = $min[0];
if (isset($min[1])) {
$minute_to = $min[1];
}
$hour_from = $cron_interval[1];
$h = explode("-", $hour_from);
$hour_from = $h[0];
if (isset($h[1])) {
$hour_to = $h[1];
}
$mday_from = $cron_interval[2];
$md = explode("-", $mday_from);
$mday_from = $md[0];
if (isset($md[1])) {
$mday_to = $md[1];
}
$month_from = $cron_interval[3];
$m = explode("-", $month_from);
$month_from = $m[0];
if (isset($m[1])) {
$month_to = $m[1];
}
$wday_from = $cron_interval[4];
$wd = explode("-", $wday_from);
$wday_from = $wd[0];
if (isset($wd[1])) {
$wday_to = $wd[1];
}
}
else {
$minute = '*';
$hour = '*';
$mday = '*';
$month = '*';
$wday = '*';
$minute_from = '*';
$hour_from = '*';
$mday_from = '*';
$month_from = '*';
$wday_from = '*';
$minute_to = '*';
$hour_to = '*';
$mday_to = '*';
$month_to = '*';
$wday_to = '*';
}
$module_macros = null;
@ -287,6 +323,7 @@ else {
$dynamic_interval = 0;
$dynamic_min = 0;
$dynamic_max = 0;
$parent_module_id = 0;
$dynamic_two_tailed = 0;
$min_warning = 0;
$max_warning = 0;
@ -320,11 +357,16 @@ else {
$id_category = 0;
$cron_interval = '* * * * *';
$hour = '*';
$minute = '*';
$mday = '*';
$month = '*';
$wday = '*';
$hour_from = '*';
$minute_from = '*';
$mday_from = '*';
$month_from = '*';
$wday_from = '*';
$hour_to = '*';
$minute_to = '*';
$mday_to = '*';
$month_to = '*';
$wday_to = '*';
$ff_interval = 0;
@ -394,7 +436,7 @@ switch ($moduletype) {
$remote_conf = false;
if (enterprise_installed()) {
enterprise_include_once('include/functions_config_agents.php');
$remote_conf = config_agents_has_remote_configuration($id_agente);
$remote_conf = enterprise_hook('config_agents_has_remote_configuration',array($id_agente));
}
/* Categories is an array containing the allowed module types

View File

@ -105,9 +105,15 @@ $disabledTextBecauseInPolicy = '';
$largeClassDisabledBecauseInPolicy = '';
$page = get_parameter('page', '');
if (strstr($page, "policy_modules") === false && $id_agent_module) {
if ($config['enterprise_installed'])
$disabledBecauseInPolicy = policies_is_module_in_policy($id_agent_module) && policies_is_module_linked($id_agent_module);
if(policies_is_module_linked($id_agent_module) == 1){
$disabledBecauseInPolicy = 1;
}
else{
$disabledBecauseInPolicy = 0;
}
else
$disabledBecauseInPolicy = false;
if ($disabledBecauseInPolicy)
@ -168,10 +174,16 @@ $table_simple->data[0][3] = __('Module group');
$table_simple->data[0][3] .= html_print_select_from_sql ('SELECT id_mg, name FROM tmodule_group ORDER BY name',
'id_module_group', $id_module_group, '', __('Not assigned'), '0', true, false, true, $disabledBecauseInPolicy);
$in_policy = strstr($page, "policy_modules");
if (!$in_policy) {
$table_simple->data[1][0] = __('Module parent');
$table_simple->data[1][1] .= html_print_select_from_sql ('SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE id_agente = ' . $id_agente . ' ORDER BY nombre',
'parent_module_id', $parent_module_id, '', __('Not assigned'), '0', true, false, true);
}
$table_simple->data[1][0] = __('Type').' ' . ui_print_help_icon ('module_type', true);
$table_simple->data[1][0] .= html_print_input_hidden ('id_module_type_hidden', $id_module_type, true);
$table_simple->data[2][0] = __('Type').' ' . ui_print_help_icon ('module_type', true);
$table_simple->data[2][0] .= html_print_input_hidden ('id_module_type_hidden', $id_module_type, true);
if (isset($id_agent_module)) {
if ($id_agent_module) {
@ -200,8 +212,8 @@ if (!$edit) {
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
}
$table_simple->data[1][1] = '<em>'.modules_get_moduletype_description ($id_module_type).' ('.$type_names_hash[$id_module_type].')</em>';
$table_simple->data[1][1] .= html_print_input_hidden('type_names',base64_encode(io_json_mb_encode($type_names_hash)),true);
$table_simple->data[2][1] = '<em>'.modules_get_moduletype_description ($id_module_type).' ('.$type_names_hash[$id_module_type].')</em>';
$table_simple->data[2][1] .= html_print_input_hidden('type_names',base64_encode(io_json_mb_encode($type_names_hash)),true);
}
else {
if (isset($id_module_type)) {
@ -217,7 +229,7 @@ else {
ORDER BY descripcion',
implode (',', $categories));
$table_simple->data[1][1] = html_print_select_from_sql ($sql, 'id_module_type',
$table_simple->data[2][1] = html_print_select_from_sql ($sql, 'id_module_type',
$idModuleType, '', '', '', true, false, false, $disabledBecauseInPolicy, false, false, 100);
// Store the relation between id and name of the types on a hidden field
@ -234,90 +246,90 @@ else {
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
}
$table_simple->data[1][1] .= html_print_input_hidden('type_names',base64_encode(io_json_mb_encode($type_names_hash)),true);
$table_simple->data[2][1] .= html_print_input_hidden('type_names',base64_encode(io_json_mb_encode($type_names_hash)),true);
}
if($disabledBecauseInPolicy){
$table_simple->data[1][3] .= html_print_input_hidden ('id_module_group', $id_module_group, true);
$table_simple->data[2][3] .= html_print_input_hidden ('id_module_group', $id_module_group, true);
}
$table_simple->data[2][0] = __('Dynamic Threshold Interval') .' ' . ui_print_help_icon ('dynamic_threshold', true);
$table_simple->data[2][1] = html_print_extended_select_for_time ('dynamic_interval', $dynamic_interval, '', 'None', '0', 10, true, 'width:150px',false, $classdisabledBecauseInPolicy, $disabledBecauseInPolicy);
$table_simple->data[2][1] .= '<a onclick=advanced_option_dynamic()>' . html_print_image('images/cog.png', true, array('title' => __('Advanced options Dynamic Threshold'))) . '</a>';
$table_simple->data[3][0] = __('Dynamic Threshold Interval') .' ' . ui_print_help_icon ('dynamic_threshold', true);
$table_simple->data[3][1] = html_print_extended_select_for_time ('dynamic_interval', $dynamic_interval, '', 'None', '0', 10, true, 'width:150px',false, $classdisabledBecauseInPolicy, $disabledBecauseInPolicy);
$table_simple->data[3][1] .= '<a onclick=advanced_option_dynamic()>' . html_print_image('images/cog.png', true, array('title' => __('Advanced options Dynamic Threshold'))) . '</a>';
$table_simple->data[2][2] = '<span><em>'.__('Dynamic Threshold Min. ').'</em>';
$table_simple->data[2][2] .= html_print_input_text ('dynamic_min', $dynamic_min, '', 10, 255, true,
$table_simple->data[3][2] = '<span><em>'.__('Dynamic Threshold Min. ').'</em>';
$table_simple->data[3][2] .= html_print_input_text ('dynamic_min', $dynamic_min, '', 10, 255, true,
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
$table_simple->data[2][2] .= '<br /><em>'.__('Dynamic Threshold Max. ').'</em>';
$table_simple->data[2][2] .= html_print_input_text ('dynamic_max', $dynamic_max, '', 10, 255, true,
$table_simple->data[3][2] .= '<br /><em>'.__('Dynamic Threshold Max. ').'</em>';
$table_simple->data[3][2] .= html_print_input_text ('dynamic_max', $dynamic_max, '', 10, 255, true,
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
$table_simple->data[2][3] = '<span><em>'.__('Dynamic Threshold Two Tailed: ').'</em>';
$table_simple->data[2][3] .= html_print_checkbox ("dynamic_two_tailed", 1, $dynamic_two_tailed, true, $disabledBecauseInPolicy);
$table_simple->data[3][3] = '<span><em>'.__('Dynamic Threshold Two Tailed: ').'</em>';
$table_simple->data[3][3] .= html_print_checkbox ("dynamic_two_tailed", 1, $dynamic_two_tailed, true, $disabledBecauseInPolicy);
$table_simple->data[3][0] = __('Warning status').' ' . ui_print_help_icon ('warning_status', true);
$table_simple->data[4][0] = __('Warning status').' ' . ui_print_help_icon ('warning_status', true);
if (!modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[3][1] .= '<span id="minmax_warning"><em>'.__('Min. ').'</em>';
$table_simple->data[3][1] .= html_print_input_text ('min_warning', $min_warning, '', 10, 255, true,
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
$table_simple->data[3][1] .= '<br /><em>'.__('Max.').'</em>';
$table_simple->data[3][1] .= html_print_input_text ('max_warning', $max_warning, '', 10, 255, true,
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).'</span>';
}
if (modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[3][1] .= '<span id="string_warning"><em>'.__('Str.').'</em>';
$table_simple->data[3][1] .= html_print_input_text ('str_warning', $str_warning,
'', 10, 255, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).'</span>';
}
$table_simple->data[3][1] .= '<br /><em>'.__('Inverse interval').'</em>';
$table_simple->data[3][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true, $disabledBecauseInPolicy);
if (!modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[3][2] = '<svg id="svg_dinamic" width="350" height="200" style="padding:40px; padding-left: 100px; margin-bottom: 60px;"> </svg>';
$table_simple->colspan[3][2] = 2;
$table_simple->rowspan[3][2] = 3;
}
$table_simple->data[4][0] = __('Critical status').' ' . ui_print_help_icon ('critical_status', true);
if (!modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[4][1] .= '<span id="minmax_critical"><em>'.__('Min. ').'</em>';
$table_simple->data[4][1] .= html_print_input_text ('min_critical', $min_critical, '', 10, 255, true,
$table_simple->data[4][1] .= '<span id="minmax_warning"><em>'.__('Min. ').'</em>';
$table_simple->data[4][1] .= html_print_input_text ('min_warning', $min_warning, '', 10, 255, true,
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
$table_simple->data[4][1] .= '<br /><em>'.__('Max.').'</em>';
$table_simple->data[4][1] .= html_print_input_text ('max_critical', $max_critical, '', 10, 255, true,
$table_simple->data[4][1] .= html_print_input_text ('max_warning', $max_warning, '', 10, 255, true,
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).'</span>';
}
if (modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[4][1] .= '<span id="string_critical"><em>'.__('Str.').'</em>';
$table_simple->data[4][1] .= html_print_input_text ('str_critical', $str_critical,
$table_simple->data[4][1] .= '<span id="string_warning"><em>'.__('Str.').'</em>';
$table_simple->data[4][1] .= html_print_input_text ('str_warning', str_replace("\"","",$str_warning),
'', 10, 255, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).'</span>';
}
$table_simple->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
$table_simple->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true, $disabledBecauseInPolicy);
if (!modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[4][2] = '<svg id="svg_dinamic" width="350" height="200" style="padding:40px; padding-left: 100px; margin-bottom: 60px;"> </svg>';
$table_simple->colspan[4][2] = 2;
$table_simple->rowspan[4][2] = 3;
}
$table_simple->data[5][0] = __('Critical status').' ' . ui_print_help_icon ('critical_status', true);
if (!modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[5][1] .= '<span id="minmax_critical"><em>'.__('Min. ').'</em>';
$table_simple->data[5][1] .= html_print_input_text ('min_critical', $min_critical, '', 10, 255, true,
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
$table_simple->data[5][1] .= '<br /><em>'.__('Max.').'</em>';
$table_simple->data[5][1] .= html_print_input_text ('max_critical', $max_critical, '', 10, 255, true,
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).'</span>';
}
if (modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[5][1] .= '<span id="string_critical"><em>'.__('Str.').'</em>';
$table_simple->data[5][1] .= html_print_input_text ('str_critical', str_replace("\"","",$str_critical),
'', 10, 255, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).'</span>';
}
$table_simple->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
$table_simple->data[4][1] .= html_print_checkbox ("critical_inverse", 1, $critical_inverse, true, $disabledBecauseInPolicy);
$table_simple->data[5][1] .= '<br /><em>'.__('Inverse interval').'</em>';
$table_simple->data[5][1] .= html_print_checkbox ("critical_inverse", 1, $critical_inverse, true, $disabledBecauseInPolicy);
/* FF stands for Flip-flop */
$table_simple->data[5][0] = __('FF threshold').' ' . ui_print_help_icon ('ff_threshold', true);
$table_simple->data[6][0] = __('FF threshold').' ' . ui_print_help_icon ('ff_threshold', true);
$table_simple->colspan[5][1] = 3;
$table_simple->data[5][1] = html_print_radio_button ('each_ff', 0, '', $each_ff, true, $disabledBecauseInPolicy) . ' ' . __('All state changing') . ' : ';
$table_simple->data[5][1] .= html_print_input_text ('ff_event', $ff_event, '', 5, 15, true,
$table_simple->data[6][1] = html_print_radio_button ('each_ff', 0, '', $each_ff, true, $disabledBecauseInPolicy) . ' ' . __('All state changing') . ' : ';
$table_simple->data[6][1] .= html_print_input_text ('ff_event', $ff_event, '', 5, 15, true,
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . '<br />';
$table_simple->data[5][1] .= html_print_radio_button ('each_ff', 1, '', $each_ff, true, $disabledBecauseInPolicy) . ' ' . __('Each state changing') . ' : ';
$table_simple->data[5][1] .= __('To normal');
$table_simple->data[5][1] .= html_print_input_text ('ff_event_normal', $ff_event_normal, '', 5, 15, true,
$table_simple->data[6][1] .= html_print_radio_button ('each_ff', 1, '', $each_ff, true, $disabledBecauseInPolicy) . ' ' . __('Each state changing') . ' : ';
$table_simple->data[6][1] .= __('To normal');
$table_simple->data[6][1] .= html_print_input_text ('ff_event_normal', $ff_event_normal, '', 5, 15, true,
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . ' ';
$table_simple->data[5][1] .= __('To warning');
$table_simple->data[5][1] .= html_print_input_text ('ff_event_warning', $ff_event_warning, '', 5, 15, true,
$table_simple->data[6][1] .= __('To warning');
$table_simple->data[6][1] .= html_print_input_text ('ff_event_warning', $ff_event_warning, '', 5, 15, true,
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . ' ';
$table_simple->data[5][1] .= __('To critical');
$table_simple->data[5][1] .= html_print_input_text ('ff_event_critical', $ff_event_critical, '', 5, 15, true,
$table_simple->data[6][1] .= __('To critical');
$table_simple->data[6][1] .= html_print_input_text ('ff_event_critical', $ff_event_critical, '', 5, 15, true,
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
$table_simple->data[6][0] = __('Historical data');
$table_simple->data[7][0] = __('Historical data');
if($disabledBecauseInPolicy) {
// If is disabled, we send a hidden in his place and print a false checkbox because HTML dont send disabled fields and could be disabled by error
$table_simple->data[6][1] = html_print_checkbox ("history_data_fake", 1, $history_data, true, $disabledBecauseInPolicy);
$table_simple->data[6][1] .= '<input type="hidden" name="history_data" value="'.(int)$history_data.'">';
$table_simple->data[7][1] = html_print_checkbox ("history_data_fake", 1, $history_data, true, $disabledBecauseInPolicy);
$table_simple->data[7][1] .= '<input type="hidden" name="history_data" value="'.(int)$history_data.'">';
}
else {
$table_simple->data[6][1] = html_print_checkbox ("history_data", 1, $history_data, true, $disabledBecauseInPolicy);
$table_simple->data[7][1] = html_print_checkbox ("history_data", 1, $history_data, true, $disabledBecauseInPolicy);
}
/* Advanced form part */
@ -419,15 +431,15 @@ $table_advanced->colspan[4][1] = 2;
// Code comes from module_editor
if ($__code_from == 'modules') {
$throw_unknown_events_check =
!modules_is_disable_type_event($id_agent_module, EVENTS_GOING_UNKNOWN);
modules_is_disable_type_event($id_agent_module, EVENTS_GOING_UNKNOWN);
}
else {
global $__id_pol_mod;
$throw_unknown_events_check =
!policy_module_is_disable_type_event($__id_pol_mod, EVENTS_GOING_UNKNOWN);
policy_module_is_disable_type_event($__id_pol_mod, EVENTS_GOING_UNKNOWN);
}
$table_advanced->data[4][3] = __('Throw unknown events');
$table_advanced->data[4][3] = __('Discard unknown events');
$table_advanced->data[4][4] = html_print_checkbox('throw_unknown_events',
1, $throw_unknown_events_check, true, $disabledBecauseInPolicy);
$table_advanced->colspan[4][4] = 3;
@ -564,34 +576,55 @@ $table_advanced->data[10][1] = html_print_textarea ('unknown_instructions', 2, 6
$table_advanced->colspan[10][1] = 6;
if (isset($id_agente) && $moduletype == MODULE_DATA) {
$table_advanced->data[11][0] = __('Cron') .
ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour, $minute, $mday, $month, $wday, true, true);
$table_advanced->colspan[11][1] = 6;
$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"]));
if ($has_remote_conf) {
$table_advanced->data[11][0] = __('Cron from') .
ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
$table_advanced->colspan[11][1] = 6;
$table_advanced->data[12][0] = __('Cron to');
$table_advanced->data[12][1] = html_print_extended_select_for_cron ($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true);
$table_advanced->colspan[12][1] = 6;
}
else {
$table_advanced->data[11][0] = __('Cron from') .
ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, true);
$table_advanced->colspan[11][1] = 6;
$table_advanced->data[12][0] = __('Cron to');
$table_advanced->data[12][1] = html_print_extended_select_for_cron ($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, true, true);
$table_advanced->colspan[12][1] = 6;
}
}
else {
$table_advanced->data[11][0] = __('Cron') .
$table_advanced->data[11][0] = __('Cron from') .
ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour, $minute, $mday, $month, $wday, true, $disabledBecauseInPolicy);
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
$table_advanced->colspan[11][1] = 6;
$table_advanced->data[12][0] = __('Cron to');
$table_advanced->data[12][1] = html_print_extended_select_for_cron ($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true);
$table_advanced->colspan[12][1] = 6;
}
$table_advanced->data[12][0] = __('Timeout');
$table_advanced->data[12][1] = html_print_input_text ('max_timeout', $max_timeout, '', 5, 10, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy). ' ' . ui_print_help_tip (__('Seconds that agent will wait for the execution of the module.'), true);
$table_advanced->data[12][2] = '';
$table_advanced->data[12][3] = __('Retries');
$table_advanced->data[12][4] = html_print_input_text ('max_retries', $max_retries, '', 5, 10, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy). ' ' . ui_print_help_tip (__('Number of retries that the module will attempt to run.'), true);
$table_advanced->colspan[12][4] = 3;
$table_advanced->data[13][0] = __('Timeout');
$table_advanced->data[13][1] = html_print_input_text ('max_timeout', $max_timeout, '', 5, 10, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy). ' ' . ui_print_help_tip (__('Seconds that agent will wait for the execution of the module.'), true);
$table_advanced->data[13][2] = '';
$table_advanced->data[13][3] = __('Retries');
$table_advanced->data[13][4] = html_print_input_text ('max_retries', $max_retries, '', 5, 10, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy). ' ' . ui_print_help_tip (__('Number of retries that the module will attempt to run.'), true);
$table_advanced->colspan[13][4] = 3;
if (check_acl ($config['id_user'], 0, "PM")) {
$table_advanced->data[13][0] = __('Category');
$table_advanced->data[13][1] = html_print_select(
$table_advanced->data[14][0] = __('Category');
$table_advanced->data[14][1] = html_print_select(
categories_get_all_categories('forselect'), 'id_category', $id_category, '', __('None'), 0, true, false, true, "", $disabledBecauseInPolicy);
$table_advanced->colspan[13][1] = 6;
$table_advanced->colspan[14][1] = 6;
}
else {
// Store in a hidden field if is not visible to avoid delete the value
$table_advanced->data[12][4] .= html_print_input_hidden ('id_category', $id_category, true);
$table_advanced->data[13][4] .= html_print_input_hidden ('id_category', $id_category, true);
}
/* Advanced form part */

View File

@ -65,7 +65,37 @@ $extra_title = __('Network server module');
$data = array ();
$data[0] = __('Target IP');
$data[1] = html_print_input_text ('ip_target', $ip_target, '', 15, 60, true);
//show agent_for defect;
if($page == 'enterprise/godmode/policies/policy_modules'){
if($ip_target != 'auto' && $ip_target != ''){
$custom_ip_target = $ip_target;
$ip_target = 'custom';
}
elseif($ip_target == ''){
$ip_target = 'force_pri';
$custom_ip_target = '';
}
else{
$custom_ip_target = '';
}
$target_ip_values = array();
$target_ip_values['auto'] = __('Auto');
$target_ip_values['force_pri'] = __('Force primary key');
$target_ip_values['custom'] = __('Custom');
$data[1] = html_print_select ($target_ip_values, 'ip_target', $ip_target, '', '', '',
true, false, false, '', false, 'width:200px;');
$data[1] .= html_print_input_text ('custom_ip_target', $custom_ip_target, '', 15, 60, true);
}
else{
if($ip_target == 'auto'){
$ip_target = agents_get_address ($id_agente);
}
$data[1] = html_print_input_text ('ip_target', $ip_target, '', 15, 60, true);
}
// In ICMP modules, port is not configurable
if ($id_module_type >= 6 && $id_module_type <= 7) {
@ -347,6 +377,18 @@ $(document).ready (function () {
$('#snmp3_browser_privacy_pass').keyup(function() {
$('#snmp3_privacy_pass').val($(this).val());
});
var custom_ip_target = "<?php echo $custom_ip_target?>";
if(custom_ip_target == ''){
$("#text-custom_ip_target").hide();
}
$('#ip_target').change(function() {
if($(this).val() == 'custom') {
$("#text-custom_ip_target").show();
}
else{
$("#text-custom_ip_target").hide();
}
});
});
// Show the SNMP browser window

View File

@ -30,7 +30,6 @@ $row = db_get_row_sql($sql);
$is_service = false;
$is_synthetic = false;
$is_synthetic_avg = false;
$is_netflow = false;
$ops = false;
if ($row !== false && is_array($row)) {
$prediction_module = $row['prediction_module'];
@ -69,10 +68,6 @@ if ($row !== false && is_array($row)) {
$custom_integer_1 = 0;
$custom_integer_2 = 0;
break;
case MODULE_PREDICTION_NETFLOW:
$is_netflow = true;
$custom_integer_2 = 0;
break;
default:
$prediction_module = $custom_integer_1;
break;
@ -97,7 +92,7 @@ $data[0] = __('Source module');
$data[0] .= ui_print_help_icon ('prediction_source_module', true);
$data[1] = '';
// Services and Synthetic are an Enterprise feature.
$module_service_synthetic_selector = enterprise_hook('get_module_service_synthetic_selector', array($is_service, $is_synthetic, $is_synthetic_avg, $is_netflow));
$module_service_synthetic_selector = enterprise_hook('get_module_service_synthetic_selector', array($is_service, $is_synthetic, $is_synthetic_avg));
if ($module_service_synthetic_selector !== ENTERPRISE_NOT_HOOK) {
$data[1] = $module_service_synthetic_selector;

View File

@ -22,7 +22,7 @@ require_once ("../../include/functions_users.php");
require_once ("../../include/functions_groups.php");
require_once ("../../include/functions_reporting.php");
$config["id_user"] = $_SESSION[$config['homeurl_static']]["id_usuario"];
$config["id_user"] = $_SESSION["id_usuario"];
if (! check_acl ($config['id_user'], 0, "AR")) {
db_pandora_audit("ACL Violation", "Trying to access downtime scheduler");
require ("general/noaccess.php");

View File

@ -149,7 +149,7 @@ if ($create_action) {
$fields_values = array();
$info_fields = '';
$values = array();
for($i=1;$i<=10;$i++) {
for($i=1;$i<=$config['max_macro_fields'];$i++) {
$values['field'.$i] = (string) get_parameter ('field'.$i.'_value');
$info_fields .= ' Field'.$i.': ' . $values['field'.$i];
$values['field'.$i.'_recovery'] = (string) get_parameter ('field'.$i.'_recovery_value');
@ -228,7 +228,7 @@ if ($update_action) {
$info_fields = '';
$values = array();
for ($i = 1; $i <= 10; $i++) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$values['field'.$i] = (string) get_parameter ('field'.$i.'_value');
$info_fields .= ' Field1: ' . $values['field'.$i];
$values['field'.$i.'_recovery'] = (string) get_parameter ('field'.$i.'_recovery_value');

View File

@ -89,7 +89,7 @@ if (is_ajax ()) {
}
$fields_rows = array();
for ($i = 1; $i <= 10; $i++) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
if (($i == 5) && ($command['id'] == 3)){
continue;
@ -260,7 +260,7 @@ if ($create_command) {
$fields_values = array();
$info_fields = '';
$values = array();
for ($i=1;$i<=10;$i++) {
for ($i=1;$i<=$config['max_macro_fields'];$i++) {
$fields_descriptions[] = (string) get_parameter ('field'.$i.'_description');
$fields_values[] = (string) get_parameter ('field'.$i.'_values');
$info_fields .= ' Field'.$i.': ' . $fields_values[$i - 1];

View File

@ -132,8 +132,8 @@ if (check_acl ($config['id_user'], 0, "LM")) {
$table->data[2][1] .= '</a>';
}
$table->data[3][0] = __('Threshold');
$table->data[3][1] = html_print_extended_select_for_time ('module_action_threshold', 0, '', 0,
__('None'), false, true) . ui_print_help_icon ('action_threshold', true, ui_get_full_url(false, false, false, false));
$table->data[3][1] = html_print_input_text ('module_action_threshold', '0', '', 5, 7, true);
$table->data[3][1] .= ' ' . __('seconds') . ui_print_help_icon ('action_threshold', true);
echo '<form class="add_alert_form" method="post">';

View File

@ -182,10 +182,9 @@ if ($update_action) {
if ($fires_max != -1)
$values['fires_max'] = $fires_max;
$values['module_action_threshold'] = (int) get_parameter ('module_action_threshold_ajax');
$values['id_alert_action'] = $id_action;
$result = alerts_update_alert_agent_module_action ($id_module_action, $values);
$values['id_alert_action'] = $id_module_action;
$result = alerts_update_alert_agent_module_action ($id_action, $values);
if ($result) {
db_pandora_audit("Alert management", 'Update action ' . $id_action . ' in alert ' . $id_alert_module);
}

View File

@ -157,7 +157,7 @@ $table->data[5][2] = html_print_textarea ('command_recovery_preview', 5, 30, '',
'disabled="disabled"', true);
$row = 6;
for ($i = 1; $i <= 10; $i++) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table->data['field' . $i][0] = html_print_image(
'images/spinner.gif', true);
$table->data['field' . $i][1] = html_print_image(
@ -273,8 +273,8 @@ $(document).ready (function () {
command_description = js_html_entity_decode (data["description"]);
render_command_description(command_description);
for (i = 1; i <= 10; i++) {
var max_fields = parseInt('<?php echo $config["max_macro_fields"]; ?>');
for (i = 1; i <= max_fields; i++) {
var old_value = '';
var old_recovery_value = '';
var field_row = data["fields_rows"][i];

View File

@ -59,7 +59,7 @@ if ($update_command) {
$fields_values = array();
$info_fields = '';
$values = array();
for ($i=1;$i<=10;$i++) {
for ($i=1;$i<=$config['max_macro_fields'];$i++) {
$fields_descriptions[] = (string) get_parameter ('field'.$i.'_description');
$fields_values[] = (string) get_parameter ('field'.$i.'_values');
$info_fields .= ' Field'.$i.': ' . $fields_values[$i - 1];
@ -155,7 +155,7 @@ $table->colspan[2][1] = 3;
$table->data[2][0] = __('Description');
$table->data[2][1] = html_print_textarea ('description', 10, 30, $description, '', true);
for ($i = 1; $i <= 10; $i++) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table->data['field'.$i][0] = sprintf(__('Field %s description'), $i);

View File

@ -304,7 +304,7 @@ function update_template ($step) {
}
elseif ($step == 3) {
$recovery_notify = (bool) get_parameter ('recovery_notify');
for($i=1;$i<=10;$i++) {
for($i=1;$i<=$config['max_macro_fields'];$i++) {
$values['field'.$i] = (string) get_parameter ('field'.$i);
$values['field'.$i.'_recovery'] = $recovery_notify ? (string) get_parameter ('field'.$i.'_recovery') : '';
}
@ -354,10 +354,10 @@ $sunday = true;
$special_day = false;
$default_action = 0;
$fields = array();
for ($i = 1; $i <= 10; $i++) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$fields[$i] = '';
}
for ($i = 1; $i <= 10; $i++) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$fields_recovery[$i] = '';
}
$priority = 1;
@ -473,13 +473,13 @@ if ($id && ! $create_template) {
$min_alerts_reset_counter = $template['min_alerts_reset_counter'];
$threshold = $template['time_threshold'];
$fields = array();
for ($i = 1; $i <= 10; $i++) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$fields[$i] = $template['field'.$i];
}
$recovery_notify = $template['recovery_notify'];
$fields_recovery = array();
for ($i = 1; $i <= 10; $i++) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$fields_recovery[$i] = $template['field'.$i.'_recovery'];
}
@ -643,6 +643,10 @@ else if ($step == 3) {
/* Alert recover */
if (! $recovery_notify) {
$table->cellstyle['label_fields'][2] = 'display:none;';
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table->cellstyle['field' . $i][2] = 'display:none;';
}
/*
$table->cellstyle['field1'][2] = 'display:none;';
$table->cellstyle['field2'][2] = 'display:none;';
$table->cellstyle['field3'][2] = 'display:none;';
@ -653,6 +657,7 @@ else if ($step == 3) {
$table->cellstyle['field8'][2] = 'display:none;';
$table->cellstyle['field9'][2] = 'display:none;';
$table->cellstyle['field10'][2] = 'display:none;';
*/
}
$table->data[0][0] = __('Alert recovery');
$values = array (false => __('Disabled'), true => __('Enabled'));
@ -665,7 +670,7 @@ else if ($step == 3) {
$table->data['label_fields'][1] = __('Firing fields');
$table->data['label_fields'][2] = __('Recovery fields');
for ($i = 1; $i <= 10; $i++) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
if (isset($template[$name])) {
$value = $template[$name];
}
@ -1090,11 +1095,21 @@ if ($step == 2) {
elseif ($step == 3) {
?>
$("#recovery_notify").change (function () {
var max_fields = parseInt('<?php echo $config["max_macro_fields"]; ?>');
if (this.value == 1) {
$("#template-label_fields-2, #template-field1-2, #template-field2-2, #template-field3-2, #template-field4-2, #template-field5-2, #template-field6-2, #template-field7-2, #template-field8-2, #template-field9-2, #template-field10-2").show ();
$("#template-label_fields-2").show();
for (i = 1; i <= max_fields; i++) {
$("#template-field" + i + "-2").show();
}
//$("#template-label_fields-2, #template-field1-2, #template-field2-2, #template-field3-2, #template-field4-2, #template-field5-2, #template-field6-2, #template-field7-2, #template-field8-2, #template-field9-2, #template-field10-2").show ();
}
else {
$("#template-label_fields-2, #template-field1-2, #template-field2-2, #template-field3-2, #template-field4-2, #template-field5-2, #template-field6-2, #template-field7-2, #template-field8-2, #template-field9-2, #template-field10-2").hide ();
$("#template-label_fields-2").hide();
for (i = 1; i <= max_fields; i++) {
$("#template-field" + i + "-2").hide();
}
//$("#template-label_fields-2, #template-field1-2, #template-field2-2, #template-field3-2, #template-field4-2, #template-field5-2, #template-field6-2, #template-field7-2, #template-field8-2, #template-field9-2, #template-field10-2").hide ();
}
});

View File

@ -22,18 +22,18 @@ require_once ($config["homedir"]."/include/auth/mysql.php");
error_reporting(E_ALL);
ini_set("display_errors", 1);
if (! isset ($_SESSION[$config['homeurl_static']]["id_usuario"])) {
if (! isset ($_SESSION["id_usuario"])) {
session_start ();
session_write_close ();
}
// Login check
if (!isset($_SESSION[$config['homeurl_static']]["id_usuario"])) {
if (!isset($_SESSION["id_usuario"])) {
$config['id_user'] = null;
}
else {
$config['id_user'] = $_SESSION[$config['homeurl_static']]["id_usuario"];
$config['id_user'] = $_SESSION["id_usuario"];
}
if (!check_login()) {

View File

@ -147,28 +147,26 @@ foreach ($filters as $filter) {
href='index.php?sec=geventos&sec2=godmode/events/events&section=filter&delete=1&id=".$filter['id_filter']."&offset=0&pure=".$config['pure']."'>" .
html_print_image('images/cross.png', true, array('title' => __('Delete'))) . "</a>" .
html_print_checkbox_extended ('delete_multiple[]', $filter['id_filter'], false, false, '', 'class="check_delete"', true);
array_push ($table->data, $data);
}
if (isset($data)) {
html_print_table ($table);
echo "<form method='post' action='index.php?sec=geventos&sec2=godmode/events/events&amp;pure=".$config['pure']."'>";
html_print_input_hidden('multiple_delete', 1);
html_print_table ($table);
if(!is_metaconsole())
echo "<div style='padding-bottom: 20px; text-align: right;'>";
else
echo "<div style='float:right; '>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo "</div>";
echo "</form>";
}
else {
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined filters') ) );
}
if (isset($data)) {
echo "<form method='post' action='index.php?sec=geventos&sec2=godmode/events/events&amp;pure=".$config['pure']."'>";
html_print_input_hidden('multiple_delete', 1);
if(!is_metaconsole())
echo "<div style='padding-bottom: 20px; text-align: right;'>";
else
echo "<div style='float:right; '>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo "</div>";
echo "</form>";
}
if(!defined("METACONSOLE"))
echo "<div style='padding-bottom: 20px; text-align: right; width:100%;'>";
else
@ -181,11 +179,11 @@ echo "</div>";
<script type="text/javascript">
function check_all_checkboxes() {
if ($("input[name=all_delete]").attr('checked')) {
$(".check_delete").attr('checked', true);
if ($("#checkbox-all_delete").prop("checked")) {
$(".check_delete").prop('checked', true);
}
else {
$(".check_delete").attr('checked', false);
$(".check_delete").prop('checked', false);
}
}
</script>

View File

@ -34,6 +34,7 @@ enterprise_include_once ('meta/include/functions_agents_meta.php');
$icon = "";
$name = "";
$id_parent = 0;
$group_pass = "";
$alerts_disabled = 0;
$custom_id = "";
$propagate = 0;
@ -55,6 +56,7 @@ if ($id_group) {
else {
$icon = $group["icon"].'.png';
}
$group_pass = io_safe_output($group['password']);
$alerts_disabled = $group["disabled"];
$id_parent = $group["parent"];
$custom_id = $group["custom_id"];
@ -96,7 +98,7 @@ else {
}
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
if (defined("METACONSOLE")) {
@ -158,23 +160,36 @@ if ($acl_parent) {
$table->data[2][1] .= '</span>';
}
$table->data[3][0] = __('Alerts');
$table->data[3][1] = html_print_checkbox ('alerts_enabled', 1, ! $alerts_disabled, true);
$i = 3;
if ($config['enterprise_installed']) {
$i = 4;
$table->data[3][0] = __('Group Password');
$table->data[3][1] = html_print_input_password ('group_pass', $group_pass, '', 16, 255, true);
}
$table->data[4][0] = __('Propagate ACL') . ui_print_help_tip (__("Propagate the same ACL security into the child subgroups."), true);
$table->data[4][1] = html_print_checkbox('propagate', 1, $propagate, true).ui_print_help_icon ("propagate_acl", true);
$table->data[$i][0] = __('Alerts');
$table->data[$i][1] = html_print_checkbox ('alerts_enabled', 1, ! $alerts_disabled, true);
$i++;
$table->data[5][0] = __('Custom ID');
$table->data[5][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true);
$table->data[$i][0] = __('Propagate ACL') . ui_print_help_tip (__("Propagate the same ACL security into the child subgroups."), true);
$table->data[$i][1] = html_print_checkbox('propagate', 1, $propagate, true).ui_print_help_icon ("propagate_acl", true);
$i++;
$table->data[6][0] = __('Description');
$table->data[6][1] = html_print_input_text ('description', $description, '', 60, 255, true);
$table->data[$i][0] = __('Custom ID');
$table->data[$i][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true);
$i++;
$table->data[7][0] = __('Contact') . ui_print_help_tip (__("Contact information accessible through the _groupcontact_ macro"), true);
$table->data[7][1] = html_print_textarea ('contact', 4, 40, $contact, "style='min-height: 0px;'", true);
$table->data[$i][0] = __('Description');
$table->data[$i][1] = html_print_input_text ('description', $description, '', 60, 255, true);
$i++;
$table->data[8][0] = __('Other') . ui_print_help_tip (__("Information accessible through the _group_other_ macro"), true);
$table->data[8][1] = html_print_textarea ('other', 4, 40, $other, "style='min-height: 0px;'", true);
$table->data[$i][0] = __('Contact') . ui_print_help_tip (__("Contact information accessible through the _groupcontact_ macro"), true);
$table->data[$i][1] = html_print_textarea ('contact', 4, 40, $contact, "style='min-height: 0px;'", true);
$i++;
$table->data[$i][0] = __('Other') . ui_print_help_tip (__("Information accessible through the _group_other_ macro"), true);
$table->data[$i][1] = html_print_textarea ('other', 4, 40, $other, "style='min-height: 0px;'", true);
$i++;
$isFunctionSkins = enterprise_include_once ('include/functions_skins.php');
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK && !defined('METACONSOLE')) {
@ -188,7 +203,9 @@ else
$sec = "gagente";
if (isset($config['metaconsole_node_id']) && $config['metaconsole_node_id'] > 0) {
$confirm_bottom = " onsubmit=' return message_check_create();'";
if(isset($config['metaconsole_agent_cache']) && $config['metaconsole_agent_cache'] == 1){
$confirm_bottom = " onsubmit=' return message_check_create();'";
}
}
else
{

View File

@ -178,6 +178,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, "PM"))) {
$name = (string) get_parameter ('name');
$icon = (string) get_parameter ('icon');
$id_parent = (int) get_parameter ('id_parent');
$group_pass = (string)get_parameter('group_pass');
$alerts_disabled = (bool) get_parameter ('alerts_disabled');
$custom_id = (string) get_parameter ('custom_id');
$skin = (string) get_parameter ('skin');
@ -200,7 +201,8 @@ if (($create_group) && (check_acl($config['id_user'], 0, "PM"))) {
'description' => $description,
'contact' => $contact,
'propagate' => $propagate,
'other' => $other
'other' => $other,
'password' => io_safe_input($group_pass)
);
$result = db_process_sql_insert('tgrupo', $values);
@ -228,6 +230,7 @@ if ($update_group) {
$icon = (string) get_parameter ('icon');
$id_parent = (int) get_parameter ('id_parent');
$description = (string) get_parameter ('description');
$group_pass = (string)get_parameter('group_pass');
$alerts_enabled = (bool) get_parameter ('alerts_enabled');
$custom_id = (string) get_parameter ('custom_id');
$propagate = (bool) get_parameter('propagate');
@ -241,9 +244,9 @@ if ($update_group) {
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ('UPDATE tgrupo SET nombre = "%s",
icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d, description = "%s", contact = "%s", other = "%s"
icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d, description = "%s", contact = "%s", other = "%s", password = "%s"
WHERE id_grupo = %d',
$name, empty($icon) ? '' : substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $description, $contact, $other, $id_group);
$name, empty($icon) ? '' : substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $description, $contact, $other, $group_pass, $id_group);
break;
case "postgresql":
case "oracle":

View File

@ -52,7 +52,6 @@ $id_group = (int) get_parameter ('id_group');
$id_agents = get_parameter ('id_agents');
$id_alert_templates = (array) get_parameter ('id_alert_templates');
$recursion = get_parameter ('recursion');
$add = (bool) get_parameter_post ('add');
if ($add) {
@ -64,45 +63,61 @@ if ($add) {
$fires_max = (int) get_parameter ('fires_max');
if (!empty($actions)) {
$agent_alerts = agents_get_alerts($id_agents);
$cont = 0;
$agent_alerts_id = array();
foreach ($agent_alerts['simple'] as $agent_alert) {
if (in_array($agent_alert['id_alert_template'], $id_alert_templates)) {
$agent_alerts_id[$cont] = $agent_alert['id'];
$cont = $cont + 1;
}
}
$options = array();
if ($fires_min > 0)
$options['fires_min'] = $fires_min;
if ($fires_max > 0)
$options['fires_max'] = $fires_max;
if (empty($agent_alerts_id)) {
ui_print_result_message (false, '', __('Could not be added').". ".__('No alerts selected'));
}
else {
$results = true;
foreach ($agent_alerts_id as $agent_alert_id) {
foreach ($actions as $action) {
$result = alerts_add_alert_agent_module_action($agent_alert_id, $action, $options);
if ($result === false)
$results = false;
$modules = get_parameter ('module');
$modules_id = array();
if (!empty($modules)) {
foreach ($modules as $module) {
foreach ($id_agents as $id_agent) {
$module_id = modules_get_agentmodule_id($module, $id_agent);
$modules_id[] = $module_id['id_agente_modulo'];
}
}
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));
$agent_alerts = agents_get_alerts($id_agents);
$cont = 0;
$agent_alerts_id = array();
ui_print_result_message ($results, __('Successfully added'), __('Could not be added'));
foreach ($agent_alerts['simple'] as $agent_alert) {
if ((in_array($agent_alert['id_alert_template'], $id_alert_templates)) && (in_array($agent_alert['id_agent_module'], $modules_id))) {
$agent_alerts_id[$cont] = $agent_alert['id'];
$cont += 1;
}
}
$options = array();
if ($fires_min > 0)
$options['fires_min'] = $fires_min;
if ($fires_max > 0)
$options['fires_max'] = $fires_max;
if (empty($agent_alerts_id)) {
ui_print_result_message (false, '', __('Could not be added').". ".__('No alerts selected'));
}
else {
$results = true;
foreach ($agent_alerts_id as $agent_alert_id) {
foreach ($actions as $action) {
$result = alerts_add_alert_agent_module_action($agent_alert_id, $action, $options);
if ($result === false)
$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));
ui_print_result_message ($results, __('Successfully added'), __('Could not be added'));
}
}
else {
ui_print_result_message (false, '', __('Could not be added').". ".__('No modules selected'));
}
}
else {
ui_print_result_message (false, '', __('Could not be added').". ".__('No action selected'));
ui_print_result_message (false, '', __('Could not be added').". ".__('No actions selected'));
}
}
@ -150,6 +165,15 @@ $table->data[2][0] .= '<span id="template_loading" class="invisible">';
$table->data[2][0] .= html_print_image('images/spinner.png', true);
$table->data[2][0] .= '</span>';
$table->data[2][1] = html_print_select (array(), 'id_alert_templates[]', '', '', '', '', true, true, true, '', $alert_templates == 0);
$table->data[2][2] = __('When select agents');
$table->data[2][2] .= '<br>';
$table->data[2][2] .= html_print_select (
array('common' => __('Show common modules'),
'all' => __('Show all modules'),'unknown' => __('Show unknown and not init modules')),
'modules_selection_mode',
'common', false, '', '', true);
$table->data[2][3] = html_print_select (array(), 'module[]',
$modules_select, false, '', '', true, true, false);
$actions = alerts_get_alert_actions ();
$table->data[3][0] = __('Action');
@ -233,6 +257,12 @@ $(document).ready (function () {
update_alerts();
});
$("#id_alert_templates").change(alert_templates_changed_by_multiple_agents_with_alerts);
$("#modules_selection_mode").click(function () {
$("#id_alert_templates").trigger("change");
});
function update_alerts() {
var idAgents = Array();
jQuery.each ($("#id_agents option:selected"), function (i, val) {

View File

@ -58,52 +58,65 @@ if ($delete) {
$actions = get_parameter ('action');
if (!empty($actions)) {
$agent_alerts = agents_get_alerts($id_agents);
$alerts_agent_modules = array();
foreach ($agent_alerts['simple'] as $agent_alert) {
if (in_array($agent_alert['id_alert_template'], $id_alert_templates)) {
$alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module ($agent_alert['id_agent_module'], true, false, 'id'));
$modules = (array) get_parameter ('module');
$modules_id = array();
if (!empty($modules)) {
foreach ($modules as $module) {
foreach ($id_agents as $id_agent) {
$module_id = modules_get_agentmodule_id($module, $id_agent);
$modules_id[] = $module_id['id_agente_modulo'];
}
}
}
if (empty($alerts_agent_modules)) {
ui_print_result_message (false, '',
__('Could not be deleted. No alerts selected'));
}
else {
$results = true;
$agent_module_actions = array();
foreach ($alerts_agent_modules as $alert_agent_module) {
$agent_module_actions = alerts_get_alert_agent_module_actions ($alert_agent_module['id'], array('id','id_alert_action'));
foreach ($agent_module_actions as $agent_module_action) {
foreach ($actions as $action) {
if ($agent_module_action['id_alert_action'] == $action) {
$result = alerts_delete_alert_agent_module_action ($agent_module_action['id']);
if ($result === false)
$results = false;
}
}
$agent_alerts = agents_get_alerts($id_agents);
$alerts_agent_modules = array();
foreach ($agent_alerts['simple'] as $agent_alert) {
if ((in_array($agent_alert['id_alert_template'], $id_alert_templates)) && (in_array($agent_alert['id_agent_module'], $modules_id))) {
$alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module ($agent_alert['id_agent_module'], true, false, 'id'));
}
}
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));
if (empty($alerts_agent_modules)) {
ui_print_result_message (false, '',
__('Could not be deleted. No alerts selected'));
}
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));
$results = true;
$agent_module_actions = array();
foreach ($alerts_agent_modules as $alert_agent_module) {
$agent_module_actions = alerts_get_alert_agent_module_actions ($alert_agent_module['id'], array('id','id_alert_action'));
foreach ($agent_module_actions as $agent_module_action) {
foreach ($actions as $action) {
if ($agent_module_action['id_alert_action'] == $action) {
$result = alerts_delete_alert_agent_module_action ($agent_module_action['id']);
if ($result === false)
$results = false;
}
}
}
}
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));
}
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));
}
ui_print_result_message ($results,
__('Successfully deleted'),
__('Could not be deleted'));
}
ui_print_result_message ($results,
__('Successfully deleted'),
__('Could not be deleted'));
}
else {
ui_print_result_message (false, '', __('Could not be added').". ".__('No modules selected'));
}
}
else {
@ -143,9 +156,6 @@ $table->data[0][3] = html_print_checkbox ("recursion", 1, $recursion,
true, false);
$table->data[1][0] = __('Agents with templates');
$table->data[1][0] .= '<span id="agent_loading" class="invisible">';
$table->data[1][0] .= html_print_image('images/spinner.png', true);
$table->data[1][0] .= '</span>';
$table->data[1][1] = html_print_select (array(),'id_agents[]', 0, false, '', '', true, true);
if (empty($id_agents)) {
@ -155,10 +165,17 @@ else {
$alert_templates = agents_get_alerts_simple ($id_agents);
}
$table->data[2][0] = __('Alert templates');
$table->data[2][0] .= '<span id="template_loading" class="invisible">';
$table->data[2][0] .= html_print_image('images/spinner.png', true);
$table->data[2][0] .= '</span>';
$table->data[2][1] = html_print_select (index_array ($alert_templates, 'id_alert_template', 'template_name'), 'id_alert_templates[]', '', '', '', '', true, true, true, '', $alert_templates == 0);
$table->data[2][2] = __('When select agents');
$table->data[2][2] .= '<br>';
$table->data[2][2] .= html_print_select (
array('common' => __('Show common modules'),
'all' => __('Show all modules'),'unknown' => __('Show unknown and not init modules')),
'modules_selection_mode',
'common', false, '', '', true);
$table->data[2][3] = html_print_select (array(), 'module[]',
$modules_select, false, '', '', true, true, false);
$actions = alerts_get_alert_actions ();
$table->data[3][0] = __('Action');
@ -221,6 +238,12 @@ $(document).ready (function () {
update_alerts();
});
$("#id_alert_templates").change(alert_templates_changed_by_multiple_agents_with_alerts);
$("#modules_selection_mode").click(function () {
$("#id_alert_templates").trigger("change");
});
function update_alerts() {
var idAgents = Array();
jQuery.each ($("#id_agents option:selected"), function (i, val) {

View File

@ -120,9 +120,9 @@ $table->data[1][0] = __('Status');
$table->data[1][1] = html_print_select($status_list, 'status_agents', 'selected',
'', __('All'), AGENT_STATUS_ALL, true);
$table->data[1][2] = __('Only disabled agents');
$table->data[1][3] = html_print_checkbox ("disabled", 1, $disabled,
true, false);
$table->data[1][2] = __('Show agents');
$table->data[1][3] = html_print_select (array(0 => 'Only enabled',1 => 'Only disabled'), 'disabled',2,'',__('All'),
2,true,'','','','','width:30%;');
$table->data[2][0] = __('Agents');
$table->data[2][0] .= '<span id="agent_loading" class="invisible">';
@ -176,10 +176,11 @@ ui_require_jquery_file ('pandora.controls');
var disabled;
$("#checkbox-disabled").click(function () {
disabled = this.checked ? 1 : 0;
$("#id_group").trigger("change");
$("#disabled").click(function () {
disabled = this.value;
$("#id_group").trigger("change");
});
$("#id_group").pandoraSelectGroupAgent ({
@ -199,5 +200,10 @@ ui_require_jquery_file ('pandora.controls');
$("#status_agents").change(function() {
$("#id_group").trigger("change");
});
disabled = 2;
$("#id_group").trigger("change");
});
</script>

View File

@ -395,7 +395,7 @@ $table->style[2] = 'font-weight: bold';
$table->data['selection_mode'][0] = __('Selection mode');
$table->data['selection_mode'][1] = __('Select modules first') . ' ' .
html_print_radio_button_extended ("selection_mode", 'modules', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true);
html_print_radio_button_extended ("selection_mode", 'modules', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true).'<br>';
$table->data['selection_mode'][1] .= __('Select agents first') . ' ' .
html_print_radio_button_extended ("selection_mode", 'agents', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true);
@ -460,7 +460,19 @@ $table->data['form_agents_2'][1] = html_print_select($status_list,
'status_agents', 'selected', '', __('All'), AGENT_STATUS_ALL, true);
$table->data['form_agents_2'][3] = '';
$table->rowclass['form_modules_3'] = '';
$table->data['form_modules_3'][0] = __('Module Status');
$table->colspan['form_modules_3'][1] = 2;
$status_list = array ();
$status_list[AGENT_MODULE_STATUS_NORMAL] = __('Normal');
$status_list[AGENT_MODULE_STATUS_WARNING] = __('Warning');
$status_list[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical');
$status_list[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown');
$status_list[AGENT_MODULE_STATUS_NOT_NORMAL] = __('Not normal');
$status_list[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init');
$table->data['form_modules_3'][1] = html_print_select($status_list,
'status_module', 'selected', '', __('All'), AGENT_MODULE_STATUS_ALL, true);
$table->data['form_modules_3'][3] = '';
$table->rowstyle['form_modules_2'] = 'vertical-align: top;';
$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
@ -569,6 +581,10 @@ $(document).ready (function () {
if (this.value != '0')
params['id_tipo_modulo'] = this.value;
var status_module = $('#status_module').val();
if (status_module != '-1')
params['status_module'] = status_module;
$("#module_loading").show ();
$("tr#delete_table-edit1, tr#delete_table-edit2").hide ();
$("#module_name").attr ("disabled", "disabled")
@ -712,6 +728,16 @@ $(document).ready (function () {
return false;
}
});
$("#status_module").change(function() {
selector = $("#form_modules input[name=selection_mode]:checked").val();
if(selector == 'agents') {
$("#id_agents").trigger("change");
}
else if(selector == 'modules') {
$("#module_type").trigger("change");
}
});
});
/* ]]> */
</script>

View File

@ -76,6 +76,8 @@ if ($update_agents) {
$values['custom_id'] = get_parameter('custom_id');
if (get_parameter ('cascade_protection', -1) != -1)
$values['cascade_protection'] = get_parameter('cascade_protection');
if (get_parameter ('cascade_protection_module', -1) != -1)
$values['cascade_protection_module'] = get_parameter('cascade_protection_module');
if (get_parameter ('delete_conf', 0) != 0)
$values['delete_conf'] = get_parameter('delete_conf');
if (get_parameter('quiet_select', -1) != -1)
@ -220,7 +222,9 @@ $status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
$table->data[1][0] = __('Status');
$table->data[1][1] = html_print_select($status_list, 'status_agents', 'selected',
'', __('All'), AGENT_STATUS_ALL, true);
$table->data[1][2] = __('Show agents');
$table->data[1][3] = html_print_select (array(0 => 'Only enabled',1 => 'Only disabled'), 'disabled',2,'',__('All'),
2,true,'','','','','width:30%;');
$table->data[2][0] = __('Agents');
$table->data[2][0] .= '<span id="agent_loading" class="invisible">';
$table->data[2][0] .= html_print_image('images/spinner.png', true);
@ -264,6 +268,15 @@ $table->data = array ();
$groups = users_get_groups ($config["id_user"], "AW",false);
$agents = agents_get_group_agents (array_keys ($groups));
$modules = db_get_all_rows_sql("SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
WHERE id_agente = " . $id_parent);
$modules_values = array();
$modules_values[0] = __('Any');
foreach ($modules as $m) {
$modules_values[$m['id_module']] = $m['name'];
}
$table->data[0][0] = __('Parent');
$params = array();
$params['return'] = true;
@ -277,6 +290,8 @@ $table->data[0][1] .= "<b>" . __('Cascade protection'). "</b>&nbsp;" .
html_print_select(array(1 => __('Yes'), 0 => __('No')),
"cascade_protection", -1, "", __('No change'), -1, true);
$table->data[0][1] .= "&nbsp;&nbsp;" . __('Module') . "&nbsp;" . html_print_select ($modules, "cascade_protection_module", $cascade_protection_module, "", "", 0, true);
$table->data[1][0] = __('Group');
$table->data[1][1] = html_print_select_groups(false, "AR", false, 'group', $group, '', __('No change'), -1, true, false, true, '', false, 'width: 150px;');
@ -313,6 +328,7 @@ $new_agent = true;
$icon_path = '';
$update_gis_data = -1;
$cascade_protection = -1;
$cascade_protection_module = -1;
$quiet_select = -1;
$table = new StdClass();
@ -474,7 +490,54 @@ var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?
//Use this function for change 3 icons when change the selectbox
$(document).ready (function () {
var checked = $("#cascade_protection").val();
$("#cascade_protection_module").attr("disabled", 'disabled');
$("#cascade_protection").change(function () {
var checked = $("#cascade_protection").val();
if (checked == 1) {
$("#cascade_protection_module").removeAttr("disabled");
}
else {
$("#cascade_protection_module").val(0);
$("#cascade_protection_module").attr("disabled", 'disabled');
}
});
$("#text-id_parent").on("autocompletechange", function () {
agent_name = $("#text-id_parent").val();
var params = {};
params["get_agent_modules_json_by_name"] = 1;
params["agent_name"] = agent_name;
params["page"] = "include/ajax/module";
jQuery.ajax ({
data: params,
dataType: "json",
type: "POST",
url: "ajax.php",
success: function (data) {
$('#cascade_protection_module').empty();
$('#cascade_protection_module')
.append ($('<option></option>')
.html("Any")
.prop("value", 0)
.prop("selected", 'selected'));
jQuery.each (data, function (i, val) {
$('#cascade_protection_module')
.append ($('<option></option>')
.html(val['name'])
.prop("value", val['id_module'])
.prop("selected", 'selected'));
});
}
});
});
$("#form_agent").submit(function() {
var get_parameters_count = window.location.href.slice(
window.location.href.indexOf('?') + 1).split('&').length;
@ -489,6 +552,14 @@ $(document).ready (function () {
}
});
var disabled;
$("#disabled").click(function () {
disabled = this.value;
$("#id_group").trigger("change");
});
$("#id_agents").change (function () {
var idAgents = Array();
@ -530,22 +601,28 @@ $(document).ready (function () {
});
$("#id_group").pandoraSelectGroupAgent ({
status_agents: function () {
return $("#status_agents").val();
},
agentSelect: "select#id_agents",
privilege: "AW",
status_agents: function () {
return $("#status_agents").val();
},
recursion: function() {return recursion}
recursion: function() {
return recursion;
},
disabled: function() {
return disabled;
}
});
$("#status_agents").change(function() {
$("#id_group").trigger("change");
});
$("#id_group").pandoraSelectGroupAgentDisabled ({
agentSelect: "select#id_agents",
recursion: function() {return recursion}
});
disabled = 2;
$("#id_group").trigger("change");
});
function changeIcons() {

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