mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-26 03:19:05 +02:00
Merge branch 'develop' into 1013-snmp-alert-dont-send-agent-alias-dev
pandora_server/lib/PandoraFMS/Core.pm
This commit is contained in:
commit
230c617c02
@ -127094,7 +127094,7 @@ msgstr ""
|
||||
#: ../../Documentos/Pandoras/pandorafms_develop/pandora_console/godmode/setup/setup_ehorus.php:87
|
||||
#: ../../Documentos/COPIA SEG/godmode/setup/setup_ehorus.php:87
|
||||
#: ../../code/pandorafms/pandora_console/godmode/setup/setup_ehorus.php:87
|
||||
msgid "e.g., switch.ehorus.com"
|
||||
msgid "e.g., portal.ehorus.com"
|
||||
msgstr ""
|
||||
|
||||
#: ../../Documentos/Pandoras/pandorafms_develop/pandora_console/godmode/setup/setup_ehorus.php:92
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.705, AIX version
|
||||
# Version 7.0NG.707, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.705, FreeBSD Version
|
||||
# Version 7.0NG.707, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.705, HP-UX Version
|
||||
# Version 7.0NG.707, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.705, GNU/Linux
|
||||
# Version 7.0NG.707, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.705, GNU/Linux
|
||||
# Version 7.0NG.707, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.705, Solaris Version
|
||||
# Version 7.0NG.707, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2010 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.705
|
||||
# Version 7.0NG.707
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.705, AIX version
|
||||
# Version 7.0NG.707, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.705
|
||||
# Version 7.0NG.707
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.705, HPUX Version
|
||||
# Version 7.0NG.707, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.705
|
||||
# Version 7.0NG.707
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.705
|
||||
# Version 7.0NG.707
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.705
|
||||
# Version 7.0NG.707
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.705, Solaris version
|
||||
# Version 7.0NG.707, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.705, AIX version
|
||||
# Version 7.0NG.707, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.705-170621
|
||||
Version: 7.0NG.707-170712
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.705-170621"
|
||||
pandora_version="7.0NG.707-170712"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.705, GNU/Linux
|
||||
# Version 7.0NG.707, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.705, FreeBSD Version
|
||||
# Version 7.0NG.707, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.705, HP-UX Version
|
||||
# Version 7.0NG.707, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.705, GNU/Linux
|
||||
# Version 7.0NG.707, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.705, GNU/Linux
|
||||
# Version 7.0NG.707, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.705, NetBSD Version
|
||||
# Version 7.0NG.707, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.705, Solaris Version
|
||||
# Version 7.0NG.707, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -40,8 +40,8 @@ my $Sem = undef;
|
||||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.705';
|
||||
use constant AGENT_BUILD => '170621';
|
||||
use constant AGENT_VERSION => '7.0NG.707';
|
||||
use constant AGENT_BUILD => '170712';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -2,8 +2,8 @@
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.705
|
||||
%define release 170621
|
||||
%define version 7.0NG.707
|
||||
%define release 170712
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -2,8 +2,8 @@
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.705
|
||||
%define release 170621
|
||||
%define version 7.0NG.707
|
||||
%define release 170712
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -9,8 +9,8 @@
|
||||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.705"
|
||||
PI_BUILD="170621"
|
||||
PI_VERSION="7.0NG.707"
|
||||
PI_BUILD="170712"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -1,17 +1,20 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
###############################################################################
|
||||
########################################################################
|
||||
# Pandora FMS - Remote Event Tool (via WEB API)
|
||||
###############################################################################
|
||||
########################################################################
|
||||
# Copyright (c) 2013 Artica Soluciones Tecnologicas S.L
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License version 2
|
||||
###############################################################################
|
||||
########################################################################
|
||||
|
||||
# Includes list
|
||||
use strict;
|
||||
use LWP::Simple;
|
||||
use MIME::Base64;
|
||||
use lib '/usr/lib/perl5';
|
||||
use PandoraFMS::Tools;
|
||||
|
||||
# Init
|
||||
tool_api_init();
|
||||
@ -19,61 +22,65 @@ tool_api_init();
|
||||
# Main
|
||||
tool_api_main();
|
||||
|
||||
##############################################################################
|
||||
########################################################################
|
||||
# Print a help screen and exit.
|
||||
##############################################################################
|
||||
########################################################################
|
||||
sub help_screen{
|
||||
|
||||
print "Options to create event:
|
||||
|
||||
\t$0 -p <path_to_consoleAPI> -create event <options>
|
||||
\t$0 -p <path_to_consoleAPI> -u <credentials> -create_event <options>
|
||||
|
||||
Where options:\n
|
||||
-u <credentials>
|
||||
-create_event
|
||||
-name <event_name> : Free text
|
||||
-group <id_group> : Group ID (use 0 for 'all')
|
||||
-type <event_type> : unknown, alert_fired, alert_recovered, alert_ceased
|
||||
alert_manual_validation, system, error, new_agent
|
||||
configuration_change, going_unknown, going_down_critical,
|
||||
going_down_warning, going_up_normal
|
||||
-u <credentials> : API credentials separated by comma: <api_pass>,<user>,<pass>
|
||||
-name <event_name> : Free text
|
||||
-group <id_group> : Group ID (use 0 for 'all')
|
||||
-agent : Agent ID
|
||||
|
||||
Optional parameters:
|
||||
|
||||
[-agent <id_agent>] : Agent ID
|
||||
[-user <id_user>] : User comment (use in combination with -comment option)
|
||||
[-status <status>] : 0 New, 1 Validated, 2 In process
|
||||
[-am <id_agent_module>] : ID Agent Module linked to event
|
||||
[-alert <id_alert_am>] : ID Alert Module linked to event
|
||||
[-criticity <criticity>] : 0 Maintance, 1 Informative, 2 Normal,
|
||||
3 Warning, 4 Crit, 5 Minor, 6 Major
|
||||
|
||||
[-comment <user_comment>] : Free text for comment
|
||||
[-tag <tags>] : Tag (must exist in the system to be imported)
|
||||
[-source <source>] : (By default 'Pandora')
|
||||
[-status <status>] : 0 New, 1 Validated, 2 In process
|
||||
[-user <id_user>] : User comment (use in combination with -comment option)
|
||||
[-type <event_type>] : unknown, alert_fired, alert_recovered, alert_ceased
|
||||
alert_manual_validation, system, error, new_agent
|
||||
configuration_change, going_unknown, going_down_critical,
|
||||
going_down_warning, going_up_normal
|
||||
[-severity <severity>] : 0 Maintance,
|
||||
1 Informative,
|
||||
2 Normal,
|
||||
3 Warning,
|
||||
4 Crit,
|
||||
5 Minor,
|
||||
6 Major
|
||||
[-am <id_agent_module>] : ID Agent Module linked to event
|
||||
[-alert <id_alert_am>] : ID Alert Module linked to event
|
||||
[-c_instructions <critical_instructions>]
|
||||
[-w_instructions <warning_instructions>]
|
||||
[-u_instructions <unknown_instructions>]
|
||||
[-owner <owner_user>] : Use the login name, not the descriptive \n\n";
|
||||
|
||||
print "Credential/API syntax: \n\n\t";
|
||||
print "<credentials>: API credentials separated by comma: <api_pass>,<user>,<pass>\n\n";
|
||||
[-user_comment <comment>]
|
||||
[-owner_user <owner event>] : Use the login name, not the descriptive
|
||||
[-source <source>] : (By default 'Pandora')
|
||||
[-tag <tags>] : Tag (must exist in the system to be imported)
|
||||
[-custom_data <custom_data>]: Custom data has to be in JSON format. Example: -custom_data \'{\"test1\" : \"t1\", \"test2\": \"2\"}\'
|
||||
[-id_extra <id extra>] : Id extra
|
||||
[-agent_name <Agent name>] : Agent name, Not to be confused with the alias.
|
||||
[-force_create_agent<0 o 1>]: Force the creation of agent through an event this will create when it is 1.
|
||||
[-server_id <server_id>] : The pandora node server_id\n\n";
|
||||
|
||||
print "Example of event generation:\n\n";
|
||||
|
||||
print "\t$0 -p http://192.168.70.160/pandora_console/include/api.php -u pot12,admin,pandora \
|
||||
\t-create_event -name \"Sample event executed from commandline\" -group 2 -type \"system\" -agent 2 \
|
||||
\t-user \"admin\" -status 0 -am 0 -alert 9 -criticity 3 -comment \"User comments\" -tag \"tags\" \
|
||||
\t-source \"Commandline\" -c_instructions \"Critical instructions\" \
|
||||
\t-w_instructions \"Warning instructions\" -u_instructions \"Unknown instructions\" -owner \"other\" ";
|
||||
print "\t./pandora_revent.pl -p http://localhost/pandora_console/include/api.php -u 1234,admin,pandora \
|
||||
\t-create_event -name \"SampleEvent\" -group 2 -agent 189 -status 0 -user \"admin\" -type \"system\" \
|
||||
\t-severity 3 -am 0 -alert 9 -c_instructions \"Critical instructions\" -w_instructions \"Warning instructions\" \
|
||||
\t-u_instructions \"Unknown instructions\" -id_extra \"id extra\" -agent_name \"agent name\" -source \"Commandline\" -tag \"Tags\"";
|
||||
|
||||
print "\n\nOptions to validate event: \n\n\t";
|
||||
print "$0 -p <path_to_consoleAPI> -u <credentials> -validate_event <options> -id <id_event>\n\n";
|
||||
print "Sample of event validation: \n\n\t";
|
||||
print "\n\n\nOptions to validate event: \n\n\t";
|
||||
print "$0 -p <path_to_consoleAPI> -u <credentials> -validate_event <options> -id <id_event>\n\n";
|
||||
print "Sample of event validation: \n\n\t";
|
||||
|
||||
print "$0 -p http://localhost/pandora/include/api.php -u pot12,admin,pandora -validate_event -id 234";
|
||||
print "\n\n\n";
|
||||
exit;
|
||||
print "$0 -p http://localhost/pandora/include/api.php -u pot12,admin,pandora -validate_event -id 234";
|
||||
print "\n\n\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
@ -81,7 +88,7 @@ Optional parameters:
|
||||
##############################################################################
|
||||
sub tool_api_init () {
|
||||
|
||||
print "\nPandora FMS Remote Event Tool Copyright (c) 2015 Artica ST\n";
|
||||
print "\nPandora FMS Remote Event Tool Copyright (c) 2013-2015 Artica ST\n";
|
||||
print "This program is Free Software, licensed under the terms of GPL License v2\n";
|
||||
print "You can download latest versions and documentation at http://www.pandorafms.org\n\n";
|
||||
|
||||
@ -95,11 +102,11 @@ sub tool_api_init () {
|
||||
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
########################################################################
|
||||
########################################################################
|
||||
# MAIN
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
########################################################################
|
||||
########################################################################
|
||||
|
||||
sub tool_api_main () {
|
||||
|
||||
@ -114,33 +121,37 @@ sub tool_api_main () {
|
||||
my $db_pass;
|
||||
my @db_info;
|
||||
my $id_agent;
|
||||
my $agent_name;
|
||||
my $id_user = '';
|
||||
my $status = '';
|
||||
my $id_agent_module = '';
|
||||
my $module_name = '';
|
||||
my $id_alert_am = '';
|
||||
my $criticity = '';
|
||||
my $severity = '';
|
||||
my $user_comment = '';
|
||||
my $tags = '';
|
||||
my $source = '';
|
||||
my $id_extra = '';
|
||||
my $critical_instructions = '';
|
||||
my $warning_instructions = '';
|
||||
my $unknown_instructions = '';
|
||||
my $id_extra = '';
|
||||
my $agent_name = '';
|
||||
my $force_create_agent = 0;
|
||||
my $owner_user = '';
|
||||
my $id_event;
|
||||
my $option = $ARGV[4];
|
||||
my $call_api;
|
||||
my $custom_data = "";
|
||||
my $server_id = 0;
|
||||
|
||||
#~ help or api path (required)
|
||||
if ($ARGV[0] eq '-h') {
|
||||
print "HELP!\n";
|
||||
help_screen();
|
||||
} elsif ($ARGV[0] ne '-p') {
|
||||
}
|
||||
elsif ($ARGV[0] ne '-p') {
|
||||
print "[ERROR] Missing API path! Read help info:\n\n";
|
||||
help_screen ();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$api_path = $ARGV[1];
|
||||
}
|
||||
|
||||
@ -152,105 +163,149 @@ sub tool_api_main () {
|
||||
if ($#db_info < 2) {
|
||||
print "[ERROR] Invalid database credentials! Read help info:\n\n";
|
||||
help_screen();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$api_pass = $db_info[0];
|
||||
$db_user = $db_info[1];
|
||||
$db_pass = $db_info[2];
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
print "[ERROR] Missing database credentials! Read help info:\n\n";
|
||||
help_screen ();
|
||||
}
|
||||
|
||||
if ($ARGV[4] eq '-create_event') {
|
||||
#~ event name (required)
|
||||
if ($ARGV[5] ne '-name') {
|
||||
print "[ERROR] Missing event name! Read help info:\n\n";
|
||||
help_screen ();
|
||||
} else {
|
||||
$event_name = $ARGV[6];
|
||||
}
|
||||
|
||||
#~ id group (required)
|
||||
if ($ARGV[7] ne '-group') {
|
||||
print "[ERROR] Missing event group! Read help info:\n\n";
|
||||
help_screen ();
|
||||
} else {
|
||||
$id_group = $ARGV[8];
|
||||
}
|
||||
|
||||
#~ id group (required)
|
||||
if ($ARGV[9] ne '-type') {
|
||||
print "[ERROR] Missing event type! Read help info:\n\n";
|
||||
help_screen ();
|
||||
} else {
|
||||
$event_type = $ARGV[10];
|
||||
}
|
||||
|
||||
# -agent_name, -module_name and -extra are not supported by api. Maybe in the future
|
||||
my $i = 0;
|
||||
foreach (@ARGV) {
|
||||
my $line = $_;
|
||||
|
||||
#-----------DEBUG----------------------------
|
||||
#print("i " . $i . " line " . $line . "\n");
|
||||
|
||||
if ($line eq '-agent') {
|
||||
$id_agent = $ARGV[$i+1];
|
||||
$id_agent = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-agent_name') {
|
||||
$agent_name = $ARGV[$i+1];
|
||||
if ($line eq '-group') {
|
||||
$id_group = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-name') {
|
||||
$event_name = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-type') {
|
||||
$event_type = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-user') {
|
||||
$id_user = $ARGV[$i+1];
|
||||
$id_user = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-status') {
|
||||
$status = $ARGV[$i+1];
|
||||
$status = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-am') {
|
||||
$id_agent_module = $ARGV[$i+1];
|
||||
}
|
||||
if ($line eq '-module_name') {
|
||||
$module_name = $ARGV[$i+1];
|
||||
$id_agent_module = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-alert') {
|
||||
$id_alert_am = $ARGV[$i+1];
|
||||
$id_alert_am = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-criticity') {
|
||||
$criticity = $ARGV[$i+1];
|
||||
}
|
||||
if ($line eq '-comment') {
|
||||
$user_comment = $ARGV[$i+1];
|
||||
if ($line eq '-severity') {
|
||||
$severity = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-tag') {
|
||||
$tags = $ARGV[$i+1];
|
||||
$tags = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-source') {
|
||||
$source = $ARGV[$i+1];
|
||||
}
|
||||
if ($line eq '-extra') {
|
||||
$id_extra = $ARGV[$i+1];
|
||||
$source = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-c_instructions') {
|
||||
$critical_instructions = $ARGV[$i+1];
|
||||
$critical_instructions = $ARGV[$i + 1];
|
||||
$critical_instructions = uri_encode($critical_instructions);
|
||||
}
|
||||
if ($line eq '-w_instructions') {
|
||||
$warning_instructions = $ARGV[$i+1];
|
||||
$warning_instructions = $ARGV[$i + 1];
|
||||
$warning_instructions = uri_encode($warning_instructions);
|
||||
}
|
||||
if ($line eq '-u_instructions') {
|
||||
$unknown_instructions = $ARGV[$i+1];
|
||||
$unknown_instructions = $ARGV[$i + 1];
|
||||
$unknown_instructions = uri_encode($unknown_instructions);
|
||||
}
|
||||
if ($line eq '-owner') {
|
||||
$owner_user = $ARGV[$i+1];
|
||||
if ($line eq '-id_extra') {
|
||||
$id_extra = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-agent_name') {
|
||||
$agent_name = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-force_create_agent') {
|
||||
$force_create_agent = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-user_comment') {
|
||||
$user_comment = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-owner_user') {
|
||||
$owner_user = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-custom_data') {
|
||||
$custom_data = $ARGV[$i + 1];
|
||||
$custom_data = encode_base64($custom_data, '');
|
||||
}
|
||||
if ($line eq '-server_id') {
|
||||
$server_id = $ARGV[$i + 1];
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$data_event .= $event_name.",".$id_group.",".$id_agent.",".$status.",".$id_user.",".$event_type.",".$criticity.",".$id_agent_module.",".$id_alert_am.",".$critical_instructions.",".$warning_instructions.",".$unknown_instructions.",".$user_comment.",".$owner_user.",".$source.",".$tags.",";
|
||||
$call_api = $api_path.'?op=set&op2=create_event&id='.$event_name.'&other='.$data_event.'&other_mode=url_encode_separator_,&apipass='.$api_pass.'&user='.$db_user.'&pass='.$db_pass;
|
||||
if ($event_name eq "") {
|
||||
print "[ERROR] Missing id agent! Read help info:\n\n";
|
||||
help_screen ();
|
||||
}
|
||||
if ($id_group eq "") {
|
||||
print "[ERROR] Missing event group! Read help info:\n\n";
|
||||
help_screen ();
|
||||
}
|
||||
if ($id_agent eq "" && $agent_name eq "") {
|
||||
print "[ERROR] Missing id agent! and agent_name Read help info:\n\n";
|
||||
help_screen ();
|
||||
}
|
||||
|
||||
} elsif ($ARGV[4] eq '-validate_event') {
|
||||
$data_event = $event_name .
|
||||
"|" . $id_group .
|
||||
"|" . $id_agent .
|
||||
"|" . $status .
|
||||
"|" . $id_user .
|
||||
"|" . $event_type .
|
||||
"|" . $severity .
|
||||
"|" . $id_agent_module .
|
||||
"|" . $id_alert_am .
|
||||
"|" . $critical_instructions .
|
||||
"|" . $warning_instructions .
|
||||
"|" . $unknown_instructions .
|
||||
"|" . $user_comment .
|
||||
"|" . $owner_user .
|
||||
"|" . $source .
|
||||
"|" . $tags .
|
||||
"|" . $custom_data .
|
||||
"|" . $server_id .
|
||||
"|" . $id_extra .
|
||||
"|" . $agent_name .
|
||||
"|" . $force_create_agent;
|
||||
|
||||
$call_api = $api_path . '?' .
|
||||
'op=set&' .
|
||||
'op2=create_event&' .
|
||||
'other=' . $data_event .'&' .
|
||||
'other_mode=url_encode_separator_|&' .
|
||||
'apipass=' . $api_pass . '&' .
|
||||
'user=' . $db_user . '&' .
|
||||
'pass=' . $db_pass;
|
||||
|
||||
}
|
||||
elsif ($ARGV[4] eq '-validate_event') {
|
||||
#~ id event(required)
|
||||
if ($ARGV[5] ne '-id') {
|
||||
print "[ERROR] Missing id event! Read help info:\n\n";
|
||||
help_screen ();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$id_event = $ARGV[6];
|
||||
}
|
||||
|
||||
@ -258,7 +313,7 @@ sub tool_api_main () {
|
||||
}
|
||||
|
||||
my @args = @ARGV;
|
||||
my $ltotal=$#args;
|
||||
my $ltotal=$#args;
|
||||
|
||||
if ($ltotal < 0) {
|
||||
print "[ERROR] No valid arguments. Read help info:\n\n";
|
||||
@ -272,15 +327,17 @@ sub tool_api_main () {
|
||||
if ($content eq undef) {
|
||||
print "[ERROR] Not respond or bad syntax. Read help info:\n\n";
|
||||
help_screen();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
print "Event ID: $content";
|
||||
}
|
||||
} elsif ($option eq '-validate_event') {
|
||||
}
|
||||
elsif ($option eq '-validate_event') {
|
||||
print "[RESULT] $content";
|
||||
}
|
||||
}
|
||||
|
||||
print "\nExiting!\n\n";
|
||||
print "\nExiting!\n\n";
|
||||
|
||||
exit;
|
||||
exit;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2014 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.705
|
||||
# Version 7.0NG.707
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
||||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.705}
|
||||
{Pandora FMS Windows Agent v7.0NG.707}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{170621}
|
||||
{170712}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.705(Build 170621)")
|
||||
#define PANDORA_VERSION ("7.0NG.707(Build 170712)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.705(Build 170621))"
|
||||
VALUE "ProductVersion", "(7.0NG.707(Build 170712))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.705-170621
|
||||
Version: 7.0NG.707-170712
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.705-170621"
|
||||
pandora_version="7.0NG.707-170712"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -93,7 +93,7 @@ function mainAgentsAlerts() {
|
||||
$groups = users_get_groups ();
|
||||
|
||||
$filter_groups .= '<b>'.__('Group').'</b>';
|
||||
$filter_groups .= html_print_select_groups(false, "AR", true, 'group_id', $group_id, false, '', '', true, false, true, '', false , 'width: 100px; margin-right: 10px;; margin-top: 5px;');
|
||||
$filter_groups .= html_print_select_groups(false, "AR", true, 'group_id', $group_id, false, '', '', true, false, true, '', false , 'margin-right: 10px; margin-top: 5px;');
|
||||
|
||||
$check = '<b>'.__('Show modules without alerts').'</b>';
|
||||
$check .= html_print_checkbox('slides_ids[]', $d['id'], $show_modules, true, false, '', true);
|
||||
|
@ -710,6 +710,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
|
||||
`module_names` TEXT,
|
||||
`module_free_text` TEXT,
|
||||
`each_agent` tinyint(1) default 1,
|
||||
`historical_db` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
PRIMARY KEY(`id_rc`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -72,7 +72,7 @@ echo '<div id="login_body" ' . $login_body_style . '>';
|
||||
echo '<div id="header_login">';
|
||||
echo '<div id="icon_custom_pandora">';
|
||||
|
||||
if (PANDORA_ENTERPRISE) {
|
||||
if (file_exists (ENTERPRISE_DIR . "/load_enterprise.php")) {
|
||||
if(isset ($config['custom_logo'])){
|
||||
echo '<img src="enterprise/images/custom_logo/' . $config['custom_logo'] .'" alt="pandora_console">';
|
||||
}
|
||||
@ -88,7 +88,7 @@ echo '<div id="header_login">';
|
||||
echo '<div id="list_icon_docs_support"><ul>';
|
||||
echo '<li><a href="http://wiki.pandorafms.com/" target="_blank"><img src="images/icono_docs.png" alt="docs pandora"></a></li>';
|
||||
echo '<li>' . __('Docs') . '</li>';
|
||||
if (defined ('PANDORA_ENTERPRISE')) {
|
||||
if (file_exists (ENTERPRISE_DIR . "/load_enterprise.php")) {
|
||||
echo '<li id="li_margin_left"><a href="https://support.artica.es" target="_blank"><img src="images/icono_support.png" alt="support pandora"></a></li>';
|
||||
} else {
|
||||
echo '<li id="li_margin_left"><a href="https://pandorafms.com/monitoring-services/support/" target="_blank"><img src="images/icono_support.png" alt="support pandora"></a></li>';
|
||||
@ -136,7 +136,7 @@ echo '<div class="login_page">';
|
||||
case 'login':
|
||||
if (!empty ($page) && !empty ($sec)) {
|
||||
foreach ($_POST as $key => $value) {
|
||||
html_print_input_hidden ($key, $value);
|
||||
html_print_input_hidden (io_safe_input($key), $value);
|
||||
}
|
||||
}
|
||||
if ($config['auth'] == 'saml') {
|
||||
@ -192,7 +192,7 @@ echo '<div class="login_page">';
|
||||
case 'double_auth':
|
||||
if (!empty ($page) && !empty ($sec)) {
|
||||
foreach ($_POST as $key => $value) {
|
||||
html_print_input_hidden ($key, $value);
|
||||
html_print_input_hidden (io_safe_input($key), $value);
|
||||
}
|
||||
}
|
||||
echo '<div class="login_nick">';
|
||||
@ -234,7 +234,7 @@ echo '<div class="login_page">';
|
||||
echo '<div class="login_data">';
|
||||
echo '<div class ="text_banner_login">';
|
||||
echo '<div><span class="span1">';
|
||||
if(defined ('PANDORA_ENTERPRISE')){
|
||||
if(file_exists (ENTERPRISE_DIR . "/load_enterprise.php")){
|
||||
if($config['custom_title1_login']){
|
||||
echo strtoupper(io_safe_output($config['custom_title1_login']));
|
||||
}
|
||||
@ -247,7 +247,7 @@ echo '<div class="login_page">';
|
||||
}
|
||||
echo '</span></div>';
|
||||
echo '<div><span class="span2">';
|
||||
if(defined ('PANDORA_ENTERPRISE')){
|
||||
if(file_exists (ENTERPRISE_DIR . "/load_enterprise.php")){
|
||||
if($config['custom_title2_login']){
|
||||
echo strtoupper(io_safe_output($config['custom_title2_login']));
|
||||
}
|
||||
@ -261,7 +261,7 @@ echo '<div class="login_page">';
|
||||
echo '</span></div>';
|
||||
echo '</div>';
|
||||
echo '<div class ="img_banner_login">';
|
||||
if (defined ('PANDORA_ENTERPRISE')) {
|
||||
if (file_exists (ENTERPRISE_DIR . "/load_enterprise.php")) {
|
||||
if(isset($config['custom_splash_login'])){
|
||||
html_print_image ("enterprise/images/custom_splash_login/".$config['custom_splash_login'], false, array ( "alt" => "splash", "border" => 0, "title" => $splash_title), false, true);
|
||||
}
|
||||
|
@ -886,7 +886,7 @@ if ($update_module || $create_module) {
|
||||
|
||||
$post_process = (string) get_parameter ('post_process', 0.0);
|
||||
if(get_parameter ('prediction_module')){
|
||||
$prediction_module = get_parameter ('prediction_module');
|
||||
$prediction_module = 1;
|
||||
}
|
||||
else{
|
||||
$prediction_module = 0;
|
||||
|
@ -150,7 +150,7 @@ if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "AW"))
|
||||
$return_all_group = false;
|
||||
else
|
||||
$return_all_group = true;
|
||||
html_print_select_groups(false, "AR", $return_all_group, "ag_group", $ag_group, 'this.form.submit();', '', 0, false, false, true, '', false, 'width:100px;');
|
||||
html_print_select_groups(false, "AR", $return_all_group, "ag_group", $ag_group, 'this.form.submit();', '', 0, false, false, true, '', false);
|
||||
|
||||
echo "<td>";
|
||||
echo __('Show Agents') . ' ';
|
||||
|
@ -698,7 +698,7 @@ if ($id_downtime > 0) {
|
||||
|
||||
|
||||
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>";
|
||||
html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'min-width:180px;width:180px;max-width:180px;margin-right:15px;');
|
||||
html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'min-width:180px;margin-right:15px;');
|
||||
|
||||
html_print_checkbox ("recursion", 1, $recursion, false, false, '');
|
||||
echo __('Recursion') . ' ';
|
||||
|
@ -496,7 +496,7 @@ $table->data['edit3'][0] = __('Post process') .
|
||||
ui_print_help_icon ('postprocess', true);
|
||||
|
||||
$table->data['edit3'][1] = html_print_extended_select_for_post_process('post_process',
|
||||
0, '', 0, '', false, true, 'width:150px;', true);
|
||||
-1, '','', 0, false, true, 'width:150px;', true, false, 1);
|
||||
|
||||
$table->data['edit3'][2] = __('SMNP community');
|
||||
$table->data['edit3'][3] = html_print_input_text ('snmp_community', '',
|
||||
@ -1153,6 +1153,11 @@ function process_manage_edit ($module_name, $agents_select = null) {
|
||||
$values['plugin_pass'] = io_input_password($value);
|
||||
}
|
||||
break;
|
||||
case 'post_process':
|
||||
if($value !== '-1'){
|
||||
$values['post_process'] = $value;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ($value != '') {
|
||||
$values[$field] = $value;
|
||||
|
@ -430,7 +430,7 @@ switch ($action) {
|
||||
$table_aux->colspan[0][0] = 4;
|
||||
$table_aux->data[0][0] = "<b>". __("Group") . "</b>";
|
||||
|
||||
$table_aux->data[0][1] = html_print_select_groups(false, $access, true, 'id_group', $id_group, '', '', '', true, false, true, '', false, 'width:150px', false, false, 'id_grupo', $strict_user). '<br>';
|
||||
$table_aux->data[0][1] = html_print_select_groups(false, $access, true, 'id_group', $id_group, '', '', '', true, false, true, '', false, "", false, false, 'id_grupo', $strict_user). '<br>';
|
||||
|
||||
$table_aux->data[0][2] = "<b>". __("Free text for search: ") . ui_print_help_tip(
|
||||
__('Search by report name or description, list matches.'),true) . "</b>";
|
||||
|
@ -84,7 +84,7 @@ $table_remote->data['ehorus_pass'] = $row;
|
||||
$row = array();
|
||||
$row['name'] = __('API Hostname');
|
||||
$row['control'] = html_print_input_text('ehorus_hostname', $config['ehorus_hostname'], '', 30, 100, true);
|
||||
$row['control'] .= ui_print_help_tip(__('Hostname of the eHorus API') . '. ' . __('Without protocol and port') . '. ' . __('e.g., switch.ehorus.com'), true);
|
||||
$row['control'] .= ui_print_help_tip(__('Hostname of the eHorus API') . '. ' . __('Without protocol and port') . '. ' . __('e.g., portal.ehorus.com'), true);
|
||||
$table_remote->data['ehorus_hostname'] = $row;
|
||||
|
||||
// Directory port
|
||||
|
@ -517,11 +517,11 @@ if ($table_events) {
|
||||
$date_subtract_day = time() - (24 * 60 * 60);
|
||||
|
||||
if($all_events_24h){
|
||||
events_print_event_table ("utimestamp > $date_subtract_day", 10, '100%',
|
||||
events_print_event_table ("utimestamp > $date_subtract_day", 200, '100%',
|
||||
false, $id_agente,true);
|
||||
}
|
||||
else{
|
||||
events_print_event_table ("estado <> 1 $tags_condition", 10, '100%',
|
||||
events_print_event_table ("estado <> 1 $tags_condition", 200, '100%',
|
||||
false, $id_agente,true);
|
||||
}
|
||||
}
|
||||
|
@ -22,8 +22,8 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC170621';
|
||||
$pandora_version = 'v7.0NG.705';
|
||||
$build_version = 'PC170712';
|
||||
$pandora_version = 'v7.0NG.707';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
File diff suppressed because one or more lines are too long
43
pandora_console/include/ehorus/bundle.min.js
vendored
43
pandora_console/include/ehorus/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
@ -37,6 +37,12 @@ div.term-container div.terminal {
|
||||
-webkit-transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
.button-color-animate {
|
||||
color: #337ab7;
|
||||
-webkit-transition: color 2000ms linear;
|
||||
-ms-transition: color 2000ms linear;
|
||||
transition: color 2000ms linear;
|
||||
}
|
||||
@-moz-keyframes spin {
|
||||
from {
|
||||
transform: scale(1) rotate(0deg);
|
||||
|
@ -61,7 +61,7 @@
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
left: -9999em;
|
||||
top: -9999em;
|
||||
top: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
z-index: -10;
|
||||
@ -71,7 +71,22 @@
|
||||
resize: none;
|
||||
}
|
||||
|
||||
.terminal .terminal-cursor {
|
||||
.terminal a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.terminal a:hover {
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.terminal a.xterm-invalid-link:hover {
|
||||
cursor: text;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.terminal.focus:not(.xterm-cursor-style-underline):not(.xterm-cursor-style-bar) .terminal-cursor {
|
||||
background-color: #fff;
|
||||
color: #000;
|
||||
}
|
||||
@ -82,19 +97,41 @@
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.terminal.focus .terminal-cursor.blinking {
|
||||
animation: blink-cursor 1.2s infinite step-end;
|
||||
.terminal:not(.xterm-cursor-style-underline):not(.xterm-cursor-style-bar).focus.xterm-cursor-blink-on .terminal-cursor {
|
||||
background-color: transparent;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
@keyframes blink-cursor {
|
||||
0% {
|
||||
background-color: #fff;
|
||||
color: #000;
|
||||
}
|
||||
50% {
|
||||
background-color: transparent;
|
||||
color: #FFF;
|
||||
}
|
||||
.terminal.xterm-cursor-style-bar .terminal-cursor,
|
||||
.terminal.xterm-cursor-style-underline .terminal-cursor {
|
||||
position: relative;
|
||||
}
|
||||
.terminal.xterm-cursor-style-bar .terminal-cursor::before,
|
||||
.terminal.xterm-cursor-style-underline .terminal-cursor::before {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
background-color: #fff;
|
||||
}
|
||||
.terminal.xterm-cursor-style-bar .terminal-cursor::before {
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 1px;
|
||||
}
|
||||
.terminal.xterm-cursor-style-underline .terminal-cursor::before {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 1px;
|
||||
}
|
||||
.terminal.xterm-cursor-style-bar.focus.xterm-cursor-blink.xterm-cursor-blink-on .terminal-cursor::before,
|
||||
.terminal.xterm-cursor-style-underline.focus.xterm-cursor-blink.xterm-cursor-blink-on .terminal-cursor::before {
|
||||
background-color: transparent;
|
||||
}
|
||||
.terminal.xterm-cursor-style-bar.focus.xterm-cursor-blink .terminal-cursor::before,
|
||||
.terminal.xterm-cursor-style-underline.focus.xterm-cursor-blink .terminal-cursor::before {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.terminal .composition-view {
|
||||
@ -116,6 +153,10 @@
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.terminal .xterm-wide-char {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.terminal .xterm-rows {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
|
@ -8867,12 +8867,47 @@ function api_set_create_event($id, $trash1, $other, $returnType) {
|
||||
returnError('error_parameter', 'Group ID required.');
|
||||
return;
|
||||
}
|
||||
|
||||
$error_msg ='';
|
||||
if ($other['data'][2] != '') {
|
||||
$values['id_agente'] = $other['data'][2];
|
||||
$id_agent_exist = db_get_value('id_agente', 'tagente', 'id_agente', $other['data'][2]);
|
||||
if($id_agent_exist){
|
||||
$values['id_agente'] = $other['data'][2];
|
||||
}
|
||||
else{
|
||||
$error_msg = 'id_not_exist';
|
||||
}
|
||||
}
|
||||
else {
|
||||
returnError('error_parameter', 'Agent ID required.');
|
||||
if($other['data'][19] != ''){
|
||||
$values['id_agente'] = db_get_value('id_agente', 'tagente', 'nombre', $other['data'][19]);
|
||||
if(!$values['id_agente']){
|
||||
if($other['data'][20] == 1){
|
||||
$values['id_agente'] = db_process_sql_insert ('tagente',
|
||||
array ( 'nombre' => $other['data'][19],
|
||||
'id_grupo' => $other['data'][1],
|
||||
'alias' => $other['data'][19] )
|
||||
);
|
||||
}
|
||||
else{
|
||||
$error_msg = 'name_not_exist';
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$error_msg = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
if($error_msg != ''){
|
||||
if($error_msg == 'id_not_exist'){
|
||||
returnError('error_parameter', 'Agent ID does not exist.');
|
||||
}
|
||||
elseif($error_msg == 'name_not_exist'){
|
||||
returnError('error_parameter', 'Agent Name does not exist.');
|
||||
}
|
||||
elseif($error_msg == 'none'){
|
||||
returnError('error_parameter', 'Agent ID or name required.');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -8961,7 +8996,19 @@ function api_set_create_event($id, $trash1, $other, $returnType) {
|
||||
else {
|
||||
$values['server_id'] = 0;
|
||||
}
|
||||
|
||||
if ($other['data'][18] != '') {
|
||||
$values['id_extra'] = $other['data'][18];
|
||||
$sql_validation = 'SELECT id_evento FROM tevento where estado=0 and id_extra ="'. $other['data'][18] .'";';
|
||||
$validation = db_get_all_rows_sql($sql_validation);
|
||||
if($validation){
|
||||
foreach ($validation as $val) {
|
||||
api_set_validate_event_by_id($val['id_evento']);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$values['id_extra'] = '';
|
||||
}
|
||||
$return = events_create_event(
|
||||
$values['event'], $values['id_grupo'], $values['id_agente'],
|
||||
$values['status'], $values['id_usuario'],
|
||||
@ -8971,7 +9018,7 @@ function api_set_create_event($id, $trash1, $other, $returnType) {
|
||||
$values['warning_instructions'],
|
||||
$values['unknown_instructions'], $values['source'],
|
||||
$values['tags'], $values['custom_data'],
|
||||
$values['server_id']);
|
||||
$values['server_id'], $values['id_extra']);
|
||||
|
||||
if ($other['data'][12] != '') { //user comments
|
||||
if ($return !== false) { //event successfully created
|
||||
@ -9138,12 +9185,10 @@ function api_get_netflow_get_summary ($discard_1, $discard_2, $params) {
|
||||
//http://localhost/pandora_console/include/api.php?op=set&op2=validate_event_by_id&id=23&apipass=1234&user=admin&pass=pandora
|
||||
function api_set_validate_event_by_id ($id, $trash1, $trash2, $returnType) {
|
||||
global $config;
|
||||
|
||||
$data['type'] = 'string';
|
||||
$check_id = db_get_value('id_evento', 'tevento', 'id_evento', $id);
|
||||
|
||||
if ($check_id) { //event exists
|
||||
|
||||
$status = db_get_value('estado', 'tevento', 'id_evento', $id);
|
||||
if ($status == 1) { //event already validated
|
||||
$data['data'] = "Event already validated";
|
||||
|
@ -1749,7 +1749,7 @@ function config_process_config () {
|
||||
config_update_value('ehorus_custom_field', 'eHorusID');
|
||||
}
|
||||
if (!isset($config['ehorus_hostname'])) {
|
||||
config_update_value('ehorus_hostname', 'switch.ehorus.com');
|
||||
config_update_value('ehorus_hostname', 'portal.ehorus.com');
|
||||
}
|
||||
if (!isset($config['ehorus_port'])) {
|
||||
config_update_value('ehorus_port', 18080);
|
||||
|
@ -703,7 +703,7 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
|
||||
$id_user = "", $event_type = "unknown", $priority = 0,
|
||||
$id_agent_module = 0, $id_aam = 0, $critical_instructions = '',
|
||||
$warning_instructions = '', $unknown_instructions = '',
|
||||
$source="Pandora", $tags="", $custom_data="", $server_id = 0) {
|
||||
$source="Pandora", $tags="", $custom_data="", $server_id = 0, $id_extra ="") {
|
||||
|
||||
global $config;
|
||||
|
||||
@ -719,15 +719,15 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
|
||||
event_type, criticity, id_agentmodule, id_alert_am,
|
||||
critical_instructions, warning_instructions,
|
||||
unknown_instructions, source, tags, custom_data,
|
||||
server_id)
|
||||
server_id, id_extra)
|
||||
VALUES (%d, %d, "%s", NOW(), %d, UNIX_TIMESTAMP(NOW()),
|
||||
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s",
|
||||
"%s", "%s", %d)',
|
||||
"%s", "%s", %d, "%s")',
|
||||
$id_agent, $id_group, $event, $status, $id_user,
|
||||
$event_type, $priority, $id_agent_module, $id_aam,
|
||||
$critical_instructions, $warning_instructions,
|
||||
$unknown_instructions, $source, $tags, $custom_data,
|
||||
$server_id);
|
||||
$server_id, $id_extra);
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf ('
|
||||
@ -736,16 +736,16 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
|
||||
event_type, criticity, id_agentmodule, id_alert_am,
|
||||
critical_instructions, warning_instructions,
|
||||
unknown_instructions, source, tags, custom_data,
|
||||
server_id)
|
||||
server_id, id_extra)
|
||||
VALUES (%d, %d, "%s", NOW(), %d,
|
||||
ceil(date_part(\'epoch\', CURRENT_TIMESTAMP)), "%s",
|
||||
"%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s",
|
||||
"%s", %d)',
|
||||
"%s", %d, "%s")',
|
||||
$id_agent, $id_group, $event, $status, $id_user,
|
||||
$event_type, $priority, $id_agent_module, $id_aam,
|
||||
$critical_instructions, $warning_instructions,
|
||||
$unknown_instructions, $source, $tags, $custom_data,
|
||||
$server_id);
|
||||
$server_id, $id_extra);
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = sprintf ('
|
||||
@ -754,15 +754,15 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
|
||||
event_type, criticity, id_agentmodule, id_alert_am,
|
||||
critical_instructions, warning_instructions,
|
||||
unknown_instructions, source, tags, custom_data,
|
||||
server_id)
|
||||
server_id, id_extra)
|
||||
VALUES (%d, %d, "%s", CURRENT_TIMESTAMP, %d, UNIX_TIMESTAMP,
|
||||
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s",
|
||||
"%s", "%s", %d)',
|
||||
"%s", "%s", %d, "%s")',
|
||||
$id_agent, $id_group, $event, $status, $id_user,
|
||||
$event_type, $priority, $id_agent_module, $id_aam,
|
||||
$critical_instructions, $warning_instructions,
|
||||
$unknown_instructions, $source, $tags, $custom_data,
|
||||
$server_id);
|
||||
$server_id, $id_extra);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -774,13 +774,13 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
|
||||
timestamp, estado, utimestamp, id_usuario,
|
||||
event_type, criticity, id_agentmodule, id_alert_am,
|
||||
critical_instructions, warning_instructions,
|
||||
unknown_instructions, source, tags, custom_data)
|
||||
unknown_instructions, source, tags, custom_data, id_extra)
|
||||
VALUES (%d, %d, "%s", NOW(), %d, UNIX_TIMESTAMP(NOW()),
|
||||
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s")',
|
||||
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", "%s")',
|
||||
$id_agent, $id_group, $event, $status, $id_user,
|
||||
$event_type, $priority, $id_agent_module, $id_aam,
|
||||
$critical_instructions, $warning_instructions,
|
||||
$unknown_instructions, $source, $tags, $custom_data);
|
||||
$unknown_instructions, $source, $tags, $custom_data, $id_extra);
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf ('
|
||||
@ -788,14 +788,14 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
|
||||
timestamp, estado, utimestamp, id_usuario,
|
||||
event_type, criticity, id_agentmodule, id_alert_am,
|
||||
critical_instructions, warning_instructions,
|
||||
unknown_instructions, source, tags, custom_data)
|
||||
unknown_instructions, source, tags, custom_data, id_extra)
|
||||
VALUES (%d, %d, "%s", NOW(), %d,
|
||||
ceil(date_part(\'epoch\', CURRENT_TIMESTAMP)), "%s",
|
||||
"%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s")',
|
||||
"%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", "%s")',
|
||||
$id_agent, $id_group, $event, $status, $id_user,
|
||||
$event_type, $priority, $id_agent_module, $id_aam,
|
||||
$critical_instructions, $warning_instructions,
|
||||
$unknown_instructions, $source, $tags, $custom_data);
|
||||
$unknown_instructions, $source, $tags, $custom_data, $id_extra);
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = sprintf ("
|
||||
@ -803,13 +803,13 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
|
||||
timestamp, estado, utimestamp, id_usuario,
|
||||
event_type, criticity, id_agentmodule, id_alert_am,
|
||||
critical_instructions, warning_instructions,
|
||||
unknown_instructions, source, tags, custom_data)
|
||||
unknown_instructions, source, tags, custom_data, id_extra)
|
||||
VALUES (%d, %d, '%s', CURRENT_TIMESTAMP, %d, UNIX_TIMESTAMP,
|
||||
'%s', '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s')",
|
||||
'%s', '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
|
||||
$id_agent, $id_group, $event, $status, $id_user,
|
||||
$event_type, $priority, $id_agent_module, $id_aam,
|
||||
$critical_instructions, $warning_instructions,
|
||||
$unknown_instructions, $source, $tags, $custom_data);
|
||||
$unknown_instructions, $source, $tags, $custom_data, $id_extra);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -3396,7 +3396,7 @@ function events_sql_events_grouped_agents($id_agent, $server_id = -1,
|
||||
}
|
||||
|
||||
//Search by tag
|
||||
if (!empty($tag_with)) {
|
||||
if (!empty($tag_with) && (io_safe_output($tag_with) != "[]") && (io_safe_output($tag_with) != "[\"0\"]")) {
|
||||
$sql_post .= ' AND ( ';
|
||||
$first = true;
|
||||
foreach ($tag_with as $id_tag) {
|
||||
@ -3406,7 +3406,7 @@ function events_sql_events_grouped_agents($id_agent, $server_id = -1,
|
||||
}
|
||||
$sql_post .= ' ) ';
|
||||
}
|
||||
if (!empty($tag_without)) {
|
||||
if (!empty($tag_without) && (io_safe_output($tag_without) != "[]") && (io_safe_output($tag_with) != "[\"0\"]")) {
|
||||
$sql_post .= ' AND ( ';
|
||||
$first = true;
|
||||
foreach ($tag_without as $id_tag) {
|
||||
|
@ -579,11 +579,46 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
|
||||
}
|
||||
else {
|
||||
$data = db_get_all_rows_filter ('tagente_datos',
|
||||
array ('id_agente_modulo' => (int)$agent_module_id,
|
||||
"utimestamp > $datelimit",
|
||||
"utimestamp < $date",
|
||||
'order' => 'utimestamp ASC'),
|
||||
array ('datos', 'utimestamp'), 'AND', $search_in_history_db);
|
||||
array ('id_agente_modulo' => (int)$agent_module_id,
|
||||
"utimestamp > $datelimit",
|
||||
"utimestamp < $date",
|
||||
'order' => 'utimestamp ASC'),
|
||||
array ('datos', 'utimestamp'), 'AND', false);
|
||||
|
||||
if ($search_in_history_db) {
|
||||
$cache = false;
|
||||
$history = false;
|
||||
|
||||
$sql = "SELECT datos, utimestamp FROM tagente_datos WHERE id_agente_modulo = " . (int)$agent_module_id .
|
||||
" AND utimestamp > " . $datelimit . " AND utimestamp < " . $date .
|
||||
" ORDER BY utimestamp ASC";
|
||||
|
||||
// Connect to the history DB
|
||||
if (! isset ($config['history_db_connection']) || $config['history_db_connection'] === false) {
|
||||
$config['history_db_connection'] = db_connect($config['history_db_host'], $config['history_db_name'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_port'], false);
|
||||
}
|
||||
if ($config['history_db_connection'] !== false) {
|
||||
$history = mysql_db_process_sql ($sql, 'affected_rows', $config['history_db_connection'], false);
|
||||
}
|
||||
|
||||
if ($history === false) {
|
||||
$history = array ();
|
||||
}
|
||||
|
||||
$new_data = array();
|
||||
$last_timestamp = 0;
|
||||
foreach($history as $h) {
|
||||
$new_data[] = $h;
|
||||
$last_timestamp = $h['utimestamp'];
|
||||
}
|
||||
foreach($data as $d) {
|
||||
if ($d['utimestamp'] > $last_timestamp) {
|
||||
$new_data[] = $d;
|
||||
$last_timestamp = $d['utimestamp'];
|
||||
}
|
||||
}
|
||||
$data = $new_data;
|
||||
}
|
||||
}
|
||||
|
||||
// Get module warning_min and critical_min
|
||||
@ -3419,7 +3454,12 @@ function graph_custom_sql_graph ($id, $width, $height,
|
||||
global $config;
|
||||
|
||||
$report_content = db_get_row ('treport_content', 'id_rc', $id);
|
||||
$historical_db = db_get_value_sql("SELECT historical_db from treport_content where id_rc =".$id);
|
||||
if($id != null){
|
||||
$historical_db = db_get_value_sql("SELECT historical_db from treport_content where id_rc =".$id);
|
||||
}
|
||||
else{
|
||||
$historical_db = $content['historical_db'];
|
||||
}
|
||||
if ($report_content["external_source"] != "") {
|
||||
$sql = io_safe_output ($report_content["external_source"]);
|
||||
}
|
||||
@ -3868,7 +3908,9 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
|
||||
$timestamp_short = date($time_format, $timestamp);
|
||||
$long_index[$timestamp_short] = date(
|
||||
html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp);
|
||||
$timestamp = $timestamp_short;
|
||||
if (!$fullscale) {
|
||||
$timestamp = $timestamp_short;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
if ($total > $max_value) {
|
||||
|
@ -609,7 +609,7 @@ function html_print_select_from_sql ($sql, $name, $selected = '',
|
||||
function html_print_extended_select_for_post_process($name, $selected = '',
|
||||
$script = '', $nothing = '', $nothing_value = '0', $size = false,
|
||||
$return = false, $select_style = false, $unique_name = true,
|
||||
$disabled = false) {
|
||||
$disabled = false, $no_change = 0) {
|
||||
|
||||
global $config;
|
||||
|
||||
@ -617,6 +617,10 @@ function html_print_extended_select_for_post_process($name, $selected = '',
|
||||
|
||||
|
||||
$fields = post_process_get_custom_values();
|
||||
if($no_change != 0){
|
||||
$fields[-1] = __('No change');
|
||||
}
|
||||
|
||||
$selected_float = (float)$selected;
|
||||
$found = false;
|
||||
|
||||
|
@ -148,8 +148,9 @@ function networkmap_process_networkmap($id = 0) {
|
||||
case "WINNT":
|
||||
case "Windows":
|
||||
$filename_plain = sys_get_temp_dir() . "\\plain.txt";
|
||||
$cmd = $config['graphviz_win'] . "$filter -Tplain -o " . $filename_plain . " " .
|
||||
$filename_dot;
|
||||
|
||||
$cmd = io_safe_output($config['graphviz_bin_dir'] . "\\$filter.exe -Tplain -o " . $filename_plain . " " .
|
||||
$filename_dot);
|
||||
break;
|
||||
default:
|
||||
$filename_plain = sys_get_temp_dir() . "/plain.txt";
|
||||
@ -165,6 +166,8 @@ function networkmap_process_networkmap($id = 0) {
|
||||
$nodes = networkmap_loadfile($id, $filename_plain,
|
||||
$relation_nodes, $graph);
|
||||
|
||||
unlink($filename_plain);
|
||||
|
||||
//Set the position of modules
|
||||
foreach ($nodes as $key => $node) {
|
||||
if ($node['type'] == 'module') {
|
||||
@ -265,8 +268,6 @@ function networkmap_process_networkmap($id = 0) {
|
||||
db_process_sql_update('tmap',
|
||||
array('center_x' => $networkmap['center_x'], 'center_y' => $networkmap['center_y']),
|
||||
array('id' => $id));
|
||||
|
||||
unlink($filename_plain);
|
||||
}
|
||||
|
||||
return $nodes_and_relations;
|
||||
|
@ -128,6 +128,26 @@ function reporting_make_reporting_data($report = null, $id_report,
|
||||
$content['period'] = $period;
|
||||
}
|
||||
|
||||
if(defined('METACONSOLE')){
|
||||
if (is_array($content['id_agent'])) {
|
||||
$new_array = array();
|
||||
foreach ($content['id_agent'] as $key => $value) {
|
||||
$meta_id = explode("|",$value);
|
||||
array_push($new_array,$meta_id[1]);
|
||||
}
|
||||
$content['id_agent'] = $new_array;
|
||||
}
|
||||
else {
|
||||
$meta_id = explode("|",$content['id_agent']);
|
||||
if ($meta_id[1] != null) {
|
||||
$content['id_agent'] = array();
|
||||
$content['id_agent'] = $meta_id[1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$content['style'] = json_decode(io_safe_output($content['style']), true);
|
||||
if(isset($content['style']['name_label'])){
|
||||
//Add macros name
|
||||
@ -147,7 +167,18 @@ function reporting_make_reporting_data($report = null, $id_report,
|
||||
}
|
||||
}
|
||||
|
||||
$content['name'] = reporting_label_macro($items_label, $content['style']['name_label']);
|
||||
|
||||
|
||||
if(sizeof($content['id_agent']) != 1){
|
||||
$content['style']['name_label'] = str_replace("_agent_",sizeof($content['id_agent']).__(' agents'),$content['style']['name_label']);
|
||||
}
|
||||
|
||||
if(sizeof($content['id_agent_module']) != 1){
|
||||
$content['style']['name_label'] = str_replace("_module_",sizeof($content['id_agent_module']).__(' modules'),$content['style']['name_label']);
|
||||
}
|
||||
|
||||
$content['name'] = reporting_label_macro($items_label, $content['style']['name_label']);
|
||||
|
||||
|
||||
if ($metaconsole_on) {
|
||||
//Restore db connection
|
||||
@ -3940,9 +3971,12 @@ function reporting_sql($report, $content) {
|
||||
$header = explode('|', $content['header_definition']);
|
||||
$return['header'] = $header;
|
||||
}
|
||||
|
||||
$historical_db = db_get_value_sql("SELECT historical_db from treport_content where id_rc =".$content['id_rc']);
|
||||
|
||||
if($content['id_rc'] != null){
|
||||
$historical_db = db_get_value_sql("SELECT historical_db from treport_content where id_rc =".$content['id_rc']);
|
||||
}
|
||||
else{
|
||||
$historical_db = $content['historical_db'];
|
||||
}
|
||||
$result = db_get_all_rows_sql($sql,$historical_db);
|
||||
if ($result !== false) {
|
||||
|
||||
@ -4339,6 +4373,20 @@ function reporting_advanced_sla ($id_agent_module, $time_from = null, $time_to =
|
||||
$max_value = null;
|
||||
$min_value = null;
|
||||
}
|
||||
if ( (!isset($min_value)) && (!isset($max_value)) ) {
|
||||
if ( ($agentmodule_info["id_tipo_modulo"] == "2") // generic_proc
|
||||
|| ($agentmodule_info["id_tipo_modulo"] == "6") // remote_icmp_proc
|
||||
|| ($agentmodule_info["id_tipo_modulo"] == "9") // remote_tcp_proc
|
||||
|| ($agentmodule_info["id_tipo_modulo"] == "18") // remote_snmp_proc
|
||||
|| ($agentmodule_info["id_tipo_modulo"] == "21") // async_proc
|
||||
|| ($agentmodule_info["id_tipo_modulo"] == "31") ) { // web_proc
|
||||
// Boolean values are OK if they're different from 0
|
||||
$max_value = 0;
|
||||
$min_value = 0;
|
||||
$inverse_interval = 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// By default show last day
|
||||
@ -5763,17 +5811,12 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
|
||||
|
||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||
|
||||
if ($type_report == 'automatic_graph') {
|
||||
// Do none
|
||||
}
|
||||
else {
|
||||
if ($config['metaconsole']) {
|
||||
$id_meta = metaconsole_get_id_server($content["server_name"]);
|
||||
if ($config['metaconsole']) {
|
||||
$id_meta = metaconsole_get_id_server($content["server_name"]);
|
||||
|
||||
|
||||
$server = metaconsole_get_connection_by_id ($id_meta);
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
$server = metaconsole_get_connection_by_id ($id_meta);
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
$graph = db_get_row ("tgraph", "id_graph", $content['id_gs']);
|
||||
@ -5816,9 +5859,17 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
|
||||
|
||||
array_push ($weights, $graph_item["weight"]);
|
||||
if (in_array('label',$content['style'])) {
|
||||
if (defined('METACONSOLE')) {
|
||||
$item = array('type' => 'custom_graph',
|
||||
'id_agent' =>$content['id_agent'],
|
||||
'id_agent_module'=>$graph_item['id_agent_module']);
|
||||
}
|
||||
else {
|
||||
$item = array('type' => 'custom_graph',
|
||||
'id_agent' =>modules_get_agentmodule_agent($graph_item['id_agent_module']),
|
||||
'id_agent_module'=>$graph_item['id_agent_module']);
|
||||
}
|
||||
|
||||
$label = reporting_label_macro($item, $content['style']['label']);
|
||||
$labels[$graph_item['id_agent_module']] = $label;
|
||||
}
|
||||
@ -5838,6 +5889,13 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
|
||||
$height = 50;
|
||||
}
|
||||
}
|
||||
if (defined('METACONSOLE')) {
|
||||
$modules_new = array();
|
||||
foreach ($modules as $mod) {
|
||||
$modules_new[] = $mod['module'];
|
||||
}
|
||||
$modules = $modules_new;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'dinamic':
|
||||
@ -10234,7 +10292,6 @@ function reporting_get_agentmodule_sla_working_timestamp ($period, $date_end, $w
|
||||
}
|
||||
|
||||
function reporting_label_macro ($item, $label) {
|
||||
|
||||
switch ($item['type']) {
|
||||
case 'event_report_agent':
|
||||
case 'alert_report_agent':
|
||||
@ -10260,6 +10317,7 @@ function reporting_label_macro ($item, $label) {
|
||||
$label = str_replace("_address_", $agent_name, $label);
|
||||
}
|
||||
break;
|
||||
case 'automatic_graph':
|
||||
case 'simple_graph':
|
||||
case 'module_histogram_graph':
|
||||
case 'custom_graph':
|
||||
|
@ -1621,13 +1621,15 @@ function ui_pagination ($count, $url = false, $offset = 0,
|
||||
// Pagination links for users include delete, create and other params, now not use these params, and not retry the previous action when go to pagination link.
|
||||
|
||||
$remove = array("user_del","disable_user","delete_user");
|
||||
$finalUrl = $config['homeurl'].'?';
|
||||
foreach($_GET as $index => $get){
|
||||
if(!in_array($index, $remove)){
|
||||
$finalUrl .= $index.'='.$get.'&';
|
||||
$url = explode("&",$url);
|
||||
|
||||
$finalUrl = array();
|
||||
foreach ($url as $key => $value) {
|
||||
if(strpos($value, $remove[0]) === false && strpos($value, $remove[1]) === false && strpos($value, $remove[2]) === false){
|
||||
array_push($finalUrl,$value);
|
||||
}
|
||||
}
|
||||
$url = $finalUrl;
|
||||
$url = implode("&",$finalUrl);
|
||||
|
||||
/*
|
||||
URL passed render links with some parameter
|
||||
|
@ -188,7 +188,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
<td align="left" style="">' .
|
||||
html_print_input_text('label', '', '', 20, 200, true) . '
|
||||
<span id="advice_label" style="font-style:italic;z-index:3;display:inline;margin-top:0px;float:right;margin-right:100px;">
|
||||
'.__("Click right mouse button to change background label editor color").'
|
||||
'.__("Click right mouse button to change the background color of the label editor").'
|
||||
</span>
|
||||
</td>';
|
||||
|
||||
|
@ -16385,7 +16385,7 @@ msgid "Without protocol and port"
|
||||
msgstr ""
|
||||
|
||||
#: ../../godmode/setup/setup_ehorus.php:87
|
||||
msgid "e.g., switch.ehorus.com"
|
||||
msgid "e.g., portal.ehorus.com"
|
||||
msgstr ""
|
||||
|
||||
#: ../../godmode/setup/setup_ehorus.php:92
|
||||
|
@ -16547,7 +16547,7 @@ msgid "Without protocol and port"
|
||||
msgstr "Without protocol and port"
|
||||
|
||||
#: ../../godmode/setup/setup_ehorus.php:87
|
||||
msgid "e.g., switch.ehorus.com"
|
||||
msgid "e.g., portal.ehorus.com"
|
||||
msgstr "e.g., switch.eHorus.com"
|
||||
|
||||
#: ../../godmode/setup/setup_ehorus.php:92
|
||||
|
@ -16978,8 +16978,8 @@ msgid "Without protocol and port"
|
||||
msgstr "Sin protocolo y puerto"
|
||||
|
||||
#: ../../godmode/setup/setup_ehorus.php:87
|
||||
msgid "e.g., switch.ehorus.com"
|
||||
msgstr "e.g., switch.ehorus.com"
|
||||
msgid "e.g., portal.ehorus.com"
|
||||
msgstr "e.g., portal.ehorus.com"
|
||||
|
||||
#: ../../godmode/setup/setup_ehorus.php:92
|
||||
msgid "API Port"
|
||||
|
@ -17215,7 +17215,7 @@ msgid "Without protocol and port"
|
||||
msgstr ""
|
||||
|
||||
#: ../../godmode/setup/setup_ehorus.php:87
|
||||
msgid "e.g., switch.ehorus.com"
|
||||
msgid "e.g., portal.ehorus.com"
|
||||
msgstr ""
|
||||
|
||||
#: ../../godmode/setup/setup_ehorus.php:92
|
||||
|
@ -16299,8 +16299,8 @@ msgid "Without protocol and port"
|
||||
msgstr "プロトコルとポート番号は含みません"
|
||||
|
||||
#: ../../godmode/setup/setup_ehorus.php:87
|
||||
msgid "e.g., switch.ehorus.com"
|
||||
msgstr "例: switch.ehorus.com"
|
||||
msgid "e.g., portal.ehorus.com"
|
||||
msgstr "例: portal.ehorus.com"
|
||||
|
||||
#: ../../godmode/setup/setup_ehorus.php:92
|
||||
msgid "API Port"
|
||||
|
@ -351,7 +351,7 @@ if (! isset ($config['id_user'])) {
|
||||
|
||||
if (($nick_in_db != false) && ((!is_user_admin($nick)
|
||||
|| $config['enable_pass_policy_admin']))
|
||||
&& (defined('PANDORA_ENTERPRISE'))
|
||||
&& (file_exists (ENTERPRISE_DIR . "/load_enterprise.php"))
|
||||
&& ($config['enable_pass_policy'])) {
|
||||
include_once(ENTERPRISE_DIR . "/include/auth/mysql.php");
|
||||
|
||||
@ -523,12 +523,12 @@ if (! isset ($config['id_user'])) {
|
||||
else { //login wrong
|
||||
$blocked = false;
|
||||
|
||||
if ((!is_user_admin($nick) || $config['enable_pass_policy_admin']) && defined('PANDORA_ENTERPRISE')) {
|
||||
if ((!is_user_admin($nick) || $config['enable_pass_policy_admin']) && file_exists (ENTERPRISE_DIR . "/load_enterprise.php")) {
|
||||
$blocked = login_check_blocked($nick);
|
||||
}
|
||||
|
||||
if (!$blocked) {
|
||||
if (defined('PANDORA_ENTERPRISE')) {
|
||||
if (file_exists (ENTERPRISE_DIR . "/load_enterprise.php")) {
|
||||
login_check_failed($nick); //Checks failed attempts
|
||||
}
|
||||
$login_failed = true;
|
||||
|
@ -70,8 +70,8 @@
|
||||
<body>
|
||||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.705';
|
||||
$build = '170621';
|
||||
$version = '7.0NG.707';
|
||||
$build = '170712';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
@ -168,7 +168,7 @@ echo __('Group') . ' ';
|
||||
|
||||
$groups = users_get_groups (false, $access);
|
||||
|
||||
html_print_select_groups(false, $access, true, 'group_id', $group_id, 'this.form.submit()', '', '', false, false, true, '', false, 'width:150px');
|
||||
html_print_select_groups(false, $access, true, 'group_id', $group_id, 'this.form.submit()', '', '', false, false, true, '', false);
|
||||
|
||||
echo '</td><td style="white-space:nowrap;">';
|
||||
|
||||
|
@ -238,7 +238,7 @@ if (empty($export_btn) || $show_form) {
|
||||
|
||||
$table->data[0][1] = html_print_select_groups($config['id_user'],
|
||||
"RR", users_can_manage_group_all(), "group", $group, '', '', 0, true, false, true,
|
||||
'w130', false);
|
||||
'', false);
|
||||
|
||||
//Agent selector
|
||||
$table->data[1][0] = '<b>'.__('Source agent').'</b>';
|
||||
|
@ -290,7 +290,7 @@ $table->style[4] = 'font-weight: bold;';
|
||||
$table->data[0][0] = __('Group');
|
||||
$table->data[0][1] = html_print_select_groups($config['id_user'], 'AR',
|
||||
true, 'ag_group', $ag_group, '', '', '0', true, false,
|
||||
false, 'w130', false, 'width:150px;', false, false,
|
||||
false, '', false, '', false, false,
|
||||
'id_grupo', false);
|
||||
|
||||
$fields = array ();
|
||||
|
@ -613,7 +613,7 @@ $data = array();
|
||||
$data[0] = __('Group') . $jump;
|
||||
|
||||
$data[0] .= html_print_select_groups($config["id_user"], $access, true,
|
||||
'id_group', $id_group, '', '', 0, true, false, false, 'w130', false, false, false, false, 'id_grupo', $strict_user). $jump;
|
||||
'id_group', $id_group, '', '', 0, true, false, false, '', false, false, false, false, 'id_grupo', $strict_user). $jump;
|
||||
//**********************************************************************
|
||||
// TODO
|
||||
// This code is disabled for to enabled in Pandora 5.1
|
||||
|
@ -77,7 +77,7 @@ $table->style[1] = 'font-weight: bold; vertical-align: top;';
|
||||
$table->style[2] = 'font-weight: bold; vertical-align: top;';
|
||||
|
||||
$table->data[0][0] = __('Group');
|
||||
$table->data[0][1] = html_print_select_groups(false, $access, true, 'group', '', 'changeGroup();', '', 0, true, false, true, '', false, 'width:120px;') . '<br />' . '<br />';
|
||||
$table->data[0][1] = html_print_select_groups(false, $access, true, 'group', '', 'changeGroup();', '', 0, true, false, true, '', false, 'max-width:200px;') . '<br />' . '<br />';
|
||||
|
||||
$table->data[0][2] = __('Type');
|
||||
$table->data[0][3] = html_print_checkbox('alert_fired', 'alert_fired', true, true, false, 'changeType();') . __('Alert fired') . '<br />' .
|
||||
@ -276,6 +276,9 @@ $(document).ready (function () {
|
||||
setInterval("check_event()", (10 * 1000)); //10 seconds between ajax request
|
||||
$("#table1").css("background-color", "#fff");
|
||||
$("#table2").css("background-color", "#fff");
|
||||
|
||||
group_width = $("#group").width();
|
||||
$("#id_agents").width(group_width + 9);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
@ -347,7 +347,7 @@ echo '<form method="post" action="' . $config['homeurl'] .
|
||||
}
|
||||
else {
|
||||
echo "<td style='font-weight:bold;'>" . __('Dst Ip'). ui_print_help_tip (__("Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249"), true) . "</td>";
|
||||
echo "<td colspan='2'>" . html_print_input_text ('ip_dst', $filter['ip_dst'], false, 30, 80, true) . "</td>";
|
||||
echo "<td>" . html_print_input_text ('ip_dst', $filter['ip_dst'], false, 30, 80, true) . "</td>";
|
||||
}
|
||||
|
||||
if ($netflow_disable_custom_lvfilters) {
|
||||
@ -356,7 +356,7 @@ echo '<form method="post" action="' . $config['homeurl'] .
|
||||
}
|
||||
else {
|
||||
echo "<td style='font-weight:bold;'>" . __('Src Ip'). ui_print_help_tip (__("Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249"), true) . "</td>";
|
||||
echo "<td colspan='2'>" . html_print_input_text ('ip_src', $filter['ip_src'], false, 30, 80, true) . "</td>";
|
||||
echo "<td>" . html_print_input_text ('ip_src', $filter['ip_src'], false, 30, 80, true) . "</td>";
|
||||
}
|
||||
|
||||
echo "</tr>";
|
||||
@ -368,7 +368,7 @@ echo '<form method="post" action="' . $config['homeurl'] .
|
||||
}
|
||||
else {
|
||||
echo "<td style='font-weight:bold;'>" . __('Dst Port'). ui_print_help_tip (__("Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22"), true) . "</td>";
|
||||
echo "<td colspan='2'>" . html_print_input_text ('dst_port', $filter['dst_port'], false, 30, 80, true) . "</td>";
|
||||
echo "<td>" . html_print_input_text ('dst_port', $filter['dst_port'], false, 30, 80, true) . "</td>";
|
||||
}
|
||||
|
||||
if ($netflow_disable_custom_lvfilters) {
|
||||
@ -377,7 +377,7 @@ echo '<form method="post" action="' . $config['homeurl'] .
|
||||
}
|
||||
else {
|
||||
echo "<td style='font-weight:bold;'>" . __('Src Port') . ui_print_help_tip (__("Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22"), true) . "</td>";
|
||||
echo "<td colspan='2'>" . html_print_input_text ('src_port', $filter['src_port'], false, 30, 80, true) . "</td>";
|
||||
echo "<td>" . html_print_input_text ('src_port', $filter['src_port'], false, 30, 80, true) . "</td>";
|
||||
}
|
||||
|
||||
echo "</tr>";
|
||||
@ -397,21 +397,19 @@ echo '<form method="post" action="' . $config['homeurl'] .
|
||||
echo "<td>" . '<b>' . __('Aggregate by') . '</b>' . ui_print_help_icon ('aggregate_by', true) . "</td>";
|
||||
$aggregate_list = array();
|
||||
$aggregate_list = array ('none' => __('None'), 'proto' => __('Protocol'), 'srcip' =>__('Src Ip Address'), 'dstip' =>__('Dst Ip Address'), 'srcport' =>__('Src Port'), 'dstport' =>__('Dst Port') );
|
||||
echo "<td colspan='2'>" . html_print_select ($aggregate_list, "aggregate", $filter['aggregate'], '', '', 0, true, false, true, '', false) . "</td>";
|
||||
echo "<td>" . html_print_select ($aggregate_list, "aggregate", $filter['aggregate'], '', '', 0, true, false, true, '', false) . "</td>";
|
||||
|
||||
echo "<td>" . '<b>'.__('Router ip').'</b>' . "</td>";
|
||||
echo "<td colspan='2'>" . html_print_input_text ('router_ip', $filter['router_ip'], false, 30, 80, true) . "</td>";
|
||||
echo "<td>" . html_print_input_text ('router_ip', $filter['router_ip'], false, 30, 80, true) . "</td>";
|
||||
|
||||
echo "<td>" . '<b>'.__('Output format').'</b>' . "</td>";
|
||||
$show_output = array ('bytes' => __('Bytes'), 'bytespersecond' => __('Bytes per second'), 'kilobytes' => __('Kilobytes'), 'megabytes' => __('Megabytes'), 'kilobytespersecond' => __('Kilobytes per second'), 'megabytespersecond' => __('Megabytes per second'));
|
||||
echo "<td colspan='2'>" . html_print_select ($show_output, 'output', $filter['output'], '', '', 0, true, false, true, '', false) . "</td>";
|
||||
echo "<td>" . html_print_select ($show_output, 'output', $filter['output'], '', '', 0, true, false, true, '', false) . "</td>";
|
||||
|
||||
echo "</tr>";
|
||||
|
||||
echo "</table>";
|
||||
|
||||
//echo "<br />";
|
||||
|
||||
echo "<table class='' width='100%' style='border: 0px; text-align:right;'><tr><td>";
|
||||
|
||||
echo html_print_submit_button (__('Draw'), 'draw_button', false, 'class="sub upd"',true) ;
|
||||
@ -437,9 +435,9 @@ if ($draw != '') {
|
||||
}
|
||||
// Draw the netflow chart
|
||||
else {
|
||||
echo netflow_draw_item ($start_date, $end_date,
|
||||
$interval_length, $chart_type, $filter,
|
||||
$max_aggregates, $connection_name, 'HTML', $address_resolution);
|
||||
echo netflow_draw_item ($start_date, $end_date,
|
||||
$interval_length, $chart_type, $filter,
|
||||
$max_aggregates, $connection_name, 'HTML', $address_resolution);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ $severities = get_priorities ();
|
||||
$alerted = array (__('Not fired'), __('Fired'));
|
||||
foreach ($all_traps as $trap) {
|
||||
$agent = agents_get_agent_with_ip ($trap['source']);
|
||||
$agents[$trap["source"]] = $agent !== false ? $agent["nombre"] : $trap["source"];
|
||||
$agents[$trap["source"]] = $agent !== false ? ($agent["alias"] ? $agent["alias"] : $agent["nombre"]) : $trap["source"];
|
||||
$oid = enterprise_hook ('get_oid', array ($trap));
|
||||
if ($oid === ENTERPRISE_NOT_HOOK) {
|
||||
$oid = $trap["oid"];
|
||||
@ -774,7 +774,7 @@ if ($traps !== false) {
|
||||
continue;
|
||||
}
|
||||
$data[1] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent["id_agente"].'" title="'.__('View agent details').'">';
|
||||
$data[1] .= '<strong>'.$agent["nombre"].ui_print_help_tip($trap['source'], true, "images/tip-blanco.png");'</strong></a>';
|
||||
$data[1] .= '<strong>'.($agent["alias"] ? $agent["alias"] : $agent["nombre"]).ui_print_help_tip($trap['source'], true, "images/tip-blanco.png");'</strong></a>';
|
||||
}
|
||||
|
||||
//OID
|
||||
|
@ -2,8 +2,8 @@
|
||||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.705
|
||||
%define release 170621
|
||||
%define version 7.0NG.707
|
||||
%define release 170712
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -2,8 +2,8 @@
|
||||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.705
|
||||
%define release 170621
|
||||
%define version 7.0NG.707
|
||||
%define release 170712
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -9,7 +9,7 @@
|
||||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.705"
|
||||
PI_VERSION="7.0NG.707"
|
||||
FORCE=0
|
||||
DESTDIR=""
|
||||
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
||||
|
@ -2696,6 +2696,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
|
||||
`module_names` TEXT,
|
||||
`module_free_text` TEXT,
|
||||
`each_agent` tinyint(1) default 1,
|
||||
`historical_db` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
PRIMARY KEY(`id_rc`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -112,7 +112,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
||||
('MR', 3),
|
||||
('identification_reminder', 1),
|
||||
('identification_reminder_timestamp', 0),
|
||||
('current_package_enterprise', '705'),
|
||||
('current_package_enterprise', '707'),
|
||||
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}');
|
||||
|
||||
UNLOCK TABLES;
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-server
|
||||
Version: 7.0NG.705-170621
|
||||
Version: 7.0NG.707-170712
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.705-170621"
|
||||
pandora_version="7.0NG.707-170712"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
@ -102,8 +102,7 @@ sub pandora_startup () {
|
||||
$Config{"encryption_key"} = enterprise_hook('pandora_get_encryption_key', [\%Config, $Config{"encryption_passphrase"}]);
|
||||
|
||||
# Update the agent cache.
|
||||
enterprise_hook('update_agent_cache', [\%Config, $DBH]) if ($Config{'node_metaconsole'} == 1);
|
||||
|
||||
threads->create('enterprise_hook', ('update_agent_cache', [\%Config]))->detach() if ($Config{'node_metaconsole'} == 1);
|
||||
pandora_audit (\%Config, 'Pandora FMS Server Daemon starting', 'SYSTEM', 'System', $DBH);
|
||||
|
||||
# Load servers
|
||||
|
@ -1,7 +1,7 @@
|
||||
#############################################################################
|
||||
# Pandora FMS Server Parameters
|
||||
# Pandora FMS, the Flexible Monitoring System.
|
||||
# Version 7.0NG.705
|
||||
# Version 7.0NG.707
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2016 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -42,8 +42,8 @@ our @EXPORT = qw(
|
||||
);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.705";
|
||||
my $pandora_build = "170621";
|
||||
my $pandora_version = "7.0NG.707";
|
||||
my $pandora_build = "170712";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
@ -830,118 +830,118 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
||||
|
||||
if (!defined($alert->{'snmp_alert'})) {
|
||||
# Regular alerts
|
||||
$field1 = $action->{'field1'} ? $action->{'field1'} : $alert->{'field1'};
|
||||
$field2 = $action->{'field2'} ? $action->{'field2'} : $alert->{'field2'};
|
||||
$field3 = $action->{'field3'} ? $action->{'field3'} : $alert->{'field3'};
|
||||
$field4 = $action->{'field4'} ? $action->{'field4'} : $alert->{'field4'};
|
||||
$field5 = $action->{'field5'} ? $action->{'field5'} : $alert->{'field5'};
|
||||
$field6 = $action->{'field6'} ? $action->{'field6'} : $alert->{'field6'};
|
||||
$field7 = $action->{'field7'} ? $action->{'field7'} : $alert->{'field7'};
|
||||
$field8 = $action->{'field8'} ? $action->{'field8'} : $alert->{'field8'};
|
||||
$field9 = $action->{'field9'} ? $action->{'field9'} : $alert->{'field9'};
|
||||
$field10 = $action->{'field10'} ? $action->{'field10'} : $alert->{'field10'};
|
||||
$field11 = $action->{'field11'} ? $action->{'field11'} : $alert->{'field11'};
|
||||
$field12 = $action->{'field12'} ? $action->{'field12'} : $alert->{'field12'};
|
||||
$field13 = $action->{'field13'} ? $action->{'field13'} : $alert->{'field13'};
|
||||
$field14 = $action->{'field14'} ? $action->{'field14'} : $alert->{'field14'};
|
||||
$field15 = $action->{'field15'} ? $action->{'field15'} : $alert->{'field15'};
|
||||
$field1 = defined($action->{'field1'}) && $action->{'field1'} ne "" ? $action->{'field1'} : $alert->{'field1'};
|
||||
$field2 = defined($action->{'field2'}) && $action->{'field2'} ne "" ? $action->{'field2'} : $alert->{'field2'};
|
||||
$field3 = defined($action->{'field3'}) && $action->{'field3'} ne "" ? $action->{'field3'} : $alert->{'field3'};
|
||||
$field4 = defined($action->{'field4'}) && $action->{'field4'} ne "" ? $action->{'field4'} : $alert->{'field4'};
|
||||
$field5 = defined($action->{'field5'}) && $action->{'field5'} ne "" ? $action->{'field5'} : $alert->{'field5'};
|
||||
$field6 = defined($action->{'field6'}) && $action->{'field6'} ne "" ? $action->{'field6'} : $alert->{'field6'};
|
||||
$field7 = defined($action->{'field7'}) && $action->{'field7'} ne "" ? $action->{'field7'} : $alert->{'field7'};
|
||||
$field8 = defined($action->{'field8'}) && $action->{'field8'} ne "" ? $action->{'field8'} : $alert->{'field8'};
|
||||
$field9 = defined($action->{'field9'}) && $action->{'field9'} ne "" ? $action->{'field9'} : $alert->{'field9'};
|
||||
$field10 = defined($action->{'field10'}) && $action->{'field10'} ne "" ? $action->{'field10'} : $alert->{'field10'};
|
||||
$field11 = defined($action->{'field11'}) && $action->{'field11'} ne "" ? $action->{'field11'} : $alert->{'field11'};
|
||||
$field12 = defined($action->{'field12'}) && $action->{'field12'} ne "" ? $action->{'field12'} : $alert->{'field12'};
|
||||
$field13 = defined($action->{'field13'}) && $action->{'field13'} ne "" ? $action->{'field13'} : $alert->{'field13'};
|
||||
$field14 = defined($action->{'field14'}) && $action->{'field14'} ne "" ? $action->{'field14'} : $alert->{'field14'};
|
||||
$field15 = defined($action->{'field15'}) && $action->{'field15'} ne "" ? $action->{'field15'} : $alert->{'field15'};
|
||||
}
|
||||
else {
|
||||
$field1 = $alert->{'field1'} ? $alert->{'field1'} : $action->{'field1'};
|
||||
$field2 = $alert->{'field2'} ? $alert->{'field2'} : $action->{'field2'};
|
||||
$field3 = $alert->{'field3'} ? $alert->{'field3'} : $action->{'field3'};
|
||||
$field4 = $action->{'field4'} ? $action->{'field4'} : $alert->{'field4'};
|
||||
$field5 = $action->{'field5'} ? $action->{'field5'} : $alert->{'field5'};
|
||||
$field6 = $action->{'field6'} ? $action->{'field6'} : $alert->{'field6'};
|
||||
$field7 = $action->{'field7'} ? $action->{'field7'} : $alert->{'field7'};
|
||||
$field8 = $action->{'field8'} ? $action->{'field8'} : $alert->{'field8'};
|
||||
$field9 = $action->{'field9'} ? $action->{'field9'} : $alert->{'field9'};
|
||||
$field10 = $action->{'field10'} ? $action->{'field10'} : $alert->{'field10'};
|
||||
$field11 = $action->{'field11'} ? $action->{'field11'} : $alert->{'field11'};
|
||||
$field12 = $action->{'field12'} ? $action->{'field12'} : $alert->{'field12'};
|
||||
$field13 = $action->{'field13'} ? $action->{'field13'} : $alert->{'field13'};
|
||||
$field14 = $action->{'field14'} ? $action->{'field14'} : $alert->{'field14'};
|
||||
$field15 = $action->{'field15'} ? $action->{'field15'} : $alert->{'field15'};
|
||||
$field1 = defined($alert->{'field1'}) && $alert->{'field1'} ne "" ? $alert->{'field1'} : $action->{'field1'};
|
||||
$field2 = defined($alert->{'field2'}) && $alert->{'field2'} ne "" ? $alert->{'field2'} : $action->{'field2'};
|
||||
$field3 = defined($alert->{'field3'}) && $alert->{'field3'} ne "" ? $alert->{'field3'} : $action->{'field3'};
|
||||
$field4 = defined($action->{'field4'}) && $action->{'field4'} ne "" ? $action->{'field4'} : $alert->{'field4'};
|
||||
$field5 = defined($action->{'field5'}) && $action->{'field5'} ne "" ? $action->{'field5'} : $alert->{'field5'};
|
||||
$field6 = defined($action->{'field6'}) && $action->{'field6'} ne "" ? $action->{'field6'} : $alert->{'field6'};
|
||||
$field7 = defined($action->{'field7'}) && $action->{'field7'} ne "" ? $action->{'field7'} : $alert->{'field7'};
|
||||
$field8 = defined($action->{'field8'}) && $action->{'field8'} ne "" ? $action->{'field8'} : $alert->{'field8'};
|
||||
$field9 = defined($action->{'field9'}) && $action->{'field9'} ne "" ? $action->{'field9'} : $alert->{'field9'};
|
||||
$field10 = defined($action->{'field10'}) && $action->{'field10'} ne "" ? $action->{'field10'} : $alert->{'field10'};
|
||||
$field11 = defined($action->{'field11'}) && $action->{'field11'} ne "" ? $action->{'field11'} : $alert->{'field11'};
|
||||
$field12 = defined($action->{'field12'}) && $action->{'field12'} ne "" ? $action->{'field12'} : $alert->{'field12'};
|
||||
$field13 = defined($action->{'field13'}) && $action->{'field13'} ne "" ? $action->{'field13'} : $alert->{'field13'};
|
||||
$field14 = defined($action->{'field14'}) && $action->{'field14'} ne "" ? $action->{'field14'} : $alert->{'field14'};
|
||||
$field15 = defined($action->{'field15'}) && $action->{'field15'} ne "" ? $action->{'field15'} : $alert->{'field15'};
|
||||
}
|
||||
|
||||
# Recovery fields, thanks to Kato Atsushi
|
||||
if ($alert_mode == RECOVERED_ALERT) {
|
||||
# Field 1 is a special case where [RECOVER] prefix is not added even when it is defined
|
||||
$field1 = $alert->{'field1_recovery'} ? $alert->{'field1_recovery'} : $field1;
|
||||
$field1 = $action->{'field1_recovery'} ? $action->{'field1_recovery'} : $field1;
|
||||
$field1 = defined($alert->{'field1_recovery'}) && $alert->{'field1_recovery'} ne "" ? $alert->{'field1_recovery'} : $field1;
|
||||
$field1 = defined($action->{'field1_recovery'}) && $action->{'field1_recovery'} ne "" ? $action->{'field1_recovery'} : $field1;
|
||||
|
||||
$field2 = $field2 ? "[RECOVER]" . $field2 : "";
|
||||
$field2 = $alert->{'field2_recovery'} ? $alert->{'field2_recovery'} : $field2;
|
||||
$field2 = $action->{'field2_recovery'} ? $action->{'field2_recovery'} : $field2;
|
||||
$field2 = defined($field2) && $field2 ne "" ? "[RECOVER]" . $field2 : "";
|
||||
$field2 = defined($alert->{'field2_recovery'}) && $alert->{'field2_recovery'} ne "" ? $alert->{'field2_recovery'} : $field2;
|
||||
$field2 = defined($action->{'field2_recovery'}) && $action->{'field2_recovery'} ne "" ? $action->{'field2_recovery'} : $field2;
|
||||
|
||||
$field3 = $field3 ? "[RECOVER]" . $field3 : "";
|
||||
$field3 = $alert->{'field3_recovery'} ? $alert->{'field3_recovery'} : $field3;
|
||||
$field3 = $action->{'field3_recovery'} ? $action->{'field3_recovery'} : $field3;
|
||||
$field3 = defined($field3) && $field3 ne "" ? "[RECOVER]" . $field3 : "";
|
||||
$field3 = defined($alert->{'field3_recovery'}) && $alert->{'field3_recovery'} ne "" ? $alert->{'field3_recovery'} : $field3;
|
||||
$field3 = defined($action->{'field3_recovery'}) && $action->{'field3_recovery'} ne "" ? $action->{'field3_recovery'} : $field3;
|
||||
|
||||
$field4 = $field4 ? "[RECOVER]" . $field4 : "";
|
||||
$field4 = $alert->{'field4_recovery'} ? $alert->{'field4_recovery'} : $field4;
|
||||
$field4 = $action->{'field4_recovery'} ? $action->{'field4_recovery'} : $field4;
|
||||
$field4 = defined($field4) && $field4 ne "" ? "[RECOVER]" . $field4 : "";
|
||||
$field4 = defined($alert->{'field4_recovery'}) && $alert->{'field4_recovery'} ne "" ? $alert->{'field4_recovery'} : $field4;
|
||||
$field4 = defined($action->{'field4_recovery'}) && $action->{'field4_recovery'} ne "" ? $action->{'field4_recovery'} : $field4;
|
||||
|
||||
$field5 = $field5 ? "[RECOVER]" . $field5 : "";
|
||||
$field5 = $alert->{'field5_recovery'} ? $alert->{'field5_recovery'} : $field5;
|
||||
$field5 = $action->{'field5_recovery'} ? $action->{'field5_recovery'} : $field5;
|
||||
$field5 = defined($field5) && $field5 ne "" ? "[RECOVER]" . $field5 : "";
|
||||
$field5 = defined($alert->{'field5_recovery'}) && $alert->{'field5_recovery'} ne "" ? $alert->{'field5_recovery'} : $field5;
|
||||
$field5 = defined($action->{'field5_recovery'}) && $action->{'field5_recovery'} ne "" ? $action->{'field5_recovery'} : $field5;
|
||||
|
||||
$field6 = $field6 ? "[RECOVER]" . $field6 : "";
|
||||
$field6 = $alert->{'field6_recovery'} ? $alert->{'field6_recovery'} : $field6;
|
||||
$field6 = $action->{'field6_recovery'} ? $action->{'field6_recovery'} : $field6;
|
||||
$field6 = defined($field6) && $field6 ne "" ? "[RECOVER]" . $field6 : "";
|
||||
$field6 = defined($alert->{'field6_recovery'}) && $alert->{'field6_recovery'} ne "" ? $alert->{'field6_recovery'} : $field6;
|
||||
$field6 = defined($action->{'field6_recovery'}) && $action->{'field6_recovery'} ne "" ? $action->{'field6_recovery'} : $field6;
|
||||
|
||||
$field7 = $field7 ? "[RECOVER]" . $field7 : "";
|
||||
$field7 = $alert->{'field7_recovery'} ? $alert->{'field7_recovery'} : $field7;
|
||||
$field7 = $action->{'field7_recovery'} ? $action->{'field7_recovery'} : $field7;
|
||||
$field7 = defined($field7) && $field7 ne "" ? "[RECOVER]" . $field7 : "";
|
||||
$field7 = defined($alert->{'field7_recovery'}) && $alert->{'field7_recovery'} ne "" ? $alert->{'field7_recovery'} : $field7;
|
||||
$field7 = defined($action->{'field7_recovery'}) && $action->{'field7_recovery'} ne "" ? $action->{'field7_recovery'} : $field7;
|
||||
|
||||
$field8 = $field8 ? "[RECOVER]" . $field8 : "";
|
||||
$field8 = $alert->{'field8_recovery'} ? $alert->{'field8_recovery'} : $field8;
|
||||
$field8 = $action->{'field8_recovery'} ? $action->{'field8_recovery'} : $field8;
|
||||
$field8 = defined($field8) && $field8 ne "" ? "[RECOVER]" . $field8 : "";
|
||||
$field8 = defined($alert->{'field8_recovery'}) && $alert->{'field8_recovery'} ne "" ? $alert->{'field8_recovery'} : $field8;
|
||||
$field8 = defined($action->{'field8_recovery'}) && $action->{'field8_recovery'} ne "" ? $action->{'field8_recovery'} : $field8;
|
||||
|
||||
$field9 = $field9 ? "[RECOVER]" . $field9 : "";
|
||||
$field9 = $alert->{'field9_recovery'} ? $alert->{'field9_recovery'} : $field9;
|
||||
$field9 = $action->{'field9_recovery'} ? $action->{'field9_recovery'} : $field9;
|
||||
$field9 = defined($field9) && $field9 ne "" ? "[RECOVER]" . $field9 : "";
|
||||
$field9 = defined($alert->{'field9_recovery'}) && $alert->{'field9_recovery'} ne "" ? $alert->{'field9_recovery'} : $field9;
|
||||
$field9 = defined($action->{'field9_recovery'}) && $action->{'field9_recovery'} ne "" ? $action->{'field9_recovery'} : $field9;
|
||||
|
||||
$field10 = $field10 ? "[RECOVER]" . $field10 : "";
|
||||
$field10 = $alert->{'field10_recovery'} ? $alert->{'field10_recovery'} : $field10;
|
||||
$field10 = $action->{'field10_recovery'} ? $action->{'field10_recovery'} : $field10;
|
||||
$field10 = defined($field10) && $field10 ne "" ? "[RECOVER]" . $field10 : "";
|
||||
$field10 = defined($alert->{'field10_recovery'}) && $alert->{'field10_recovery'} ne "" ? $alert->{'field10_recovery'} : $field10;
|
||||
$field10 = defined($action->{'field10_recovery'}) && $action->{'field10_recovery'} ne "" ? $action->{'field10_recovery'} : $field10;
|
||||
|
||||
$field11 = $field11 ? "[RECOVER]" . $field11 : "";
|
||||
$field11 = $alert->{'field11_recovery'} ? $alert->{'field11_recovery'} : $field11;
|
||||
$field11 = $action->{'field11_recovery'} ? $action->{'field11_recovery'} : $field11;
|
||||
$field11 = defined($field11) && $field11 ne "" ? "[RECOVER]" . $field11 : "";
|
||||
$field11 = defined($alert->{'field11_recovery'}) && $alert->{'field11_recovery'} ne "" ? $alert->{'field11_recovery'} : $field11;
|
||||
$field11 = defined($action->{'field11_recovery'}) && $action->{'field11_recovery'} ne "" ? $action->{'field11_recovery'} : $field11;
|
||||
|
||||
$field12 = $field12 ? "[RECOVER]" . $field12 : "";
|
||||
$field12 = $alert->{'field12_recovery'} ? $alert->{'field12_recovery'} : $field12;
|
||||
$field12 = $action->{'field12_recovery'} ? $action->{'field12_recovery'} : $field12;
|
||||
$field12 = defined($field12) && $field12 ne "" ? "[RECOVER]" . $field12 : "";
|
||||
$field12 = defined($alert->{'field12_recovery'}) && $alert->{'field12_recovery'} ne "" ? $alert->{'field12_recovery'} : $field12;
|
||||
$field12 = defined($action->{'field12_recovery'}) && $action->{'field12_recovery'} ne "" ? $action->{'field12_recovery'} : $field12;
|
||||
|
||||
$field13 = $field13 ? "[RECOVER]" . $field13 : "";
|
||||
$field13 = $alert->{'field13_recovery'} ? $alert->{'field13_recovery'} : $field13;
|
||||
$field13 = $action->{'field13_recovery'} ? $action->{'field13_recovery'} : $field13;
|
||||
$field13 = defined($field13) && $field13 ne "" ? "[RECOVER]" . $field13 : "";
|
||||
$field13 = defined($alert->{'field13_recovery'}) && $alert->{'field13_recovery'} ne "" ? $alert->{'field13_recovery'} : $field13;
|
||||
$field13 = defined($action->{'field13_recovery'}) && $action->{'field13_recovery'} ne "" ? $action->{'field13_recovery'} : $field13;
|
||||
|
||||
$field14 = $field14 ? "[RECOVER]" . $field14 : "";
|
||||
$field14 = $alert->{'field14_recovery'} ? $alert->{'field14_recovery'} : $field14;
|
||||
$field14 = $action->{'field14_recovery'} ? $action->{'field14_recovery'} : $field14;
|
||||
$field14 = defined($field14) && $field14 ne "" ? "[RECOVER]" . $field14 : "";
|
||||
$field14 = defined($alert->{'field14_recovery'}) && $alert->{'field14_recovery'} ne "" ? $alert->{'field14_recovery'} : $field14;
|
||||
$field14 = defined($action->{'field14_recovery'}) && $action->{'field14_recovery'} ne "" ? $action->{'field14_recovery'} : $field14;
|
||||
|
||||
$field15 = $field15 ? "[RECOVER]" . $field15 : "";
|
||||
$field15 = $alert->{'field15_recovery'} ? $alert->{'field15_recovery'} : $field15;
|
||||
$field15 = $action->{'field15_recovery'} ? $action->{'field15_recovery'} : $field15;
|
||||
$field15 = defined($field15) && $field15 ne "" ? "[RECOVER]" . $field15 : "";
|
||||
$field15 = defined($alert->{'field15_recovery'}) && $alert->{'field15_recovery'} ne "" ? $alert->{'field15_recovery'} : $field15;
|
||||
$field15 = defined($action->{'field15_recovery'}) && $action->{'field15_recovery'} ne "" ? $action->{'field15_recovery'} : $field15;
|
||||
}
|
||||
|
||||
$field1 = $field1 ? decode_entities($field1) : "";
|
||||
$field2 = $field2 ? decode_entities($field2) : "";
|
||||
$field3 = $field3 ? decode_entities($field3) : "";
|
||||
$field4 = $field4 ? decode_entities($field4) : "";
|
||||
$field5 = $field5 ? decode_entities($field5) : "";
|
||||
$field6 = $field6 ? decode_entities($field6) : "";
|
||||
$field7 = $field7 ? decode_entities($field7) : "";
|
||||
$field8 = $field8 ? decode_entities($field8) : "";
|
||||
$field9 = $field9 ? decode_entities($field9) : "";
|
||||
$field10 = $field10 ? decode_entities($field10) : "";
|
||||
$field11 = $field11 ? decode_entities($field11) : "";
|
||||
$field12 = $field12 ? decode_entities($field12) : "";
|
||||
$field13 = $field13 ? decode_entities($field13) : "";
|
||||
$field14 = $field14 ? decode_entities($field14) : "";
|
||||
$field15 = $field15 ? decode_entities($field15) : "";
|
||||
$field1 = defined($field1) && $field1 ne "" ? decode_entities($field1) : "";
|
||||
$field2 = defined($field2) && $field2 ne "" ? decode_entities($field2) : "";
|
||||
$field3 = defined($field3) && $field3 ne "" ? decode_entities($field3) : "";
|
||||
$field4 = defined($field4) && $field4 ne "" ? decode_entities($field4) : "";
|
||||
$field5 = defined($field5) && $field5 ne "" ? decode_entities($field5) : "";
|
||||
$field6 = defined($field6) && $field6 ne "" ? decode_entities($field6) : "";
|
||||
$field7 = defined($field7) && $field7 ne "" ? decode_entities($field7) : "";
|
||||
$field8 = defined($field8) && $field8 ne "" ? decode_entities($field8) : "";
|
||||
$field9 = defined($field9) && $field9 ne "" ? decode_entities($field9) : "";
|
||||
$field10 = defined($field10) && $field10 ne "" ? decode_entities($field10) : "";
|
||||
$field11 = defined($field11) && $field11 ne "" ? decode_entities($field11) : "";
|
||||
$field12 = defined($field12) && $field12 ne "" ? decode_entities($field12) : "";
|
||||
$field13 = defined($field13) && $field13 ne "" ? decode_entities($field13) : "";
|
||||
$field14 = defined($field14) && $field14 ne "" ? decode_entities($field14) : "";
|
||||
$field15 = defined($field15) && $field15 ne "" ? decode_entities($field15) : "";
|
||||
|
||||
# Get group info
|
||||
my $group = undef;
|
||||
@ -976,7 +976,9 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
||||
_field13_ => $field13,
|
||||
_field14_ => $field14,
|
||||
_field15_ => $field15,
|
||||
_agent_ => (defined ($agent)) ? $agent->{'alias'} : '',
|
||||
_agentname_ => (defined ($agent)) ? $agent->{'nombre'} : '',
|
||||
_agentalias_ => (defined ($agent)) ? $agent->{'alias'} : '',
|
||||
_agent_ => (defined ($agent)) ? ($agent->{'alias'} ? $agent->{'alias'} : $agent->{'nombre'}) : '',
|
||||
_agentcustomid_ => (defined ($agent)) ? $agent->{'custom_id'} : '',
|
||||
'_agentcustomfield_\d+_' => undef,
|
||||
_agentdescription_ => (defined ($agent)) ? $agent->{'comentarios'} : '',
|
||||
@ -1216,6 +1218,9 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
||||
}
|
||||
$agent_name = subst_alert_macros ($agent_name, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
my $fullagent = get_agent_from_name ($dbh, $agent_name);
|
||||
if( ! $fullagent && $macros{'_agentname_'} ) {
|
||||
$fullagent = get_agent_from_name ($dbh, $macros{'_agentname_'} );
|
||||
}
|
||||
|
||||
# Field 5 (priority)
|
||||
my $priority = $field5;
|
||||
@ -1619,40 +1624,34 @@ Start the planned downtime, the once type.
|
||||
sub pandora_planned_downtime_set_disabled_elements($$$) {
|
||||
my ($pa_config, $dbh, $downtime) = @_;
|
||||
|
||||
my @downtime_agents = get_db_rows($dbh, 'SELECT *
|
||||
FROM tplanned_downtime_agents
|
||||
WHERE id_downtime = ' . $downtime->{'id'});
|
||||
my $only_alerts = 0;
|
||||
|
||||
foreach my $downtime_agent (@downtime_agents) {
|
||||
my $only_alerts = 0;
|
||||
|
||||
if ($downtime->{'only_alerts'} == 0) {
|
||||
if ($downtime->{'type_downtime'} eq 'disable_agents_alerts') {
|
||||
$only_alerts = 1;
|
||||
}
|
||||
if ($downtime->{'only_alerts'} == 0) {
|
||||
if ($downtime->{'type_downtime'} eq 'disable_agents_alerts') {
|
||||
$only_alerts = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($only_alerts == 0) {
|
||||
if ($only_alerts == 0) {
|
||||
db_do($dbh,'UPDATE tplanned_downtime_agents tp, tagente ta
|
||||
SET tp.manually_disabled = ta.disabled
|
||||
WHERE tp.id_agent = ta.id_agente AND tp.id_downtime = ?',$downtime->{'id'});
|
||||
|
||||
if($pa_config->{'include_agents'} == 0){
|
||||
db_do($dbh, 'UPDATE tplanned_downtime_agents
|
||||
SET manually_disabled = 1 WHERE id_agent IN (SELECT id_agente FROM tagente WHERE disabled = 1 AND id_agente = ?)
|
||||
AND id_downtime = ' . $downtime->{'id'}, $downtime_agent->{'id_agent'});
|
||||
}
|
||||
db_do($dbh,'UPDATE tagente ta, tplanned_downtime_agents tpa
|
||||
SET ta.disabled = 1 WHERE tpa.id_agent = ta.id_agente AND
|
||||
tpa.id_downtime = ?',$downtime->{'id'});
|
||||
|
||||
db_do ($dbh, 'UPDATE tagente
|
||||
SET disabled = 1
|
||||
WHERE id_agente = ?', $downtime_agent->{'id_agent'});
|
||||
} else {
|
||||
my @downtime_agents = get_db_rows($dbh, 'SELECT *
|
||||
FROM tplanned_downtime_agents
|
||||
WHERE id_downtime = ' . $downtime->{'id'});
|
||||
|
||||
foreach my $downtime_agent (@downtime_agents) {
|
||||
db_do ($dbh, 'UPDATE talert_template_modules tat, tagente_modulo tam
|
||||
SET tat.disabled = 1
|
||||
WHERE tat.id_agent_module = tam.id_agente_modulo
|
||||
AND tam.id_agente = ?', $downtime_agent->{'id_agent'});
|
||||
}
|
||||
else {
|
||||
db_do ($dbh, 'UPDATE talert_template_modules
|
||||
SET disabled = 1
|
||||
WHERE id_agent_module IN (
|
||||
SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente = ?)', $downtime_agent->{'id_agent'});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1666,39 +1665,29 @@ Start the planned downtime, the once type.
|
||||
sub pandora_planned_downtime_unset_disabled_elements($$$) {
|
||||
my ($pa_config, $dbh, $downtime) = @_;
|
||||
|
||||
my @downtime_agents = get_db_rows($dbh, 'SELECT *
|
||||
FROM tplanned_downtime_agents
|
||||
WHERE id_downtime = ' . $downtime->{'id'});
|
||||
my $only_alerts = 0;
|
||||
|
||||
foreach my $downtime_agent (@downtime_agents) {
|
||||
my $only_alerts = 0;
|
||||
|
||||
if ($downtime->{'only_alerts'} == 0) {
|
||||
if ($downtime->{'type_downtime'} eq 'disable_agents_alerts') {
|
||||
$only_alerts = 1;
|
||||
}
|
||||
if ($downtime->{'only_alerts'} == 0) {
|
||||
if ($downtime->{'type_downtime'} eq 'disable_agents_alerts') {
|
||||
$only_alerts = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($only_alerts == 0) {
|
||||
db_do ($dbh, 'UPDATE tagente
|
||||
SET disabled = 0
|
||||
WHERE id_agente = ?', $downtime_agent->{'id_agent'});
|
||||
if ($only_alerts == 0) {
|
||||
db_do($dbh,'UPDATE tagente ta, tplanned_downtime_agents tpa
|
||||
set ta.disabled = 0 WHERE tpa.id_agent = ta.id_agente AND
|
||||
tpa.manually_disabled = 0 AND tpa.id_downtime = ?',$downtime->{'id'});
|
||||
} else {
|
||||
my @downtime_agents = get_db_rows($dbh, 'SELECT *
|
||||
FROM tplanned_downtime_agents
|
||||
WHERE id_downtime = ' . $downtime->{'id'});
|
||||
|
||||
if($pa_config->{'include_agents'} == 0){
|
||||
db_do ($dbh, 'UPDATE tagente
|
||||
SET disabled = 1
|
||||
WHERE id_agente IN (SELECT id_agent FROM tplanned_downtime_agents WHERE manually_disabled = 1 and id_downtime = ?)',$downtime_agent->{'id_downtime'});
|
||||
}
|
||||
foreach my $downtime_agent (@downtime_agents) {
|
||||
db_do ($dbh, 'UPDATE talert_template_modules tat, tagente_modulo tam
|
||||
SET tat.disabled = 0
|
||||
WHERE tat.id_agent_module = tam.id_agente_modulo
|
||||
AND tam.id_agente = ?', $downtime_agent->{'id_agent'});
|
||||
}
|
||||
else {
|
||||
db_do ($dbh, 'UPDATE talert_template_modules
|
||||
SET disabled = 0
|
||||
WHERE id_agent_module IN (
|
||||
SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente = ?)', $downtime_agent->{'id_agent'});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -3391,30 +3380,6 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) {
|
||||
if (($internal_counter + 1 >= $min_alerts) && ($times_fired + 1 <= $max_alerts)) {
|
||||
($times_fired++, $internal_counter++);
|
||||
|
||||
my %agent;
|
||||
|
||||
my $this_agent = get_agent_from_addr ($dbh, $trap_agent);
|
||||
|
||||
if (defined($this_agent)){
|
||||
%agent = (
|
||||
'nombre' => $this_agent->{'nombre'},
|
||||
'id_agente' => $this_agent->{'id_agente'},
|
||||
'direccion' => $trap_agent,
|
||||
'id_grupo' => $this_agent->{'id_grupo'},
|
||||
'comentarios' => '',
|
||||
'alias' => $this_agent->{'alias'}
|
||||
);
|
||||
} else {
|
||||
%agent = (
|
||||
'nombre' => $trap_agent,
|
||||
'direccion' => $trap_agent,
|
||||
'comentarios' => '',
|
||||
'id_agente' => 0,
|
||||
'id_grupo' => 0,
|
||||
'alias' => $trap_agent
|
||||
);
|
||||
}
|
||||
|
||||
my %alert = (
|
||||
'snmp_alert' => 1,
|
||||
'name' => '',
|
||||
@ -3444,6 +3409,28 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) {
|
||||
'priority' => $alert->{'priority'},
|
||||
);
|
||||
|
||||
my %agent;
|
||||
|
||||
my $this_agent = get_agent_from_addr ($dbh, $trap_agent);
|
||||
if (defined($this_agent)){
|
||||
%agent = (
|
||||
'nombre' => $this_agent->{'nombre'},
|
||||
'alias' => $this_agent->{'alias'},
|
||||
'id_agente' => $this_agent->{'id_agente'},
|
||||
'direccion' => $trap_agent,
|
||||
'id_grupo' => $this_agent->{'id_grupo'},
|
||||
'comentarios' => ''
|
||||
);
|
||||
} else {
|
||||
%agent = (
|
||||
'nombre' => $trap_agent,
|
||||
'direccion' => $trap_agent,
|
||||
'comentarios' => '',
|
||||
'id_agente' => 0,
|
||||
'id_grupo' => 0
|
||||
);
|
||||
}
|
||||
|
||||
# Execute alert
|
||||
my $action = get_db_single_row ($dbh, 'SELECT *
|
||||
FROM talert_actions, talert_commands
|
||||
@ -3458,7 +3445,7 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) {
|
||||
if ($action->{'id_alert_command'} != 3){
|
||||
pandora_event ($pa_config, "SNMP alert fired (" . $alert->{'description'} . ")",
|
||||
0, 0, $alert->{'priority'}, 0, 0, 'alert_fired', 0, $dbh);
|
||||
}
|
||||
}
|
||||
|
||||
# Update alert status
|
||||
db_do ($dbh, 'UPDATE talert_snmp SET times_fired = ?, last_fired = ?, internal_counter = ? WHERE id_as = ?',
|
||||
|
@ -326,10 +326,12 @@ sub process_xml_data ($$$$$) {
|
||||
}
|
||||
|
||||
# Save the first address as the main address
|
||||
$address = $address_list[0];
|
||||
$address =~ s/^\s+|\s+$//g ;
|
||||
shift (@address_list);
|
||||
}
|
||||
if (defined($address_list[0])) {
|
||||
$address = $address_list[0];
|
||||
$address =~ s/^\s+|\s+$//g ;
|
||||
shift (@address_list);
|
||||
}
|
||||
}
|
||||
|
||||
# A module with No-learn mode (modo = 0) creates its modules on database only when it is created
|
||||
my $new_agent = 0;
|
||||
|
@ -215,7 +215,7 @@ sub data_consumer ($$) {
|
||||
}
|
||||
|
||||
# Agent and module macros
|
||||
my %macros = (_agent_ => (defined ($agent)) ? $agent->{'nombre'} : '',
|
||||
my %macros = (_agent_ => (defined ($agent)) ? $agent->{'alias'} : '',
|
||||
_agentdescription_ => (defined ($agent)) ? $agent->{'comentarios'} : '',
|
||||
_agentstatus_ => undef,
|
||||
_agentgroup_ => (defined ($group)) ? $group->{'nombre'} : '',
|
||||
|
@ -101,6 +101,7 @@ our @EXPORT = qw(
|
||||
translate_obj
|
||||
valid_regex
|
||||
set_file_permissions
|
||||
uri_encode
|
||||
);
|
||||
|
||||
# ID of the different servers
|
||||
@ -1468,6 +1469,61 @@ sub is_metaconsole ($) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#######################
|
||||
# ENCODE
|
||||
#######################
|
||||
sub uri_encode {
|
||||
# Un-reserved characters
|
||||
my $unreserved_re = qr{ ([^a-zA-Z0-9\Q-_.~\E\%]) }x;
|
||||
my $enc_map = { ( map { chr($_) => sprintf( "%%%02X", $_ ) } ( 0 ... 255 ) ) };
|
||||
my $dec_map = { ( map { sprintf( "%02X", $_ ) => chr($_) } ( 0 ... 255 ) ) };
|
||||
|
||||
my ($data) = @_;
|
||||
|
||||
# Check for data
|
||||
# Allow to be '0'
|
||||
return unless defined $data;
|
||||
|
||||
# UTF-8 encode
|
||||
$data = Encode::encode( 'utf-8-strict', $data );
|
||||
|
||||
# Encode a literal '%'
|
||||
$data =~ s{(\%)(.*)}{uri_encode_literal_percent($1, $2, $enc_map, $dec_map)}gex;
|
||||
|
||||
# Percent Encode
|
||||
$data =~ s{$unreserved_re}{uri_encode_get_encoded_char($1, $enc_map)}gex;
|
||||
|
||||
# Done
|
||||
return $data;
|
||||
} ## end sub encode
|
||||
|
||||
#######################
|
||||
# INTERNAL
|
||||
#######################
|
||||
sub uri_encode_get_encoded_char($$) {
|
||||
my ( $char, $enc_map ) = @_;
|
||||
|
||||
return $enc_map->{$char} if exists $enc_map->{$char};
|
||||
return $char;
|
||||
} ## end sub uri_encode_get_encoded_char
|
||||
|
||||
sub uri_encode_literal_percent {
|
||||
my ( $char, $post, $enc_map, $dec_map ) = @_;
|
||||
|
||||
return uri_encode_get_encoded_char($char, $enc_map) if not defined $post;
|
||||
|
||||
my $return_char;
|
||||
if ( $post =~ m{^([a-fA-F0-9]{2})}x ) {
|
||||
if ( exists $dec_map->{$1} ) {
|
||||
$return_char = join( '', $char, $post );
|
||||
}
|
||||
} ## end if ( $post =~ m{^([a-fA-F0-9]{2})}x)
|
||||
|
||||
$return_char ||= join( '', uri_encode_get_encoded_char($char, $enc_map), $post );
|
||||
return $return_char;
|
||||
} ## end sub uri_encode_literal_percent
|
||||
|
||||
|
||||
# End of function declaration
|
||||
# End of defined Code
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
# Pandora FMS Server
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.705
|
||||
%define release 170621
|
||||
%define version 7.0NG.707
|
||||
%define release 170712
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -2,8 +2,8 @@
|
||||
# Pandora FMS Server
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.705
|
||||
%define release 170621
|
||||
%define version 7.0NG.707
|
||||
%define release 170712
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -8,8 +8,8 @@
|
||||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.705"
|
||||
PI_BUILD="170621"
|
||||
PI_VERSION="7.0NG.707"
|
||||
PI_BUILD="170712"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
@ -33,7 +33,7 @@ use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.705 PS170621";
|
||||
my $version = "7.0NG.707 PS170712";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
@ -35,7 +35,7 @@ use Encode::Locale;
|
||||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.705 PS170621";
|
||||
my $version = "7.0NG.707 PS170712";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
@ -12,6 +12,9 @@
|
||||
# Includes list
|
||||
use strict;
|
||||
use LWP::Simple;
|
||||
use MIME::Base64;
|
||||
use lib '/usr/lib/perl5';
|
||||
use PandoraFMS::Tools;
|
||||
|
||||
# Init
|
||||
tool_api_init();
|
||||
@ -32,17 +35,17 @@ Where options:\n
|
||||
-u <credentials> : API credentials separated by comma: <api_pass>,<user>,<pass>
|
||||
-name <event_name> : Free text
|
||||
-group <id_group> : Group ID (use 0 for 'all')
|
||||
-agent : Agent ID
|
||||
-agent : Agent ID
|
||||
|
||||
Optional parameters:
|
||||
|
||||
[-status <status>] : 0 New, 1 Validated, 2 In process
|
||||
[-user <id_user>] : User comment (use in combination with -comment option)
|
||||
[-type <event_type>] : unknown, alert_fired, alert_recovered, alert_ceased
|
||||
[-type <event_type>] : unknown, alert_fired, alert_recovered, alert_ceased
|
||||
alert_manual_validation, system, error, new_agent
|
||||
configuration_change, going_unknown, going_down_critical,
|
||||
going_down_warning, going_up_normal
|
||||
[-severity <severity>] : 0 Maintance,
|
||||
[-severity <severity>] : 0 Maintance,
|
||||
1 Informative,
|
||||
2 Normal,
|
||||
3 Warning,
|
||||
@ -58,7 +61,10 @@ Optional parameters:
|
||||
[-owner_user <owner event>] : Use the login name, not the descriptive
|
||||
[-source <source>] : (By default 'Pandora')
|
||||
[-tag <tags>] : Tag (must exist in the system to be imported)
|
||||
[-custom_data <custom_data>]: Custom data should be a base 64 encoded JSON document
|
||||
[-custom_data <custom_data>]: Custom data should be a base 64 encoded JSON document example -custom_data \'{\"test1\" : 1, \"test2\": 2}\'
|
||||
[-id_extra <id extra>] : Id extra
|
||||
[-agent_name <Agent name>] : Agent name, Not to be confused with the alias.
|
||||
[-force_create_agent<0 o 1>]: Force the creation of agent through an event this will create when it is 1.
|
||||
[-server_id <server_id>] : The pandora node server_id\n\n";
|
||||
|
||||
print "Example of event generation:\n\n";
|
||||
@ -66,7 +72,7 @@ Optional parameters:
|
||||
print "\t./pandora_revent.pl -p http://localhost/pandora_console/include/api.php -u 1234,admin,pandora \
|
||||
\t-create_event -name \"SampleEvent\" -group 2 -agent 189 -status 0 -user \"admin\" -type \"system\" \
|
||||
\t-severity 3 -am 0 -alert 9 -c_instructions \"Critical instructions\" -w_instructions \"Warning instructions\" \
|
||||
\t-u_instructions \"Unknown instructions\" -source \"Commandline\" -tag \"Tags\"";
|
||||
\t-u_instructions \"Unknown instructions\" -id_extra \"id extra\" -agent_name \"agent name\" -source \"Commandline\" -tag \"Tags\"";
|
||||
|
||||
print "\n\n\nOptions to validate event: \n\n\t";
|
||||
print "$0 -p <path_to_consoleAPI> -u <credentials> -validate_event <options> -id <id_event>\n\n";
|
||||
@ -126,6 +132,9 @@ sub tool_api_main () {
|
||||
my $critical_instructions = '';
|
||||
my $warning_instructions = '';
|
||||
my $unknown_instructions = '';
|
||||
my $id_extra = '';
|
||||
my $agent_name = '';
|
||||
my $force_create_agent = 0;
|
||||
my $owner_user = '';
|
||||
my $id_event;
|
||||
my $option = $ARGV[4];
|
||||
@ -209,12 +218,24 @@ sub tool_api_main () {
|
||||
}
|
||||
if ($line eq '-c_instructions') {
|
||||
$critical_instructions = $ARGV[$i + 1];
|
||||
$critical_instructions = uri_encode($critical_instructions);
|
||||
}
|
||||
if ($line eq '-w_instructions') {
|
||||
$warning_instructions = $ARGV[$i + 1];
|
||||
$warning_instructions = uri_encode($warning_instructions);
|
||||
}
|
||||
if ($line eq '-u_instructions') {
|
||||
$unknown_instructions = $ARGV[$i + 1];
|
||||
$unknown_instructions = uri_encode($unknown_instructions);
|
||||
}
|
||||
if ($line eq '-id_extra') {
|
||||
$id_extra = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-agent_name') {
|
||||
$agent_name = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-force_create_agent') {
|
||||
$force_create_agent = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-user_comment') {
|
||||
$user_comment = $ARGV[$i + 1];
|
||||
@ -224,6 +245,7 @@ sub tool_api_main () {
|
||||
}
|
||||
if ($line eq '-custom_data') {
|
||||
$custom_data = $ARGV[$i + 1];
|
||||
$custom_data = encode_base64($custom_data, '');
|
||||
}
|
||||
if ($line eq '-server_id') {
|
||||
$server_id = $ARGV[$i + 1];
|
||||
@ -240,8 +262,8 @@ sub tool_api_main () {
|
||||
print "[ERROR] Missing event group! Read help info:\n\n";
|
||||
help_screen ();
|
||||
}
|
||||
if ($id_agent eq "") {
|
||||
print "[ERROR] Missing id agent! Read help info:\n\n";
|
||||
if ($id_agent eq "" && $agent_name eq "") {
|
||||
print "[ERROR] Missing id agent! and agent_name Read help info:\n\n";
|
||||
help_screen ();
|
||||
}
|
||||
|
||||
@ -262,7 +284,10 @@ sub tool_api_main () {
|
||||
"|" . $source .
|
||||
"|" . $tags .
|
||||
"|" . $custom_data .
|
||||
"|" . $server_id;
|
||||
"|" . $server_id .
|
||||
"|" . $id_extra .
|
||||
"|" . $agent_name .
|
||||
"|" . $force_create_agent;
|
||||
|
||||
$call_api = $api_path . '?' .
|
||||
'op=set&' .
|
||||
|
Loading…
x
Reference in New Issue
Block a user