conflict resolution on branch 2389-Ordenar-eventos-por-campo
This commit is contained in:
commit
01656f2e76
|
@ -58,7 +58,7 @@ PERL_PLUGIN_FILES="$PANDHOME_ENT/pandora_server/util/plugin/vmware-plugin.pl \
|
|||
$PANDHOME_ENT/pandora_plugins/NGINX/nginx_requests_queued.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Sybase/sybase_plugin.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/SNMP/dynamic_snmp.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/SNMP/snmp_bandwith.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/SNMP/snmp_bandwidth.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/laboratory/cacti/cacti2pandora.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/MarkLogic/pandora_marklogic.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/MySQL/pandora_mysql.pl \
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, AIX version
|
||||
# Version 7.0NG.725, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, FreeBSD Version
|
||||
# Version 7.0NG.725, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, HP-UX Version
|
||||
# Version 7.0NG.725, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, GNU/Linux
|
||||
# Version 7.0NG.725, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, GNU/Linux
|
||||
# Version 7.0NG.725, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, Solaris Version
|
||||
# Version 7.0NG.725, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2010 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.724
|
||||
# Version 7.0NG.725
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.724, AIX version
|
||||
# Version 7.0NG.725, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.724
|
||||
# Version 7.0NG.725
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.724, HPUX Version
|
||||
# Version 7.0NG.725, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724
|
||||
# Version 7.0NG.725
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724
|
||||
# Version 7.0NG.725
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724
|
||||
# Version 7.0NG.725
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.724, Solaris version
|
||||
# Version 7.0NG.725, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, AIX version
|
||||
# Version 7.0NG.725, 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.724-180709
|
||||
Version: 7.0NG.725-180801
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.724-180709"
|
||||
pandora_version="7.0NG.725-180801"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, GNU/Linux
|
||||
# Version 7.0NG.725, 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.724, FreeBSD Version
|
||||
# Version 7.0NG.725, 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.724, HP-UX Version
|
||||
# Version 7.0NG.725, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, GNU/Linux
|
||||
# Version 7.0NG.725, 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.724, GNU/Linux
|
||||
# Version 7.0NG.725, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.724, NetBSD Version
|
||||
# Version 7.0NG.725, 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.724, Solaris Version
|
||||
# Version 7.0NG.725, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -41,8 +41,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.724';
|
||||
use constant AGENT_BUILD => '180709';
|
||||
use constant AGENT_VERSION => '7.0NG.725';
|
||||
use constant AGENT_BUILD => '180801';
|
||||
|
||||
# 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.724
|
||||
%define release 180709
|
||||
%define version 7.0NG.725
|
||||
%define release 180801
|
||||
|
||||
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.724
|
||||
%define release 180709
|
||||
%define version 7.0NG.725
|
||||
%define release 180801
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.724"
|
||||
PI_BUILD="180709"
|
||||
PI_VERSION="7.0NG.725"
|
||||
PI_BUILD="180801"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2017 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.724
|
||||
# Version 7.0NG.725
|
||||
|
||||
# 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.724}
|
||||
{Pandora FMS Windows Agent v7.0NG.725}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{180709}
|
||||
{180801}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.724(Build 180709)")
|
||||
#define PANDORA_VERSION ("7.0NG.725(Build 180801)")
|
||||
|
||||
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.724(Build 180709))"
|
||||
VALUE "ProductVersion", "(7.0NG.725(Build 180801))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.724-180709
|
||||
Version: 7.0NG.725-180801
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.724-180709"
|
||||
pandora_version="7.0NG.725-180801"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -10,4 +10,62 @@ ALTER TABLE `tmetaconsole_agent` ADD COLUMN `cps` int NOT NULL DEFAULT '0';
|
|||
|
||||
ALTER TABLE `tagente_modulo` ADD COLUMN `cps` int NOT NULL DEFAULT '0';
|
||||
|
||||
COMMIT;
|
||||
ALTER TABLE `tservice` ADD COLUMN `evaluate_sla` int(1) NOT NULL DEFAULT '0';
|
||||
|
||||
ALTER TABLE `tpolicy_modules` ADD COLUMN `cps` int NOT NULL DEFAULT '0';
|
||||
|
||||
DROP INDEX id_policy ON `tpolicy_agents`;
|
||||
|
||||
ALTER TABLE `tpolicy_agents` ADD COLUMN `id_node` int(10) NOT NULL DEFAULT '0';
|
||||
|
||||
ALTER TABLE `tpolicy_agents` ADD UNIQUE(`id_policy`, `id_agent`, `id_node`);
|
||||
|
||||
ALTER TABLE `tevento` ADD COLUMN `data` double(22,5) default NULL;
|
||||
|
||||
ALTER TABLE `tmetaconsole_event` ADD COLUMN `data` double(22,5) default NULL;
|
||||
|
||||
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `data` double(22,5) default NULL;
|
||||
|
||||
ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
||||
|
||||
ALTER TABLE `tmetaconsole_event` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
||||
|
||||
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
||||
|
||||
CREATE TABLE `tautoconfig` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`order` int(11) NOT NULL DEFAULT '0',
|
||||
`description` text,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
CREATE TABLE `tautoconfig_rules` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_autoconfig` int(10) unsigned NOT NULL,
|
||||
`order` int(11) NOT NULL DEFAULT '0',
|
||||
`operator` enum('AND','OR') DEFAULT 'OR',
|
||||
`type` enum('alias','ip-range','group','os','custom-field','script','server-name') DEFAULT 'alias',
|
||||
`value` text,
|
||||
`custom` text,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id_autoconfig` (`id_autoconfig`),
|
||||
CONSTRAINT `tautoconfig_rules_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
CREATE TABLE `tautoconfig_actions` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_autoconfig` int(10) unsigned NOT NULL,
|
||||
`order` int(11) NOT NULL DEFAULT '0',
|
||||
`action_type` enum('set-group', 'set-secondary-group', 'apply-policy', 'launch-script', 'launch-event', 'launch-alert-action', 'raw-config') DEFAULT 'launch-event',
|
||||
`value` text,
|
||||
`custom` text,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id_autoconfig` (`id_autoconfig`),
|
||||
CONSTRAINT `tautoconfig_action_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -1269,6 +1269,7 @@ UPDATE tagente SET tagente.alias = tagente.nombre;
|
|||
ALTER TABLE `tservice` ADD COLUMN `quiet` tinyint(1) NOT NULL default 0;
|
||||
ALTER TABLE `tservice` ADD COLUMN `cps` int NOT NULL default 0;
|
||||
ALTER TABLE `tservice` ADD COLUMN `cascade_protection` tinyint(1) NOT NULL default 0;
|
||||
ALTER TABLE `tservice` ADD COLUMN `evaluate_sla` int(1) NOT NULL default 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlayout`
|
||||
|
@ -1353,6 +1354,7 @@ ALTER TABLE tlocal_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned
|
|||
ALTER TABLE tpolicy_modules ADD COLUMN `ip_target`varchar(100) default '';
|
||||
ALTER TABLE tpolicy_modules ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
|
||||
ALTER TABLE tpolicy_modules ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
|
||||
ALTER TABLE `tpolicy_modules` ADD COLUMN `cps` int NOT NULL DEFAULT 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmetaconsole_agent`
|
||||
|
@ -1667,3 +1669,47 @@ create table IF NOT EXISTS `tmetaconsole_agent_secondary_group`(
|
|||
ALTER TABLE tagente ADD COLUMN `update_secondary_groups` tinyint(1) NOT NULL default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `update_secondary_groups` tinyint(1) NOT NULL default '0';
|
||||
ALTER TABLE tusuario_perfil ADD COLUMN `is_secondary` tinyint(1) NOT NULL default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tautoconfig`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tautoconfig` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`order` int(11) NOT NULL DEFAULT '0',
|
||||
`description` text,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tautoconfig_rules`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tautoconfig_rules` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_autoconfig` int(10) unsigned NOT NULL,
|
||||
`order` int(11) NOT NULL DEFAULT '0',
|
||||
`operator` enum('AND','OR') DEFAULT 'OR',
|
||||
`type` enum('alias','ip-range','group','os','custom-field','script','server-name') DEFAULT 'alias',
|
||||
`value` text,
|
||||
`custom` text,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id_autoconfig` (`id_autoconfig`),
|
||||
CONSTRAINT `tautoconfig_rules_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tautoconfig_actions`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tautoconfig_actions` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_autoconfig` int(10) unsigned NOT NULL,
|
||||
`order` int(11) NOT NULL DEFAULT '0',
|
||||
`action_type` enum('set-group', 'set-secondary-group', 'apply-policy', 'launch-script', 'launch-event', 'launch-alert-action', 'raw-config') DEFAULT 'launch-event',
|
||||
`value` text,
|
||||
`custom` text,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id_autoconfig` (`id_autoconfig`),
|
||||
CONSTRAINT `tautoconfig_action_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
|
|
|
@ -757,7 +757,7 @@ $table->data[2][1] = '<b>'.__('Auth user').'</b>';
|
|||
$table->data[2][2] = html_print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
|
||||
$table->data[2][3] = '<b>'.__('Auth password').'</b>';
|
||||
$table->data[2][4] = html_print_input_password ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
|
||||
$table->data[2][4] .= html_print_input_hidden('active_snmp_v3', 0, true);
|
||||
$table->data[2][4] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_awse', true);
|
||||
|
||||
$table->data[5][0] = '<b>'.__('Privacy method').'</b>';
|
||||
$table->data[5][1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true);
|
||||
|
|
|
@ -474,7 +474,7 @@ $table->data[2][1] = '<b>'.__('Auth user').'</b>';
|
|||
$table->data[2][2] = html_print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
|
||||
$table->data[2][3] = '<b>'.__('Auth password').'</b>';
|
||||
$table->data[2][4] = html_print_input_password ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
|
||||
$table->data[2][4] .= html_print_input_hidden('active_snmp_v3', 0, true);
|
||||
$table->data[2][4] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_awsie', true);
|
||||
|
||||
$table->data[5][0] = '<b>'.__('Privacy method').'</b>';
|
||||
$table->data[5][1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true);
|
||||
|
|
|
@ -23,9 +23,9 @@ else {
|
|||
|
||||
enterprise_include ('godmode/agentes/module_manager.php');
|
||||
$isFunctionPolicies = enterprise_include_once ('include/functions_policies.php');
|
||||
require_once ('include/functions_modules.php');
|
||||
require_once ('include/functions_agents.php');
|
||||
require_once ('include/functions_servers.php');
|
||||
require_once ($config['homedir'] . '/include/functions_modules.php');
|
||||
require_once ($config['homedir'] . '/include/functions_agents.php');
|
||||
require_once ($config['homedir'] . '/include/functions_servers.php');
|
||||
|
||||
$search_string = io_safe_output(urldecode(trim(get_parameter ("search_string", ""))));
|
||||
|
||||
|
@ -35,7 +35,6 @@ if (!isset($policy_page))
|
|||
$policy_page = false;
|
||||
|
||||
// Search string filter form
|
||||
//echo '<form id="create_module_type" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
|
||||
if (($policy_page) || (isset($agent)))
|
||||
echo '<form id="" method="post" action="">';
|
||||
else
|
||||
|
@ -67,11 +66,13 @@ $prediction_available = db_get_sql ("SELECT count(*)
|
|||
WHERE server_type = 5"); //POSTGRESQL AND ORACLE COMPATIBLE
|
||||
|
||||
// Development mode to use all servers
|
||||
if ($develop_bypass) {
|
||||
if ($develop_bypass || is_metaconsole()) {
|
||||
$network_available = 1;
|
||||
$wmi_available = 1;
|
||||
$plugin_available = 1;
|
||||
$prediction_available = 1;
|
||||
// FIXME when prediction predictions server modules can be configured
|
||||
// on metaconsole
|
||||
$prediction_available = is_metaconsole() ? 0 : 1;
|
||||
}
|
||||
|
||||
$modules = array ();
|
||||
|
@ -108,7 +109,7 @@ $checked = get_parameter("checked");
|
|||
|
||||
if (($policy_page) || (isset($agent))) {
|
||||
if ($policy_page) {
|
||||
$show_creation = true;
|
||||
$show_creation = !is_central_policies_on_node();
|
||||
}
|
||||
else {
|
||||
if (!isset($all_groups)) {
|
||||
|
|
|
@ -14,10 +14,11 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
include_once("include/functions_modules.php");
|
||||
include_once("include/functions_categories.php");
|
||||
include_once($config['homedir'] . "/include/functions_modules.php");
|
||||
include_once($config['homedir'] . "/include/functions_categories.php");
|
||||
include_once($config['homedir'] . "/include/graphs/functions_d3.php");
|
||||
|
||||
echo "<script type='text/javascript' src='include/javascript/d3.3.5.14.js'></script>" . "\n";
|
||||
include_javascript_d3();
|
||||
|
||||
function prepend_table_simple ($row, $id = false) {
|
||||
global $table_simple;
|
||||
|
@ -133,19 +134,30 @@ $table_simple->id = 'simple';
|
|||
$table_simple->width = '100%';
|
||||
$table_simple->class = 'databox';
|
||||
$table_simple->data = array ();
|
||||
$table_simple->colspan = array ();
|
||||
$table_simple->style = array ();
|
||||
$table_simple->style[0] = 'font-weight: bold; width: 15%;';
|
||||
$table_simple->style[1] = 'width: 35%';
|
||||
$table_simple->style[0] = 'font-weight: bold; width: 25%;';
|
||||
$table_simple->style[1] = 'width: 25%';
|
||||
$table_simple->style[2] = 'font-weight: bold; width: 25%;';
|
||||
$table_simple->style[3] = 'width: 25%';
|
||||
$table_simple->cellclass = array();
|
||||
|
||||
$table_simple->colspan = array ();
|
||||
|
||||
|
||||
|
||||
#$table_simple->colspan[4][1] = 3;
|
||||
$table_simple->colspan[5][1] = 3;
|
||||
$table_simple->colspan[6][1] = 3;
|
||||
|
||||
$table_simple->rowspan = array ();
|
||||
if(strstr($page, "policy_modules")){
|
||||
$table_simple->rowspan[3][2] = 3;
|
||||
$table_simple->colspan[3][2] = 2;
|
||||
}
|
||||
else{
|
||||
$table_simple->rowspan[4][2] = 3;
|
||||
$table_simple->colspan[4][2] = 2;
|
||||
$table_simple->colspan[5][1] = 3;
|
||||
}
|
||||
|
||||
$table_simple->data[0][0] = __('Name');
|
||||
$table_simple->data[0][1] = html_print_input_text_extended ('name',
|
||||
io_safe_input(html_entity_decode($name)), 'text-name', '', 45, 100, $disabledBecauseInPolicy, '', $largeClassDisabledBecauseInPolicy, true);
|
||||
|
@ -154,7 +166,7 @@ $table_simple->data[0][1] = html_print_input_text_extended ('name',
|
|||
|
||||
if (!empty($id_agent_module) && isset($id_agente)) {
|
||||
$table_simple->data[0][1] .= ' <b>' . __('ID') . '</b> ' . $id_agent_module . ' ';
|
||||
|
||||
|
||||
$table_simple->data[0][1] .= ' <a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$id_agent_module.'"
|
||||
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
$table_simple->data[0][1] .= html_print_image ('images/cross.png', true,
|
||||
|
@ -182,7 +194,6 @@ if (!$in_policy) {
|
|||
'parent_module_id', $parent_module_id, '', __('Not assigned'), '0', true, false, true);
|
||||
}
|
||||
|
||||
|
||||
$table_simple->data[2][0] = __('Type').' ' . ui_print_help_icon ('module_type', true);
|
||||
$table_simple->data[2][0] .= html_print_input_hidden ('id_module_type_hidden', $id_module_type, true);
|
||||
|
||||
|
@ -205,14 +216,14 @@ if (!$edit) {
|
|||
WHERE id_tipo = %s
|
||||
ORDER BY descripcion',
|
||||
$id_module_type);
|
||||
|
||||
|
||||
$type_names = db_get_all_rows_sql($sql);
|
||||
|
||||
|
||||
$type_names_hash = array();
|
||||
foreach ($type_names as $tn) {
|
||||
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
|
||||
}
|
||||
|
||||
|
||||
$table_simple->data[2][1] = '<em>'.modules_get_moduletype_description ($id_module_type).' ('.$type_names_hash[$id_module_type].')</em>';
|
||||
$table_simple->data[2][1] .= html_print_input_hidden('type_names',base64_encode(io_json_mb_encode($type_names_hash)),true);
|
||||
}
|
||||
|
@ -223,35 +234,35 @@ else {
|
|||
else {
|
||||
$idModuleType = '';
|
||||
}
|
||||
|
||||
|
||||
$sql = sprintf ('SELECT id_tipo, descripcion
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria IN (%s)
|
||||
ORDER BY descripcion',
|
||||
implode (',', $categories));
|
||||
|
||||
|
||||
$table_simple->data[2][1] = html_print_select_from_sql ($sql, 'id_module_type',
|
||||
$idModuleType, '', '', '', true, false, false, $disabledBecauseInPolicy, false, false, 100);
|
||||
|
||||
|
||||
// Store the relation between id and name of the types on a hidden field
|
||||
$sql = sprintf ('SELECT id_tipo, nombre
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria IN (%s)
|
||||
ORDER BY descripcion',
|
||||
implode (',', $categories));
|
||||
|
||||
|
||||
$type_names = db_get_all_rows_sql($sql);
|
||||
|
||||
|
||||
$type_names_hash = array();
|
||||
foreach ($type_names as $tn) {
|
||||
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
|
||||
}
|
||||
|
||||
|
||||
$table_simple->data[2][1] .= html_print_input_hidden('type_names',base64_encode(io_json_mb_encode($type_names_hash)),true);
|
||||
}
|
||||
|
||||
if($disabledBecauseInPolicy){
|
||||
$table_simple->data[2][3] .= html_print_input_hidden ('id_module_group', $id_module_group, true);
|
||||
$table_simple->data[2][3] .= html_print_input_hidden ('id_module_group', $id_module_group, true);
|
||||
}
|
||||
$table_simple->data[3][0] = __('Dynamic Threshold Interval') .' ' . ui_print_help_icon ('dynamic_threshold', true);
|
||||
$table_simple->data[3][1] = html_print_extended_select_for_time ('dynamic_interval', $dynamic_interval, '', 'None', '0', 10, true, 'width:150px',false, $classdisabledBecauseInPolicy, $disabledBecauseInPolicy);
|
||||
|
@ -280,21 +291,21 @@ if (!modules_is_string_type($id_module_type) || $edit) {
|
|||
$table_simple->data[4][1] .= html_print_input_text ('min_warning', $min_warning, '', 10, 255, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
$table_simple->data[4][1] .= '<br /><em>'.__('Max.').'</em>';
|
||||
$table_simple->data[4][1] .= html_print_input_text ('max_warning', $max_warning, '', 10, 255, true,
|
||||
$table_simple->data[4][1] .= html_print_input_text ('max_warning', $max_warning, '', 10, 255, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).'</span>';
|
||||
}
|
||||
if (modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[4][1] .= '<span id="string_warning"><em>'.__('Str.').'</em>';
|
||||
$table_simple->data[4][1] .= html_print_input_text ('str_warning', str_replace("\"","",$str_warning),
|
||||
$table_simple->data[4][1] .= html_print_input_text ('str_warning', str_replace("\"","",$str_warning),
|
||||
'', 10, 255, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).'</span>';
|
||||
}
|
||||
$table_simple->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
$table_simple->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true, $disabledBecauseInPolicy);
|
||||
|
||||
if (!modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[4][2] = '<svg id="svg_dinamic" width="800" height="300"> </svg>';
|
||||
$table_simple->colspan[4][2] = 2;
|
||||
$table_simple->rowspan[4][2] = 3;
|
||||
$table_simple->data[4][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
|
||||
}
|
||||
|
||||
$table_simple->data[5][0] = __('Critical status').' ' . ui_print_help_icon ('critical_status', true);
|
||||
if (!modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[5][1] .= '<span id="minmax_critical"><em>'.__('Min. ').'</em>';
|
||||
|
@ -306,30 +317,29 @@ if (!modules_is_string_type($id_module_type) || $edit) {
|
|||
}
|
||||
if (modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[5][1] .= '<span id="string_critical"><em>'.__('Str.').'</em>';
|
||||
$table_simple->data[5][1] .= html_print_input_text ('str_critical', str_replace("\"","",$str_critical),
|
||||
$table_simple->data[5][1] .= html_print_input_text ('str_critical', str_replace("\"","",$str_critical),
|
||||
'', 10, 255, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).'</span>';
|
||||
}
|
||||
|
||||
$table_simple->data[5][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
$table_simple->data[5][1] .= html_print_checkbox ("critical_inverse", 1, $critical_inverse, true, $disabledBecauseInPolicy);
|
||||
|
||||
/* FF stands for Flip-flop */
|
||||
//FF stands for Flip-flop
|
||||
$table_simple->data[6][0] = __('FF threshold').' ' . ui_print_help_icon ('ff_threshold', true);
|
||||
$table_simple->colspan[5][1] = 3;
|
||||
|
||||
$table_simple->data[6][1] = html_print_radio_button ('each_ff', 0, '', $each_ff, true, $disabledBecauseInPolicy) . ' ' . __('All state changing') . ' : ';
|
||||
$table_simple->data[6][1] .= html_print_input_text ('ff_event', $ff_event, '', 5, 15, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . '<br />';
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . '<br />';
|
||||
$table_simple->data[6][1] .= html_print_radio_button ('each_ff', 1, '', $each_ff, true, $disabledBecauseInPolicy) . ' ' . __('Each state changing') . ' : ';
|
||||
$table_simple->data[6][1] .= __('To normal');
|
||||
$table_simple->data[6][1] .= html_print_input_text ('ff_event_normal', $ff_event_normal, '', 5, 15, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . ' ';
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . ' ';
|
||||
$table_simple->data[6][1] .= __('To warning');
|
||||
$table_simple->data[6][1] .= html_print_input_text ('ff_event_warning', $ff_event_warning, '', 5, 15, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . ' ';
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . ' ';
|
||||
$table_simple->data[6][1] .= __('To critical');
|
||||
$table_simple->data[6][1] .= html_print_input_text ('ff_event_critical', $ff_event_critical, '', 5, 15, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
$table_simple->data[7][0] = __('Historical data');
|
||||
if($disabledBecauseInPolicy) {
|
||||
// If is disabled, we send a hidden in his place and print a false checkbox because HTML dont send disabled fields and could be disabled by error
|
||||
|
@ -340,7 +350,7 @@ else {
|
|||
$table_simple->data[7][1] = html_print_checkbox ("history_data", 1, $history_data, true, $disabledBecauseInPolicy);
|
||||
}
|
||||
|
||||
/* Advanced form part */
|
||||
//Advanced form part
|
||||
$table_advanced = new stdClass();
|
||||
$table_advanced->id = 'advanced';
|
||||
$table_advanced->width = '100%';
|
||||
|
@ -359,8 +369,8 @@ $table_advanced->data[0][1] = html_print_textarea ('description', 2, 65,
|
|||
|
||||
$table_advanced->data[1][0] = __('Custom ID');
|
||||
$table_advanced->colspan[1][1] = 2;
|
||||
$table_advanced->data[1][1] = html_print_input_text ('custom_id', $custom_id, '', 20, 65, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
$table_advanced->data[1][1] = html_print_input_text ('custom_id', $custom_id, '', 20, 65, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
|
||||
$table_advanced->data[1][3] = __('Unit');
|
||||
// $table_advanced->data[1][4] = html_print_input_text ('unit', $unit, '', 20, 65, true,
|
||||
|
|
|
@ -16,15 +16,18 @@
|
|||
global $config;
|
||||
|
||||
require_once($config['homedir'] . "/include/functions_snmp_browser.php");
|
||||
?>
|
||||
<script type="text/javascript" src="include/javascript/pandora_snmp_browser.js"></script>
|
||||
<?php
|
||||
$snmp_browser_path = is_metaconsole() ? "../../" : "";
|
||||
$snmp_browser_path .= "include/javascript/pandora_snmp_browser.js";
|
||||
echo "<script type='text/javascript' src='$snmp_browser_path'></script>";
|
||||
//This line does not run with the dinamic loader editor in policies.
|
||||
//ui_require_javascript_file ('pandora_snmp_browser');
|
||||
|
||||
//WARNING REPEAT input hidden errors in console
|
||||
// Save some variables for javascript functions
|
||||
html_print_input_hidden ('ajax_url', ui_get_full_url("ajax.php"), false);
|
||||
html_print_input_hidden ('search_matches_translation', __("Search matches"), false);
|
||||
//html_print_input_hidden ('ajax_url', ui_get_full_url("ajax.php"), false);
|
||||
//html_print_input_hidden ('search_matches_translation', __("Search matches"), false);
|
||||
|
||||
|
||||
|
||||
// Define a custom action to save the OID selected in the SNMP browser to the form
|
||||
html_print_input_hidden ('custom_action', urlencode (base64_encode(' <a href="javascript:setOID()"><img src="' . ui_get_full_url("images") . '/input_filter.disabled.png" title="' . __("Use this OID") . '" style="vertical-align: middle;"></img></a>')), false);
|
||||
|
@ -215,11 +218,11 @@ else if ($id_agent_module === false) {
|
|||
$data = array();
|
||||
$data[0] = __('Auth user');
|
||||
$data[1] = html_print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true, $disabledBecauseInPolicy,
|
||||
false, '', $classdisabledBecauseInPolicy);
|
||||
false, '', $classdisabledBecauseInPolicy);
|
||||
$data[2] = __('Auth password') . ui_print_help_tip(__("The pass length must be eight character minimum."), true);
|
||||
$data[3] = html_print_input_password ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true, $disabledBecauseInPolicy,
|
||||
false, $largeclassdisabledBecauseInPolicy);
|
||||
$data[3] .= html_print_input_hidden('active_snmp_v3', 0, true);
|
||||
false, $largeclassdisabledBecauseInPolicy);
|
||||
$data[3] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_mmen', true);
|
||||
if ($snmp_version != 3) $table_simple->rowstyle['field_snmpv3_row1'] = 'display: none;';
|
||||
push_table_simple($data, 'field_snmpv3_row1');
|
||||
|
||||
|
|
|
@ -65,13 +65,13 @@ if ($fields_selected[0]!='') {
|
|||
foreach ($fields_selected as $field_selected) {
|
||||
switch ($field_selected) {
|
||||
case 'id_evento':
|
||||
$result = __('Event id');
|
||||
$result = __('Event Id');
|
||||
break;
|
||||
case 'evento':
|
||||
$result = __('Event name');
|
||||
$result = __('Event Name');
|
||||
break;
|
||||
case 'id_agente':
|
||||
$result = __('Agent name');
|
||||
$result = __('Agent Name');
|
||||
break;
|
||||
case 'id_usuario':
|
||||
$result = __('User');
|
||||
|
@ -86,10 +86,10 @@ if ($fields_selected[0]!='') {
|
|||
$result = __('Timestamp');
|
||||
break;
|
||||
case 'event_type':
|
||||
$result = __('Event type');
|
||||
$result = __('Event Type');
|
||||
break;
|
||||
case 'id_agentmodule':
|
||||
$result = __('Agent module');
|
||||
$result = __('Module Name');
|
||||
break;
|
||||
case 'id_alert_am':
|
||||
$result = __('Alert');
|
||||
|
@ -107,7 +107,7 @@ if ($fields_selected[0]!='') {
|
|||
$result = __('Source');
|
||||
break;
|
||||
case 'id_extra':
|
||||
$result = __('Extra id');
|
||||
$result = __('Extra Id');
|
||||
break;
|
||||
case 'owner_user':
|
||||
$result = __('Owner');
|
||||
|
@ -119,8 +119,15 @@ if ($fields_selected[0]!='') {
|
|||
$result = __('Instructions');
|
||||
break;
|
||||
case 'server_name':
|
||||
$result = __('Server name');
|
||||
$result = __('Server Name');
|
||||
break;
|
||||
case 'data':
|
||||
$result = __('Data');
|
||||
break;
|
||||
case 'module_status':
|
||||
$result = __('Module Status');
|
||||
break;
|
||||
|
||||
}
|
||||
$result_selected[$field_selected] = $result;
|
||||
}
|
||||
|
@ -149,25 +156,27 @@ $table->data = array();
|
|||
|
||||
$fields_available = array();
|
||||
|
||||
$fields_available['id_evento'] = __('Event id');
|
||||
$fields_available['evento'] = __('Event name');
|
||||
$fields_available['id_agente'] = __('Agent name');
|
||||
$fields_available['id_evento'] = __('Event Id');
|
||||
$fields_available['evento'] = __('Event Name');
|
||||
$fields_available['id_agente'] = __('Agent Name');
|
||||
$fields_available['id_usuario'] = __('User');
|
||||
$fields_available['id_grupo'] = __('Group');
|
||||
$fields_available['estado'] = __('Status');
|
||||
$fields_available['timestamp'] = __('Timestamp');
|
||||
$fields_available['event_type'] = __('Event type');
|
||||
$fields_available['id_agentmodule'] = __('Agent module');
|
||||
$fields_available['event_type'] = __('Event Type');
|
||||
$fields_available['id_agentmodule'] = __('Module Name');
|
||||
$fields_available['id_alert_am'] = __('Alert');
|
||||
$fields_available['criticity'] = __('Severity');
|
||||
$fields_available['user_comment'] = __('Comment');
|
||||
$fields_available['tags'] = __('Tags');
|
||||
$fields_available['source'] = __('Source');
|
||||
$fields_available['id_extra'] = __('Extra id');
|
||||
$fields_available['id_extra'] = __('Extra Id');
|
||||
$fields_available['owner_user'] = __('Owner');
|
||||
$fields_available['ack_utimestamp'] = __('ACK Timestamp');
|
||||
$fields_available['instructions'] = __('Instructions');
|
||||
$fields_available['server_name'] = __('Server name');
|
||||
$fields_available['server_name'] = __('Server Name');
|
||||
$fields_available['data'] = __('Data');
|
||||
$fields_available['module_status'] = __('Module Status');
|
||||
|
||||
//remove fields already selected
|
||||
foreach ($fields_available as $key=>$available) {
|
||||
|
|
|
@ -66,6 +66,7 @@ if (is_ajax ()) {
|
|||
}
|
||||
|
||||
if ($get_group_agents) {
|
||||
ob_clean();
|
||||
$id_group = (int) get_parameter ('id_group');
|
||||
$disabled = (int) get_parameter ('disabled', 0);
|
||||
$search = (string) get_parameter ('search', '');
|
||||
|
@ -82,6 +83,9 @@ if (is_ajax ()) {
|
|||
$status_agents = (int)get_parameter('status_agents', AGENT_STATUS_ALL);
|
||||
// Juanma (22/05/2014) Fix: If setted remove void agents from result (by default and for compatibility show void agents)
|
||||
$show_void_agents = (int)get_parameter('show_void_agents', 1);
|
||||
$serialized = (bool)get_parameter('serialized', false);
|
||||
$serialized_separator = (string)get_parameter('serialized_separator', "|");
|
||||
$force_serialized = (bool)get_parameter('force_serialized', false);
|
||||
|
||||
if (! check_acl ($config['id_user'], $id_group, "AR")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
|
@ -121,18 +125,26 @@ if (is_ajax ()) {
|
|||
$filter[$_sql_post] = '1';
|
||||
|
||||
}
|
||||
|
||||
|
||||
$id_groups_get_agents = $id_group;
|
||||
if ( $id_group == 0 && $privilege != '') {
|
||||
$groups = users_get_groups ($config["id_user"], $privilege, false);
|
||||
// if group ID doesn't matter and $privilege is specified (like 'AW'),
|
||||
// retruns all agents that current user has $privilege privilege for.
|
||||
$agents = agents_get_group_agents(array_keys($groups), $filter, "none", false, $recursion, false, '|', $add_alert_bulk_op);
|
||||
$id_groups_get_agents = array_keys($groups);
|
||||
}
|
||||
else {
|
||||
$agents = agents_get_group_agents($id_group, $filter, "none",
|
||||
true, $recursion, false, '|', $add_alert_bulk_op);
|
||||
}
|
||||
|
||||
$agents = agents_get_group_agents(
|
||||
$id_groups_get_agents,
|
||||
$filter,
|
||||
"none",
|
||||
false,
|
||||
$recursion,
|
||||
$serialized,
|
||||
$serialized_separator,
|
||||
$add_alert_bulk_op,
|
||||
$force_serialized
|
||||
);
|
||||
|
||||
$agents_disabled = array();
|
||||
// Add keys prefix
|
||||
if ($keys_prefix !== "") {
|
||||
|
@ -140,7 +152,34 @@ if (is_ajax ()) {
|
|||
$agents[$keys_prefix . $k] = $v;
|
||||
unset($agents[$k]);
|
||||
if ($all_agents) {
|
||||
$agent_disabled = db_get_value_filter('disabled', 'tagente', array('id_agente' => $k));
|
||||
// Unserialize to get the status
|
||||
if ($serialized && is_metaconsole()) {
|
||||
$agent_info = explode($serialized_separator, $k);
|
||||
$agent_disabled = db_get_value_filter(
|
||||
'disabled',
|
||||
'tmetaconsole_agent',
|
||||
array(
|
||||
'id_tagente' => $agent_info[1],
|
||||
'id_tmetaconsole_setup' => $agent_info[0]
|
||||
)
|
||||
);
|
||||
} elseif ($serialized && !is_metaconsole() && $force_serialized) {
|
||||
$agent_info = explode($serialized_separator, $k);
|
||||
$agent_disabled = db_get_value_filter(
|
||||
'disabled',
|
||||
'tagente',
|
||||
array('id_agente' => $agent_info[1])
|
||||
);
|
||||
} elseif (!$serialized && is_metaconsole()) {
|
||||
// Cannot retrieve the disabled status. Mark all as not disabled
|
||||
$agent_disabled = 0;
|
||||
} else {
|
||||
$agent_disabled = db_get_value_filter(
|
||||
'disabled',
|
||||
'tagente',
|
||||
array('id_agente' => $k)
|
||||
);
|
||||
}
|
||||
$agents_disabled[$keys_prefix . $k] = $agent_disabled;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,12 +101,12 @@ if (check_acl ($config['id_user'], 0, "PM")) {
|
|||
$sub["godmode/modules/manage_network_templates"]["text"] = __('Module templates');
|
||||
$sub["godmode/modules/manage_network_templates"]["id"] = 'Module templates';
|
||||
enterprise_hook ('inventory_submenu');
|
||||
enterprise_hook ('autoconfiguration_menu');
|
||||
}
|
||||
if (check_acl ($config['id_user'], 0, "AW")) {
|
||||
enterprise_hook ('policies_menu');
|
||||
enterprise_hook('agents_submenu');
|
||||
}
|
||||
|
||||
if (check_acl ($config['id_user'], 0, "AW")) {
|
||||
$sub["gmassive"]["text"] = __('Bulk operations');
|
||||
$sub["gmassive"]["id"] = 'Bulk operations';
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// GNU General Public License for more details.
|
||||
|
||||
global $config;
|
||||
include_once($config['homedir'] . '/include/graphs/functions_d3.php');
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "PM")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
|
@ -22,7 +23,7 @@ if (! check_acl ($config['id_user'], 0, "PM")) {
|
|||
return;
|
||||
}
|
||||
|
||||
echo "<script type='text/javascript' src='include/javascript/d3.3.5.14.js'></script>" . "\n";
|
||||
include_javascript_d3();
|
||||
|
||||
function push_table_row ($row, $id = false) {
|
||||
global $table;
|
||||
|
@ -128,7 +129,7 @@ $table->data[4][1] .= html_print_input_text ('str_warning', $str_warning,
|
|||
$table->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
$table->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true);
|
||||
|
||||
$table->data[4][2] = '<svg id="svg_dinamic" width="800" height="300"> </svg>';
|
||||
$table->data[4][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
|
||||
$table->colspan[4][2] = 2;
|
||||
$table->rowspan[4][2] = 3;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ $data[0] = __('Auth user');
|
|||
$data[1] = html_print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
|
||||
$data[2] = __('Auth password');
|
||||
$data[3] = html_print_input_password ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
|
||||
$data[3] .= html_print_input_hidden('active_snmp_v3', 0, true);
|
||||
$data[3] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_mncfn', true);
|
||||
push_table_row($data, 'field_snmpv3_row1');
|
||||
|
||||
$data = array();
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC180709';
|
||||
$pandora_version = 'v7.0NG.724';
|
||||
$build_version = 'PC180801';
|
||||
$pandora_version = 'v7.0NG.725';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
|
@ -1360,11 +1360,41 @@ function safe_sql_string($string) {
|
|||
|
||||
function is_metaconsole() {
|
||||
global $config;
|
||||
|
||||
if ($config['metaconsole'])
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return (bool) $config['metaconsole'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if there is management operations are allowed in current context
|
||||
* (node // meta)
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_management_allowed() {
|
||||
global $config;
|
||||
return ( (is_metaconsole() && $config["centralized_management"])
|
||||
|| (!is_metaconsole() && !$config["centralized_management"]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if there is centralized management in metaconsole environment.
|
||||
* Usefull to display some policy features on metaconsole.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_central_policies() {
|
||||
global $config;
|
||||
return is_metaconsole() && $config["centralized_management"];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if there is centralized management in node environment. Usefull
|
||||
* to reduce the policy functionallity on nodes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_central_policies_on_node() {
|
||||
global $config;
|
||||
return (!is_metaconsole()) && $config["centralized_management"];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3117,29 +3147,25 @@ function series_type_graph_array($data, $show_elements_graph){
|
|||
}
|
||||
}
|
||||
|
||||
if(($show_elements_graph['fullscale'] ||
|
||||
$show_elements_graph['type_mode_graph'] ) &&
|
||||
strpos($key, 'baseline') === false ){
|
||||
$data_return['legend'][$key] .=
|
||||
__('Min:') . remove_right_zeros(
|
||||
number_format(
|
||||
$value['min'],
|
||||
$config['graph_precision']
|
||||
)
|
||||
) . ' ' .
|
||||
__('Max:') . remove_right_zeros(
|
||||
number_format(
|
||||
$value['max'],
|
||||
$config['graph_precision']
|
||||
)
|
||||
) . ' ' .
|
||||
_('Avg:') . remove_right_zeros(
|
||||
number_format(
|
||||
$value['avg'],
|
||||
$config['graph_precision']
|
||||
)
|
||||
) . ' ' . $str;
|
||||
}
|
||||
$data_return['legend'][$key] .=
|
||||
__('Min:') . remove_right_zeros(
|
||||
number_format(
|
||||
$value['min'],
|
||||
$config['graph_precision']
|
||||
)
|
||||
) . ' ' .
|
||||
__('Max:') . remove_right_zeros(
|
||||
number_format(
|
||||
$value['max'],
|
||||
$config['graph_precision']
|
||||
)
|
||||
) . ' ' .
|
||||
_('Avg:') . remove_right_zeros(
|
||||
number_format(
|
||||
$value['avg'],
|
||||
$config['graph_precision']
|
||||
)
|
||||
) . ' ' . $str;
|
||||
|
||||
if($show_elements_graph['compare'] == 'overlapped' && $key == 'sum2'){
|
||||
$data_return['color'][$key] = $color_series['overlapped'];
|
||||
|
|
|
@ -796,11 +796,22 @@ function agents_common_modules ($id_agent, $filter = false, $indexed = true, $ge
|
|||
* @param boolean $childGroups The flag to get agents in the child group of group parent passed. By default false.
|
||||
* @param boolean $serialized Only in metaconsole. Return the key as <server id><SEPARATOR><agent id>. By default false.
|
||||
* @param string $separator Only in metaconsole. Separator for the serialized data. By default |.
|
||||
* @param bool $add_alert_bulk_op //TODO documentation
|
||||
* @param bool $force_serialized. If the agent has not id_server (typically in node) put 0 as <server_id>.
|
||||
*
|
||||
* @return array An array with all agents in the group or an empty array
|
||||
*/
|
||||
function agents_get_group_agents ($id_group = 0, $search = false,
|
||||
$case = "lower", $noACL = false, $childGroups = false, $serialized = false, $separator = '|', $add_alert_bulk_op = false) {
|
||||
function agents_get_group_agents (
|
||||
$id_group = 0,
|
||||
$search = false,
|
||||
$case = "lower",
|
||||
$noACL = false,
|
||||
$childGroups = false,
|
||||
$serialized = false,
|
||||
$separator = '|',
|
||||
$add_alert_bulk_op = false,
|
||||
$force_serialized = false
|
||||
) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -977,11 +988,12 @@ function agents_get_group_agents ($id_group = 0, $search = false,
|
|||
|
||||
if ($serialized && isset($row["id_server"])) {
|
||||
$key = $row["id_server"] . $separator . $row["id_agente"];
|
||||
}
|
||||
else {
|
||||
} elseif ($force_serialized) {
|
||||
$key = "0" . $separator . $row["id_agente"];
|
||||
} else {
|
||||
$key = $row["id_agente"];
|
||||
}
|
||||
|
||||
|
||||
switch ($case) {
|
||||
case "lower":
|
||||
$value = mb_strtolower ($row["alias"], "UTF-8");
|
||||
|
@ -2010,7 +2022,8 @@ function agents_get_agentmodule_group ($id_module) {
|
|||
* @return int The group id
|
||||
*/
|
||||
function agents_get_agent_group ($id_agent) {
|
||||
return (int) db_get_value ('id_grupo', 'tagente', 'id_agente', (int) $id_agent);
|
||||
$table = is_metaconsole() ? "tmetaconsole_agent" : "tagente";
|
||||
return (int) db_get_value ('id_grupo', $table, 'id_agente', (int) $id_agent);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -99,78 +99,69 @@ function returnError($typeError, $returnType = 'string') {
|
|||
break;
|
||||
default:
|
||||
returnData("string",
|
||||
array('type' => 'string', 'data' => __($returnType)));
|
||||
array('type' => 'string', 'data' => __($typeError)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $returnType
|
||||
* @param $data
|
||||
* @param $separator
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
function returnData($returnType, $data, $separator = ';') {
|
||||
switch ($returnType) {
|
||||
case 'string':
|
||||
if ($data['type'] == 'string') {
|
||||
echo $data['data'];
|
||||
if( is_array($data['data']) ){
|
||||
echo convert_array_multi($data['data'], $separator);
|
||||
}
|
||||
else {
|
||||
//TODO
|
||||
else{
|
||||
echo $data['data'];
|
||||
}
|
||||
break;
|
||||
case 'csv':
|
||||
case 'csv_head':
|
||||
switch ($data['type']) {
|
||||
case 'array':
|
||||
if (array_key_exists('list_index', $data))
|
||||
{
|
||||
if ($returnType == 'csv_head') {
|
||||
foreach($data['list_index'] as $index) {
|
||||
echo $index;
|
||||
if (end($data['list_index']) == $index)
|
||||
echo "\n";
|
||||
else
|
||||
echo $separator;
|
||||
}
|
||||
}
|
||||
foreach($data['data'] as $dataContent) {
|
||||
foreach($data['list_index'] as $index) {
|
||||
if (array_key_exists($index, $dataContent))
|
||||
echo str_replace("\n", " ", $dataContent[$index]);
|
||||
if (end($data['list_index']) == $index)
|
||||
echo "\n";
|
||||
else
|
||||
echo $separator;
|
||||
}
|
||||
if( is_array($data['data']) ){
|
||||
if (array_key_exists('list_index', $data)) {
|
||||
if ($returnType == 'csv_head') {
|
||||
foreach($data['list_index'] as $index) {
|
||||
echo $index;
|
||||
if (end($data['list_index']) == $index)
|
||||
echo "\n";
|
||||
else
|
||||
echo $separator;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!empty($data['data'])) {
|
||||
|
||||
foreach ($data['data'] as $dataContent) {
|
||||
|
||||
$clean = array_map("array_apply_io_safe_output", $dataContent);
|
||||
|
||||
foreach ($clean as $k => $v) {
|
||||
$clean[$k] = str_replace("\r", "\n", $clean[$k]);
|
||||
$clean[$k] = str_replace("\n", " ", $clean[$k]);
|
||||
$clean[$k] = strip_tags($clean[$k]);
|
||||
$clean[$k] = str_replace(';',' ',$clean[$k]);
|
||||
}
|
||||
$row = implode($separator, $clean);
|
||||
|
||||
echo $row . "\n";
|
||||
}
|
||||
foreach($data['data'] as $dataContent) {
|
||||
foreach($data['list_index'] as $index) {
|
||||
if (array_key_exists($index, $dataContent))
|
||||
echo str_replace("\n", " ", $dataContent[$index]);
|
||||
if (end($data['list_index']) == $index)
|
||||
echo "\n";
|
||||
else
|
||||
echo $separator;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'string':
|
||||
echo $data['data'];
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if (!empty($data['data'])) {
|
||||
foreach ($data['data'] as $dataContent) {
|
||||
$clean = array_map("array_apply_io_safe_output", $dataContent);
|
||||
foreach ($clean as $k => $v) {
|
||||
$clean[$k] = str_replace("\r", "\n", $clean[$k]);
|
||||
$clean[$k] = str_replace("\n", " ", $clean[$k]);
|
||||
$clean[$k] = strip_tags($clean[$k]);
|
||||
$clean[$k] = str_replace(';',' ',$clean[$k]);
|
||||
}
|
||||
$row = implode($separator, $clean);
|
||||
echo $row . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo $data['data'];
|
||||
}
|
||||
break;
|
||||
case 'json':
|
||||
|
@ -180,13 +171,13 @@ function returnData($returnType, $data, $separator = ';') {
|
|||
if ($separator == ";") {
|
||||
$separator = null;
|
||||
}
|
||||
|
||||
|
||||
if(empty($separator)){
|
||||
echo json_encode ($data);
|
||||
} else {
|
||||
echo json_encode ($data, $separator);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -5400,74 +5391,6 @@ function api_set_planned_downtimes_additem ($id, $thrash1, $other, $thrash3) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add agent to a policy. And return a message with the result of the operation.
|
||||
*
|
||||
* @param string $id Id of the target policy.
|
||||
* @param $thrash1 Don't use.
|
||||
* @param array $other it's array, $other as param is <id_agent> in this order
|
||||
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||
* example:
|
||||
*
|
||||
* example:
|
||||
*
|
||||
* api.php?op=set&op2=add_agent_policy&id=1&other=167&other_mode=url_encode_separator_|
|
||||
*
|
||||
* @param $thrash3 Don't use
|
||||
*/
|
||||
function api_set_add_agent_policy($id, $thrash1, $other, $thrash2) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id == "") {
|
||||
returnError('error_add_agent_policy', __('Error adding agent to policy. Id_policy cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($other['data'][0] == "") {
|
||||
returnError('error_add_agent_policy', __('Error adding agent to policy. Id_agent cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the agent exists and permissions
|
||||
if (!util_api_check_agent_and_print_error((int) $other['data'][0], 'string', "AW")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the policy permissions and existence
|
||||
if (enterprise_hook('policies_check_user_policy', array($id)) === false) {
|
||||
$result_agent = db_get_value ('id_agente', 'tagente', 'id_agente', (int) $other['data'][0]);
|
||||
if ($result_agent) {
|
||||
returnError('error_add_agent_policy', __('Error adding agent to policy. Id policy doesn\'t exist.'));
|
||||
return;
|
||||
}
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the agent is already in the policy
|
||||
$id_agent_policy = enterprise_hook('policies_get_agents', array($id, array('id_agent' => $other['data'][0]), 'id'));
|
||||
|
||||
if ($id_agent_policy === ENTERPRISE_NOT_HOOK) {
|
||||
returnError('error_add_agent_policy', __('Error adding agent to policy.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id_agent_policy === false) {
|
||||
$success = enterprise_hook('policies_create_agent', array($other['data'][0], $id, true));
|
||||
}
|
||||
else {
|
||||
returnError('error_add_agent_policy', __('Error adding agent to policy. The agent is already in the policy.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($success)
|
||||
returnData('string', array('type' => 'string', 'data' => $success));
|
||||
else
|
||||
returnError('error_add_agent_policy', 'Error adding agent to policy.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add data module to policy. And return id from new module.
|
||||
*
|
||||
|
@ -6429,153 +6352,6 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) {
|
|||
array('type' => 'string', 'data' => __('SNMP policy module updated.')));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Apply policy. And return id from the applying operation.
|
||||
*
|
||||
* @param string $id Id of the target policy.
|
||||
* @param $thrash1 Don't use.
|
||||
* @param array $other Don't use
|
||||
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||
* example:
|
||||
*
|
||||
* api.php?op=set&op2=apply_policy&id=1
|
||||
*
|
||||
* @param $thrash3 Don't use
|
||||
*/
|
||||
function api_set_apply_policy($id, $thrash1, $other, $thrash3) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id == "") {
|
||||
returnError('error_apply_policy', __('Error applying policy. Id_policy cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
# Check if this operation is duplicated
|
||||
$duplicated = enterprise_hook('policies_get_policy_queue_status', array($id));
|
||||
|
||||
if ($duplicated === ENTERPRISE_NOT_HOOK) {
|
||||
// We want to return a value
|
||||
if ($other == "return") {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
returnError('error_apply_policy', __('Error applying policy.'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($duplicated == STATUS_IN_QUEUE_APPLYING or $duplicated == STATUS_IN_QUEUE_IN) {
|
||||
// We want to return a value
|
||||
if ($other == "return") {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
returnError('error_apply_policy',
|
||||
__('Error applying policy. This policy is already pending to apply.'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$check_acl = enterprise_hook('policies_check_user_policy', array($id));
|
||||
if ($check_acl !== true) {
|
||||
// We want to return a value
|
||||
if ($other == "return") {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
returnError('error_apply_policy', __('Error applying policy.'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$id = enterprise_hook('add_policy_queue_operation', array($id, 0, 'apply'));
|
||||
|
||||
if ($id === ENTERPRISE_NOT_HOOK) {
|
||||
// We want to return a value
|
||||
if ($other == "return") {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
returnError('error_apply_policy', __('Error applying policy.'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// We want to return a value
|
||||
if ($other == "return") {
|
||||
if ($id)
|
||||
return $id;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
if ($id)
|
||||
returnData('string', array('type' => 'string', 'data' => $id));
|
||||
else
|
||||
returnError('error_apply_policy', 'Error applying policy.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Apply all policy in database. And return the number of policies applied.
|
||||
*
|
||||
* @param string $id Don't use.
|
||||
* @param $thrash1 Don't use.
|
||||
* @param array $other Don't use
|
||||
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||
* example:
|
||||
*
|
||||
* api.php?op=set&op2=apply_all_policies
|
||||
*
|
||||
* @param $thrash3 Don't use
|
||||
*/
|
||||
function api_set_apply_all_policies($thrash1, $thrash2, $other, $thrash3) {
|
||||
global $config;
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!check_acl($config['id_user'], 0, "AW")) {
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
$policies = array();
|
||||
|
||||
# Get all policies
|
||||
$policies = enterprise_hook('policies_get_policies', array(false, false, false));
|
||||
|
||||
if ($policies === ENTERPRISE_NOT_HOOK) {
|
||||
returnError('error_apply_all_policy', __('Error applying all policies.'));
|
||||
return;
|
||||
}
|
||||
if ($policies === false) $policies = array();
|
||||
|
||||
$num_policies = count($policies);
|
||||
$count_results = 0;
|
||||
foreach ($policies as $policy) {
|
||||
$return_value = enterprise_hook('add_policy_queue_operation',
|
||||
array($policy['id'], 0, 'apply'));
|
||||
|
||||
if ($return_value != -1) {
|
||||
$count_results++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($num_policies > $count_results) {
|
||||
$errors = $num_policies - $count_results;
|
||||
|
||||
returnError('error_apply_policy', 'Error applying policy. ' . $errors . ' failed. ');
|
||||
}
|
||||
else {
|
||||
returnData('string', array('type' => 'string', 'data' => $count_results));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new group. And return the id_group of the new group.
|
||||
*
|
||||
|
@ -10345,10 +10121,11 @@ function api_set_create_special_day($thrash1, $thrash2, $other, $thrash3) {
|
|||
*
|
||||
* @param $thrash1 Don't use.
|
||||
* @param $thrash2 Don't use.
|
||||
* @param array $other it's array, $other as param is <description>;<id_group>;<critical>;
|
||||
* @param array $other it's array, $other as param is <description>;<id_group>;<critical>;
|
||||
* <warning>;<id_agent>;<sla_interval>;<sla_limit>;<id_warning_module_template_alert>;
|
||||
* <id_critical_module_template_alert>;<id_critical_module_sla_template_alert>;
|
||||
* in this order and separator char (after text ; ) and separator
|
||||
* <id_critical_module_template_alert>;<id_critical_module_sla_template_alert>;<quiet>;
|
||||
* <cascade_protection>;<evaluate_sla>;
|
||||
* in this order and separator char (after text ; ) and separator
|
||||
* (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||
* @param $thrash3 Don't use
|
||||
*
|
||||
|
@ -10376,6 +10153,7 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
$id_critical_module_sla = $other['data'][10];
|
||||
$quiet = $other['data'][11];
|
||||
$cascade_protection = $other['data'][12];
|
||||
$evaluate_sla = $other['data'][13];
|
||||
|
||||
if(empty($name)){
|
||||
returnError('error_create_service', __('Error in creation service. No name'));
|
||||
|
@ -10425,6 +10203,9 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
if(empty($cascade_protection)){
|
||||
$cascade_protection = 0;
|
||||
}
|
||||
if(empty($evaluate_sla)){
|
||||
$evaluate_sla = 0;
|
||||
}
|
||||
|
||||
$result = services_create_service (
|
||||
$name, $description, $id_group,
|
||||
|
@ -10432,7 +10213,7 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
$mode, $id_agent, $sla_interval, $sla_limit,
|
||||
$id_warning_module_template, $id_critical_module_template,
|
||||
$id_unknown_module_template, $id_critical_module_sla,
|
||||
$quiet, $cascade_protection
|
||||
$quiet, $cascade_protection, $evaluate_sla
|
||||
);
|
||||
|
||||
if($result){
|
||||
|
@ -10447,10 +10228,11 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
*
|
||||
* @param $thrash1 service id.
|
||||
* @param $thrash2 Don't use.
|
||||
* @param array $other it's array, $other as param is <name>;<description>;<id_group>;<critical>;
|
||||
* @param array $other it's array, $other as param is <name>;<description>;<id_group>;<critical>;
|
||||
* <warning>;<id_agent>;<sla_interval>;<sla_limit>;<id_warning_module_template_alert>;
|
||||
* <id_critical_module_template_alert>;<id_critical_module_sla_template_alert>;
|
||||
* in this order and separator char (after text ; ) and separator
|
||||
* <id_critical_module_template_alert>;<id_critical_module_sla_template_alert>;<quiet>;
|
||||
* <cascade_protection>;<evaluate_sla>;
|
||||
* in this order and separator char (after text ; ) and separator
|
||||
* (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||
* @param $thrash3 Don't use
|
||||
*
|
||||
|
@ -10548,6 +10330,11 @@ function api_set_update_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
$cascade_protection = $service['cascade_protection'];
|
||||
}
|
||||
|
||||
$evaluate_sla = $other['data'][13];
|
||||
if(empty($evaluate_sla)){
|
||||
$evaluate_sla = $service['evaluate_sla'];
|
||||
}
|
||||
|
||||
$result = services_update_service (
|
||||
$id_service, $name,$description, $id_group,
|
||||
$critical, $warning, SECONDS_5MINUTES, $mode,
|
||||
|
@ -10556,7 +10343,8 @@ function api_set_update_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
$id_critical_module_template,
|
||||
$id_unknown_module_template,
|
||||
$id_critical_module_sla,
|
||||
$quiet, $cascade_protection
|
||||
$quiet, $cascade_protection,
|
||||
$evaluate_sla
|
||||
);
|
||||
|
||||
if($result){
|
||||
|
@ -10571,10 +10359,10 @@ function api_set_update_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
*
|
||||
* @param $thrash1 service id.
|
||||
* @param $thrash2 Don't use.
|
||||
* @param array $other it's a json, $other as param is <description>;<id_group>;<critical>;
|
||||
* @param array $other it's a json, $other as param is <description>;<id_group>;<critical>;
|
||||
* <warning>;<id_agent>;<sla_interval>;<sla_limit>;<id_warning_module_template_alert>;
|
||||
* <id_critical_module_template_alert>;<id_critical_module_sla_template_alert>;
|
||||
* in this order and separator char (after text ; ) and separator
|
||||
* <id_critical_module_template_alert>;<id_critical_module_sla_template_alert>;
|
||||
* in this order and separator char (after text ; ) and separator
|
||||
* (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||
* @param $thrash3 Don't use
|
||||
*
|
||||
|
@ -10590,7 +10378,7 @@ function api_set_add_element_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
if (is_metaconsole()) return;
|
||||
|
||||
$id = $thrash1;
|
||||
|
||||
|
||||
if(empty($id)){
|
||||
returnError('error_add_service_element', __('Error adding elements to service. No service id'));
|
||||
return;
|
||||
|
@ -10619,7 +10407,7 @@ function api_set_add_element_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'module':
|
||||
$agent_id = 0;
|
||||
$id_service_child = 0;
|
||||
|
@ -10628,7 +10416,7 @@ function api_set_add_element_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'service':
|
||||
$agent_id = 0;
|
||||
$id_agente_modulo = 0;
|
||||
|
@ -10641,7 +10429,7 @@ function api_set_add_element_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$values = array(
|
||||
'id_agente_modulo' => $id_agente_modulo,
|
||||
'description' => $element['description'],
|
||||
|
@ -10653,20 +10441,20 @@ function api_set_add_element_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
'id_agent' => $agent_id,
|
||||
'id_service_child' => $id_service_child,
|
||||
'id_server_meta' => 0);
|
||||
|
||||
|
||||
$result = db_process_sql_insert('tservice_element',$values);
|
||||
if($result && !$results){
|
||||
$results = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($results){
|
||||
returnData('string', array('type' => 'string', 'data' => 1));
|
||||
} else {
|
||||
returnError('error_add_service_element', __('Error adding elements to service'));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Update a special day. And return a message with the result of the operation.
|
||||
|
|
|
@ -2291,4 +2291,19 @@ function config_prepare_session() {
|
|||
ini_set("post_max_size", $config["max_file_size"]);
|
||||
ini_set("upload_max_filesize", $config["max_file_size"]);
|
||||
}
|
||||
|
||||
function config_update_value_in_db ($token, $value) {
|
||||
$inserted_value = db_get_value('value', 'tconfig', '`token`', $token);
|
||||
if ($inserted_value === false) {
|
||||
return db_process_sql_insert(
|
||||
'tconfig',
|
||||
array('value' => $value, 'token' => $token)
|
||||
) !== false;
|
||||
}
|
||||
else {
|
||||
return db_process_sql_update(
|
||||
'tconfig', array('value' => $value), array('token' => $token)
|
||||
) !== false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -50,6 +50,8 @@ function events_get_all_fields() {
|
|||
$columns['ack_utimestamp'] = __('ACK Timestamp');
|
||||
$columns['instructions'] = __('Instructions');
|
||||
$columns['server_name'] = __('Server name');
|
||||
$columns['data'] = __('Data');
|
||||
$columns['module_status'] = __('Module status');
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
@ -763,15 +765,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, id_extra)
|
||||
server_id, id_extra, data, module_status)
|
||||
VALUES (%d, %d, "%s", NOW(), %d, UNIX_TIMESTAMP(NOW()),
|
||||
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s",
|
||||
"%s", "%s", %d, "%s")',
|
||||
"%s", "%s", %d, "%s", %d, %d)',
|
||||
$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, $id_extra);
|
||||
$server_id, $id_extra, $data, $module_status);
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf ('
|
||||
|
@ -780,16 +782,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, id_extra)
|
||||
server_id, id_extra, data, module_status)
|
||||
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")',
|
||||
"%s", %d, "%s", %d, %d)',
|
||||
$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, $id_extra);
|
||||
$server_id, $id_extra, $data, $module_status);
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = sprintf ('
|
||||
|
@ -798,15 +800,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, id_extra)
|
||||
server_id, id_extra, data, module_status)
|
||||
VALUES (%d, %d, "%s", CURRENT_TIMESTAMP, %d, UNIX_TIMESTAMP,
|
||||
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s",
|
||||
"%s", "%s", %d, "%s")',
|
||||
"%s", "%s", %d, "%s", %d, %d)',
|
||||
$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, $id_extra);
|
||||
$server_id, $id_extra, $data, $module_status);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -818,13 +820,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, id_extra)
|
||||
unknown_instructions, source, tags, custom_data, id_extra, data, module_status)
|
||||
VALUES (%d, %d, "%s", NOW(), %d, UNIX_TIMESTAMP(NOW()),
|
||||
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", "%s")',
|
||||
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", "%s", %d, %d)',
|
||||
$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, $id_extra);
|
||||
$unknown_instructions, $source, $tags, $custom_data, $id_extra, $data, $module_status);
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf ('
|
||||
|
@ -832,14 +834,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, id_extra)
|
||||
unknown_instructions, source, tags, custom_data, id_extra, data, module_status)
|
||||
VALUES (%d, %d, "%s", NOW(), %d,
|
||||
ceil(date_part(\'epoch\', CURRENT_TIMESTAMP)), "%s",
|
||||
"%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", "%s")',
|
||||
"%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", "%s", %d, %d)',
|
||||
$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, $id_extra);
|
||||
$unknown_instructions, $source, $tags, $custom_data, $id_extra, $data, $module_status);
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = sprintf ("
|
||||
|
@ -847,13 +849,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, id_extra)
|
||||
unknown_instructions, source, tags, custom_data, id_extra, data, module_status)
|
||||
VALUES (%d, %d, '%s', CURRENT_TIMESTAMP, %d, UNIX_TIMESTAMP,
|
||||
'%s', '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
|
||||
'%s', '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d)",
|
||||
$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, $id_extra);
|
||||
$unknown_instructions, $source, $tags, $custom_data, $id_extra, $data, $module_status);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3745,6 +3747,16 @@ function events_list_events_grouped_agents($sql) {
|
|||
$table->align[$i] = 'left';
|
||||
$i++;
|
||||
}
|
||||
if (in_array('data', $show_fields)) {
|
||||
$table->head[$i] = __('Data');
|
||||
$table->align[$i] = 'left';
|
||||
$i++;
|
||||
}
|
||||
if (in_array('module_status', $show_fields)) {
|
||||
$table->head[$i] = __('Module status');
|
||||
$table->align[$i] = 'left';
|
||||
$i++;
|
||||
}
|
||||
if ($i != 0 && $allow_action) {
|
||||
$table->head[$i] = __('Action');
|
||||
$table->align[$i] = 'left';
|
||||
|
@ -4144,6 +4156,20 @@ function events_list_events_grouped_agents($sql) {
|
|||
$table->cellclass[count($table->data)][$i] = $myclass;
|
||||
$i++;
|
||||
}
|
||||
if (in_array('data',$show_fields)) {
|
||||
$data[$i] = $event["data"];
|
||||
if($data[$i] %1 == 0)
|
||||
$data[$i]= number_format($data[$i], 0);
|
||||
else
|
||||
$data[$i]= number_format($data[$i], 2);
|
||||
$table->cellclass[count($table->data)][$i] = $myclass;
|
||||
$i++;
|
||||
}
|
||||
if (in_array('module_status',$show_fields)) {
|
||||
$data[$i] = modules_get_modules_status ($event["module_status"]);
|
||||
$table->cellclass[count($table->data)][$i] = $myclass;
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($i != 0 && $allow_action) {
|
||||
//Actions
|
||||
|
|
|
@ -264,7 +264,9 @@ function grafico_modulo_sparse_data_chart (
|
|||
$data_module_graph['id_module_type'] == 18 ||
|
||||
$data_module_graph['id_module_type'] == 9 ||
|
||||
$data_module_graph['id_module_type'] == 31 ||
|
||||
$data_module_graph['id_module_type'] == 100 ){
|
||||
$data_module_graph['id_module_type'] == 100 ||
|
||||
$params['baseline'] || $params['projection']
|
||||
){
|
||||
|
||||
$data = db_get_all_rows_filter (
|
||||
'tagente_datos',
|
||||
|
@ -419,8 +421,8 @@ function grafico_modulo_sparse_data(
|
|||
$data_module_graph['id_module_type'] == 18 ||
|
||||
$data_module_graph['id_module_type'] == 9 ||
|
||||
$data_module_graph['id_module_type'] == 31 ||
|
||||
$data_module_graph['id_module_type'] == 100 ){
|
||||
html_debug_prinbt('entra');
|
||||
$data_module_graph['id_module_type'] == 100 ||
|
||||
$params['projection'] ){
|
||||
$array_data = grafico_modulo_sparse_data_chart (
|
||||
$agent_module_id,
|
||||
$date_array,
|
||||
|
@ -898,6 +900,10 @@ function grafico_modulo_sparse ($params) {
|
|||
$params['type_mode_graph'] = $config['type_mode_graph'];
|
||||
}
|
||||
|
||||
if(!isset($params['projection'])){
|
||||
$params['projection'] = false;
|
||||
}
|
||||
|
||||
//XXXX Configurable
|
||||
$params['grid_color'] = '#C1C1C1';
|
||||
$params['legend_color'] = '#636363';
|
||||
|
@ -1213,6 +1219,7 @@ function graphic_combined_module (
|
|||
}
|
||||
else{
|
||||
$params['stacked'] = 'area';
|
||||
$params['projection'] = $params_combined['projection'];
|
||||
}
|
||||
|
||||
if(!isset($params_combined['labels'])){
|
||||
|
@ -4084,21 +4091,32 @@ function fullscale_data (
|
|||
|
||||
$data["sum" . $series_suffix]['data'][] = array($real_date , $sum_data/$count_data);
|
||||
if($type_mode_graph && !$params['baseline']){
|
||||
$data["min" . $series_suffix]['data'][] = array($real_date , $min_value);
|
||||
$data["max" . $series_suffix]['data'][] = array($real_date , $max_value);
|
||||
if($min_value != PHP_INT_MAX) {
|
||||
$data["min" . $series_suffix]['data'][] = array($real_date , $min_value);
|
||||
}
|
||||
|
||||
if($max_value != -PHP_INT_MAX) {
|
||||
$data["max" . $series_suffix]['data'][] = array($real_date , $max_value);
|
||||
}
|
||||
}
|
||||
else{
|
||||
$data["sum" . $series_suffix]['slice_data'][$real_date]['min'] = $min_value;
|
||||
if($min_value != PHP_INT_MAX) {
|
||||
$data["sum" . $series_suffix]['slice_data'][$real_date]['min'] = $min_value;
|
||||
}
|
||||
|
||||
$data["sum" . $series_suffix]['slice_data'][$real_date]['avg'] = $sum_data/$count_data;
|
||||
$data["sum" . $series_suffix]['slice_data'][$real_date]['max'] = $max_value;
|
||||
|
||||
if($max_value != -PHP_INT_MAX) {
|
||||
$data["sum" . $series_suffix]['slice_data'][$real_date]['max'] = $max_value;
|
||||
}
|
||||
}
|
||||
|
||||
//max_total
|
||||
if($max_value >= $max_value_total){
|
||||
if($max_value >= $max_value_total && $max_value != -PHP_INT_MAX){
|
||||
$max_value_total = $max_value;
|
||||
}
|
||||
//min_total
|
||||
if($min_value <= $min_value_total){
|
||||
if($min_value <= $min_value_total && $min_value != PHP_INT_MAX){
|
||||
$min_value_total = $min_value;
|
||||
}
|
||||
//avg sum_total
|
||||
|
@ -4110,27 +4128,31 @@ function fullscale_data (
|
|||
if($type_mode_graph && !$params['baseline']){
|
||||
/*MIN*/
|
||||
//max_min
|
||||
if($min_value >= $min_value_max){
|
||||
if($min_value >= $min_value_max && $min_value != PHP_INT_MAX){
|
||||
$min_value_max = $min_value;
|
||||
}
|
||||
//min_min
|
||||
if($min_value <= $min_value_min){
|
||||
if($min_value <= $min_value_min && $min_value != PHP_INT_MAX){
|
||||
$min_value_min = $min_value;
|
||||
}
|
||||
//avg sum_min
|
||||
$sum_data_min += $min_value;
|
||||
if ($min_value != PHP_INT_MAX) {
|
||||
$sum_data_min += $min_value;
|
||||
}
|
||||
|
||||
/*MAX*/
|
||||
//max_max
|
||||
if($max_value >= $max_value_max){
|
||||
if($max_value >= $max_value_max && $max_value != -PHP_INT_MAX){
|
||||
$max_value_max = $max_value;
|
||||
}
|
||||
//min_max
|
||||
if($max_value <= $max_value_min){
|
||||
if($max_value <= $max_value_min && $max_value != -PHP_INT_MAX){
|
||||
$max_value_min = $max_value;
|
||||
}
|
||||
//avg sum_max
|
||||
$sum_data_max += $max_value;
|
||||
if ($max_value != -PHP_INT_MAX) {
|
||||
$sum_data_max += $max_value;
|
||||
}
|
||||
|
||||
/*AVG*/
|
||||
//max_max
|
||||
|
|
|
@ -2764,4 +2764,57 @@ function force_set_module_status ($status, $id_agent_module) {
|
|||
array('id_agente_modulo' => $id_agent_module)
|
||||
);
|
||||
}
|
||||
function modules_get_modules_status ($mod_status_id) {
|
||||
|
||||
$diferent_types = get_priorities ();
|
||||
|
||||
$mod_status_desc = '';
|
||||
switch ($mod_status_id) {
|
||||
case AGENT_MODULE_STATUS_NORMAL:
|
||||
$mod_status_desc = __('NORMAL');
|
||||
break;
|
||||
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
||||
$mod_status_desc = __('CRITICAL');
|
||||
break;
|
||||
case AGENT_MODULE_STATUS_WARNING:
|
||||
$mod_status_desc = __('WARNING');
|
||||
break;
|
||||
case AGENT_MODULE_STATUS_UNKNOWN:
|
||||
$mod_status_desc = __('UNKNOWN');
|
||||
break;
|
||||
case AGENT_MODULE_STATUS_NOT_INIT:
|
||||
$mod_status_desc = __('NOT INIT');
|
||||
break;
|
||||
case AGENT_MODULE_STATUS_ALL:
|
||||
$mod_status_desc = __('ALL');
|
||||
break;
|
||||
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
||||
$mod_status_desc = __('CRITICAL');
|
||||
break;
|
||||
case AGENT_MODULE_STATUS_NO_DATA:
|
||||
$mod_status_desc = __('NO DATA');
|
||||
break;
|
||||
case AGENT_MODULE_STATUS_NORMAL_ALERT:
|
||||
$mod_status_desc = __('NORMAL');
|
||||
break;
|
||||
case AGENT_MODULE_STATUS_NOT_NORMAL:
|
||||
$mod_status_desc = __('NOT NORMAL');
|
||||
break;
|
||||
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
||||
$mod_status_desc = __('WARNING');
|
||||
break;
|
||||
default:
|
||||
if (isset($config['text_char_long'])) {
|
||||
foreach ($diferent_types as $key => $type) {
|
||||
if ($key == $mod_status_id) {
|
||||
$mod_status_desc = ui_print_truncate_text($type,
|
||||
$config['text_char_long'], false, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $mod_status_desc;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -478,8 +478,8 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$row[] = $sla['module'];
|
||||
|
||||
if(is_numeric($sla['dinamic_text'])){
|
||||
$row[] = remove_right_zeros(number_format($sla['max'], $config['graph_precision'])) . " / " .
|
||||
remove_right_zeros(number_format($sla['min'], $config['graph_precision']));
|
||||
$row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " .
|
||||
sla_truncate($sla['min'], $config['graph_precision']);
|
||||
}
|
||||
else{
|
||||
$row[] = $sla['dinamic_text'];
|
||||
|
@ -561,8 +561,8 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$row[] = $sla['module'];
|
||||
|
||||
if(is_numeric($sla['dinamic_text'])){
|
||||
$row[] = remove_right_zeros(number_format($sla['max'], $config['graph_precision'])) . " / " .
|
||||
remove_right_zeros(number_format($sla['min'], $config['graph_precision']));
|
||||
$row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " .
|
||||
sla_truncate($sla['min'], $config['graph_precision']);
|
||||
}
|
||||
else{
|
||||
$row[] = $sla['dinamic_text'];
|
||||
|
@ -2432,7 +2432,7 @@ function reporting_html_availability(&$table, $item) {
|
|||
else
|
||||
$table_row[] = '--';
|
||||
|
||||
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'] * 100, $config['graph_precision']). '%</span>';
|
||||
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'], $config['graph_precision']). '%</span>';
|
||||
|
||||
$table_row2 = array();
|
||||
$table_row2[] = $row['agent'];
|
||||
|
@ -2478,7 +2478,7 @@ function reporting_html_availability(&$table, $item) {
|
|||
else
|
||||
$table_row[] = '--';
|
||||
|
||||
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'] * 100, $config['graph_precision']). '%</span>';
|
||||
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'], $config['graph_precision']). '%</span>';
|
||||
|
||||
$table_row2 = array();
|
||||
$table_row2[] = $row['agent'];
|
||||
|
@ -2545,7 +2545,7 @@ function reporting_html_availability(&$table, $item) {
|
|||
'max' => sla_truncate($item['resume']['max'], $config['graph_precision']) . "%",
|
||||
'min_text' => $item['resume']['min_text'],
|
||||
'min' => sla_truncate($item['resume']['min'], $config['graph_precision']) . "%",
|
||||
'avg' => '<span style="font-size: 1.2em; font-weight:bold;">' .remove_right_zeros(number_format($item['resume']['avg'], $config['graph_precision'])) . "%</span>"
|
||||
'avg' => '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($item['resume']['avg'], $config['graph_precision']) . "%</span>"
|
||||
);
|
||||
|
||||
$table->colspan[3][0] = 3;
|
||||
|
|
|
@ -36,7 +36,7 @@ function snmp_browser_print_tree ($tree, $id = 0, $depth = 0, $last = 0, $last_a
|
|||
|
||||
// Get the base URL for images
|
||||
if ($url === false) {
|
||||
$url = ui_get_full_url('operation/tree');
|
||||
$url = ui_get_full_url('operation/tree', false, false, false);
|
||||
}
|
||||
|
||||
// Leaf
|
||||
|
@ -604,8 +604,8 @@ function snmp_browser_print_container ($return = false, $width = '100%', $height
|
|||
$table3->data[2][2] = html_print_input_text ('snmp3_browser_auth_user', '', '', 15, 60, true);
|
||||
$table3->data[2][3] = '<b>'.__('Auth password').'</b>';
|
||||
$table3->data[2][4] = html_print_input_password ('snmp3_browser_auth_pass', '', '', 15, 60, true);
|
||||
$table3->data[2][4] .= html_print_input_hidden('active_snmp_v3', 0, true);
|
||||
|
||||
$table3->data[2][4] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_fsb', true);
|
||||
|
||||
$table3->data[5][0] = '<b>'.__('Privacy method').'</b>';
|
||||
$table3->data[5][1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp3_browser_privacy_method', '', '', '', '', true);
|
||||
$table3->data[5][2] = '<b>'.__('Privacy pass').'</b>';
|
||||
|
|
|
@ -831,22 +831,39 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
|||
$description = io_safe_output($template['name']);
|
||||
|
||||
$data = array ();
|
||||
|
||||
if (!defined('METACONSOLE')) {
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$policyInfo = policies_is_alert_in_policy2($alert['id'], false);
|
||||
if ($policyInfo === false)
|
||||
$data[$index['policy']] = '';
|
||||
else {
|
||||
$img = 'images/policies.png';
|
||||
|
||||
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
if(is_metaconsole()){
|
||||
$node = metaconsole_get_connection_by_id($alert['server_data']['id']);
|
||||
if (metaconsole_load_external_db($node) !== NOERR) {
|
||||
// Restore the default connection.
|
||||
metaconsole_restore_db();
|
||||
$errors++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$policyInfo = policies_is_alert_in_policy2($alert['id'], false);
|
||||
if ($policyInfo === false)
|
||||
$data[$index['policy']] = '';
|
||||
else {
|
||||
$img = 'images/policies.png';
|
||||
if(!is_metaconsole()){
|
||||
$data[$index['policy']] = '<a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id'] . '">' .
|
||||
html_print_image($img,true, array('title' => $policyInfo['name'])) .
|
||||
'</a>';
|
||||
}else{
|
||||
$data[$index['policy']] = '<a href="?sec=gmodules&sec2=advanced/policymanager&id=' . $policyInfo['id'] . '">' .
|
||||
html_print_image($img,true, array('title' => $policyInfo['name'])) .
|
||||
'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if(is_metaconsole()){
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Standby
|
||||
$data[$index['standby']] = '';
|
||||
if (isset ($alert["standby"]) && $alert["standby"] == 1) {
|
||||
|
@ -881,8 +898,8 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
|||
$agent_name = false;
|
||||
$id_agent = modules_get_agentmodule_agent ($alert["id_agent_module"]);
|
||||
}
|
||||
|
||||
if (defined('METACONSOLE') && !can_user_access_node ()) {
|
||||
|
||||
if (defined('METACONSOLE') || !can_user_access_node ()) {
|
||||
$data[$index['agent_name']] = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '[…]', 'font-size:7.5pt;');
|
||||
}
|
||||
else {
|
||||
|
@ -893,7 +910,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
|||
$data[$index['agent_name']] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'"> <span style="font-size: 7pt;font-weight:bold" title ="' . $agente['nombre']. '">'.$agente["alias"].'</span></a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$data[$index['module_name']] =
|
||||
ui_print_truncate_text (isset($alert['agent_module_name']) ? $alert['agent_module_name'] : modules_get_agentmodule_name ($alert["id_agent_module"]), 'module_small', false, true, true, '[…]', 'font-size: 7.2pt');
|
||||
}
|
||||
|
@ -2504,11 +2521,23 @@ function ui_print_page_header ($title, $icon = "", $return = false,
|
|||
";
|
||||
}
|
||||
|
||||
if ($help != "")
|
||||
$buffer .= "<div class='head_help' style='float: right; margin-top: -2px !important;'>" .
|
||||
ui_print_help_icon ($help, true, '', 'images/help_w.png') . "</div>";
|
||||
$buffer .= '</span></li></ul></div>';
|
||||
|
||||
if(!is_metaconsole()){
|
||||
if ($help != ""){
|
||||
$buffer .= "<div class='head_help' style='float: right; margin-top: -2px !important;'>" .
|
||||
ui_print_help_icon ($help, true, '', 'images/help_w.png') . "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
$buffer .= '</span>';
|
||||
|
||||
if(is_metaconsole()){
|
||||
if ($help != ""){
|
||||
$buffer .= "<div class='head_help'>" . ui_print_help_icon ($help, true, '', 'images/help_30.png') . "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
$buffer .= '</li></ul></div>';
|
||||
|
||||
if (is_array($options)) {
|
||||
$buffer .= '<div id="menu_tab"><ul class="mn">';
|
||||
foreach ($options as $key => $option) {
|
||||
|
|
|
@ -2026,13 +2026,13 @@ function pandoraFlotArea( graph_id, values, legend,
|
|||
avg_bigger = "";
|
||||
}
|
||||
|
||||
data_legend[index] =
|
||||
data_legend[index] =
|
||||
' Min: ' + (short_data ? number_format(min_y, 0, "", short_data) : parseFloat(min_y)) + min_bigger
|
||||
+ ' Max: ' + (short_data ? number_format(max_y, 0, "", short_data) : parseFloat(max_y)) + max_bigger
|
||||
+ ' Avg: ' + (short_data ? number_format(avg_y, 0, "", short_data) : parseFloat(avg_y)) + avg_bigger;
|
||||
});
|
||||
|
||||
var label_aux = legend[series.label] + data_legend[series.label];
|
||||
var label_aux = legend[series.label].split(":")[0] + data_legend[series.label];
|
||||
$('#legend_' + graph_id + ' .legendLabel').eq(i).html(label_aux);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -301,4 +301,22 @@ function get_complementary_rgb ($hexcode) {
|
|||
|
||||
return $rgbhex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns convert array multidimensional to string whit gluer.
|
||||
* @param array $array to convert
|
||||
* @param string glue to implode
|
||||
*/
|
||||
function convert_array_multi($array, $glue) {
|
||||
$result = '';
|
||||
foreach ($array as $item) {
|
||||
if (is_array($item)) {
|
||||
$result .= convert_array_multi($item, $glue) . $glue;
|
||||
} else {
|
||||
$result .= $item . $glue;
|
||||
}
|
||||
}
|
||||
$result = substr($result, 0, 0-strlen($glue));
|
||||
return $result;
|
||||
}
|
||||
?>
|
|
@ -90,6 +90,7 @@ Apart from the defined module macros, the following macros are also available:
|
|||
<li>_plugin_parameters_: Module plugin parameters.</li>
|
||||
<li>_policy_: Name of the policy that the module belongs to (if applies).</li>
|
||||
<li>_prevdata_: Module previous data before the alert has been triggered.</li>
|
||||
<li>_rca_: Root cause analysis chain (only for services).</li>
|
||||
<li>_server_ip_: Ip of server assigned to agent. </li>
|
||||
<li>_server_name_: Name of server assigned to agent. </li>
|
||||
<li>_target_ip_: IP address for the module’s target.</li>
|
||||
|
|
|
@ -75,6 +75,7 @@ Besides the defined module macros, the following macros are available:
|
|||
<li>_plugin_parameters_: Module plugin parameters.</li>
|
||||
<li>_policy_: Name of the policy that the module belongs to (if applies).</li>
|
||||
<li>_prevdata_: Module previous data before the alert has been triggered.</li>
|
||||
<li>_rca_: Root cause analysis chain (only for services).</li>
|
||||
<li>_server_ip_: Ip of server assigned to agent. </li>
|
||||
<li>_server_name_: Name of server assigned to agent. </li>
|
||||
<li>_target_ip_: IP address for the module’s target.</li>
|
||||
|
|
|
@ -92,6 +92,7 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
|
|||
<li>_plugin_parameters_: Parámetros del plugin del módulo.</li>
|
||||
<li>_policy_: Nombre de la política a la que pertenece el módulo (si aplica).</li>
|
||||
<li>_prevdata_: Dato previo antes de disparase la alerta.</li>
|
||||
<li>_rca_: Cadena de análasis de causa raíz (sólo para servicios).</li>
|
||||
<li>_server_ip_: Ip del servidor al que el agente está asignado. </li>
|
||||
<li>_server_name_: Nombre del servidor al que el agente está asignado. </li>
|
||||
<li>_target_ip_: Dirección IP del objetivo del módulo.</li>
|
||||
|
|
|
@ -75,6 +75,7 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
|
|||
<li>_plugin_parameters_: Parámetros del plugin del módulo.</li>
|
||||
<li>_policy_: Nombre de la política a la que pertenece el módulo (si aplica).</li>
|
||||
<li>_prevdata_: Dato previo antes de disparase la alerta.</li>
|
||||
<li>_rca_: Cadena de análasis de causa raíz (sólo para servicios).</li>
|
||||
<li>_server_ip_: Ip del servidor al que el agente está asignado. </li>
|
||||
<li>_server_name_: Nombre del servidor al que el agente está asignado. </li>
|
||||
<li>_target_ip_: Dirección IP del objetivo del módulo.</li>
|
||||
|
|
|
@ -91,6 +91,7 @@ email アクションを設定するには、_field1_ (送信先アドレス)、
|
|||
<li>_plugin_parameters_ : モジュールのプラグインパラメータ</li>
|
||||
<li>_policy_ : モジュールが属するポリシー名 (存在する場合)</li>
|
||||
<li>_prevdata_ : アラートを発報する前のモジュールデータ</li>
|
||||
<li>_rca_: Root cause analysis chain (only for services).</li>
|
||||
<li>_server_ip_ : エージェントが割り当てられているサーバ IP。</li>
|
||||
<li>_server_name_ : エージェントが割り当てられているサーバ名。 </li>
|
||||
<li>_target_ip_ : モジュールの対象IPアドレス</li>
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
<li>_plugin_parameters_ : モジュールのプラグインパラメータ</li>
|
||||
<li>_policy_ : モジュールが属するポリシー名 (存在する場合)</li>
|
||||
<li>_prevdata_ : アラートを発報する前のモジュールデータ</li>
|
||||
<li>_rca_: Root cause analysis chain (only for services).</li>
|
||||
<li>_server_ip_ : エージェントが割り当てられているサーバ IP。</li>
|
||||
<li>_server_name_ : エージェントが割り当てられているサーバ名。 </li>
|
||||
<li>_target_ip_ : モジュールの対象IPアドレス</li>
|
||||
|
|
|
@ -1264,13 +1264,14 @@ function pagination_show_more(params, message){
|
|||
datatype: "html"
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
*function use d3.js for paint graph
|
||||
*/
|
||||
function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical) {
|
||||
|
||||
|
||||
//Check if they are numbers
|
||||
if(isNaN(min_w)){ min_w = 0; };
|
||||
if(isNaN(max_w)){ max_w = 0; };
|
||||
|
@ -1284,31 +1285,31 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
min_c = parseFloat(min_c);
|
||||
max_w = parseFloat(max_w);
|
||||
max_c = parseFloat(max_c);
|
||||
|
||||
|
||||
//inicialize var
|
||||
var range_min = 0;
|
||||
var range_max = 0;
|
||||
var range_max_min = 0;
|
||||
var range_max_min = 0;
|
||||
|
||||
|
||||
//Find the lowest possible value
|
||||
if(min_w < 0 || min_c < 0){
|
||||
if(min_w < min_c){
|
||||
range_min = min_w - 100;
|
||||
} else {
|
||||
range_min = min_c - 100;
|
||||
range_min = min_c - 100;
|
||||
}
|
||||
} else if (min_w > 0 || min_c > 0) {
|
||||
if(min_w > min_c){
|
||||
range_max_min = min_w;
|
||||
} else {
|
||||
range_max_min = min_c;
|
||||
range_max_min = min_c;
|
||||
}
|
||||
} else {
|
||||
if(min_w < min_c){
|
||||
range_min = min_w - 100;
|
||||
} else {
|
||||
range_min = min_c - 100;
|
||||
range_min = min_c - 100;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1318,7 +1319,7 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
} else {
|
||||
range_max = max_c + 100 + range_max_min;
|
||||
}
|
||||
|
||||
|
||||
//Controls whether the maximum = 0 is infinite
|
||||
if((max_w == 0 || max_w == 0.00) && min_w != 0){
|
||||
max_w = range_max;
|
||||
|
@ -1326,10 +1327,10 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
if((max_c == 0 || max_c == 0.00) && min_c != 0){
|
||||
max_c = range_max;
|
||||
}
|
||||
|
||||
|
||||
//Scale according to the position
|
||||
position = 200 / (range_max-range_min);
|
||||
|
||||
|
||||
//axes
|
||||
var yScale = d3.scale.linear()
|
||||
.domain([range_min, range_max])
|
||||
|
@ -1344,13 +1345,13 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
//delete elements
|
||||
svg.selectAll("g").remove();
|
||||
|
||||
width_x = 201;
|
||||
width_x = 101;
|
||||
height_x = 50;
|
||||
|
||||
svg.append("g")
|
||||
.attr("transform", "translate(200, 150)")
|
||||
.attr("transform", "translate(100, 150)")
|
||||
.call(yAxis);
|
||||
|
||||
|
||||
//legend Normal text
|
||||
svg.append("g")
|
||||
.attr("width", 300)
|
||||
|
@ -1371,14 +1372,14 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
svg.append("g")
|
||||
.append("rect")
|
||||
.attr("id", "legend_normal")
|
||||
.attr("x", width_x + 80)
|
||||
.attr("y", height_x - 30)
|
||||
.attr("width", 10)
|
||||
.attr("height", 10)
|
||||
.style("fill", "#82B92E");
|
||||
.attr("x", width_x + 80)
|
||||
.attr("y", height_x - 30)
|
||||
.attr("width", 10)
|
||||
.attr("height", 10)
|
||||
.style("fill", "#82B92E");
|
||||
|
||||
//legend Warning text
|
||||
svg.append("g")
|
||||
//legend Warning text
|
||||
svg.append("g")
|
||||
.append("text")
|
||||
.attr("x", width_x + 100)
|
||||
.attr("y", height_x - 20)
|
||||
|
@ -1393,14 +1394,14 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
svg.append("g")
|
||||
.append("rect")
|
||||
.attr("id", "legend_warning")
|
||||
.attr("x", width_x + 185)
|
||||
.attr("y", height_x - 30)
|
||||
.attr("width", 10)
|
||||
.attr("height", 10)
|
||||
.style("fill", "#ffd731");
|
||||
.attr("x", width_x + 185)
|
||||
.attr("y", height_x - 30)
|
||||
.attr("width", 10)
|
||||
.attr("height", 10)
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
//legend Critical text
|
||||
svg.append("g")
|
||||
//legend Critical text
|
||||
svg.append("g")
|
||||
.append("text")
|
||||
.attr("x", width_x + 205)
|
||||
.attr("y", height_x - 20)
|
||||
|
@ -1415,11 +1416,11 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
svg.append("g")
|
||||
.append("rect")
|
||||
.attr("id", "legend_critical")
|
||||
.attr("x", width_x + 285)
|
||||
.attr("y", height_x - 30)
|
||||
.attr("width", 10)
|
||||
.attr("height", 10)
|
||||
.style("fill", "#fc4444");
|
||||
.attr("x", width_x + 285)
|
||||
.attr("y", height_x - 30)
|
||||
.attr("width", 10)
|
||||
.attr("height", 10)
|
||||
.style("fill", "#fc4444");
|
||||
|
||||
//styles for number and axes
|
||||
svg.selectAll("g .domain")
|
||||
|
@ -1435,89 +1436,87 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
svg.append("g")
|
||||
.append("rect")
|
||||
.attr("id", "status_rect")
|
||||
.attr("x", width_x)
|
||||
.attr("y", height_x)
|
||||
.attr("width", 300)
|
||||
.attr("height", 200)
|
||||
.style("fill", "#82B92E");
|
||||
|
||||
//controls the inverse warning
|
||||
if(inverse_w == 0){
|
||||
svg.append("g")
|
||||
.attr("x", width_x)
|
||||
.attr("y", height_x)
|
||||
.attr("width", 300)
|
||||
.attr("height", 200)
|
||||
.style("fill", "#82B92E");
|
||||
|
||||
//controls the inverse warning
|
||||
if(inverse_w == 0){
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_rect")
|
||||
.attr("x", width_x)
|
||||
.attr("x", width_x)
|
||||
.attr("y", (height_x +(range_max - min_w) * position) - ((max_w - min_w) * position))
|
||||
.attr("width", 300)
|
||||
.attr("width", 300)
|
||||
.attr("height", ((max_w - min_w) * position))
|
||||
.style("fill", "#ffd731");
|
||||
}
|
||||
else {
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.duration(600)
|
||||
.style("fill", "#ffd731");
|
||||
}
|
||||
else {
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_rect")
|
||||
.attr("x", width_x)
|
||||
.attr("x", width_x)
|
||||
.attr("y", height_x + 200 - ((min_w -range_min) * position))
|
||||
.attr("width", 300)
|
||||
.attr("width", 300)
|
||||
.attr("height", (min_w -range_min) * position)
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.duration(600)
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_inverse_rect")
|
||||
.attr("x", width_x)
|
||||
.attr("y", height_x)
|
||||
.attr("width", 300)
|
||||
.attr("x", width_x)
|
||||
.attr("y", height_x)
|
||||
.attr("width", 300)
|
||||
.attr("height", ((range_max - min_w) * position) - ((max_w - min_w) * position))
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
}
|
||||
//controls the inverse critical
|
||||
if(inverse_c == 0){
|
||||
svg.append("g")
|
||||
.style("fill", "#ffd731");
|
||||
}
|
||||
//controls the inverse critical
|
||||
if(inverse_c == 0){
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_rect")
|
||||
.attr("x", width_x)
|
||||
.attr("x", width_x)
|
||||
.attr("y", (height_x + (range_max - min_c) * position) - ((max_c - min_c) * position))
|
||||
.attr("width", 300)
|
||||
.attr("width", 300)
|
||||
.attr("height", ((max_c - min_c) * position))
|
||||
.style("fill", "#fc4444");
|
||||
}
|
||||
else {
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.style("fill", "#fc4444");
|
||||
}
|
||||
else {
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_rect")
|
||||
.attr("x", width_x)
|
||||
.attr("x", width_x)
|
||||
.attr("y", height_x + 200 - ((min_c -range_min) * position))
|
||||
.attr("width", 300)
|
||||
.attr("width", 300)
|
||||
.attr("height", (min_c -range_min) * position)
|
||||
.style("fill", "#fc4444");
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.style("fill", "#fc4444");
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_inverse_rect")
|
||||
.attr("x", width_x)
|
||||
.attr("y", height_x)
|
||||
.attr("width", 300)
|
||||
.attr("x", width_x)
|
||||
.attr("y", height_x)
|
||||
.attr("width", 300)
|
||||
.attr("height", ((range_max - min_c) * position) - ((max_c - min_c) * position))
|
||||
.style("fill", "#fc4444");
|
||||
}
|
||||
|
||||
.style("fill", "#fc4444");
|
||||
}
|
||||
}
|
||||
else {
|
||||
d3.select("#svg_dinamic rect").remove();
|
||||
//create svg
|
||||
var svg = d3.select("#svg_dinamic");
|
||||
svg.selectAll("g").remove();
|
||||
|
||||
width_x = 201;
|
||||
|
||||
width_x = 10;
|
||||
height_x = 50;
|
||||
|
||||
|
||||
//message error warning
|
||||
if (error_w == 1) {
|
||||
$("#text-max_warning").addClass("input_error");
|
||||
|
@ -1546,9 +1545,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
.style("font-size", 14)
|
||||
.style("fill", "red")
|
||||
.html(message_error_critical)
|
||||
.style("text-anchor", "first");
|
||||
.style("text-anchor", "first");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,8 +70,8 @@
|
|||
<body>
|
||||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.724';
|
||||
$build = '180709';
|
||||
$version = '7.0NG.725';
|
||||
$build = '180801';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -449,11 +449,9 @@ $table->align = array ();
|
|||
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
if ($print_agent) {
|
||||
if (!is_metaconsole()) {
|
||||
$table->head[0] = "<span title='" . __('Policy') . "'>" .
|
||||
__('P.') . "</span>";
|
||||
}
|
||||
|
||||
|
||||
$table->head[0] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
|
||||
|
||||
$table->head[1] = "<span title='" . __('Standby') . "'>" .
|
||||
__('S.') . "</span>";
|
||||
|
||||
|
@ -496,10 +494,8 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (!is_metaconsole()) {
|
||||
$table->head[0] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
|
||||
}
|
||||
|
||||
$table->head[0] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
|
||||
|
||||
$table->head[1] = "<span title='" . __('Standby') . "'>" . __('S.') . "</span>";
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
|
|
|
@ -203,10 +203,8 @@ $zoom_default = file($config['homedir'] . '/images/zoom_default.svg');
|
|||
</div>
|
||||
<?php
|
||||
|
||||
echo '<script '.
|
||||
' type="text/javascript" ' .
|
||||
' src="' . $config['homeurl'] . 'include/javascript/d3.3.5.14.js" ' .
|
||||
' charset="utf-8"></script>';
|
||||
include_javascript_d3();
|
||||
|
||||
echo '<div id="dinamic_networkmap" style="overflow: hidden;"></div>';
|
||||
?>
|
||||
<style type="text/css">
|
||||
|
|
|
@ -977,17 +977,17 @@ if (!empty($result)) {
|
|||
$table->head[2] = __('Data Type');
|
||||
$table->head[2] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype . '&moduletype='.$moduletype . '&refr=' . $refr . '&modulegroup='.$modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=type&sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectTypeUp, 'alt' => 'up')) . '</a>' .
|
||||
'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype . '&moduletype='.$moduletype . '&refr=' . $refr . '&modulegroup='.$modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=type&sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectTypeDown, 'alt' => 'down')) . '</a>';
|
||||
|
||||
|
||||
$table->align[2] = 'left';
|
||||
|
||||
$table->head[3] = __('Module name');
|
||||
$table->head[3] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype . '&moduletype='.$moduletype . '&refr=' . $refr . '&modulegroup='.$modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=module_name&sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '</a>' .
|
||||
'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype . '&moduletype='.$moduletype . '&refr=' . $refr . '&modulegroup='.$modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=module_name&sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . '</a>';
|
||||
|
||||
$table->head[4] = __('Server type');
|
||||
|
||||
$table->head[4] = __('Server type');
|
||||
$table->head[4] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype . '&moduletype='.$moduletype . '&refr=' . $refr . '&modulegroup='.$modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=moduletype&sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '</a>' .
|
||||
'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype . '&moduletype='.$moduletype . '&refr=' . $refr . '&modulegroup='.$modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=moduletype&sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . '</a>';
|
||||
|
||||
|
||||
$table->head[5] = __('Interval');
|
||||
$table->head[5] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype . '&moduletype='.$moduletype . '&refr=' . $refr . '&modulegroup='.$modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=interval&sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectIntervalUp, 'alt' => 'up')) . '</a>' .
|
||||
'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype . '&moduletype='.$moduletype . '&refr=' . $refr . '&modulegroup='.$modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=interval&sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectIntervalDown, 'alt' => 'down')) . '</a>';
|
||||
|
@ -1024,36 +1024,47 @@ if (!empty($result)) {
|
|||
//Avoid unset, null and false value
|
||||
if (empty($row['server_name']))
|
||||
$row['server_name'] = "";
|
||||
|
||||
|
||||
$is_web_content_string = (bool)db_get_value_filter('id_agente_modulo',
|
||||
'tagente_modulo',
|
||||
array('id_agente_modulo' => $row['id_agente_modulo'],
|
||||
'id_tipo_modulo' => $id_type_web_content_string));
|
||||
|
||||
|
||||
//Fixed the goliat sends the strings from web
|
||||
//without HTML entities
|
||||
if ($is_web_content_string) {
|
||||
$row['datos'] = io_safe_input($row['datos']);
|
||||
}
|
||||
|
||||
|
||||
//Fixed the data from Selenium Plugin
|
||||
if ($row['datos'] != strip_tags($row['datos'])) {
|
||||
$row['datos'] = io_safe_input($row['datos']);
|
||||
}
|
||||
|
||||
|
||||
$data = array ();
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
if(is_metaconsole()){
|
||||
$node = metaconsole_get_connection_by_id($row['server_id']);
|
||||
if (metaconsole_load_external_db($node) !== NOERR) {
|
||||
// Restore the default connection.
|
||||
metaconsole_restore_db();
|
||||
$errors++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$policyInfo = policies_info_module_policy($row['id_agente_modulo']);
|
||||
|
||||
if ($policyInfo === false)
|
||||
$data[0] = '';
|
||||
else {
|
||||
$linked = policies_is_module_linked($row['id_agente_modulo']);
|
||||
|
||||
|
||||
$adopt = false;
|
||||
if (policies_is_module_adopt($row['id_agente_modulo'])) {
|
||||
$adopt = true;
|
||||
}
|
||||
|
||||
|
||||
if ($linked) {
|
||||
if ($adopt) {
|
||||
$img = 'images/policies_brick.png';
|
||||
|
@ -1074,15 +1085,25 @@ if (!empty($result)) {
|
|||
$title = __('(Unlinked) ') . $policyInfo['name_policy'];
|
||||
}
|
||||
}
|
||||
|
||||
$data[0] = '<a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id_policy'] . '">' .
|
||||
html_print_image($img,true, array('title' => $title)) .
|
||||
'</a>';
|
||||
if(is_metaconsole()){
|
||||
$data[0] = '<a href="?sec=gmodules&sec2=advanced/policymanager&id=' . $policyInfo['id_policy'] . '">' .
|
||||
html_print_image($img,true, array('title' => $title)) .
|
||||
'</a>';
|
||||
}
|
||||
else{
|
||||
$data[0] = '<a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id_policy'] . '">' .
|
||||
html_print_image($img,true, array('title' => $title)) .
|
||||
'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if(is_metaconsole()){
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$agent_alias = !empty($row['agent_alias']) ? $row['agent_alias'] : $row['agent_name'];
|
||||
|
||||
|
||||
// TODO: Calculate hash access before to use it more simply like other sections. I.E. Events view
|
||||
if (defined('METACONSOLE')) {
|
||||
$agent_link = '<a href="'.
|
||||
|
|
|
@ -556,11 +556,13 @@ if (is_ajax ()) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
$sql = 'SELECT DISTINCT nombre, id_agente_modulo
|
||||
FROM tagente_modulo t1
|
||||
WHERE ' . $filter . '
|
||||
$sql = 'SELECT DISTINCT nombre, t1.id_agente_modulo
|
||||
FROM tagente_modulo t1, tagente_estado t2
|
||||
WHERE t1.id_agente_modulo = t2.id_agente_modulo AND
|
||||
' . $filter . '
|
||||
AND t1.delete_pending = 0
|
||||
AND t1.id_agente IN (' . implode(',', $idAgents) . ')';
|
||||
AND t1.id_agente IN (' . implode(',', $idAgents) . ')
|
||||
AND t2.datos NOT LIKE "%image%"';
|
||||
|
||||
if ($selection_mode == 'common') {
|
||||
$sql .= ' AND (
|
||||
|
|
|
@ -188,14 +188,14 @@ else {
|
|||
$i++;
|
||||
}
|
||||
if (in_array('event_type', $show_fields)) {
|
||||
$table->head[$i] = __('Event type');
|
||||
$table->head[$i] = __('Event Type');
|
||||
$table->align[$i] = 'left';
|
||||
|
||||
$table->style[$i] = 'min-width: 85px;';
|
||||
$i++;
|
||||
}
|
||||
if (in_array('id_agentmodule', $show_fields)) {
|
||||
$table->head[$i] = __('Agent Module');
|
||||
$table->head[$i] = __('Module Name');
|
||||
$table->align[$i] = 'left';
|
||||
|
||||
$i++;
|
||||
|
@ -249,6 +249,18 @@ else {
|
|||
|
||||
$i++;
|
||||
}
|
||||
if (in_array('data', $show_fields)) {
|
||||
$table->head[$i] = __('Data');
|
||||
$table->align[$i] = 'left';
|
||||
|
||||
$i++;
|
||||
}
|
||||
if (in_array('module_status', $show_fields)) {
|
||||
$table->head[$i] = __('Module Status');
|
||||
$table->align[$i] = 'left';
|
||||
|
||||
$i++;
|
||||
}
|
||||
if ($i != 0 && $allow_action) {
|
||||
$table->head[$i] = __('Action');
|
||||
$table->align[$i] = 'left';
|
||||
|
@ -663,6 +675,20 @@ else {
|
|||
$table->cellclass[count($table->data)][$i] = $myclass;
|
||||
$i++;
|
||||
}
|
||||
if (in_array('data',$show_fields)) {
|
||||
$data[$i] = $event["data"];
|
||||
if($data[$i] %1 == 0)
|
||||
$data[$i]= number_format($data[$i], 0);
|
||||
else
|
||||
$data[$i]= number_format($data[$i], 2);
|
||||
$table->cellclass[count($table->data)][$i] = $myclass;
|
||||
$i++;
|
||||
}
|
||||
if (in_array('module_status',$show_fields)) {
|
||||
$data[$i] = modules_get_modules_status ($event["module_status"]);
|
||||
$table->cellclass[count($table->data)][$i] = $myclass;
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($i != 0 && $allow_action) {
|
||||
//Actions
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.724
|
||||
%define release 180709
|
||||
%define version 7.0NG.725
|
||||
%define release 180801
|
||||
|
||||
# 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.724
|
||||
%define release 180709
|
||||
%define version 7.0NG.725
|
||||
%define release 180801
|
||||
%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.724"
|
||||
PI_VERSION="7.0NG.725"
|
||||
FORCE=0
|
||||
DESTDIR=""
|
||||
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
||||
|
|
|
@ -641,6 +641,8 @@ CREATE TABLE IF NOT EXISTS `tevento` (
|
|||
`owner_user` VARCHAR(100) NOT NULL DEFAULT '',
|
||||
`ack_utimestamp` BIGINT(20) NOT NULL DEFAULT '0',
|
||||
`custom_data` TEXT NOT NULL,
|
||||
`data` double(22,5) default NULL,
|
||||
`module_status` int(4) NOT NULL default '0',
|
||||
PRIMARY KEY (`id_evento`),
|
||||
KEY `idx_agente` (`id_agente`),
|
||||
KEY `idx_agentmodule` (`id_agentmodule`),
|
||||
|
@ -2158,6 +2160,7 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` (
|
|||
`prediction_sample_window` int(10) default 0,
|
||||
`prediction_samples` int(4) default 0,
|
||||
`prediction_threshold` int(4) default 0,
|
||||
`cps` int NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `main_idx` (`id_policy`),
|
||||
UNIQUE (`id_policy`, `name`)
|
||||
|
@ -2205,8 +2208,9 @@ CREATE TABLE IF NOT EXISTS `tpolicy_agents` (
|
|||
`policy_applied` tinyint(1) unsigned default '0',
|
||||
`pending_delete` tinyint(1) unsigned default '0',
|
||||
`last_apply_utimestamp` int(10) unsigned NOT NULL default 0,
|
||||
`id_node` int(10) NOT NULL default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE (`id_policy`, `id_agent`)
|
||||
UNIQUE (`id_policy`, `id_agent`, `id_node`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
|
@ -2429,6 +2433,7 @@ CREATE TABLE IF NOT EXISTS `tservice` (
|
|||
`quiet` tinyint(1) NOT NULL default 0,
|
||||
`cps` int NOT NULL default 0,
|
||||
`cascade_protection` tinyint(1) NOT NULL default 0,
|
||||
`evaluate_sla` int(1) NOT NULL default 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB
|
||||
COMMENT = 'Table to define services to monitor'
|
||||
|
@ -2875,6 +2880,8 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event` (
|
|||
`ack_utimestamp` BIGINT(20) NOT NULL DEFAULT '0',
|
||||
`server_id` int(10) NOT NULL,
|
||||
`custom_data` TEXT NOT NULL DEFAULT '',
|
||||
`data` double(22,5) default NULL,
|
||||
`module_status` int(4) NOT NULL default '0',
|
||||
PRIMARY KEY (`id_evento`),
|
||||
KEY `idx_agente` (`id_agente`),
|
||||
KEY `idx_agentmodule` (`id_agentmodule`),
|
||||
|
@ -2920,6 +2927,8 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event_history` (
|
|||
`ack_utimestamp` BIGINT(20) NOT NULL DEFAULT '0',
|
||||
`server_id` int(10) NOT NULL,
|
||||
`custom_data` TEXT NOT NULL DEFAULT '',
|
||||
`data` double(22,5) default NULL,
|
||||
`module_status` int(4) NOT NULL default '0',
|
||||
PRIMARY KEY (`id_evento`),
|
||||
KEY `idx_agente` (`id_agente`),
|
||||
KEY `idx_agentmodule` (`id_agentmodule`),
|
||||
|
@ -3195,3 +3204,46 @@ create table IF NOT EXISTS `tmetaconsole_agent_secondary_group`(
|
|||
ON DELETE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tautoconfig`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tautoconfig` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`order` int(11) NOT NULL DEFAULT '0',
|
||||
`description` text,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tautoconfig_rules`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tautoconfig_rules` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_autoconfig` int(10) unsigned NOT NULL,
|
||||
`order` int(11) NOT NULL DEFAULT '0',
|
||||
`operator` enum('AND','OR') DEFAULT 'OR',
|
||||
`type` enum('alias','ip-range','group','os','custom-field','script','server-name') DEFAULT 'alias',
|
||||
`value` text,
|
||||
`custom` text,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id_autoconfig` (`id_autoconfig`),
|
||||
CONSTRAINT `tautoconfig_rules_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tautoconfig_actions`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tautoconfig_actions` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_autoconfig` int(10) unsigned NOT NULL,
|
||||
`order` int(11) NOT NULL DEFAULT '0',
|
||||
`action_type` enum('set-group', 'set-secondary-group', 'apply-policy', 'launch-script', 'launch-event', 'launch-alert-action', 'raw-config') DEFAULT 'launch-event',
|
||||
`value` text,
|
||||
`custom` text,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id_autoconfig` (`id_autoconfig`),
|
||||
CONSTRAINT `tautoconfig_action_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('MR', 18),
|
||||
('identification_reminder', 1),
|
||||
('identification_reminder_timestamp', 0),
|
||||
('current_package_enterprise', '724'),
|
||||
('current_package_enterprise', '725'),
|
||||
('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"}'),
|
||||
('custom_docs_logo', 'default_docs.png'),
|
||||
('custom_support_logo', 'default_support.png'),
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.724-180709
|
||||
Version: 7.0NG.725-180801
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
Installed-Size: 640
|
||||
Maintainer: Miguel de Dios <miguel.dedios@artica.es>
|
||||
Homepage: http://pandorafms.org/
|
||||
Depends: perl (>= 5.8), libdbi-perl, libdbd-mysql-perl, libtime-format-perl, libnetaddr-ip-perl, libtime-format-perl, libxml-simple-perl, libxml-twig-perl, libhtml-parser-perl, snmp, snmpd, traceroute, xprobe2, nmap, sudo, libwww-perl, libsocket6-perl, libio-socket-inet6-perl, snmp-mibs-downloader, libjson-perl, libnet-telnet-perl, libencode-locale-perl
|
||||
Depends: perl (>= 5.8), libdbi-perl, libdbd-mysql-perl, libtime-format-perl, libnetaddr-ip-perl, libtime-format-perl, libxml-simple-perl, libxml-twig-perl, libhtml-parser-perl, snmp, snmpd, traceroute, xprobe2, nmap, sudo, libwww-perl, libsocket6-perl, libio-socket-inet6-perl, snmp-mibs-downloader, libjson-perl, libnet-telnet-perl, libencode-locale-perl, libgeo-ip-perl
|
||||
Description: Pandora FMS is a monitoring system for big IT environments. It uses remote tests, or local agents to grab information. Pandora supports all standard OS (Linux, AIX, HP-UX, Solaris and Windows XP,2000/2003), and support multiple setups in HA enviroments. This is the server package. Server makes the remote checks and process information transfer by Pandora FMS agents to the server.
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.724-180709"
|
||||
pandora_version="7.0NG.725-180801"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -330,18 +330,9 @@ restart_delay 60
|
|||
|
||||
#location_error 50
|
||||
|
||||
# Recon reverse geolocation mode [disabled, sql, file]
|
||||
# disabled The recon task doesn't try to geolocate the ip discovered.
|
||||
# sql The recon task trys to query the SQL database to geolocate the
|
||||
# ip discovered
|
||||
# file The recon task trys to find the geolocation information of the
|
||||
# ip discovered in the file indicated in the
|
||||
# recon_reverse_geolocation_file parameter
|
||||
|
||||
# recon_reverse_geolocation_mode disabled
|
||||
|
||||
# Recon reverse geolocation file. This is the database with the reverse
|
||||
# geolocation information using MaxMind GPL GeoLiteCity.dat format).
|
||||
# Comment it to disable the IP geolocation on agent creation.
|
||||
|
||||
#recon_reverse_geolocation_file /usr/local/share/GeoIP/GeoIPCity.dat
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ WriteMakefile(
|
|||
HTML::Entities => 0,
|
||||
IO::Socket::INET6 => 0,
|
||||
JSON => 0,
|
||||
Geo::IP => 0,
|
||||
},
|
||||
EXE_FILES => [ @exe_files ],
|
||||
PMLIBDIRS => [ 'lib' ],
|
||||
|
|
|
@ -325,18 +325,9 @@ restart_delay 60
|
|||
|
||||
#location_error 50
|
||||
|
||||
# Recon reverse geolocation mode [disabled, sql, file]
|
||||
# disabled The recon task doesn't try to geolocate the ip discovered.
|
||||
# sql The recon task trys to query the SQL database to geolocate the
|
||||
# ip discovered
|
||||
# file The recon task trys to find the geolocation information of the
|
||||
# ip discovered in the file indicated in the
|
||||
# recon_reverse_geolocation_file parameter
|
||||
|
||||
# recon_reverse_geolocation_mode disabled
|
||||
|
||||
# Recon reverse geolocation file. This is the database with the reverse
|
||||
# geolocation information using MaxMind GPL GeoLiteCity.dat format).
|
||||
# Comment it to disable the IP geolocation on agent creation.
|
||||
|
||||
#recon_reverse_geolocation_file /usr/local/share/GeoIP/GeoIPCity.dat
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#############################################################################
|
||||
# Pandora FMS Server Parameters
|
||||
# Pandora FMS, the Flexible Monitoring System.
|
||||
# Version 7.0NG.724
|
||||
# Version 7.0NG.725
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2017 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -342,18 +342,9 @@ restart_delay 60
|
|||
|
||||
#location_error 50
|
||||
|
||||
# Recon reverse geolocation mode [disabled, sql, file]
|
||||
# disabled The recon task doesn't try to geolocate the ip discovered.
|
||||
# sql The recon task trys to query the SQL database to geolocate the
|
||||
# ip discovered
|
||||
# file The recon task trys to find the geolocation information of the
|
||||
# ip discovered in the file indicated in the
|
||||
# recon_reverse_geolocation_file parameter
|
||||
|
||||
# recon_reverse_geolocation_mode disabled
|
||||
|
||||
# Recon reverse geolocation file. This is the database with the reverse
|
||||
# geolocation information using MaxMind GPL GeoLiteCity.dat format).
|
||||
# Comment it to disable the IP geolocation on agent creation.
|
||||
|
||||
#recon_reverse_geolocation_file /usr/local/share/GeoIP/GeoIPCity.dat
|
||||
|
||||
|
|
|
@ -301,18 +301,9 @@ restart_delay 60
|
|||
|
||||
#location_error 50
|
||||
|
||||
# Recon reverse geolocation mode [disabled, sql, file]
|
||||
# disabled The recon task doesn't try to geolocate the ip discovered.
|
||||
# sql The recon task trys to query the SQL database to geolocate the
|
||||
# ip discovered
|
||||
# file The recon task trys to find the geolocation information of the
|
||||
# ip discovered in the file indicated in the
|
||||
# recon_reverse_geolocation_file parameter
|
||||
|
||||
# recon_reverse_geolocation_mode disabled
|
||||
|
||||
# Recon reverse geolocation file. This is the database with the reverse
|
||||
# geolocation information using MaxMind GPL GeoLiteCity.dat format).
|
||||
# Comment it to disable the IP geolocation on agent creation.
|
||||
|
||||
#recon_reverse_geolocation_file /usr/local/share/GeoIP/GeoIPCity.dat
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@ our @EXPORT = qw(
|
|||
);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.724";
|
||||
my $pandora_build = "180709";
|
||||
my $pandora_version = "7.0NG.725";
|
||||
my $pandora_build = "180801";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
@ -266,8 +266,7 @@ sub pandora_load_config {
|
|||
$pa_config->{"web_engine"} = 'lwp'; # 5.1
|
||||
$pa_config->{"activate_gis"} = 0; # 3.1
|
||||
$pa_config->{"location_error"} = 50; # 3.1
|
||||
$pa_config->{"recon_reverse_geolocation_mode"} = 'disabled'; # 3.1
|
||||
$pa_config->{"recon_reverse_geolocation_file"} = '/usr/local/share/GeoIP/GeoIPCity.dat'; # 3.1
|
||||
$pa_config->{"recon_reverse_geolocation_file"} = ''; # 3.1
|
||||
$pa_config->{"recon_location_scatter_radius"} = 50; # 3.1
|
||||
$pa_config->{"update_parent"} = 0; # 3.1
|
||||
$pa_config->{"google_maps_description"} = 0;
|
||||
|
@ -487,6 +486,8 @@ sub pandora_load_config {
|
|||
$pa_config->{"provisioningserver_threads"} = 1; # 7.0 720
|
||||
$pa_config->{"provisioning_cache_interval"} = 300; # 7.0 720
|
||||
|
||||
$pa_config->{"autoconfigure_agents"} = 1; # 7.0 725
|
||||
|
||||
# Check for UID0
|
||||
if ($pa_config->{"quiet"} != 0){
|
||||
if ($> == 0){
|
||||
|
@ -863,12 +864,13 @@ sub pandora_load_config {
|
|||
}
|
||||
elsif ($parametro =~ m/^location_error\s+(\d+)/i) {
|
||||
$pa_config->{'location_error'} = clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^recon_reverse_geolocation_mode\s+(\w+)/i) {
|
||||
$pa_config->{'recon_reverse_geolocation_mode'} = clean_blank($1);
|
||||
} #FIXME: Find a better regexp to validate the path
|
||||
elsif ($parametro =~ m/^recon_reverse_geolocation_file\s+(.*)/i) {
|
||||
$pa_config->{'recon_reverse_geolocation_file'} = clean_blank($1);
|
||||
if ( ! -r $pa_config->{'recon_reverse_geolocation_file'} ) {
|
||||
print "[WARN] Invalid recon_reverse_geolocation_file.\n";
|
||||
$pa_config->{'recon_reverse_geolocation_file'} = '';
|
||||
}
|
||||
}
|
||||
elsif ($parametro =~ m/^recon_location_scatter_radius\s+(\d+)/i) {
|
||||
$pa_config->{'recon_location_scatter_radius'} = clean_blank($1);
|
||||
|
@ -1113,6 +1115,9 @@ sub pandora_load_config {
|
|||
elsif ($parametro =~ m/^provisioning_cache_interval\s+([0-9]*)/i){
|
||||
$pa_config->{'provisioning_cache_interval'}= clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^autoconfigure_agents\s+([0-1])/i){
|
||||
$pa_config->{'autoconfigure_agents'}= clean_blank($1);
|
||||
}
|
||||
} # end of loop for parameter #
|
||||
|
||||
# Set to RDBMS' standard port
|
||||
|
|
|
@ -352,16 +352,6 @@ sub pandora_generate_alerts ($$$$$$$$;$$$) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ($agent->{'cps'} > 0) {
|
||||
logger($pa_config, "Generate Alert. The agent '" . $agent->{'nombre'} . "' is in quiet mode by cascade protection services.", 10);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($module->{'cps'} > 0) {
|
||||
logger($pa_config, "Generate Alert. The module '" . $module->{'nombre'} . "' is in quiet mode by cascade protection services.", 10);
|
||||
return;
|
||||
}
|
||||
|
||||
# Do not generate alerts for disabled groups
|
||||
if (is_group_disabled ($dbh, $agent->{'id_grupo'})) {
|
||||
return;
|
||||
|
@ -1649,7 +1639,7 @@ sub pandora_process_module ($$$$$$$$$;$) {
|
|||
}
|
||||
|
||||
# Generate alerts
|
||||
if (pandora_inhibit_alerts ($pa_config, $agent, $dbh, 0) == 0) {
|
||||
if (pandora_inhibit_alerts ($pa_config, $agent, $dbh, 0) == 0 && pandora_cps_enabled($agent, $module) == 0) {
|
||||
pandora_generate_alerts ($pa_config, $processed_data, $status, $agent, $module, $utimestamp, $dbh, $timestamp, $extra_macros, $last_data_value);
|
||||
}
|
||||
else {
|
||||
|
@ -3126,11 +3116,12 @@ Generate an event.
|
|||
|
||||
=cut
|
||||
##########################################################################
|
||||
sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
|
||||
sub pandora_event ($$$$$$$$$$;$$$$$$$$$$$) {
|
||||
my ($pa_config, $evento, $id_grupo, $id_agente, $severity,
|
||||
$id_alert_am, $id_agentmodule, $event_type, $event_status, $dbh,
|
||||
$source, $user_name, $comment, $id_extra, $tags,
|
||||
$critical_instructions, $warning_instructions, $unknown_instructions, $custom_data) = @_;
|
||||
$critical_instructions, $warning_instructions, $unknown_instructions, $custom_data,
|
||||
$module_data, $module_status) = @_;
|
||||
my $event_table = is_metaconsole($pa_config) ? 'tmetaconsole_event' : 'tevento';
|
||||
|
||||
my $agent = undef;
|
||||
|
@ -3140,25 +3131,18 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
|
|||
logger($pa_config, "Generate Event. The agent '" . $agent->{'nombre'} . "' is in quiet mode.", 10);
|
||||
return;
|
||||
}
|
||||
|
||||
if (defined ($agent) && $agent->{'cps'} > 0) {
|
||||
logger($pa_config, "Generate Event. The agent '" . $agent->{'nombre'} . "' is in quiet mode by cascade protection services.", 10);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
my $module = undef;
|
||||
if (defined($id_agentmodule) && $id_agentmodule != 0) {
|
||||
$module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente_modulo = ?', $id_agentmodule);
|
||||
$module = get_db_single_row ($dbh, 'SELECT *, tagente_estado.datos, tagente_estado.estado
|
||||
FROM tagente_modulo, tagente_estado
|
||||
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
AND tagente_modulo.id_agente_modulo = ?', $id_agentmodule);
|
||||
if (defined ($module) && $module->{'quiet'} == 1) {
|
||||
logger($pa_config, "Generate Event. The module '" . $module->{'nombre'} . "' is in quiet mode.", 10);
|
||||
return;
|
||||
}
|
||||
|
||||
if (defined ($module) && $module->{'cps'} > 0) {
|
||||
logger($pa_config, "Generate Event. The module '" . $module->{'nombre'} . "' is in quiet mode by cascade protection services.", 10);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# Get module tags
|
||||
|
@ -3182,6 +3166,8 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
|
|||
$warning_instructions = '' unless defined ($warning_instructions);
|
||||
$unknown_instructions = '' unless defined ($unknown_instructions);
|
||||
$custom_data = '' unless defined ($custom_data);
|
||||
$module_data = defined($module) ? $module->{'datos'} : '' unless defined ($module_data);
|
||||
$module_status = defined($module) ? $module->{'estado'} : '' unless defined ($module_status);
|
||||
|
||||
# If the event is created with validated status, assign ack_utimestamp
|
||||
my $ack_utimestamp = $event_status == 1 ? time() : 0;
|
||||
|
@ -3203,8 +3189,8 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
|
|||
|
||||
# Create the event
|
||||
logger($pa_config, "Generating event '$evento' for agent ID $id_agente module ID $id_agentmodule.", 10);
|
||||
db_do ($dbh, 'INSERT INTO ' . $event_table . ' (id_agente, id_grupo, evento, timestamp, estado, utimestamp, event_type, id_agentmodule, id_alert_am, criticity, user_comment, tags, source, id_extra, id_usuario, critical_instructions, warning_instructions, unknown_instructions, ack_utimestamp, custom_data)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id_agente, $id_grupo, safe_input ($evento), $timestamp, $event_status, $utimestamp, $event_type, $id_agentmodule, $id_alert_am, $severity, $comment, $module_tags, $source, $id_extra, $user_name, $critical_instructions, $warning_instructions, $unknown_instructions, $ack_utimestamp, $custom_data);
|
||||
db_do ($dbh, 'INSERT INTO ' . $event_table . ' (id_agente, id_grupo, evento, timestamp, estado, utimestamp, event_type, id_agentmodule, id_alert_am, criticity, user_comment, tags, source, id_extra, id_usuario, critical_instructions, warning_instructions, unknown_instructions, ack_utimestamp, custom_data, data, module_status)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id_agente, $id_grupo, safe_input ($evento), $timestamp, $event_status, $utimestamp, $event_type, $id_agentmodule, $id_alert_am, $severity, $comment, $module_tags, $source, $id_extra, $user_name, $critical_instructions, $warning_instructions, $unknown_instructions, $ack_utimestamp, $custom_data, $module_data, $module_status);
|
||||
|
||||
# Do not write to the event file
|
||||
return if ($pa_config->{'event_file'} eq '');
|
||||
|
@ -4188,11 +4174,11 @@ sub generate_status_event ($$$$$$$$) {
|
|||
# Generate the event
|
||||
if ($status != 0){
|
||||
pandora_event ($pa_config, $description, $agent->{'id_grupo'}, $module->{'id_agente'},
|
||||
$severity, 0, $module->{'id_agente_modulo'}, $event_type, 0, $dbh, 'monitoring_server', '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'});
|
||||
$severity, 0, $module->{'id_agente_modulo'}, $event_type, 0, $dbh, 'monitoring_server', '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'}, undef, $data, $status);
|
||||
} else {
|
||||
# Self validate this event if has "normal" status
|
||||
pandora_event ($pa_config, $description, $agent->{'id_grupo'}, $module->{'id_agente'},
|
||||
$severity, 0, $module->{'id_agente_modulo'}, $event_type, 1, $dbh, 'monitoring_server', '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'});
|
||||
$severity, 0, $module->{'id_agente_modulo'}, $event_type, 1, $dbh, 'monitoring_server', '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'}, undef, $data, $status);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4289,6 +4275,20 @@ sub pandora_inhibit_alerts {
|
|||
return pandora_inhibit_alerts ($pa_config, $agent, $dbh, $depth + 1);
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# Returns 1 if service cascade protection is enabled for the given
|
||||
# agent/module, 0 otherwise.
|
||||
##########################################################################
|
||||
sub pandora_cps_enabled($$) {
|
||||
my ($agent, $module) = @_;
|
||||
|
||||
return 1 if ($agent->{'cps'} > 0);
|
||||
|
||||
return 1 if ($module->{'cps'} > 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
=head2 C<< save_agent_position (I<$pa_config>, I<$current_longitude>, I<$current_latitude>,
|
||||
I<$current_altitude>, I<$agent_id>, I<$dbh>, [I<$start_timestamp>], [I<$description>]) >>
|
||||
|
@ -4925,7 +4925,7 @@ sub pandora_module_unknown ($$) {
|
|||
pandora_mark_agent_for_module_update ($dbh, $module->{'id_agente'});
|
||||
|
||||
# Generate alerts
|
||||
if (pandora_inhibit_alerts ($pa_config, $agent, $dbh, 0) == 0) {
|
||||
if (pandora_inhibit_alerts ($pa_config, $agent, $dbh, 0) == 0 && pandora_cps_enabled($agent, $module) == 0) {
|
||||
pandora_generate_alerts ($pa_config, 0, 3, $agent, $module, time (), $dbh, undef, undef, 0, 'unknown');
|
||||
}
|
||||
else {
|
||||
|
@ -4969,7 +4969,7 @@ sub pandora_module_unknown ($$) {
|
|||
pandora_mark_agent_for_module_update ($dbh, $module->{'id_agente'});
|
||||
|
||||
# Generate alerts
|
||||
if (pandora_inhibit_alerts ($pa_config, $agent, $dbh, 0) == 0) {
|
||||
if (pandora_inhibit_alerts ($pa_config, $agent, $dbh, 0) == 0 && pandora_cps_enabled($agent, $module) == 0) {
|
||||
pandora_generate_alerts ($pa_config, 0, 3, $agent, $module, time (), $dbh, undef, undef, 0, 'unknown');
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -50,6 +50,7 @@ our @EXPORT = qw(
|
|||
db_text
|
||||
db_update
|
||||
db_update_get_values
|
||||
set_update_agent
|
||||
get_action_id
|
||||
get_addr_id
|
||||
get_agent_addr_id
|
||||
|
@ -801,6 +802,35 @@ sub get_db_rows_limit ($$$;@) {
|
|||
return @rows;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
## Updates agent fields using field => value
|
||||
## Be careful, no filter is done.
|
||||
##########################################################################
|
||||
sub set_update_agent {
|
||||
my ($dbh, $agent_id, $data) = @_;
|
||||
|
||||
return undef unless (defined($agent_id) && $agent_id > 0);
|
||||
return undef unless (ref($data) eq "HASH");
|
||||
|
||||
# Build update query
|
||||
my $query = 'UPDATE tagente SET ';
|
||||
|
||||
my @values;
|
||||
foreach my $field (keys %{$data}) {
|
||||
push @values, $data->{$field};
|
||||
|
||||
$query .= ' ' . $field . ' = ?,';
|
||||
}
|
||||
|
||||
chop($query);
|
||||
|
||||
$query .= ' WHERE id_agente = ? ';
|
||||
push @values, $agent_id;
|
||||
|
||||
return db_update($dbh, $query, @values);
|
||||
}
|
||||
|
||||
|
||||
##########################################################################
|
||||
## SQL delete with a LIMIT clause.
|
||||
##########################################################################
|
||||
|
|
|
@ -39,6 +39,7 @@ use PandoraFMS::Tools;
|
|||
use PandoraFMS::DB;
|
||||
use PandoraFMS::Core;
|
||||
use PandoraFMS::ProducerConsumerServer;
|
||||
use PandoraFMS::GIS;
|
||||
|
||||
# Inherits from PandoraFMS::ProducerConsumerServer
|
||||
our @ISA = qw(PandoraFMS::ProducerConsumerServer);
|
||||
|
@ -362,10 +363,13 @@ sub process_xml_data ($$$$$) {
|
|||
my $description = '';
|
||||
$description = $data->{'description'} if (defined ($data->{'description'}));
|
||||
my $alias = (defined ($data->{'agent_alias'}) && $data->{'agent_alias'} ne '') ? $data->{'agent_alias'} : $data->{'agent_name'};
|
||||
|
||||
$agent_id = pandora_create_agent($pa_config, $pa_config->{'servername'}, $agent_name, $address, $group_id, $parent_id, $os,
|
||||
$description, $interval, $dbh, $timezone_offset, undef, undef, undef, undef, $custom_id, $url_address, $agent_mode, $alias);
|
||||
|
||||
my $location = get_geoip_info($pa_config, $address);
|
||||
$agent_id = pandora_create_agent($pa_config, $pa_config->{'servername'}, $agent_name, $address,
|
||||
$group_id, $parent_id, $os,
|
||||
$description, $interval, $dbh, $timezone_offset,
|
||||
$location->{'longitude'}, $location->{'latitude'}, undef, undef,
|
||||
$custom_id, $url_address, $agent_mode, $alias
|
||||
);
|
||||
if (! defined ($agent_id)) {
|
||||
return;
|
||||
}
|
||||
|
@ -409,6 +413,12 @@ sub process_xml_data ($$$$$) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (defined($pa_config->{'autoconfigure_agents'}) && $pa_config->{'autoconfigure_agents'} == 1) {
|
||||
# Update agent configuration once, before create agent - MetaConsole port to Node
|
||||
enterprise_hook('autoconfigure_agent', [$pa_config, $agent_name, $agent_id, $data, $dbh]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# Get the data of the agent, if fail return
|
||||
|
|
|
@ -40,11 +40,7 @@ Exported Functions:
|
|||
|
||||
=item * C<distance_moved>
|
||||
|
||||
=item * C<get_reverse_geoip_sql>
|
||||
|
||||
=item * C<get_reverse_geoip_file>
|
||||
|
||||
=item * C<get_random_close_point>
|
||||
=item * C<get_geoip_info>
|
||||
|
||||
=back
|
||||
|
||||
|
@ -54,15 +50,13 @@ Exported Functions:
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Geo::IP;
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
|
||||
use PandoraFMS::DB;
|
||||
use PandoraFMS::Tools;
|
||||
# TODO:Test if is instaled
|
||||
|
||||
my $geoIPPurePerlavilable= (eval 'use PandoraFMS::GeoIP; 1') ? 1 : 0;
|
||||
|
||||
|
||||
require Exporter;
|
||||
|
@ -72,9 +66,7 @@ our %EXPORT_TAGS = ( 'all' => [ qw( ) ] );
|
|||
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
||||
our @EXPORT = qw(
|
||||
distance_moved
|
||||
get_reverse_geoip_sql
|
||||
get_reverse_geoip_file
|
||||
get_random_close_point
|
||||
get_geoip_info
|
||||
);
|
||||
# Some intenrnal constants
|
||||
|
||||
|
@ -137,84 +129,43 @@ sub distance_moved ($$$$$$$) {
|
|||
}
|
||||
|
||||
##########################################################################
|
||||
=head2 C<< get_revesrse_geoip_sql (I<$pa_config>, I<$ip_addr>, I<$dbh>) >>
|
||||
=head2 C<< get_geoip_info (I<$pa_config>, I<$address>, I<$dispersion>) >>
|
||||
|
||||
Gets the GIS information obtained from the B<SQL> Database:
|
||||
Get GIS information from the MaxMind GeoIP database on file using Geo::IP module
|
||||
|
||||
B<Returns>: I<undef> if there is not information available or a B<hash> with:
|
||||
* I<country_code>
|
||||
* I<country_code3>
|
||||
* I<country_name>
|
||||
* I<region>
|
||||
* I<city>
|
||||
* I<postal_code>
|
||||
B<Returns>: I<undef> if there is not information available or a B<hash ref> with:
|
||||
* I<longitude>
|
||||
* I<latitude>
|
||||
* I<metro_code>
|
||||
* I<area_code>
|
||||
|
||||
=cut
|
||||
##########################################################################
|
||||
sub get_reverse_geoip_sql($$$) {
|
||||
my ($pa_config,$ip_addr, $dbh) = @_;
|
||||
|
||||
my $id_range = get_db_value($dbh,
|
||||
'SELECT ' . $RDBMS_QUOTE . 'id_range' . $RDBMS_QUOTE . '
|
||||
FROM tgis_reverse_geoip_ranges
|
||||
WHERE INET_ATON(?) >= ' . $RDBMS_QUOTE . 'first_IP_decimal' . $RDBMS_QUOTE . '
|
||||
AND INET_ATON(?) <= ' . $RDBMS_QUOTE . 'last_IP_decimal ' . $RDBMS_QUOTE . '
|
||||
LIMIT 1', $ip_addr, $ip_addr);
|
||||
|
||||
if (defined($id_range)) {
|
||||
logger($pa_config,"Range id of '$ip_addr' is '$id_range'", 8);
|
||||
my $region_info = get_db_single_row($dbh,
|
||||
'SELECT *
|
||||
FROM tgis_reverse_geoip_info
|
||||
WHERE ' . $RDBMS_QUOTE . 'id_range ' . $RDBMS_QUOTE . ' = ?',
|
||||
$id_range);
|
||||
|
||||
logger($pa_config, "region info of id_range '$id_range' is: country:".$region_info->{'country_name'}." region:".$region_info->{'region'}." city:".$region_info->{'city'}." longitude:".$region_info->{'longitude'}." latitude:".$region_info->{'longitude'}, 8);
|
||||
|
||||
return $region_info;
|
||||
sub get_geoip_info {
|
||||
my ($pa_config, $address) = @_;
|
||||
|
||||
# Return undef if feature is not activated
|
||||
return undef unless ($pa_config->{'activate_gis'} && $pa_config->{'recon_reverse_geolocation_file'} ne '');
|
||||
|
||||
my $record = undef;
|
||||
eval {
|
||||
local $SIG{__DIE__};
|
||||
my $gi = Geo::IP->open($pa_config->{'recon_reverse_geolocation_file'}, GEOIP_STANDARD);
|
||||
die("Cannot load the geoip file \"" . $pa_config->{'recon_reverse_geolocation_file'} . "\".\n") unless defined($gi);
|
||||
$record = $gi->record_by_addr($address);
|
||||
};
|
||||
if ($@) {
|
||||
logger($pa_config, "Error giving coordinates to IP: $address. $@", 8);
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
return undef unless defined($record);
|
||||
|
||||
##########################################################################
|
||||
=head2 C<< get_reverse_geoip_file (I<$pa_config>, I<$ip_addr>) >>
|
||||
# Fuzzy position filter
|
||||
my ($longitude, $latitude) = get_random_close_point (
|
||||
$pa_config, $record->longitude, $record->latitude
|
||||
);
|
||||
|
||||
Gets GIS information from the MaxMind GeooIP database on file using the
|
||||
GPL perl API from MaxMindGeoIP
|
||||
|
||||
B<Returns>: I<undef> if there is not information available or a B<hash> with:
|
||||
* I<country_code>
|
||||
* I<country_code3>
|
||||
* I<country_name>
|
||||
* I<region>
|
||||
* I<city>
|
||||
* I<postal_code>
|
||||
* I<longitude>
|
||||
* I<latitude>
|
||||
* I<metro_code>
|
||||
* I<area_code>
|
||||
|
||||
=cut
|
||||
##########################################################################
|
||||
sub get_reverse_geoip_file($$) {
|
||||
my ($pa_config,$ip_addr) = @_;
|
||||
if ($geoIPPurePerlavilable == 1) {
|
||||
my $geoipdb = PandoraFMS::GeoIP->open( $pa_config->{'recon_reverse_geolocation_file'});
|
||||
if (defined($geoipdb)) {
|
||||
my $region_info = $geoipdb->get_city_record_as_hash($ip_addr);
|
||||
logger($pa_config, "Region info found for IP '$ip_addr' is: country:".$region_info->{'country_name'}." region:".$region_info->{'region'}." city:".$region_info->{'city'}." longitude:".$region_info->{'longitude'}." latitude:".$region_info->{'latitude'}, 8);
|
||||
return $region_info;
|
||||
}
|
||||
else {
|
||||
logger($pa_config, "WARNING: Can't open reverse geolocation file ($pa_config->{'recon_reverse_geolocation_file'}) :$!",8);
|
||||
}
|
||||
}
|
||||
|
||||
return undef;
|
||||
return {
|
||||
"longitude" => $longitude,
|
||||
"latitude" => $latitude
|
||||
};
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
|
@ -228,7 +179,9 @@ Returns C<< (I<$longitude>, I<$laitiutde>) >>
|
|||
##########################################################################
|
||||
sub get_random_close_point ($$$) {
|
||||
my ($pa_config, $center_longitude, $center_latitude) = @_;
|
||||
|
||||
|
||||
return ($center_longitude, $center_latitude) if ($pa_config->{'recon_location_scatter_radius'} == 0);
|
||||
|
||||
my $sign = int rand(2);
|
||||
my $longitude = ($sign*(-1)+(1-$sign)) * rand($pa_config->{'recon_location_scatter_radius'}/$earth_radius_in_meters)*$to_degrees;
|
||||
logger($pa_config,"Longitude random offset '$longitude' ", 8);
|
||||
|
@ -250,7 +203,7 @@ __END__
|
|||
|
||||
=head1 DEPENDENCIES
|
||||
|
||||
L<PandoraFMS::DB>, L<PandoraFMS::Tools> (Optional L<Geo::IP::PurePerl> to use file reverse geolocation database that is faster than the SQL)
|
||||
L<PandoraFMS::DB>, L<PandoraFMS::Tools>, L<Geo::IP>
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
|
@ -262,6 +215,6 @@ L<PandoraFMS::DB>, L<PandoraFMS::Tools>
|
|||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (c) 2005-2010 Artica Soluciones Tecnologicas S.L
|
||||
Copyright (c) 2005-2018 Artica Soluciones Tecnologicas S.L
|
||||
|
||||
=cut
|
||||
|
|
|
@ -1,891 +0,0 @@
|
|||
package PandoraFMS::GeoIP;
|
||||
|
||||
use strict;
|
||||
use FileHandle;
|
||||
use File::Spec;
|
||||
|
||||
BEGIN {
|
||||
if ( $] >= 5.008 ) {
|
||||
require Encode;
|
||||
Encode->import(qw/ decode /);
|
||||
}
|
||||
else {
|
||||
*decode = sub {
|
||||
local $_ = $_[1];
|
||||
use bytes;
|
||||
s/([\x80-\xff])/my $c = ord($1);
|
||||
my $p = $c >= 192 ? 1 : 0;
|
||||
pack ( 'CC' => 0xc2 + $p , $c & ~0x40 ); /ge;
|
||||
return $_;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
use vars qw( @ISA $VERSION @EXPORT $OPEN_TYPE_PATH );
|
||||
|
||||
use constant GEOIP_CHARSET_ISO_8859_1 => 0;
|
||||
use constant GEOIP_CHARSET_UTF8 => 1;
|
||||
|
||||
use constant FULL_RECORD_LENGTH => 50;
|
||||
use constant GEOIP_COUNTRY_BEGIN => 16776960;
|
||||
use constant RECORD_LENGTH => 3;
|
||||
use constant GEOIP_STATE_BEGIN_REV0 => 16700000;
|
||||
use constant GEOIP_STATE_BEGIN_REV1 => 16000000;
|
||||
use constant STRUCTURE_INFO_MAX_SIZE => 20;
|
||||
use constant DATABASE_INFO_MAX_SIZE => 100;
|
||||
use constant GEOIP_COUNTRY_EDITION => 1;
|
||||
use constant GEOIP_REGION_EDITION_REV0 => 7;
|
||||
use constant GEOIP_REGION_EDITION_REV1 => 3;
|
||||
use constant GEOIP_CITY_EDITION_REV0 => 6;
|
||||
use constant GEOIP_CITY_EDITION_REV1 => 2;
|
||||
use constant GEOIP_ORG_EDITION => 5;
|
||||
use constant GEOIP_ISP_EDITION => 4;
|
||||
use constant GEOIP_PROXY_EDITION => 8;
|
||||
use constant GEOIP_ASNUM_EDITION => 9;
|
||||
use constant GEOIP_NETSPEED_EDITION => 10;
|
||||
use constant GEOIP_DOMAIN_EDITION => 11;
|
||||
use constant SEGMENT_RECORD_LENGTH => 3;
|
||||
use constant STANDARD_RECORD_LENGTH => 3;
|
||||
use constant ORG_RECORD_LENGTH => 4;
|
||||
use constant MAX_RECORD_LENGTH => 4;
|
||||
use constant MAX_ORG_RECORD_LENGTH => 300;
|
||||
use constant US_OFFSET => 1;
|
||||
use constant CANADA_OFFSET => 677;
|
||||
use constant WORLD_OFFSET => 1353;
|
||||
use constant FIPS_RANGE => 360;
|
||||
|
||||
$VERSION = '1.24';
|
||||
|
||||
require Exporter;
|
||||
@ISA = qw(Exporter);
|
||||
|
||||
# cheat --- try to load Sys::Mmap
|
||||
BEGIN {
|
||||
eval {
|
||||
# wrap into eval again, as workaround for centos / mod_perl issue
|
||||
# seems they use $@ without eval somewhere
|
||||
|
||||
eval "require Sys::Mmap"
|
||||
? Sys::Mmap->import
|
||||
: do {
|
||||
for (qw/ PROT_READ MAP_PRIVATE MAP_SHARED /) {
|
||||
no strict 'refs';
|
||||
my $unused_stub = $_; # we must use a copy
|
||||
*$unused_stub = sub { die 'Sys::Mmap required for mmap support' };
|
||||
} # for
|
||||
}; # do
|
||||
1;
|
||||
}; # eval
|
||||
} # begin
|
||||
|
||||
|
||||
sub GEOIP_STANDARD(){0;}
|
||||
sub GEOIP_MEMORY_CACHE(){1;}
|
||||
|
||||
#sub GEOIP_CHECK_CACHE(){2;}
|
||||
#sub GEOIP_INDEX_CACHE(){4;}
|
||||
sub GEOIP_MMAP_CACHE(){8;}
|
||||
|
||||
sub GEOIP_UNKNOWN_SPEED(){0;}
|
||||
sub GEOIP_DIALUP_SPEED(){1;}
|
||||
sub GEOIP_CABLEDSL_SPEED(){2;}
|
||||
sub GEOIP_CORPORATE_SPEED(){3;}
|
||||
|
||||
@EXPORT = qw( GEOIP_STANDARD GEOIP_MEMORY_CACHE GEOIP_MMAP_CACHE
|
||||
GEOIP_UNKNOWN_SPEED GEOIP_DIALUP_SPEED GEOIP_CABLEDSL_SPEED GEOIP_CORPORATE_SPEED );
|
||||
my @countries =
|
||||
(undef,"AP","EU","AD","AE","AF","AG","AI","AL","AM","AN","AO","AQ","AR","AS","AT","AU","AW","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BM","BN","BO","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","FX","GA","GB","GD","GE","GF","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IN","IO","IQ","IR","IS","IT","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","ST","SV","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TM","TN","TO","TL","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","RS","ZA","ZM","ME","ZW","A1","A2","O1","AX","GG","IM","JE","BL","MF");
|
||||
my @code3s = ( undef,"AP","EU","AND","ARE","AFG","ATG","AIA","ALB","ARM","ANT","AGO","AQ","ARG","ASM","AUT","AUS","ABW","AZE","BIH","BRB","BGD","BEL","BFA","BGR","BHR","BDI","BEN","BMU","BRN","BOL","BRA","BHS","BTN","BV","BWA","BLR","BLZ","CAN","CC","COD","CAF","COG","CHE","CIV","COK","CHL","CMR","CHN","COL","CRI","CUB","CPV","CX","CYP","CZE","DEU","DJI","DNK","DMA","DOM","DZA","ECU","EST","EGY","ESH","ERI","ESP","ETH","FIN","FJI","FLK","FSM","FRO","FRA","FX","GAB","GBR","GRD","GEO","GUF","GHA","GIB","GRL","GMB","GIN","GLP","GNQ","GRC","GS","GTM","GUM","GNB","GUY","HKG","HM","HND","HRV","HTI","HUN","IDN","IRL","ISR","IND","IO","IRQ","IRN","ISL","ITA","JAM","JOR","JPN","KEN","KGZ","KHM","KIR","COM","KNA","PRK","KOR","KWT","CYM","KAZ","LAO","LBN","LCA","LIE","LKA","LBR","LSO","LTU","LUX","LVA","LBY","MAR","MCO","MDA","MDG","MHL","MKD","MLI","MMR","MNG","MAC","MNP","MTQ","MRT","MSR","MLT","MUS","MDV","MWI","MEX","MYS","MOZ","NAM","NCL","NER","NFK","NGA","NIC","NLD","NOR","NPL","NRU","NIU","NZL","OMN","PAN","PER","PYF","PNG","PHL","PAK","POL","SPM","PCN","PRI","PSE","PRT","PLW","PRY","QAT","REU","ROU","RUS","RWA","SAU","SLB","SYC","SDN","SWE","SGP","SHN","SVN","SJM","SVK","SLE","SMR","SEN","SOM","SUR","STP","SLV","SYR","SWZ","TCA","TCD","TF","TGO","THA","TJK","TKL","TKM","TUN","TON","TLS","TUR","TTO","TUV","TWN","TZA","UKR","UGA","UM","USA","URY","UZB","VAT","VCT","VEN","VGB","VIR","VNM","VUT","WLF","WSM","YEM","YT","SRB","ZAF","ZMB","MNE","ZWE","A1","A2","O1","ALA","GGY","IMN","JEY","BLM","MAF");
|
||||
my @names = (undef,"Asia/Pacific Region","Europe","Andorra","United Arab Emirates","Afghanistan","Antigua and Barbuda",
|
||||
"Anguilla","Albania","Armenia","Netherlands Antilles","Angola","Antarctica","Argentina","American Samoa",
|
||||
"Austria","Australia","Aruba","Azerbaijan","Bosnia and Herzegovina","Barbados","Bangladesh","Belgium","Burkina Faso",
|
||||
"Bulgaria","Bahrain","Burundi","Benin","Bermuda","Brunei Darussalam","Bolivia","Brazil","Bahamas","Bhutan","Bouvet Island",
|
||||
"Botswana","Belarus","Belize","Canada","Cocos (Keeling) Islands","Congo, The Democratic Republic of the","Central African Republic",
|
||||
"Congo","Switzerland","Cote D'Ivoire","Cook Islands","Chile","Cameroon","China","Colombia","Costa Rica","Cuba","Cape Verde",
|
||||
"Christmas Island","Cyprus","Czech Republic","Germany","Djibouti","Denmark","Dominica","Dominican Republic","Algeria","Ecuador",
|
||||
"Estonia","Egypt","Western Sahara","Eritrea","Spain","Ethiopia","Finland","Fiji","Falkland Islands (Malvinas)",
|
||||
"Micronesia, Federated States of","Faroe Islands","France","France, Metropolitan","Gabon","United Kingdom","Grenada","Georgia",
|
||||
"French Guiana","Ghana","Gibraltar","Greenland","Gambia","Guinea","Guadeloupe","Equatorial Guinea","Greece",
|
||||
"South Georgia and the South Sandwich Islands","Guatemala","Guam","Guinea-Bissau","Guyana","Hong Kong",
|
||||
"Heard Island and McDonald Islands","Honduras","Croatia","Haiti","Hungary","Indonesia","Ireland","Israel","India",
|
||||
"British Indian Ocean Territory","Iraq","Iran, Islamic Republic of","Iceland","Italy","Jamaica","Jordan","Japan","Kenya",
|
||||
"Kyrgyzstan","Cambodia","Kiribati","Comoros","Saint Kitts and Nevis","Korea, Democratic People's Republic of","Korea, Republic of",
|
||||
"Kuwait","Cayman Islands","Kazakhstan","Lao People's Democratic Republic","Lebanon","Saint Lucia","Liechtenstein","Sri Lanka",
|
||||
"Liberia","Lesotho","Lithuania","Luxembourg","Latvia","Libyan Arab Jamahiriya","Morocco","Monaco","Moldova, Republic of",
|
||||
"Madagascar","Marshall Islands","Macedonia","Mali","Myanmar","Mongolia","Macau","Northern Mariana Islands","Martinique",
|
||||
"Mauritania","Montserrat","Malta","Mauritius","Maldives","Malawi","Mexico","Malaysia","Mozambique","Namibia","New Caledonia",
|
||||
"Niger","Norfolk Island","Nigeria","Nicaragua","Netherlands","Norway","Nepal","Nauru","Niue","New Zealand","Oman","Panama","Peru",
|
||||
"French Polynesia","Papua New Guinea","Philippines","Pakistan","Poland","Saint Pierre and Miquelon","Pitcairn Islands","Puerto Rico",
|
||||
"Palestinian Territory","Portugal","Palau","Paraguay","Qatar","Reunion","Romania","Russian Federation","Rwanda","Saudi Arabia",
|
||||
"Solomon Islands","Seychelles","Sudan","Sweden","Singapore","Saint Helena","Slovenia","Svalbard and Jan Mayen","Slovakia","Sierra Leone",
|
||||
"San Marino","Senegal","Somalia","Suriname","Sao Tome and Principe","El Salvador","Syrian Arab Republic","Swaziland",
|
||||
"Turks and Caicos Islands","Chad","French Southern Territories","Togo","Thailand","Tajikistan","Tokelau","Turkmenistan","Tunisia",
|
||||
"Tonga","Timor-Leste","Turkey","Trinidad and Tobago","Tuvalu","Taiwan","Tanzania, United Republic of","Ukraine","Uganda",
|
||||
"United States Minor Outlying Islands","United States","Uruguay","Uzbekistan","Holy See (Vatican City State)",
|
||||
"Saint Vincent and the Grenadines","Venezuela","Virgin Islands, British","Virgin Islands, U.S.","Vietnam","Vanuatu",
|
||||
"Wallis and Futuna","Samoa","Yemen","Mayotte","Serbia","South Africa","Zambia","Montenegro","Zimbabwe","Anonymous Proxy",
|
||||
"Satellite Provider","Other","Aland Islands","Guernsey","Isle of Man","Jersey","Saint Barthelemy","Saint Martin");
|
||||
|
||||
|
||||
# --- unfortunately we do not know the path so we assume the
|
||||
# default path /usr/local/share/GeoIP
|
||||
# if thats not true, you can set $Geo::IP::PurePerl::OPEN_TYPE_PATH
|
||||
#
|
||||
sub open_type {
|
||||
my ( $class, $type, $flags ) = @_;
|
||||
my %type_dat_name_mapper = (
|
||||
GEOIP_COUNTRY_EDITION() => 'GeoIP',
|
||||
GEOIP_REGION_EDITION_REV0() => 'GeoIPRegion',
|
||||
GEOIP_REGION_EDITION_REV1() => 'GeoIPRegion',
|
||||
GEOIP_CITY_EDITION_REV0() => 'GeoIPCity',
|
||||
GEOIP_CITY_EDITION_REV1() => 'GeoIPCity',
|
||||
GEOIP_ISP_EDITION() => 'GeoIPISP',
|
||||
GEOIP_ORG_EDITION() => 'GeoIPOrg',
|
||||
GEOIP_PROXY_EDITION() => 'GeoIPProxy',
|
||||
GEOIP_ASNUM_EDITION() => 'GeoIPASNum',
|
||||
GEOIP_NETSPEED_EDITION() => 'GeoIPNetSpeed',
|
||||
GEOIP_DOMAIN_EDITION() => 'GeoIPDomain',
|
||||
);
|
||||
|
||||
# backward compatibility for 2003 databases.
|
||||
$type -= 105 if $type >= 106;
|
||||
|
||||
my $name = $type_dat_name_mapper{$type};
|
||||
die("Invalid database type $type\n") unless $name;
|
||||
|
||||
my $mkpath = sub { File::Spec->catfile( File::Spec->rootdir, @_ ) };
|
||||
|
||||
my $path =
|
||||
defined $Geo::IP::PurePerl::OPEN_TYPE_PATH
|
||||
? $Geo::IP::PurePerl::OPEN_TYPE_PATH
|
||||
: do {
|
||||
$^O eq 'NetWare'
|
||||
? $mkpath->(qw/ etc GeoIP /)
|
||||
: do {
|
||||
$^O eq 'MSWin32'
|
||||
? $mkpath->(qw/ GeoIP /)
|
||||
: $mkpath->(qw/ usr local share GeoIP /);
|
||||
}
|
||||
};
|
||||
|
||||
my $filename = File::Spec->catfile( $path, $name . '.dat' );
|
||||
return $class->open( $filename, $flags );
|
||||
}
|
||||
|
||||
|
||||
sub open {
|
||||
die "Geo::IP::PurePerl::open() requires a path name"
|
||||
unless( @_ > 1 and $_[1] );
|
||||
my ($class, $db_file, $flags) = @_;
|
||||
my $fh = FileHandle->new;
|
||||
my $gi;
|
||||
CORE::open $fh, $db_file or die "Error opening $db_file";
|
||||
binmode($fh);
|
||||
if ( $flags && ( $flags & ( GEOIP_MEMORY_CACHE | GEOIP_MMAP_CACHE ) ) ) {
|
||||
my %self;
|
||||
|
||||
if ( $flags & GEOIP_MMAP_CACHE ) {
|
||||
die "Sys::Mmap required for MMAP support"
|
||||
unless defined $Sys::Mmap::VERSION;
|
||||
mmap( $self{buf} = undef, 0, PROT_READ, MAP_PRIVATE, $fh )
|
||||
or die "mmap: $!";
|
||||
}
|
||||
else {
|
||||
local $/ = undef;
|
||||
$self{buf} = <$fh>;
|
||||
}
|
||||
$self{fh} = $fh;
|
||||
$gi = bless \%self, $class;
|
||||
}
|
||||
else {
|
||||
$gi = bless { fh => $fh }, $class;
|
||||
}
|
||||
$gi->_setup_segments();
|
||||
return $gi;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, $db_file, $flags) = @_;
|
||||
# this will be less messy once deprecated new( $path, [$flags] )
|
||||
# is no longer supported (that's what open() is for)
|
||||
|
||||
my $def_db_file = '/usr/local/share/GeoIP/GeoIP.dat';
|
||||
if ($^O eq 'NetWare') {
|
||||
$def_db_file = 'sys:/etc/GeoIP/GeoIP.dat';
|
||||
} elsif ($^O eq 'MSWin32') {
|
||||
$def_db_file = 'c:/GeoIP/GeoIP.dat';
|
||||
}
|
||||
if ( !defined $db_file ) {
|
||||
# called as new()
|
||||
$db_file = $def_db_file;
|
||||
} elsif ( $db_file =~ /^\d+$/ ) {
|
||||
# db_file is GEOIP_MEMORY_CACHE or GEOIP_STANDARD
|
||||
# called as new( $flags )
|
||||
$flags = $db_file;
|
||||
$db_file = $def_db_file;
|
||||
} # else called as new( $database_filename, [$flags] );
|
||||
|
||||
$class->open( $db_file, $flags );
|
||||
}
|
||||
|
||||
#this function setups the database segments
|
||||
sub _setup_segments {
|
||||
my ($gi) = @_;
|
||||
my $a = 0;
|
||||
my $i = 0;
|
||||
my $j = 0;
|
||||
my $delim;
|
||||
my $buf;
|
||||
$gi->{_charset} = GEOIP_CHARSET_ISO_8859_1;
|
||||
$gi->{"databaseType"} = GEOIP_COUNTRY_EDITION;
|
||||
$gi->{"record_length"} = STANDARD_RECORD_LENGTH;
|
||||
|
||||
my $filepos = tell($gi->{fh});
|
||||
seek($gi->{fh}, -3, 2);
|
||||
for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) {
|
||||
read($gi->{fh},$delim,3);
|
||||
|
||||
#find the delim
|
||||
if ($delim eq (chr(255).chr(255).chr(255))) {
|
||||
read($gi->{fh},$a,1);
|
||||
|
||||
#read the databasetype
|
||||
$gi->{"databaseType"} = ord($a);
|
||||
|
||||
# backward compatibility for 2003 databases.
|
||||
$gi->{databaseType} -= 105 if $gi->{databaseType} >= 106;
|
||||
|
||||
#chose the database segment for the database type
|
||||
#if database Type is GEOIP_REGION_EDITION then use database segment GEOIP_STATE_BEGIN
|
||||
if ($gi->{"databaseType"} == GEOIP_REGION_EDITION_REV0) {
|
||||
$gi->{"databaseSegments"} = GEOIP_STATE_BEGIN_REV0;
|
||||
} elsif ($gi->{"databaseType"} == GEOIP_REGION_EDITION_REV1) {
|
||||
$gi->{"databaseSegments"} = GEOIP_STATE_BEGIN_REV1;
|
||||
}
|
||||
|
||||
#if database Type is GEOIP_CITY_EDITION, GEOIP_ISP_EDITION or GEOIP_ORG_EDITION then
|
||||
#read in the database segment
|
||||
elsif (($gi->{"databaseType"} == GEOIP_CITY_EDITION_REV0) ||
|
||||
($gi->{"databaseType"} == GEOIP_CITY_EDITION_REV1) ||
|
||||
($gi->{"databaseType"} == GEOIP_ORG_EDITION) ||
|
||||
($gi->{"databaseType"} == GEOIP_ASNUM_EDITION) ||
|
||||
($gi->{"databaseType"} == GEOIP_ISP_EDITION)) {
|
||||
$gi->{"databaseSegments"} = 0;
|
||||
|
||||
#read in the database segment for the database type
|
||||
read($gi->{fh},$buf,SEGMENT_RECORD_LENGTH);
|
||||
for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++) {
|
||||
$gi->{"databaseSegments"} += (ord(substr($buf,$j,1)) << ($j * 8));
|
||||
}
|
||||
|
||||
#record length is four for ISP databases and ORG databases
|
||||
#record length is three for country databases, region database and city databases
|
||||
if ($gi->{"databaseType"} == GEOIP_ORG_EDITION ||
|
||||
$gi->{"databaseType"} == GEOIP_ISP_EDITION) {
|
||||
$gi->{"record_length"} = ORG_RECORD_LENGTH;
|
||||
}
|
||||
}
|
||||
last;
|
||||
} else {
|
||||
seek($gi->{fh}, -4 , 1);
|
||||
}
|
||||
}
|
||||
#if database Type is GEOIP_COUNTY_EDITION then use database segment GEOIP_COUNTRY_BEGIN
|
||||
if ($gi->{"databaseType"} == GEOIP_COUNTRY_EDITION ||
|
||||
$gi->{"databaseType"} == GEOIP_NETSPEED_EDITION) {
|
||||
$gi->{"databaseSegments"} = GEOIP_COUNTRY_BEGIN;
|
||||
}
|
||||
seek($gi->{fh},$filepos,0);
|
||||
return $gi;
|
||||
}
|
||||
|
||||
sub _seek_country {
|
||||
my ($gi, $ipnum) = @_;
|
||||
|
||||
my $fh = $gi->{fh};
|
||||
my $offset = 0;
|
||||
|
||||
my ($x0, $x1);
|
||||
|
||||
my $reclen = $gi->{"record_length"};
|
||||
|
||||
for (my $depth = 31; $depth >= 0; $depth--) {
|
||||
unless ( exists $gi->{buf} ) {
|
||||
seek $fh, $offset * 2 * $reclen, 0;
|
||||
read $fh, $x0, $reclen;
|
||||
read $fh, $x1, $reclen;
|
||||
} else {
|
||||
|
||||
$x0 = substr($gi->{buf}, $offset * 2 * $reclen, $reclen);
|
||||
$x1 = substr($gi->{buf}, $offset * 2 * $reclen + $reclen, $reclen);
|
||||
}
|
||||
|
||||
$x0 = unpack("V1", $x0."\0");
|
||||
$x1 = unpack("V1", $x1."\0");
|
||||
|
||||
if ($ipnum & (1 << $depth)) {
|
||||
if ($x1 >= $gi->{"databaseSegments"}) {
|
||||
$gi->{last_netmask} = 32 - $depth;
|
||||
return $x1;
|
||||
}
|
||||
$offset = $x1;
|
||||
} else {
|
||||
if ($x0 >= $gi->{"databaseSegments"}) {
|
||||
$gi->{last_netmask} = 32 - $depth;
|
||||
return $x0;
|
||||
}
|
||||
$offset = $x0;
|
||||
}
|
||||
}
|
||||
|
||||
print STDERR "Error Traversing Database for ipnum = $ipnum - Perhaps database is corrupt?";
|
||||
}
|
||||
sub charset {
|
||||
return $_[0]->{_charset};
|
||||
}
|
||||
|
||||
sub set_charset{
|
||||
my ( $gi, $charset ) = @_;
|
||||
my $old_charset = $gi->{_charset};
|
||||
$gi->{_charset} = $charset;
|
||||
|
||||
return $old_charset;
|
||||
}
|
||||
|
||||
#this function returns the country code of ip address
|
||||
sub country_code_by_addr {
|
||||
my ($gi, $ip_address) = @_;
|
||||
return unless $ip_address =~ m!^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$!;
|
||||
return $countries[$gi->id_by_addr($ip_address)];
|
||||
}
|
||||
|
||||
#this function returns the country code3 of ip address
|
||||
sub country_code3_by_addr {
|
||||
my ($gi, $ip_address) = @_;
|
||||
return unless $ip_address =~ m!^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$!;
|
||||
return $code3s[$gi->id_by_addr($ip_address)];
|
||||
}
|
||||
|
||||
#this function returns the name of ip address
|
||||
sub country_name_by_addr {
|
||||
my ($gi, $ip_address) = @_;
|
||||
return unless $ip_address =~ m!^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$!;
|
||||
return $names[$gi->id_by_addr($ip_address)];
|
||||
}
|
||||
|
||||
sub id_by_addr {
|
||||
my ($gi, $ip_address) = @_;
|
||||
return unless $ip_address =~ m!^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$!;
|
||||
return $gi->_seek_country(addr_to_num($ip_address)) - GEOIP_COUNTRY_BEGIN;
|
||||
}
|
||||
|
||||
#this function returns the country code of domain name
|
||||
sub country_code_by_name {
|
||||
my ($gi, $host) = @_;
|
||||
my $country_id = $gi->id_by_name($host);
|
||||
return $countries[$country_id];
|
||||
}
|
||||
|
||||
#this function returns the country code3 of domain name
|
||||
sub country_code3_by_name {
|
||||
my ($gi, $host) = @_;
|
||||
my $country_id = $gi->id_by_name($host);
|
||||
return $code3s[$country_id];
|
||||
}
|
||||
|
||||
#this function returns the country name of domain name
|
||||
sub country_name_by_name {
|
||||
my ($gi, $host) = @_;
|
||||
my $country_id = $gi->id_by_name($host);
|
||||
return $names[$country_id];
|
||||
}
|
||||
|
||||
sub id_by_name {
|
||||
my ($gi, $host) = @_;
|
||||
my $ip_address;
|
||||
if ($host =~ m!^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$!) {
|
||||
$ip_address = $host;
|
||||
} else {
|
||||
$ip_address = join('.',unpack('C4',(gethostbyname($host))[4]));
|
||||
}
|
||||
return unless $ip_address;
|
||||
return $gi->_seek_country(addr_to_num($ip_address)) - GEOIP_COUNTRY_BEGIN;
|
||||
}
|
||||
|
||||
#this function returns the city record as a array
|
||||
sub get_city_record {
|
||||
my ($gi, $host) = @_;
|
||||
my $ip_address = $gi->get_ip_address($host);
|
||||
return unless $ip_address;
|
||||
my $record_buf;
|
||||
my $record_buf_pos;
|
||||
my $char;
|
||||
my $metroarea_combo;
|
||||
my $record_country_code = "";
|
||||
my $record_country_code3 = "";
|
||||
my $record_country_name = "";
|
||||
my $record_region = "";
|
||||
my $record_city = "";
|
||||
my $record_postal_code = "";
|
||||
my $record_latitude = "";
|
||||
my $record_longitude = "";
|
||||
my $record_metro_code = "";
|
||||
my $record_area_code = "";
|
||||
my $str_length = 0;
|
||||
my $i;
|
||||
my $j;
|
||||
|
||||
#lookup the city
|
||||
my $seek_country = $gi->_seek_country(addr_to_num($ip_address));
|
||||
if ($seek_country == $gi->{"databaseSegments"}) {
|
||||
return;
|
||||
}
|
||||
#set the record pointer to location of the city record
|
||||
my $record_pointer = $seek_country + (2 * $gi->{"record_length"} - 1) * $gi->{"databaseSegments"};
|
||||
|
||||
unless ( exists $gi->{buf} ) {
|
||||
seek( $gi->{"fh"}, $record_pointer, 0 );
|
||||
read( $gi->{"fh"}, $record_buf, FULL_RECORD_LENGTH );
|
||||
$record_buf_pos = 0;
|
||||
}
|
||||
else {
|
||||
$record_buf = substr($gi->{buf}, $record_pointer, FULL_RECORD_LENGTH);
|
||||
$record_buf_pos = 0;
|
||||
}
|
||||
|
||||
#get the country
|
||||
$char = ord(substr($record_buf,$record_buf_pos,1));
|
||||
$record_country_code = $countries[$char];#get the country code
|
||||
$record_country_code3 = $code3s[$char];#get the country code with 3 letters
|
||||
$record_country_name = $names[$char];#get the country name
|
||||
$record_buf_pos++;
|
||||
|
||||
#get the region
|
||||
$char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
|
||||
while ($char != 0) {
|
||||
$str_length++;#get the length of string
|
||||
$char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
|
||||
}
|
||||
if ($str_length > 0) {
|
||||
$record_region = substr($record_buf,$record_buf_pos,$str_length);
|
||||
}
|
||||
$record_buf_pos += $str_length + 1;
|
||||
$str_length = 0;
|
||||
|
||||
#get the city
|
||||
$char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
|
||||
while ($char != 0) {
|
||||
$str_length++;#get the length of string
|
||||
$char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
|
||||
}
|
||||
if ($str_length > 0) {
|
||||
$record_city = substr($record_buf,$record_buf_pos,$str_length);
|
||||
}
|
||||
$record_buf_pos += $str_length + 1;
|
||||
$str_length = 0;
|
||||
|
||||
#get the postal code
|
||||
$char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
|
||||
while ($char != 0) {
|
||||
$str_length++;#get the length of string
|
||||
$char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
|
||||
}
|
||||
if ($str_length > 0) {
|
||||
$record_postal_code = substr($record_buf,$record_buf_pos,$str_length);
|
||||
}
|
||||
$record_buf_pos += $str_length + 1;
|
||||
$str_length = 0;
|
||||
my $latitude = 0;
|
||||
my $longitude = 0;
|
||||
|
||||
#get the latitude
|
||||
for ($j = 0;$j < 3; ++$j) {
|
||||
$char = ord(substr($record_buf,$record_buf_pos++,1));
|
||||
$latitude += ($char << ($j * 8));
|
||||
}
|
||||
$record_latitude = ($latitude/10000) - 180;
|
||||
|
||||
#get the longitude
|
||||
for ($j = 0;$j < 3; ++$j) {
|
||||
$char = ord(substr($record_buf,$record_buf_pos++,1));
|
||||
$longitude += ($char << ($j * 8));
|
||||
}
|
||||
$record_longitude = ($longitude/10000) - 180;
|
||||
|
||||
#get the metro code and the area code
|
||||
if (GEOIP_CITY_EDITION_REV1 == $gi->{"databaseType"}) {
|
||||
$metroarea_combo = 0;
|
||||
if ($record_country_code eq "US") {
|
||||
#if the country is US then read the metro area combo
|
||||
for ($j = 0;$j < 3;++$j) {
|
||||
$char = ord(substr($record_buf,$record_buf_pos++,1));
|
||||
$metroarea_combo += ($char << ($j * 8));
|
||||
}
|
||||
#split the metro area combo into the metro code and the area code
|
||||
$record_metro_code = int($metroarea_combo/1000);
|
||||
$record_area_code = $metroarea_combo%1000;
|
||||
}
|
||||
}
|
||||
|
||||
# the pureperl API must convert the string by themself to UTF8
|
||||
# using Encode for perl >= 5.008 otherwise use it's own iso-8859-1 to utf8 converter
|
||||
$record_city = decode( 'iso-8859-1' => $record_city )
|
||||
if $gi->charset == GEOIP_CHARSET_UTF8;
|
||||
|
||||
return ($record_country_code,$record_country_code3,$record_country_name,$record_region,$record_city,$record_postal_code,$record_latitude,$record_longitude,$record_metro_code,$record_area_code);
|
||||
}
|
||||
|
||||
#this function returns the city record as a hash ref
|
||||
sub get_city_record_as_hash {
|
||||
my ($gi, $host) = @_;
|
||||
my %h;
|
||||
@h{qw/ country_code country_code3 country_name
|
||||
region city postal_code
|
||||
latitude longitude metro_code
|
||||
area_code /}
|
||||
= $gi->get_city_record($host);
|
||||
$h{dma_code} = $h{metro_code}; # alias for depreciated dma_code
|
||||
return \%h;
|
||||
}
|
||||
|
||||
#this function returns isp or org of the domain name
|
||||
sub org_by_name {
|
||||
my ($gi, $host) = @_;
|
||||
my $ip_address = $gi->get_ip_address($host);
|
||||
my $seek_org = $gi->_seek_country(addr_to_num($ip_address));
|
||||
my $char;
|
||||
my $org_buf;
|
||||
my $org_buf_length = 0;
|
||||
my $record_pointer;
|
||||
|
||||
if ($seek_org == $gi->{"databaseSegments"}) {
|
||||
return undef;
|
||||
}
|
||||
|
||||
$record_pointer = $seek_org + (2 * $gi->{"record_length"} - 1) * $gi->{"databaseSegments"};
|
||||
|
||||
unless ( exists $gi->{buf} ) {
|
||||
seek( $gi->{"fh"}, $record_pointer, 0 );
|
||||
read( $gi->{"fh"}, $org_buf, MAX_ORG_RECORD_LENGTH );
|
||||
}
|
||||
else {
|
||||
$org_buf = substr($gi->{buf}, $record_pointer, MAX_ORG_RECORD_LENGTH );
|
||||
}
|
||||
|
||||
$char = ord(substr($org_buf,0,1));
|
||||
while ($char != 0) {
|
||||
$org_buf_length++;
|
||||
$char = ord(substr($org_buf,$org_buf_length,1));
|
||||
}
|
||||
|
||||
$org_buf = substr($org_buf, 0, $org_buf_length);
|
||||
return $org_buf;
|
||||
}
|
||||
|
||||
#this function returns isp or org of the domain name
|
||||
*isp_by_name = \*org_by_name;
|
||||
|
||||
*org_by_addr = \*org_by_name;
|
||||
*isp_by_addr = \*org_by_name;
|
||||
|
||||
#this function returns the region
|
||||
sub region_by_name {
|
||||
my ($gi, $host) = @_;
|
||||
my $ip_address = $gi->get_ip_address($host);
|
||||
return unless $ip_address;
|
||||
if ($gi->{"databaseType"} == GEOIP_REGION_EDITION_REV0) {
|
||||
my $seek_region = $gi->_seek_country(addr_to_num($ip_address)) - GEOIP_STATE_BEGIN_REV0;
|
||||
if ($seek_region >= 1000) {
|
||||
return ("US",chr(($seek_region - 1000)/26 + 65) . chr(($seek_region - 1000)%26 + 65));
|
||||
} else {
|
||||
return ($countries[$seek_region],"");
|
||||
}
|
||||
} elsif ($gi->{"databaseType"} == GEOIP_REGION_EDITION_REV1) {
|
||||
my $seek_region = $gi->_seek_country(addr_to_num($ip_address)) - GEOIP_STATE_BEGIN_REV1;
|
||||
if ($seek_region < US_OFFSET) {
|
||||
return ("","");
|
||||
} elsif ($seek_region < CANADA_OFFSET) {
|
||||
# return a us state
|
||||
return ("US",chr(($seek_region - US_OFFSET)/26 + 65) . chr(($seek_region - US_OFFSET)%26 + 65));
|
||||
} elsif ($seek_region < WORLD_OFFSET) {
|
||||
# return a canada province
|
||||
return ("CA",chr(($seek_region - CANADA_OFFSET)/26 + 65) . chr(($seek_region - CANADA_OFFSET)%26 + 65));
|
||||
} else {
|
||||
# return a country of the world
|
||||
my $c = $countries[($seek_region - WORLD_OFFSET) / FIPS_RANGE];
|
||||
my $a2 = ($seek_region - WORLD_OFFSET) % FIPS_RANGE;
|
||||
my $r = chr(($a2 / 100)+48) . chr((($a2 / 10) % 10)+48) . chr(($a2 % 10)+48);
|
||||
return ($c,$r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub get_ip_address {
|
||||
my ($gi, $host) = @_;
|
||||
my $ip_address;
|
||||
#check if host is ip address
|
||||
if ($host =~ m!^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$!) {
|
||||
#host is ip address
|
||||
$ip_address = $host;
|
||||
} else {
|
||||
#host is domain name do a dns lookup
|
||||
$ip_address = join('.',unpack('C4',(gethostbyname($host))[4]));
|
||||
}
|
||||
return $ip_address;
|
||||
}
|
||||
|
||||
sub addr_to_num { unpack( N => pack( C4 => split( /\./, $_[0] ) ) ) }
|
||||
sub num_to_addr { join q{.}, unpack( C4 => pack( N => $_[0] ) ) }
|
||||
|
||||
sub database_info {
|
||||
my $gi = shift;
|
||||
my $i = 0;
|
||||
my $buf;
|
||||
my $retval;
|
||||
my $hasStructureInfo;
|
||||
seek($gi->{fh},-3,2);
|
||||
for (my $i = 0;$i < STRUCTURE_INFO_MAX_SIZE;$i++) {
|
||||
read($gi->{fh},$buf,3);
|
||||
if ($buf eq (chr(255) . chr(255) . chr(255))) {
|
||||
$hasStructureInfo = 1;
|
||||
last;
|
||||
}
|
||||
seek($gi->{fh},-4,1);
|
||||
}
|
||||
if ($hasStructureInfo == 1) {
|
||||
seek($gi->{fh},-6,1);
|
||||
} else {
|
||||
# no structure info, must be pre Sep 2002 database, go back to
|
||||
seek($gi->{fh},-3,2);
|
||||
}
|
||||
for (my $i = 0;$i < DATABASE_INFO_MAX_SIZE;$i++){
|
||||
read($gi->{fh},$buf,3);
|
||||
if ($buf eq (chr(0). chr(0). chr(0))){
|
||||
read($gi->{fh},$retval,$i);
|
||||
return $retval;
|
||||
}
|
||||
seek($gi->{fh},-4,1);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
sub range_by_ip {
|
||||
my $gi = shift;
|
||||
my $ipnum = addr_to_num( shift );
|
||||
my $c = $gi->_seek_country( $ipnum );
|
||||
my $nm = $gi->last_netmask;
|
||||
my $m = 0xffffffff << 32 - $nm;
|
||||
my $left_seek_num = $ipnum & $m;
|
||||
my $right_seek_num = $left_seek_num + ( 0xffffffff & ~$m );
|
||||
|
||||
while ( $left_seek_num != 0
|
||||
and $c == $gi->_seek_country( $left_seek_num - 1) ) {
|
||||
my $lm = 0xffffffff << 32 - $gi->last_netmask;
|
||||
$left_seek_num = ( $left_seek_num - 1 ) & $lm;
|
||||
}
|
||||
while ( $right_seek_num != 0xffffffff
|
||||
and $c == $gi->_seek_country( $right_seek_num + 1 ) ) {
|
||||
my $rm = 0xffffffff << 32 - $gi->last_netmask;
|
||||
$right_seek_num = ( $right_seek_num + 1 ) & $rm;
|
||||
$right_seek_num += ( 0xffffffff & ~$rm );
|
||||
}
|
||||
return ( num_to_addr($left_seek_num), num_to_addr($right_seek_num) );
|
||||
}
|
||||
|
||||
sub netmask { $_[0]->{last_netmask} = $_[1] }
|
||||
|
||||
sub last_netmask {
|
||||
return $_[0]->{last_netmask};
|
||||
}
|
||||
|
||||
sub DESTROY {
|
||||
my $gi = shift;
|
||||
|
||||
if ( exists $gi->{buf} && $gi->{flags} && ( $gi->{flags} & GEOIP_MMAP_CACHE ) ) {
|
||||
munmap( $gi->{buf} ) or die "munmap: $!";
|
||||
delete $gi->{buf};
|
||||
}
|
||||
}
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Geo::IP::PurePerl - Look up country by IP Address
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Geo::IP::PurePerl;
|
||||
|
||||
my $gi = Geo::IP::PurePerl->new(GEOIP_STANDARD);
|
||||
|
||||
# look up IP address '24.24.24.24'
|
||||
my $country = $gi->country_code_by_addr('24.24.24.24');
|
||||
$country = $gi->country_code_by_name('yahoo.com');
|
||||
# $country is equal to "US"
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module uses a file based database. This database simply contains
|
||||
IP blocks as keys, and countries as values. This database is more
|
||||
complete and accurate than reverse DNS lookups.
|
||||
|
||||
This module can be used to automatically select the geographically closest mirror,
|
||||
to analyze your web server logs
|
||||
to determine the countries of your visiters, for credit card fraud
|
||||
detection, and for software export controls.
|
||||
|
||||
=head1 IP ADDRESS TO COUNTRY DATABASES
|
||||
|
||||
The database is available for free, updated monthly:
|
||||
|
||||
http://www.maxmind.com/download/geoip/database/
|
||||
|
||||
This free database is similar to the database contained in IP::Country,
|
||||
as well as many paid databases. It uses ARIN, RIPE, APNIC, and LACNIC
|
||||
whois to obtain the IP->Country mappings.
|
||||
|
||||
If you require greater accuracy, MaxMind offers a paid database
|
||||
on a paid subscription basis from http://www.maxmind.com/app/country
|
||||
|
||||
=head1 CLASS METHODS
|
||||
|
||||
=over 4
|
||||
|
||||
=item $gi = Geo::IP->new( [$flags] );
|
||||
|
||||
Constructs a new Geo::IP object with the default database located inside your system's
|
||||
I<datadir>, typically I</usr/local/share/GeoIP/GeoIP.dat>.
|
||||
|
||||
Flags can be set to either GEOIP_STANDARD, or for faster performance
|
||||
(at a cost of using more memory), GEOIP_MEMORY_CACHE.
|
||||
The default flag is GEOIP_STANDARD (uses less memory, but runs slower).
|
||||
|
||||
=item $gi = Geo::IP->new( $database_filename );
|
||||
|
||||
Calling the C<new> constructor in this fashion was was deprecated after version
|
||||
0.26 in order to make the XS and pure perl interfaces more similar. Use the
|
||||
C<open> constructor (below) if you need to specify a path. Eventually, this
|
||||
means of calling C<new> will no longer be supported.
|
||||
|
||||
Flags can be set to either GEOIP_STANDARD, or for faster performance
|
||||
(at a cost of using more memory), GEOIP_MEMORY_CACHE.
|
||||
|
||||
=item $gi = Geo::IP->open( $database_filename, [$flags] );
|
||||
|
||||
Constructs a new Geo::IP object with the database located at C<$database_filename>.
|
||||
The default flag is GEOIP_STANDARD (uses less memory, but runs slower).
|
||||
|
||||
=back
|
||||
|
||||
=head1 OBJECT METHODS
|
||||
|
||||
=over 4
|
||||
|
||||
=item $code = $gi->country_code_by_addr( $ipaddr );
|
||||
|
||||
Returns the ISO 3166 country code for an IP address.
|
||||
|
||||
=item $code = $gi->country_code_by_name( $ipname );
|
||||
|
||||
Returns the ISO 3166 country code for a hostname.
|
||||
|
||||
=item $code = $gi->country_code3_by_addr( $ipaddr );
|
||||
|
||||
Returns the 3 letter country code for an IP address.
|
||||
|
||||
=item $code = $gi->country_code3_by_name( $ipname );
|
||||
|
||||
Returns the 3 letter country code for a hostname.
|
||||
|
||||
=item $name = $gi->country_name_by_addr( $ipaddr );
|
||||
|
||||
Returns the full country name for an IP address.
|
||||
|
||||
=item $name = $gi->country_name_by_name( $ipname );
|
||||
|
||||
Returns the full country name for a hostname.
|
||||
|
||||
=item $info = $gi->database_info;
|
||||
|
||||
Returns database string, includes version, date, build number and copyright notice.
|
||||
|
||||
=item $old_charset = $gi->set_charset( $charset );
|
||||
|
||||
Set the charset for the city name - defaults to GEOIP_CHARSET_ISO_8859_1. To
|
||||
set UTF8, pass GEOIP_CHARSET_UTF8 to set_charset.
|
||||
|
||||
=item $charset = $gi->charset;
|
||||
|
||||
Gets the currently used charset.
|
||||
|
||||
=item $netmask = $gi->last_netmask;
|
||||
|
||||
Gets netmask of network block from last lookup.
|
||||
|
||||
=item $gi->netmask(12);
|
||||
|
||||
Sets netmask for the last lookup
|
||||
|
||||
=item my ( $from, $to ) = $gi->range_by_ip('24.24.24.24');
|
||||
|
||||
Returns the start and end of the current network block. The method tries to join several continous netblocks.
|
||||
|
||||
=item @data = $gi->get_city_record( $addr );
|
||||
|
||||
Returns a array filled with information about the city.
|
||||
|
||||
my ($country_code,$country_code3,$country_name,$region,$city,$postal_code,$latitude,$longitude,$metro_code,$area_code ) = $gi->get_city_record($addr);
|
||||
|
||||
=item $href = get_city_record_as_hash( $addr );
|
||||
|
||||
Returns a hashref filled with information about the city.
|
||||
|
||||
my $href = $gi->get_city_record_as_hash($addr);
|
||||
|
||||
The hash include the following keys:
|
||||
country_code, country_code3, country_name, region, city, postal_code, latitude, longitude, metro_code, area_code
|
||||
|
||||
=item $gi->isp_by_addr($addr)
|
||||
|
||||
Returns the isp name for an ipaddress
|
||||
|
||||
=item $gi->isp_by_name($name)
|
||||
|
||||
Returns the isp name for a hostname
|
||||
|
||||
=item $gi->org_by_addr($addr)
|
||||
|
||||
Returns the organisation name for an ipaddress
|
||||
|
||||
=item $gi->org_by_name($name)
|
||||
|
||||
Returns the organisation name for a hostname
|
||||
|
||||
=back
|
||||
|
||||
=head1 MAILING LISTS AND CVS
|
||||
|
||||
Are available from SourceForge, see
|
||||
http://sourceforge.net/projects/geoip/
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
1.23
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
Geo::IP - this now has the PurePerl code merged it, so it supports
|
||||
both XS and Pure Perl implementations. The XS implementation is
|
||||
a wrapper around the GeoIP C API, which is much faster than the
|
||||
Pure Perl API.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Copyright (c) 2008 MaxMind Inc
|
||||
|
||||
All rights reserved. This package is free software; it is licensed
|
||||
under the GPL.
|
||||
|
||||
=cut
|
|
@ -31,8 +31,8 @@ use base 'Exporter';
|
|||
our @ISA = qw(Exporter);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.724";
|
||||
my $pandora_build = "180709";
|
||||
my $pandora_version = "7.0NG.725";
|
||||
my $pandora_build = "180801";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
@ -990,6 +990,18 @@ sub init {
|
|||
return $conf;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Update internal UA timeout
|
||||
################################################################################
|
||||
sub ua_set_timeout {
|
||||
my ($config, $timeout) = @_;
|
||||
return unless looks_like_number($timeout) and $timeout > 0;
|
||||
my $sys = get_sys_environment($config);
|
||||
|
||||
return unless defined($sys->{'ua'});
|
||||
$sys->{'ua'}->timeout($timeout);
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# initialize plugin (basic)
|
||||
################################################################################
|
||||
|
|
|
@ -176,7 +176,7 @@ sub exec_prediction_module ($$$$) {
|
|||
logger ($pa_config, "Executing service module " .
|
||||
$agent_module->{'id_agente_modulo'} . " " .
|
||||
$agent_module->{'nombre'}, 10);
|
||||
enterprise_hook ('exec_service_module', [$pa_config, $agent_module, $server_id, $dbh]);
|
||||
enterprise_hook ('exec_service_module', [$pa_config, $agent_module, undef, $server_id, $dbh]);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -36,7 +36,7 @@ use PandoraFMS::Tools;
|
|||
use PandoraFMS::DB;
|
||||
use PandoraFMS::Core;
|
||||
use PandoraFMS::ProducerConsumerServer;
|
||||
use PandoraFMS::GIS qw(get_reverse_geoip_sql get_reverse_geoip_file get_random_close_point);
|
||||
use PandoraFMS::GIS;
|
||||
use PandoraFMS::Recon::Base;
|
||||
|
||||
# Patched Nmap::Parser. See http://search.cpan.org/dist/Nmap-Parser/.
|
||||
|
@ -418,8 +418,12 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
|||
|
||||
# Are we filtering hosts by TCP port?
|
||||
return if ($self->{'recon_ports'} ne '' && $self->tcp_scan($device) == 0);
|
||||
|
||||
$agent_id = pandora_create_agent($self->{'pa_config'}, $self->{'pa_config'}->{'servername'}, $host_name, $device, $self->{'group_id'}, 0, $id_os, '', 300, $self->{'dbh'});
|
||||
my $location = get_geoip_info($self->{'pa_config'}, $device);
|
||||
$agent_id = pandora_create_agent($self->{'pa_config'}, $self->{'pa_config'}->{'servername'}, $host_name, $device,
|
||||
$self->{'group_id'}, 0, $id_os,
|
||||
'', 300, $self->{'dbh'}, undef,
|
||||
$location->{'longitude'}, $location->{'latitude'}
|
||||
);
|
||||
return undef unless defined ($agent_id) and ($agent_id > 0);
|
||||
pandora_event($self->{'pa_config'}, "[RECON] New " . safe_output($self->get_device_type($device)) . " found (" . join(',', safe_output($self->get_addresses($device))) . ").", $self->{'group_id'}, $agent_id, 2, 0, 0, 'recon_host_detected', 0, $self->{'dbh'});
|
||||
$agent_learning = 1;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Server
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.724
|
||||
%define release 180709
|
||||
%define version 7.0NG.725
|
||||
%define release 180801
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -30,7 +30,7 @@ Requires: perl(NetAddr::IP) net-snmp net-tools
|
|||
Requires: perl(IO::Socket::INET6) perl(Net::Telnet)
|
||||
Requires: nmap sudo perl(JSON)
|
||||
Requires: perl(Time::HiRes) perl(Encode::Locale)
|
||||
Requires: perl perl(Sys::Syslog) perl(HTML::Entities)
|
||||
Requires: perl perl(Sys::Syslog) perl(HTML::Entities) perl(Geo::IP)
|
||||
|
||||
%description
|
||||
Pandora FMS is a monitoring system for big IT environments. It uses remote tests, or local agents to grab information. Pandora supports all standard OS (Linux, AIX, HP-UX, Solaris and Windows XP,2000/2003), and support multiple setups in HA enviroments.
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Server
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.724
|
||||
%define release 180709
|
||||
%define version 7.0NG.725
|
||||
%define release 180801
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -25,7 +25,7 @@ Requires: perl-DBI perl-DBD-mysql perl-libwww-perl
|
|||
Requires: perl-NetAddr-IP net-snmp net-tools perl-XML-Twig
|
||||
Requires: nmap sudo perl-HTML-Tree perl-XML-Simple perl-Net-Telnet
|
||||
Requires: perl-IO-Socket-INET6 perl-Socket6 snmp-mibs perl-JSON
|
||||
Requires: perl-Encode-Locale
|
||||
Requires: perl-Encode-Locale perl-Geo-IP
|
||||
|
||||
%description
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.724"
|
||||
PI_BUILD="180709"
|
||||
PI_VERSION="7.0NG.725"
|
||||
PI_BUILD="180801"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
###############################################################################
|
||||
# Pandora FMS DB Management
|
||||
###############################################################################
|
||||
# Copyright (c) 2005-2018 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
|
||||
# as published by the Free Software Foundation; version 2
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
|
||||
###############################################################################
|
||||
|
||||
# Includes list
|
||||
use strict;
|
||||
use warnings;
|
||||
use Time::Local; # DateTime basic manipulation
|
||||
use DBI; # DB interface with MySQL
|
||||
use POSIX qw(strftime);
|
||||
use Time::HiRes qw(usleep);
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
|
||||
use PandoraFMS::Core;
|
||||
use PandoraFMS::Config;
|
||||
use PandoraFMS::DB;
|
||||
use PandoraFMS::GIS;
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
||||
# Pandora db handler
|
||||
my $dbh;
|
||||
|
||||
# FLUSH in each IO
|
||||
$| = 1;
|
||||
|
||||
sub print_agent_gis_update_help() {
|
||||
print "Usage: $0 <path to pandora_server.conf>\n";
|
||||
}
|
||||
|
||||
# Get options
|
||||
my ($configuration_file) = @ARGV;
|
||||
if (!defined($configuration_file) || $configuration_file eq '-h' || $configuration_file eq '--help') {
|
||||
print_agent_gis_update_help();
|
||||
exit defined($configuration_file) ? 0 : 1;
|
||||
}
|
||||
|
||||
# Load configuration file
|
||||
$conf{'pandora_path'} = $configuration_file;
|
||||
$conf{'quiet'} = 0;
|
||||
pandora_load_config(\%conf);
|
||||
|
||||
use Data::Dumper;
|
||||
#print Dumper(\%conf);
|
||||
|
||||
if (!$conf{'activate_gis'} || $conf{'recon_reverse_geolocation_file'} eq '') {
|
||||
print "Geolocation feature es blocked.\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
# Connect to the DB
|
||||
$dbh = db_connect ('mysql', $conf{'dbname'}, $conf{'dbhost'}, $conf{'dbport'}, $conf{'dbuser'}, $conf{'dbpass'});
|
||||
if (!defined($dbh)){
|
||||
print "Cannot connect to database\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# Get all agents with IP assigned
|
||||
my @agents = get_db_rows($dbh,
|
||||
"SELECT id_agente, direccion, alias FROM tagente WHERE disabled = 0 AND direccion <> ''"
|
||||
);
|
||||
|
||||
my $c_time = strftime ("%Y/%m/%d %H:%M:%S", localtime());
|
||||
foreach my $agent (@agents) {
|
||||
my $location = get_geoip_info (\%conf, $agent->{'direccion'});
|
||||
if (defined($location)) {
|
||||
pandora_update_gis_data(\%conf, $dbh, $agent->{'id_agente'}, $agent->{'id_agente'}, $location->{'longitude'}, $location->{'latitude'}, undef, undef, $c_time);
|
||||
}
|
||||
}
|
||||
|
||||
print "Successfull relocation\n";
|
||||
|
||||
db_disconnect($dbh);
|
||||
exit 0;
|
|
@ -5,8 +5,6 @@ In order to be able to use GeoIP/GIS features of the Pandora FMS reconserver, yo
|
|||
http://www.maxmind.com/app/geoip_resources
|
||||
http://www.maxmind.com/app/installation
|
||||
http://www.maxmind.com/app/geolitecity
|
||||
|
||||
Install manually Geo-IP-PurePerl-1.24.tar.gz
|
||||
|
||||
This database will be used with Pandora FMS recon server for positioning detected host Systems. Check Pandora FMS documentacion for more information.
|
||||
|
||||
|
@ -15,7 +13,6 @@ Prior to use this database you need to decompress it with gzip -d and edit your
|
|||
activate_gis 1
|
||||
recon_reverse_geolocation_file /usr/share/pandora_server/util/GeoLiteCity.dat
|
||||
location_error 50
|
||||
recon_reverse_geolocation_mode file
|
||||
recon_location_scatter_radius 1000
|
||||
|
||||
Get a new version at:
|
||||
|
|
|
@ -34,7 +34,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.724 PS180709";
|
||||
my $version = "7.0NG.725 PS180801";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
@ -687,7 +687,7 @@ sub pandora_load_config_pdb ($) {
|
|||
###############################################################################
|
||||
|
||||
sub pandora_checkdb_integrity {
|
||||
my $dbh = shift;
|
||||
my ($conf, $dbh) = @_;
|
||||
|
||||
log_message ('INTEGRITY', "Cleaning up group stats.");
|
||||
|
||||
|
@ -719,7 +719,7 @@ sub pandora_checkdb_integrity {
|
|||
db_do ($dbh, 'DELETE FROM tagente_datos_inc WHERE id_agente_modulo NOT IN (SELECT id_agente_modulo FROM tagente_modulo)');
|
||||
|
||||
# Check enterprise tables
|
||||
enterprise_hook ('pandora_checkdb_integrity_enterprise', [$dbh]);
|
||||
enterprise_hook ('pandora_checkdb_integrity_enterprise', [$conf, $dbh]);
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
@ -996,7 +996,7 @@ sub pandoradb_main ($$$) {
|
|||
pandora_checkdb_consistency ($conf, $dbh);
|
||||
|
||||
# Maintain Referential integrity and other stuff
|
||||
pandora_checkdb_integrity ($dbh);
|
||||
pandora_checkdb_integrity ($conf, $dbh);
|
||||
|
||||
# Move old data to the history DB
|
||||
if (defined ($history_dbh)) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue