Merge remote-tracking branch 'origin/develop' into 1873-autoprovisionamiento-de-agentes
This commit is contained in:
commit
42107017bf
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719, AIX version
|
||||
# Version 7.0NG.720, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719, FreeBSD Version
|
||||
# Version 7.0NG.720, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719, HP-UX Version
|
||||
# Version 7.0NG.720, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719, GNU/Linux
|
||||
# Version 7.0NG.720, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719, GNU/Linux
|
||||
# Version 7.0NG.720, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719, Solaris Version
|
||||
# Version 7.0NG.720, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2010 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.719
|
||||
# Version 7.0NG.720
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.719, AIX version
|
||||
# Version 7.0NG.720, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.719
|
||||
# Version 7.0NG.720
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.719, HPUX Version
|
||||
# Version 7.0NG.720, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719
|
||||
# Version 7.0NG.720
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719
|
||||
# Version 7.0NG.720
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719
|
||||
# Version 7.0NG.720
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.719, Solaris version
|
||||
# Version 7.0NG.720, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719, AIX version
|
||||
# Version 7.0NG.720, 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.719-180302
|
||||
Version: 7.0NG.720
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.719-180302"
|
||||
pandora_version="7.0NG.720"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719, GNU/Linux
|
||||
# Version 7.0NG.720, 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.719, FreeBSD Version
|
||||
# Version 7.0NG.720, 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.719, HP-UX Version
|
||||
# Version 7.0NG.720, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719, GNU/Linux
|
||||
# Version 7.0NG.720, 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.719, GNU/Linux
|
||||
# Version 7.0NG.720, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.719, NetBSD Version
|
||||
# Version 7.0NG.720, 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.719, Solaris Version
|
||||
# Version 7.0NG.720, 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.719';
|
||||
use constant AGENT_BUILD => '180302';
|
||||
use constant AGENT_VERSION => '7.0NG.720';
|
||||
use constant AGENT_BUILD => '180313';
|
||||
|
||||
# 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.719
|
||||
%define release 180302
|
||||
%define version 7.0NG.720
|
||||
%define release 1
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.719
|
||||
%define release 180302
|
||||
%define version 7.0NG.720
|
||||
%define release 1
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.719"
|
||||
PI_BUILD="180302"
|
||||
PI_VERSION="7.0NG.720"
|
||||
PI_BUILD="180313"
|
||||
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.719
|
||||
# Version 7.0NG.720
|
||||
|
||||
# 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.719}
|
||||
{Pandora FMS Windows Agent v7.0NG.720}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{180302}
|
||||
{180313}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives
|
|||
{No}
|
||||
|
||||
Windows,Executable
|
||||
{<%AppName%>-<%Version%>-Setup<%Ext%>}
|
||||
{<%AppName%>-Setup<%Ext%>}
|
||||
|
||||
Windows,FileDescription
|
||||
{<%AppName%> <%Version%> Setup}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.719(Build 180302)")
|
||||
#define PANDORA_VERSION ("7.0NG.720(Build 180313)")
|
||||
|
||||
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.719(Build 180302))"
|
||||
VALUE "ProductVersion", "(7.0NG.720(Build 180313))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.719-180302
|
||||
Version: 7.0NG.720
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.719-180302"
|
||||
pandora_version="7.0NG.720"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -32,4 +32,30 @@ START TRANSACTION;
|
|||
FOREIGN KEY (`id_provisioning`) REFERENCES tprovisioning(`id`)
|
||||
ON DELETE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
create table IF NOT EXISTS `tmigration_queue`(
|
||||
`id` int unsigned not null auto_increment,
|
||||
`id_source_agent` int unsigned not null,
|
||||
`id_target_agent` int unsigned not null,
|
||||
`id_source_node` int unsigned not null,
|
||||
`id_target_node` int unsigned not null,
|
||||
`priority` int unsigned default 0,
|
||||
`step` int default 0,
|
||||
`running` tinyint(2) default 0,
|
||||
`active_db_only` tinyint(2) default 0,
|
||||
PRIMARY KEY(`id`)
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
create table IF NOT EXISTS `tmigration_module_queue`(
|
||||
`id` int unsigned not null auto_increment,
|
||||
`id_migration` int unsigned not null,
|
||||
`id_source_agentmodule` int unsigned not null,
|
||||
`id_target_agentmodule` int unsigned not null,
|
||||
`last_replication_timestamp` bigint(20) NOT NULL default 0,
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY(`id_migration`) REFERENCES tmigration_queue(`id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -1560,3 +1560,36 @@ create table IF NOT EXISTS `tprovisioning_rules`(
|
|||
FOREIGN KEY (`id_provisioning`) REFERENCES tprovisioning(`id`)
|
||||
ON DELETE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmigration_queue`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
create table IF NOT EXISTS `tmigration_queue`(
|
||||
`id` int unsigned not null auto_increment,
|
||||
`id_source_agent` int unsigned not null,
|
||||
`id_target_agent` int unsigned not null,
|
||||
`id_source_node` int unsigned not null,
|
||||
`id_target_node` int unsigned not null,
|
||||
`priority` int unsigned default 0,
|
||||
`step` int default 0,
|
||||
`running` tinyint(2) default 0,
|
||||
`active_db_only` tinyint(2) default 0,
|
||||
PRIMARY KEY(`id`)
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmigration_module_queue`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
create table IF NOT EXISTS `tmigration_module_queue`(
|
||||
`id` int unsigned not null auto_increment,
|
||||
`id_migration` int unsigned not null,
|
||||
`id_source_agentmodule` int unsigned not null,
|
||||
`id_target_agentmodule` int unsigned not null,
|
||||
`last_replication_timestamp` bigint(20) NOT NULL default 0,
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY(`id_migration`) REFERENCES tmigration_queue(`id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
|
@ -1186,6 +1186,7 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri
|
|||
|
||||
$(document).ready (function () {
|
||||
$("#id_agents").change(agent_changed_by_multiple_agents);
|
||||
$("#modules_selection_mode").change(agent_changed_by_multiple_agents);
|
||||
|
||||
change_type_downtime();
|
||||
change_type_execution();
|
||||
|
|
|
@ -290,18 +290,22 @@ if (!defined('METACONSOLE')) {
|
|||
else {
|
||||
$url = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&recursion='.$recursion.'&ag_group='.$ag_group.'&search='.$search.'&pagination='.$pagination;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($own_info['is_admin'] || $vconsoles_read) {
|
||||
if($ag_group){
|
||||
$maps = visual_map_get_user_layouts (0,false,$filters,false);
|
||||
$maps = visual_map_get_user_layouts ($config['id_user'],false,$filters,false);
|
||||
unset($filters['offset']);
|
||||
unset($filters['limit']);
|
||||
$count_maps = visual_map_get_user_layouts (0,false,$filters,false);
|
||||
$count_maps = visual_map_get_user_layouts ($config['id_user'],false,$filters,false);
|
||||
$total_maps = count($count_maps);
|
||||
}else{
|
||||
$maps = visual_map_get_user_layouts (0,false,$filters, false);
|
||||
$maps = visual_map_get_user_layouts ($config['id_user'],false,$filters, false);
|
||||
unset($filters['offset']);
|
||||
unset($filters['limit']);
|
||||
$count_maps = visual_map_get_user_layouts (0,false,$filters,false);
|
||||
$count_maps = visual_map_get_user_layouts ($config['id_user'],false,$filters,false);
|
||||
$total_maps = count($count_maps);
|
||||
}
|
||||
}
|
||||
|
@ -309,7 +313,7 @@ else {
|
|||
$maps = visual_map_get_user_layouts ($config['id_user'], false, $filters, false);
|
||||
unset($filters['offset']);
|
||||
unset($filters['limit']);
|
||||
$count_maps = visual_map_get_user_layouts (0,false,$filters,false);
|
||||
$count_maps = visual_map_get_user_layouts ($config['id_user'],false,$filters,false);
|
||||
$total_maps = count($count_maps);
|
||||
}
|
||||
if (!$maps && !is_metaconsole()) {
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 81 KiB |
Binary file not shown.
After Width: | Height: | Size: 565 KiB |
|
@ -51,6 +51,9 @@ $correctLogin = false;
|
|||
$user_in_db = null;
|
||||
$no_login_msg = "";
|
||||
|
||||
// Clean unwanted output
|
||||
ob_clean();
|
||||
|
||||
// Special call without checks to retrieve version and build of the Pandora FMS
|
||||
// This info is avalable from the web console without login
|
||||
// Don't change the format, it is parsed by applications
|
||||
|
|
|
@ -1599,6 +1599,15 @@ class Tree {
|
|||
'url' => $moduleGraphURL,
|
||||
'handle' => $winHandle
|
||||
);
|
||||
|
||||
// Info to be able to open the snapshot image new page
|
||||
$module['snapshot'] = ui_get_snapshot_link(array(
|
||||
'id_module' => $module['id'],
|
||||
'last_data' => $module['datos'],
|
||||
'timestamp' => $module['timestamp'],
|
||||
'interval' => $module['current_interval'],
|
||||
'module_name' => $module['name']
|
||||
), true);
|
||||
}
|
||||
|
||||
// Alerts fired image
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC180302';
|
||||
$pandora_version = 'v7.0NG.719';
|
||||
$build_version = 'PC180313';
|
||||
$pandora_version = 'v7.0NG.720';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
|
@ -34,6 +34,7 @@ enterprise_include_once ('include/functions_local_components.php');
|
|||
enterprise_include_once ('include/functions_events.php');
|
||||
enterprise_include_once ('include/functions_agents.php');
|
||||
enterprise_include_once ('include/functions_modules.php');
|
||||
enterprise_include_once ('include/functions_collection.php');
|
||||
|
||||
/**
|
||||
* Parse the "other" parameter.
|
||||
|
|
|
@ -731,6 +731,15 @@ function networkmap_links_to_js_links($relations, $nodes_graph) {
|
|||
|
||||
$agent = agents_get_agent_id_by_module_id($relation['id_parent_source_data']);
|
||||
$agent2 = agents_get_agent_id_by_module_id($relation['id_child_source_data']);
|
||||
foreach ($nodes_graph as $key2 => $node) {
|
||||
if(isset($node['id_agent'])) {
|
||||
if($node['id_agent'] == $agent) {
|
||||
$agent = $node['id_db'];
|
||||
} else if ($node['id_agent'] == $agent2) {
|
||||
$agent2 = $node['id_db'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($relation['child_type'] == 1) {
|
||||
$mod1_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_child_source_data']));
|
||||
|
@ -742,8 +751,16 @@ function networkmap_links_to_js_links($relations, $nodes_graph) {
|
|||
$item['link_color'] = "#FAD403";
|
||||
}
|
||||
|
||||
$agent = $relation['id_parent_source_data'];
|
||||
$agent2 = agents_get_agent_id_by_module_id($relation['id_child_source_data']);
|
||||
foreach ($nodes_graph as $key2 => $node) {
|
||||
if(isset($node['id_agent'])) {
|
||||
if($node['id_agent'] == $relation['id_parent_source_data']) {
|
||||
$agent = $node['id_db'];
|
||||
} else if ($node['id_agent'] == $agent2) {
|
||||
$agent2 = $node['id_db'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($relation['parent_type'] == 1) {
|
||||
$mod1_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_parent_source_data']));
|
||||
|
@ -756,59 +773,67 @@ function networkmap_links_to_js_links($relations, $nodes_graph) {
|
|||
}
|
||||
|
||||
$agent = agents_get_agent_id_by_module_id($relation['id_parent_source_data']);
|
||||
$agent2 = $relation['id_child_source_data'];
|
||||
|
||||
foreach ($nodes_graph as $key2 => $node) {
|
||||
if(isset($node['id_agent'])) {
|
||||
if($node['id_agent'] == $agent) {
|
||||
$agent = $node['id_db'];
|
||||
} else if ($node['id_agent'] == $relation['id_child_source_data']) {
|
||||
$agent2 = $node['id_db'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (($relation['parent_type'] == 3) && ($relation['child_type'] == 3)) {
|
||||
foreach ($nodes_graph as $key => $node) {
|
||||
foreach ($nodes_graph as $key2 => $node) {
|
||||
if ($relation['id_parent'] == $node['id_db']) {
|
||||
$agent = $key;
|
||||
$agent = $node['id_db'];
|
||||
}
|
||||
}
|
||||
foreach ($nodes_graph as $key => $node) {
|
||||
foreach ($nodes_graph as $key2 => $node) {
|
||||
if ($relation['id_child'] == $node['id_db']) {
|
||||
$agent2 = $key;
|
||||
$agent2 = $node['id_db'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (($relation['parent_type'] == 3) || ($relation['child_type'] == 3)) {
|
||||
if ($relation['parent_type'] == 3) {
|
||||
foreach ($nodes_graph as $key => $node) {
|
||||
foreach ($nodes_graph as $key2 => $node) {
|
||||
if ($relation['id_parent'] == $node['id_db']) {
|
||||
$agent = $key;
|
||||
$agent = $node['id_db'];
|
||||
} else if ($node['id_agent'] == $relation['id_child_source_data']) {
|
||||
$agent2 = $node['id_db'];
|
||||
}
|
||||
}
|
||||
$agent2 = $relation['id_child_source_data'];
|
||||
}
|
||||
else if ($relation['child_type'] == 3) {
|
||||
foreach ($nodes_graph as $key => $node) {
|
||||
foreach ($nodes_graph as $key2 => $node) {
|
||||
if ($relation['id_child'] == $node['id_db']) {
|
||||
$agent2 = $key;
|
||||
$agent2 = $node['id_db'];
|
||||
} else if ($node['id_agent'] == $relation['id_parent_source_data']) {
|
||||
$agent = $node['id_db'];
|
||||
}
|
||||
}
|
||||
$agent = $relation['id_parent_source_data'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$agent = $relation['id_parent_source_data'];
|
||||
$agent2 = $relation['id_child_source_data'];
|
||||
foreach ($nodes_graph as $key2 => $node) {
|
||||
if(isset($node['id_agent'])) {
|
||||
if($node['id_agent'] == $relation['id_parent_source_data']) {
|
||||
$agent = $node['id_db'];
|
||||
} else if ($node['id_agent'] == $relation['id_child_source_data']) {
|
||||
$agent2 = $node['id_db'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($nodes_graph as $node) {
|
||||
if (!isset($node['id_agent'])) {
|
||||
if ($node['id'] == $agent) {
|
||||
$item['target'] = $node['id'];
|
||||
}
|
||||
else if($node['id'] == $agent2) {
|
||||
$item['source'] = $node['id'];
|
||||
}
|
||||
if ($node['id_db'] == $agent) {
|
||||
$item['target'] = $node['id'];
|
||||
}
|
||||
else {
|
||||
if ($node['id_agent'] == $agent) {
|
||||
$item['target'] = $node['id'];
|
||||
}
|
||||
else if ($node['id_agent'] == $agent2) {
|
||||
$item['source'] = $node['id'];
|
||||
}
|
||||
else if($node['id_db'] == $agent2) {
|
||||
$item['source'] = $node['id'];
|
||||
}
|
||||
}
|
||||
$return[] = $item;
|
||||
|
|
|
@ -268,21 +268,14 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
|
|||
$last_data_str .= html_print_image('images/clock2.png', true, array('title' => $last_data["timestamp"], 'width' => '18px'));
|
||||
|
||||
$is_snapshot = is_snapshot_data ( $last_data["datos"] );
|
||||
|
||||
if (($config['command_snapshot']) && ($is_snapshot)) {
|
||||
$handle = 'snapshot_' . $module['id_agente_modulo'];
|
||||
$url = 'include/procesos.php?agente=' . $row['id_agente_modulo'];
|
||||
$win_handle = dechex(crc32($handle));
|
||||
if (! defined ('METACONSOLE')) {
|
||||
$link = "winopeng_var('operation/agentes/snapshot_view.php?" .
|
||||
"id=" . $module['id_agente_modulo'] .
|
||||
"&refr=" . $module['current_interval'] .
|
||||
"&label=" . rawurlencode(urlencode(io_safe_output($module['module_name']))) . "','" . $win_handle . "', 700,480)";
|
||||
}
|
||||
else{
|
||||
$link = "winopeng_var('$last_data[datos]','',700,480)";
|
||||
|
||||
}
|
||||
$link = ui_get_snapshot_link( array(
|
||||
'id_module' => $module['id_agente_modulo'],
|
||||
'last_data' => $last_data['datos'],
|
||||
'timestamp' => $last_data['timestamp'],
|
||||
'interval' => $module['current_interval'],
|
||||
'module_name' => $module['module_name']
|
||||
));
|
||||
|
||||
if(!is_image_data($last_data["datos"])){
|
||||
$salida = '<a href="javascript:' . $link . '">' .
|
||||
|
|
|
@ -3919,4 +3919,48 @@ function ui_print_tags_view($title = '', $tags = array()) {
|
|||
$tv .= '</div>';
|
||||
echo $tv;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the link to open a snapshot into a new page
|
||||
*
|
||||
* @param Array Params to build the link (see $default_params)
|
||||
* @param bool Flag to choose de return value:
|
||||
* true: Get the four params required in the function of pandora.js winopen_var (js use)
|
||||
* false: Get an inline winopen_var function call (php user)
|
||||
*/
|
||||
function ui_get_snapshot_link($params, $only_params = false) {
|
||||
global $config;
|
||||
|
||||
$default_params = array(
|
||||
'id_module' => 0, //id_agente_modulo
|
||||
'module_name' => '',
|
||||
'interval' => 300,
|
||||
'last_data' => '',
|
||||
'timestamp' => '0'
|
||||
);
|
||||
|
||||
// Merge default params with passed params
|
||||
$params = array_merge ($default_params, $params);
|
||||
|
||||
// First parameter of js winopeng_var
|
||||
$page = $config['homeurl_static'] . "/operation/agentes/snapshot_view.php";
|
||||
|
||||
$url = "$page?" .
|
||||
"id=" . $params['id_module'] .
|
||||
"&refr=" . $parms['interval'] .
|
||||
"×tamp=" . $params['timestamp'] .
|
||||
"&last_data=" . rawurlencode(urlencode(io_safe_output($params['last_data']))) .
|
||||
"&label=" . rawurlencode(urlencode(io_safe_output($params['module_name'])));
|
||||
|
||||
// Second parameter of js winopeng_var
|
||||
$win_handle = dechex(crc32('snapshot_' . $params['id_module']));
|
||||
|
||||
$link_parts = array ($url, $win_handle, 700, 480);
|
||||
|
||||
// Return only the params to js execution
|
||||
if ($only_params) return $link_parts;
|
||||
|
||||
// Return the function call to inline js execution
|
||||
return "winopeng_var('" . implode("', '", $link_parts) . "')";
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -3602,6 +3602,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
|
|||
*/
|
||||
function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter = false,
|
||||
$returnAllGroup = true, $favourite = false) {
|
||||
|
||||
if (! is_array ($filter)){
|
||||
$filter = array ();
|
||||
} else {
|
||||
|
@ -3626,10 +3627,7 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter
|
|||
if ($returnAllGroup) {
|
||||
$groups = users_get_groups ($id_user, 'VR', true, true);
|
||||
} else {
|
||||
if(users_is_admin($id_user)){
|
||||
$groups = users_get_groups ($id_user, 'VR', true, true);
|
||||
}
|
||||
else{
|
||||
|
||||
if(!empty($filter['group'])) {
|
||||
$permissions_group = users_get_groups ($id_user, 'VR', false, true);
|
||||
if(empty($permissions_group)){
|
||||
|
@ -3637,12 +3635,12 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter
|
|||
}
|
||||
$groups = array_intersect_key($filter['group'], $permissions_group);
|
||||
} else {
|
||||
$groups = users_get_groups ($id_user, 'VR', false, true);
|
||||
$groups = users_get_groups ($id_user, 'VR', true, true);
|
||||
if(empty($groups)) {
|
||||
$groups = users_get_groups ($id_user, 'VM', false, true);
|
||||
$groups = users_get_groups ($id_user, 'VM', true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
unset($filter['group']);
|
||||
}
|
||||
|
|
|
@ -1928,7 +1928,12 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||
var formatted = number_format(v, force_integer, "", short_data);
|
||||
}
|
||||
else {
|
||||
var formatted = v;
|
||||
// It is an integer
|
||||
if(v - Math.floor(v) == 0){
|
||||
var formatted = number_format(v, force_integer, "", 2);
|
||||
} else {
|
||||
var formatted = v;
|
||||
}
|
||||
}
|
||||
|
||||
return '<div class='+font+' style="font-size:'+font_size+'pt;">'+formatted+'</div>';
|
||||
|
|
|
@ -402,16 +402,21 @@ var TreeController = {
|
|||
else{
|
||||
|
||||
var $graphImage = $('<img src="'+(controller.baseURL.length > 0 ? controller.baseURL : '')
|
||||
+'images/chart_curve.png" /> ');
|
||||
+'images/chart_curve.png" /> ');
|
||||
}
|
||||
|
||||
|
||||
$graphImage
|
||||
.addClass('module-graph')
|
||||
.click(function (e) {
|
||||
e.preventDefault();
|
||||
if(element.statusImageHTML.indexOf('data:image')!=-1){
|
||||
try {
|
||||
winopeng_var(element.datos,'',700,480);
|
||||
winopeng_var(
|
||||
decodeURI(element.snapshot[0]),
|
||||
element.snapshot[1],
|
||||
element.snapshot[2],
|
||||
element.snapshot[3]
|
||||
);
|
||||
}
|
||||
catch (error) {
|
||||
// console.log(error);
|
||||
|
|
|
@ -70,8 +70,8 @@
|
|||
<body>
|
||||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.719';
|
||||
$build = '180302';
|
||||
$version = '7.0NG.720';
|
||||
$build = '180313';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -39,6 +39,16 @@ if (file_exists ('../../include/languages/'.$user_language.'.mo')) {
|
|||
|
||||
$id = get_parameter('id');
|
||||
$label = get_parameter ("label");
|
||||
$last_data = get_parameter("last_data", '');
|
||||
$last_timestamp = get_parameter("timestamp", '');
|
||||
// FIXME: Support to old call snapshow_view calls. Remove it when all are migrated
|
||||
if (empty($last_data)) {
|
||||
$row = db_get_row_sql("SELECT *
|
||||
FROM tagente_estado
|
||||
WHERE id_agente_modulo = $id");
|
||||
$last_data = io_safe_output($row["datos"]);
|
||||
$last_timestamp = $row["timestamp"];
|
||||
}
|
||||
|
||||
// TODO - Put ACL here
|
||||
?>
|
||||
|
@ -61,15 +71,14 @@ $label = get_parameter ("label");
|
|||
$row = db_get_row_sql("SELECT *
|
||||
FROM tagente_estado
|
||||
WHERE id_agente_modulo = $id");
|
||||
|
||||
|
||||
echo "<h2 style='text-align:center;' id='title_snapshot_view'>";
|
||||
echo __("Current data at");
|
||||
echo " ";
|
||||
echo $row["timestamp"];
|
||||
echo $last_timestamp;
|
||||
echo "</h2>";
|
||||
$datos = io_safe_output($row["datos"]);
|
||||
if (is_image_data($datos)) {
|
||||
echo '<center><img src="' . $datos . '" alt="image" style="width:100%"/></center>';
|
||||
if (is_image_data($last_data)) {
|
||||
echo '<center><img src="' . $last_data . '" alt="image" style="width:100%"/></center>';
|
||||
}
|
||||
else {
|
||||
$datos = preg_replace ('/</', '<', $datos);
|
||||
|
@ -77,7 +86,7 @@ $label = get_parameter ("label");
|
|||
$datos = preg_replace ('/\n/i','<br>',$datos);
|
||||
$datos = preg_replace ('/\s/i',' ',$datos);
|
||||
echo "<div id='result_div' style='width: 100%; height: 100%; overflow: scroll; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'>";
|
||||
echo $datos;
|
||||
echo $last_data;
|
||||
echo "</div>";
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
@ -88,16 +97,16 @@ $label = get_parameter ("label");
|
|||
div.css('overflow-y', 'auto');
|
||||
var w2 = $('div', div).innerWidth();
|
||||
$(div).remove();
|
||||
|
||||
|
||||
return (w1 - w2);
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
width = $("#result_div").css("width");
|
||||
width = width.replace("px", "");
|
||||
width = parseInt(width);
|
||||
$("#result_div").css("width", (width - getScrollbarWidth()) + "px");
|
||||
|
||||
|
||||
height = $("#result_div").css("height");
|
||||
height = height.replace("px", "");
|
||||
height = parseInt(height);
|
||||
|
|
|
@ -1361,19 +1361,13 @@ if (!empty($result)) {
|
|||
$is_snapshot = is_snapshot_data ( $module_value );
|
||||
|
||||
if (($config['command_snapshot']) && ($is_snapshot)) {
|
||||
$handle = 'snapshot_' . $row['id_agente_modulo'];
|
||||
$url = 'include/procesos.php?agente=' . $row['id_agente_modulo'];
|
||||
$win_handle = dechex(crc32($handle));
|
||||
if (! defined ('METACONSOLE')) {
|
||||
$link = "winopeng_var('operation/agentes/snapshot_view.php?" .
|
||||
"id=" . $row['id_agente_modulo'] .
|
||||
"&refr=" . $row['current_interval'] .
|
||||
"&label=" . rawurlencode(urlencode(io_safe_output($row['module_name']))) . "','" . $win_handle . "', 700,480)";
|
||||
}
|
||||
else{
|
||||
$link = "winopeng_var('$row[datos]','',700,480)";
|
||||
|
||||
}
|
||||
$link = ui_get_snapshot_link( array(
|
||||
'id_module' => $row['id_agente_modulo'],
|
||||
'last_data' => $row['datos'],
|
||||
'timestamp' => $row['timestamp'],
|
||||
'interval' => $row['current_interval'],
|
||||
'module_name' => $row['module_name']
|
||||
));
|
||||
|
||||
if(!is_image_data($row['datos'])){
|
||||
$salida = '<a href="javascript:' . $link . '">' .
|
||||
|
|
|
@ -299,7 +299,7 @@ if (is_ajax ()) {
|
|||
}
|
||||
|
||||
if ($get_agent_modules_json_for_multiple_agents) {
|
||||
$idAgents = get_parameter('id_agent');
|
||||
$idAgents = (array) get_parameter('id_agent');
|
||||
$tags = get_parameter('tags', null);
|
||||
$module_types_excluded = get_parameter('module_types_excluded', array());
|
||||
$module_name = (string) get_parameter('name');
|
||||
|
|
|
@ -370,7 +370,11 @@ $table->data[] = $data;
|
|||
$data = array();
|
||||
|
||||
$autorefresh_list_out = array();
|
||||
$autorefresh_list_out['operation/agentes/tactical'] = "tactical";
|
||||
if(is_metaconsole()) {
|
||||
$autorefresh_list_out['monitoring/tactical'] = "tactical";
|
||||
} else {
|
||||
$autorefresh_list_out['operation/agentes/tactical'] = "tactical";
|
||||
}
|
||||
$autorefresh_list_out['operation/agentes/group_view'] = "group_view";
|
||||
$autorefresh_list_out['operation/agentes/estado_agente'] = "agent_status";
|
||||
$autorefresh_list_out['operation/agentes/alerts_status'] = "alerts_status";
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.719
|
||||
%define release 180302
|
||||
%define version 7.0NG.720
|
||||
%define release 1
|
||||
|
||||
# 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.719
|
||||
%define release 180302
|
||||
%define version 7.0NG.720
|
||||
%define release 1
|
||||
%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.719"
|
||||
PI_VERSION="7.0NG.720"
|
||||
FORCE=0
|
||||
DESTDIR=""
|
||||
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
||||
|
|
|
@ -3107,3 +3107,36 @@ create table IF NOT EXISTS `tprovisioning_rules`(
|
|||
FOREIGN KEY (`id_provisioning`) REFERENCES tprovisioning(`id`)
|
||||
ON DELETE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmigration_queue`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
create table IF NOT EXISTS `tmigration_queue`(
|
||||
`id` int unsigned not null auto_increment,
|
||||
`id_source_agent` int unsigned not null,
|
||||
`id_target_agent` int unsigned not null,
|
||||
`id_source_node` int unsigned not null,
|
||||
`id_target_node` int unsigned not null,
|
||||
`priority` int unsigned default 0,
|
||||
`step` int default 0,
|
||||
`running` tinyint(2) default 0,
|
||||
`active_db_only` tinyint(2) default 0,
|
||||
PRIMARY KEY(`id`)
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmigration_module_queue`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
create table IF NOT EXISTS `tmigration_module_queue`(
|
||||
`id` int unsigned not null auto_increment,
|
||||
`id_migration` int unsigned not null,
|
||||
`id_source_agentmodule` int unsigned not null,
|
||||
`id_target_agentmodule` int unsigned not null,
|
||||
`last_replication_timestamp` bigint(20) NOT NULL default 0,
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY(`id_migration`) REFERENCES tmigration_queue(`id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
|
@ -32,7 +32,7 @@ foreach my $line (@out) {
|
|||
|
||||
print "<module>\n";
|
||||
print " <name><![CDATA[[$section] $module_name]]></name>\n";
|
||||
print " <type>generic_data</type>\n";
|
||||
print " <type>generic_data_inc</type>\n";
|
||||
print " <module_group>Networking</module_group>\n";
|
||||
print " <data>$data</data>\n";
|
||||
print "</module>\n";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.719-180302
|
||||
Version: 7.0NG.720
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.719-180302"
|
||||
pandora_version="7.0NG.720"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#############################################################################
|
||||
# Pandora FMS Server Parameters
|
||||
# Pandora FMS, the Flexible Monitoring System.
|
||||
# Version 7.0NG.719
|
||||
# Version 7.0NG.720
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2017 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -42,8 +42,8 @@ our @EXPORT = qw(
|
|||
);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.719";
|
||||
my $pandora_build = "180302";
|
||||
my $pandora_version = "7.0NG.720";
|
||||
my $pandora_build = "180313";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -230,6 +230,7 @@ our @EXPORT = qw(
|
|||
pandora_self_monitoring
|
||||
pandora_process_policy_queue
|
||||
subst_alert_macros
|
||||
get_agent
|
||||
get_agent_from_alias
|
||||
get_agent_from_addr
|
||||
get_agent_from_name
|
||||
|
@ -254,6 +255,27 @@ our $EventStormProtection :shared = 0;
|
|||
# Current master server
|
||||
my $Master :shared = 0;
|
||||
|
||||
|
||||
##########################################################################
|
||||
# Return the agent given the agent name or alias or address.
|
||||
##########################################################################
|
||||
sub get_agent {
|
||||
my ($dbh, $field) = @_;
|
||||
|
||||
return undef if (! defined ($field) || $field eq '');
|
||||
|
||||
my $rs = get_agent_from_alias($dbh, $field);
|
||||
return $rs if defined($rs) && (ref($rs)); # defined and not a scalar
|
||||
|
||||
$rs = get_agent_from_addr($dbh, $field);
|
||||
return $rs if defined($rs) && (ref($rs)); # defined and not a scalar
|
||||
|
||||
$rs = get_agent_from_name($dbh, $field);
|
||||
return $rs if defined($rs) && (ref($rs)); # defined and not a scalar
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# Return the agent given the agent name.
|
||||
##########################################################################
|
||||
|
@ -1317,7 +1339,11 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
|||
(defined ($agent) ? $agent->{'id_grupo'} : 0),
|
||||
(defined ($fullagent) ? $fullagent->{'id_agente'} : 0),
|
||||
$priority,
|
||||
(defined($alert) ? $alert->{'id'} : 0),
|
||||
(defined($alert)
|
||||
? defined($alert->{'id_template_module'})
|
||||
? $alert->{'id_template_module'}
|
||||
: $alert->{'id'}
|
||||
: 0),
|
||||
(defined($alert) ? $alert->{'id_agent_module'} : 0),
|
||||
$event_type,
|
||||
0,
|
||||
|
|
|
@ -34,12 +34,15 @@ our @EXPORT = qw(
|
|||
add_new_address_agent
|
||||
db_concat
|
||||
db_connect
|
||||
db_history_connect
|
||||
db_delete_limit
|
||||
db_disconnect
|
||||
db_do
|
||||
db_get_lock
|
||||
db_insert
|
||||
db_insert_get_values
|
||||
db_insert_from_array_hash
|
||||
db_insert_from_hash
|
||||
db_process_insert
|
||||
db_process_update
|
||||
db_release_lock
|
||||
|
@ -167,6 +170,28 @@ sub db_connect ($$$$$$) {
|
|||
return undef;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
## Connect to a history DB associated to given dbh.
|
||||
##########################################################################
|
||||
sub db_history_connect {
|
||||
my ($dbh, $pa_config) = @_;
|
||||
|
||||
my %conf;
|
||||
|
||||
$conf{'history_db_enabled'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = ?", "history_db_enabled");
|
||||
$conf{'history_db_host'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = ?", "history_db_host");
|
||||
$conf{'history_db_port'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = ?", "history_db_port");
|
||||
$conf{'history_db_name'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = ?", "history_db_name");
|
||||
$conf{'history_db_user'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = ?", "history_db_user");
|
||||
$conf{'history_db_pass'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = ?", "history_db_pass");
|
||||
|
||||
my $history_dbh = ($conf{'history_db_enabled'} eq '1') ? db_connect ($pa_config->{'dbengine'}, $conf{'history_db_name'},
|
||||
$conf{'history_db_host'}, $conf{'history_db_port'}, $conf{'history_db_user'}, $conf{'history_db_pass'}) : undef;
|
||||
|
||||
|
||||
return $history_dbh;
|
||||
}
|
||||
|
||||
########################################################################
|
||||
## Disconnect from the DB.
|
||||
########################################################################
|
||||
|
@ -900,6 +925,60 @@ sub db_process_insert($$$$;@) {
|
|||
return $res;
|
||||
}
|
||||
|
||||
########################################################################
|
||||
## SQL insert from hash
|
||||
## 1st: dbh
|
||||
## 2nd: index
|
||||
## 3rd: table name,
|
||||
## 4th: {field => value} ref
|
||||
########################################################################
|
||||
sub db_insert_from_hash {
|
||||
my ($dbh, $index, $table, $data) = @_;
|
||||
|
||||
my $values_prep = "";
|
||||
my @fields = keys %{$data};
|
||||
my @values = values %{$data};
|
||||
my $nfields = scalar @fields;
|
||||
|
||||
for (my $i=0; $i<$nfields; $i++) {
|
||||
$values_prep .= "?,";
|
||||
}
|
||||
$values_prep =~ s/,$//;
|
||||
|
||||
return db_insert($dbh, $index, "INSERT INTO " . $table . " (" . join (",", @fields) . ") VALUES ($values_prep)", @values);
|
||||
}
|
||||
|
||||
########################################################################
|
||||
## SQL insert from hash
|
||||
## 1st: dbh
|
||||
## 2nd: index
|
||||
## 3rd: table name,
|
||||
## 4th: array({field => value},{field => value}) array ref
|
||||
##
|
||||
## Returns: An array with the inserted indexes
|
||||
########################################################################
|
||||
sub db_insert_from_array_hash {
|
||||
my ($dbh, $index, $table, $data) = @_;
|
||||
|
||||
if ((!defined($data) || ref ($data) ne "ARRAY")) {
|
||||
return ();
|
||||
}
|
||||
|
||||
|
||||
my @inserted_keys;
|
||||
|
||||
eval {
|
||||
foreach my $row (@{$data}) {
|
||||
push @inserted_keys, db_insert_from_hash($dbh, $index, $table, $row);
|
||||
}
|
||||
};
|
||||
if ($@) {
|
||||
return undef;
|
||||
}
|
||||
|
||||
return @inserted_keys;
|
||||
}
|
||||
|
||||
########################################################################
|
||||
## SQL update.
|
||||
########################################################################
|
||||
|
|
|
@ -642,10 +642,11 @@ sub process_module_data ($$$$$$$$$$) {
|
|||
|
||||
# Calculate the module interval in seconds
|
||||
if (defined($module_conf->{'cron_interval'})) {
|
||||
$module_conf->{'module_interval'} = 1 unless defined ($module_conf->{'module_interval'});
|
||||
$module_conf->{'module_interval'} *= $interval if (defined ($module_conf->{'module_interval'}));
|
||||
} else {
|
||||
$module_conf->{'module_interval'} = $module_conf->{'cron_interval'};
|
||||
} elsif (defined ($module_conf->{'module_interval'})) {
|
||||
$module_conf->{'module_interval'} = $interval * $module_conf->{'module_interval'};
|
||||
} else {
|
||||
$module_conf->{'module_interval'} = $interval;
|
||||
}
|
||||
|
||||
# Allow , as a decimal separator
|
||||
|
|
|
@ -30,8 +30,8 @@ use base 'Exporter';
|
|||
our @ISA = qw(Exporter);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.719";
|
||||
my $pandora_build = "180302";
|
||||
my $pandora_version = "7.0NG.720";
|
||||
my $pandora_build = "180313";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
@ -47,7 +47,9 @@ our @EXPORT = qw(
|
|||
decrypt
|
||||
empty
|
||||
encrypt
|
||||
extract_dbpass
|
||||
extract_key_map
|
||||
get_addresses
|
||||
get_lib_version
|
||||
get_unit
|
||||
get_unix_time
|
||||
|
@ -78,12 +80,16 @@ our @EXPORT = qw(
|
|||
snmp_data_switcher
|
||||
snmp_get
|
||||
snmp_walk
|
||||
seconds2readable
|
||||
tail
|
||||
to_number
|
||||
transfer_xml
|
||||
trim
|
||||
);
|
||||
|
||||
# ~ compat
|
||||
my $DevNull = ($^O =~ /win/i)?'/NUL':'/dev/null';
|
||||
|
||||
################################################################################
|
||||
#
|
||||
################################################################################
|
||||
|
@ -420,6 +426,17 @@ sub print_module {
|
|||
$data->{warning_instructions} = $conf->{warning_instructions} unless (defined($data->{warning_instructions}) || (!defined($conf->{warning_instructions})));
|
||||
$data->{critical_instructions} = $conf->{critical_instructions} unless (defined($data->{critical_instructions}) || (!defined($conf->{critical_instructions})));
|
||||
|
||||
# Translation compatibility
|
||||
$data->{'min_warning'} = $data->{'wmin'} if empty($data->{'min_warning'});
|
||||
$data->{'max_warning'} = $data->{'wmax'} if empty($data->{'max_warning'});
|
||||
$data->{'min_critical'} = $data->{'cmin'} if empty($data->{'min_critical'});
|
||||
$data->{'max_critical'} = $data->{'cmax'} if empty($data->{'max_critical'});
|
||||
$data->{'warning_inverse'} = $data->{'winv'} if empty($data->{'warning_inverse'});
|
||||
$data->{'critical_inverse'} = $data->{'cinv'} if empty($data->{'critical_inverse'});
|
||||
$data->{'str_warning'} = $data->{'wstr'} if empty($data->{'str_warning'});
|
||||
$data->{'str_critical'} = $data->{'cstr'} if empty($data->{'str_critical'});
|
||||
|
||||
|
||||
$xml_module .= "<module>\n";
|
||||
$xml_module .= "\t<name><![CDATA[" . $data->{name} . "]]></name>\n";
|
||||
$xml_module .= "\t<type>" . $data->{type} . "</type>\n";
|
||||
|
@ -460,29 +477,29 @@ sub print_module {
|
|||
if (! (empty($data->{module_parent})) ) {
|
||||
$xml_module .= "\t<module_parent>" . $data->{module_parent} . "</module_parent>\n";
|
||||
}
|
||||
if (! (empty($data->{wmin})) ) {
|
||||
$xml_module .= "\t<min_warning><![CDATA[" . $data->{wmin} . "]]></min_warning>\n";
|
||||
if (! (empty($data->{min_warning})) ) {
|
||||
$xml_module .= "\t<min_warning><![CDATA[" . $data->{min_warning} . "]]></min_warning>\n";
|
||||
}
|
||||
if (! (empty($data->{wmax})) ) {
|
||||
$xml_module .= "\t<max_warning><![CDATA[" . $data->{wmax} . "]]></max_warning>\n";
|
||||
if (! (empty($data->{max_warning})) ) {
|
||||
$xml_module .= "\t<max_warning><![CDATA[" . $data->{max_warning} . "]]></max_warning>\n";
|
||||
}
|
||||
if (! (empty ($data->{cmin})) ) {
|
||||
$xml_module .= "\t<min_critical><![CDATA[" . $data->{cmin} . "]]></min_critical>\n";
|
||||
if (! (empty ($data->{min_critical})) ) {
|
||||
$xml_module .= "\t<min_critical><![CDATA[" . $data->{min_critical} . "]]></min_critical>\n";
|
||||
}
|
||||
if (! (empty ($data->{cmax})) ){
|
||||
$xml_module .= "\t<max_critical><![CDATA[" . $data->{cmax} . "]]></max_critical>\n";
|
||||
if (! (empty ($data->{max_critical})) ){
|
||||
$xml_module .= "\t<max_critical><![CDATA[" . $data->{max_critical} . "]]></max_critical>\n";
|
||||
}
|
||||
if (! (empty ($data->{wstr}))) {
|
||||
$xml_module .= "\t<str_warning><![CDATA[" . $data->{wstr} . "]]></str_warning>\n";
|
||||
if (! (empty ($data->{str_warning}))) {
|
||||
$xml_module .= "\t<str_warning><![CDATA[" . $data->{str_warning} . "]]></str_warning>\n";
|
||||
}
|
||||
if (! (empty ($data->{cstr}))) {
|
||||
$xml_module .= "\t<str_critical><![CDATA[" . $data->{cstr} . "]]></str_critical>\n";
|
||||
if (! (empty ($data->{str_critical}))) {
|
||||
$xml_module .= "\t<str_critical><![CDATA[" . $data->{str_critical} . "]]></str_critical>\n";
|
||||
}
|
||||
if (! (empty ($data->{cinv}))) {
|
||||
$xml_module .= "\t<critical_inverse><![CDATA[" . $data->{cinv} . "]]></critical_inverse>\n";
|
||||
if (! (empty ($data->{critical_inverse}))) {
|
||||
$xml_module .= "\t<critical_inverse><![CDATA[" . $data->{critical_inverse} . "]]></critical_inverse>\n";
|
||||
}
|
||||
if (! (empty ($data->{winv}))) {
|
||||
$xml_module .= "\t<warning_inverse><![CDATA[" . $data->{winv} . "]]></warning_inverse>\n";
|
||||
if (! (empty ($data->{warning_inverse}))) {
|
||||
$xml_module .= "\t<warning_inverse><![CDATA[" . $data->{warning_inverse} . "]]></warning_inverse>\n";
|
||||
}
|
||||
if (! (empty ($data->{max}))) {
|
||||
$xml_module .= "\t<max><![CDATA[" . $data->{max} . "]]></max>\n";
|
||||
|
@ -588,6 +605,9 @@ sub transfer_xml {
|
|||
$file_name .= "_" . time() . ".data";
|
||||
}
|
||||
|
||||
$conf->{temp} = $conf->{tmp} if (empty($conf->{temp}) && defined($conf->{tmp}));
|
||||
$conf->{temp} = $conf->{temporal} if (empty($conf->{temporal}) && defined($conf->{temporal}));
|
||||
|
||||
$file_path = $conf->{temp} . "/" . $file_name;
|
||||
|
||||
#Creating XML file in temp directory
|
||||
|
@ -598,7 +618,12 @@ sub transfer_xml {
|
|||
$file_path = $conf->{temp} . "/" . $file_name;
|
||||
}
|
||||
|
||||
open (FD, ">>", $file_path) or print_stderror($conf, "Cannot write to [" . $file_path . "]");
|
||||
my $r = open (my $FD, ">>", $file_path);
|
||||
|
||||
if (empty($r)) {
|
||||
print_stderror($conf, "Cannot write to [" . $file_path . "]", $conf->{'debug'});
|
||||
return undef;
|
||||
}
|
||||
|
||||
my $bin_opts = ':raw:encoding(UTF8)';
|
||||
|
||||
|
@ -606,11 +631,11 @@ sub transfer_xml {
|
|||
$bin_opts .= ':crlf';
|
||||
}
|
||||
|
||||
binmode(FD, $bin_opts);
|
||||
binmode($FD, $bin_opts);
|
||||
|
||||
print FD $xml;
|
||||
print $FD $xml;
|
||||
|
||||
close (FD);
|
||||
close ($FD);
|
||||
|
||||
# Reassign default values if not present
|
||||
$conf->{tentacle_client} = "tentacle_client" if empty($conf->{tentacle_client});
|
||||
|
@ -720,16 +745,24 @@ sub print_execution_result {
|
|||
## Plugin devolution in case of error
|
||||
################################################################################
|
||||
sub print_error {
|
||||
my ($conf, $msg) = @_;
|
||||
my ($conf, $msg, $value) = @_;
|
||||
|
||||
$value = 0 unless defined($value);
|
||||
|
||||
if (!(is_enabled($conf->{informational_modules}))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (is_enabled($conf->{'as_server_plugin'})) {
|
||||
print STDERR $msg . "\n";
|
||||
print $value . "\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
print_module($conf, {
|
||||
name => "Plugin execution result",
|
||||
name => (empty($conf->{'global_plugin_module'})?"Plugin execution result":$conf->{'global_plugin_module'}),
|
||||
type => "generic_proc",
|
||||
value => 0,
|
||||
value => $value,
|
||||
desc => $msg,
|
||||
});
|
||||
exit 1;
|
||||
|
@ -774,7 +807,8 @@ sub logger {
|
|||
}
|
||||
}
|
||||
|
||||
$message = "[" . $tag . "] " . $message if ((defined $tag) && ($tag ne ""));
|
||||
$message = '' if empty($message);
|
||||
$message = "[" . $tag . "] " . $message if empty($tag);
|
||||
|
||||
if (!(empty($conf->{agent_name}))){
|
||||
$message = "[" . $conf->{agent_xml_name} . "] " . $message;
|
||||
|
@ -973,19 +1007,39 @@ sub parse_arguments {
|
|||
|
||||
}
|
||||
|
||||
|
||||
################################################################################
|
||||
# General configuration file parser
|
||||
#
|
||||
# log=/PATH/TO/LOG/FILE
|
||||
# Custom evals are defined in an array reference of hash references:
|
||||
#
|
||||
# $custom_eval = [
|
||||
# {
|
||||
# 'exp' => 'regular expression to match',
|
||||
# 'target' => \&target_custom_method_to_parse_line
|
||||
# },
|
||||
# {
|
||||
# 'exp' => 'another regular expression to search',
|
||||
# 'target' => \&target_custom_method_to_parse_line2
|
||||
# },
|
||||
# ]
|
||||
#
|
||||
# Target is an user defined function wich will be invoked with following
|
||||
# arguments:
|
||||
#
|
||||
# $config : The configuration read to the point the regex matches
|
||||
# $exp : The matching regex which fires this action
|
||||
# $line : The complete line readed from the file
|
||||
# $file_pointer : A pointer to the file which is being parsed.
|
||||
# $current_entity : The current_entity (optional) when regex matches
|
||||
#
|
||||
################################################################################
|
||||
sub parse_configuration {
|
||||
my $conf_file = shift;
|
||||
my $separator;
|
||||
$separator = shift or $separator = "=";
|
||||
my $custom_eval = shift;
|
||||
my $_CFILE;
|
||||
my ($conf_file, $separator, $custom_eval, $detect_entities, $entities_list) = @_;
|
||||
|
||||
$separator = "=" unless defined($separator);
|
||||
|
||||
my $_CFILE;
|
||||
my $_config;
|
||||
|
||||
if (empty($conf_file)) {
|
||||
|
@ -1000,25 +1054,61 @@ sub parse_configuration {
|
|||
};
|
||||
}
|
||||
|
||||
my $current_entity = '';
|
||||
my $new_entity = '';
|
||||
|
||||
my $global_config;
|
||||
|
||||
while (my $line = <$_CFILE>){
|
||||
if (($line =~ /^ *\r*\n*$/)
|
||||
|| ($line =~ /^#/ )){
|
||||
# skip blank lines and comments
|
||||
next;
|
||||
}
|
||||
my @parsed = split /$separator/, $line, 2;
|
||||
my ($key,$value) = split /$separator/, $line, 2;
|
||||
|
||||
# Clear entity detection is only compatible with specific entities declaration
|
||||
if (empty($value) && ($line =~ /^(\w+?)\r*\n*$/)
|
||||
&& is_enabled($detect_entities)
|
||||
&& in_array($entities_list, trim($key))) {
|
||||
# possible Entity detected - compatibility vmware-plugin
|
||||
$new_entity = $key;
|
||||
}
|
||||
if (($line =~ /\[(.*?)\]\r*\n*$/) && is_enabled($detect_entities)) {
|
||||
# Entity detected
|
||||
$new_entity = $1
|
||||
}
|
||||
|
||||
if (!empty($new_entity)) {
|
||||
if (empty($current_entity)) {
|
||||
$global_config = merge_hashes($global_config, $_config);
|
||||
}
|
||||
else {
|
||||
$global_config->{$current_entity} = $_config;
|
||||
}
|
||||
|
||||
$current_entity = trim($new_entity);
|
||||
undef($new_entity);
|
||||
|
||||
# Initialize reference
|
||||
$global_config->{$current_entity} = {};
|
||||
$_config = $global_config->{$current_entity};
|
||||
|
||||
next;
|
||||
}
|
||||
|
||||
if ($line =~ /^\s*global_alerts/){
|
||||
push (@{$_config->{global_alerts}}, trim($parsed[1]));
|
||||
push (@{$_config->{global_alerts}}, trim($value));
|
||||
next;
|
||||
}
|
||||
if (ref ($custom_eval) eq "ARRAY") {
|
||||
my $f = 0;
|
||||
foreach my $item (@{$custom_eval}) {
|
||||
if ($line =~ /$item->{exp}/) {
|
||||
if ($line =~ /$item->{'exp'}/) {
|
||||
$f = 1;
|
||||
my $aux;
|
||||
eval {
|
||||
$aux = $item->{target}->($_config, $item->{exp}, $line);
|
||||
$aux = $item->{'target'}->($_config, $item->{'exp'}, $line, $_CFILE, $current_entity);
|
||||
};
|
||||
|
||||
if (empty($_config)) {
|
||||
|
@ -1034,10 +1124,21 @@ sub parse_configuration {
|
|||
next;
|
||||
}
|
||||
}
|
||||
$_config->{trim($parsed[0])} = trim($parsed[1]);
|
||||
$_config->{trim($key)} = trim($value);
|
||||
}
|
||||
close ($_CFILE);
|
||||
|
||||
if(is_enabled($detect_entities)) {
|
||||
if (empty($current_entity) && (!empty($global_config))) {
|
||||
$global_config = merge_hashes($global_config, $_config);
|
||||
}
|
||||
else {
|
||||
$global_config->{$current_entity} = $_config;
|
||||
}
|
||||
|
||||
return $global_config unless empty($global_config);
|
||||
}
|
||||
|
||||
return $_config;
|
||||
}
|
||||
|
||||
|
@ -1118,6 +1219,11 @@ sub process_performance {
|
|||
my ($conf, $process, $mod_name, $only_text_flag) = @_;
|
||||
my $_PluginTools_system = $conf->{'__system'};
|
||||
|
||||
if (empty($_PluginTools_system)) {
|
||||
$_PluginTools_system = init_system();
|
||||
$_PluginTools_system = get_sys_environment($_PluginTools_system);
|
||||
}
|
||||
|
||||
my $cpu;
|
||||
my $mem;
|
||||
my $instances;
|
||||
|
@ -1225,7 +1331,9 @@ sub process_performance {
|
|||
return {
|
||||
cpu => $cpu,
|
||||
mem => $mem,
|
||||
instances => $instances
|
||||
instances => $instances,
|
||||
runit => $runit,
|
||||
cunit => $cunit,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1876,6 +1984,125 @@ sub load_perl_modules {
|
|||
return 1;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Transforms an absolute seconds value into a readable count
|
||||
################################################################################
|
||||
sub seconds2readable {
|
||||
my ($tseconds, $format) = @_;
|
||||
|
||||
return '' unless looks_like_number($tseconds);
|
||||
|
||||
if (empty($format)) {
|
||||
return int($tseconds/(24*60*60)) . " d, "
|
||||
. ($tseconds/(60*60))%24 . "h, "
|
||||
. ($tseconds/60)%60 . "m, "
|
||||
. $tseconds%60 . "s";
|
||||
}
|
||||
|
||||
|
||||
my $str = $format;
|
||||
|
||||
# %d -> days
|
||||
if($format =~ /\%d/) {
|
||||
my $days = ($tseconds/(24*60*60)) | 0;
|
||||
$tseconds -= $days*24*60*60;
|
||||
$str =~ s/%d/$days/g;
|
||||
}
|
||||
|
||||
# %h -> hours
|
||||
if($format =~ /\%h/) {
|
||||
my $hours = ($tseconds/(60*60)) | 0;
|
||||
$tseconds -= $hours*60*60;
|
||||
$str =~ s/%h/$hours/g;
|
||||
}
|
||||
|
||||
# %m -> minutes
|
||||
if($format =~ /\%m/) {
|
||||
my $min = ($tseconds/60) | 0;
|
||||
$tseconds -= $min*60;
|
||||
$str =~ s/%m/$min/g;
|
||||
}
|
||||
|
||||
# %s -> seconds
|
||||
if($format =~ /\%s/) {
|
||||
$str =~ s/%s/$tseconds/g;
|
||||
}
|
||||
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Extracts a database password from file or environment
|
||||
################################################################################
|
||||
sub extract_dbpass {
|
||||
my ($config) = @_;
|
||||
|
||||
return $config->{'dbpass'} unless empty($config->{'dbpass'});
|
||||
|
||||
if (!empty ($config->{'dbpass_file'})) {
|
||||
if (-f $config->{'dbpass_file'}) {
|
||||
eval {
|
||||
open(my $pf, "<", $config->{'dbpass_file'}) or die ("Cannot open file " . $config->{'dbpass_file'});
|
||||
$config->{'dbpass'} = trim(<$pf>);
|
||||
close($pf);
|
||||
};
|
||||
if($@) {
|
||||
print_error($config, "Failed to read password file" . $@, 1);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
print_error($config, "Failed to read password file", 1);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
elsif (!empty ($config->{'dbpass_env_var_name'})) {
|
||||
if (!empty ($ENV{$config->{'dbpass_env_var_name'}})) {
|
||||
$config->{'dbpass'} = $ENV{$config->{'dbpass_env_var_name'}};
|
||||
}
|
||||
|
||||
if (empty($config->{'dbpass'})) {
|
||||
print_error($config, "Failed to read password from environment", 1);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
return $config->{'dbpass'};
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Extracts IP addresses (IPv4) from current system
|
||||
################################################################################
|
||||
sub get_addresses {
|
||||
my ($config) = @_;
|
||||
my $address = '';
|
||||
|
||||
if (is_enabled($config->{'local'})) {
|
||||
$address = $config->{'dbhost'};
|
||||
}
|
||||
elsif($^O !~ /win/i) {
|
||||
my @address_list;
|
||||
|
||||
if( -x "/bin/ip" || -x "/sbin/ip" || -x "/usr/sbin/ip" ) {
|
||||
@address_list = `ip addr show 2>$DevNull | sed -e '/127.0.0/d' -e '/[0-9]*\\.[0-9]*\\.[0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/\\/.*//'`;
|
||||
}
|
||||
else {
|
||||
@address_list = `ifconfig -a 2>$DevNull | sed -e '/127.0.0/d' -e '/[0-9]*\\.[0-9]*\\.[0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/.*://'`;
|
||||
}
|
||||
|
||||
for (my $i = 0; $i <= $#address_list; $i++) {
|
||||
chomp($address_list[$i]);
|
||||
if ($i > 0) {
|
||||
$address .= ',';
|
||||
}
|
||||
|
||||
$address .= $address_list[$i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $address;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -27,6 +27,7 @@ use Encode;
|
|||
use Socket qw(inet_ntoa inet_aton);
|
||||
use Sys::Syslog;
|
||||
use Scalar::Util qw(looks_like_number);
|
||||
use LWP::UserAgent;
|
||||
|
||||
# New in 3.2. Used to sendmail internally, without external scripts
|
||||
# use Module::Loaded;
|
||||
|
@ -62,9 +63,10 @@ our @EXPORT = qw(
|
|||
TRANSACTIONALSERVER
|
||||
SYNCSERVER
|
||||
SYSLOGSERVER
|
||||
METACONSOLE_LICENSE
|
||||
WUXSERVER
|
||||
PROVISIONINGSERVER
|
||||
MIGRATIONSERVER
|
||||
METACONSOLE_LICENSE
|
||||
$DEVNULL
|
||||
$OS
|
||||
$OS_VERSION
|
||||
|
@ -75,7 +77,8 @@ our @EXPORT = qw(
|
|||
MODULE_WARNING
|
||||
MODULE_UNKNOWN
|
||||
MODULE_NOTINIT
|
||||
cron_get_closest_in_range
|
||||
api_call_url
|
||||
cron_get_closest_in_range
|
||||
cron_next_execution
|
||||
cron_next_execution_date
|
||||
cron_check_syntax
|
||||
|
@ -135,6 +138,7 @@ use constant SYNCSERVER => 16;
|
|||
use constant WUXSERVER => 17;
|
||||
use constant SYSLOGSERVER => 18;
|
||||
use constant PROVISIONINGSERVER => 19;
|
||||
use constant MIGRATIONSERVER => 20;
|
||||
|
||||
# Module status
|
||||
use constant MODULE_NORMAL => 0;
|
||||
|
@ -1710,6 +1714,35 @@ sub uri_encode_literal_percent {
|
|||
} ## end sub uri_encode_literal_percent
|
||||
|
||||
|
||||
################################################################################
|
||||
# Launch API call
|
||||
################################################################################
|
||||
sub api_call_url {
|
||||
my ($pa_config, $server_url, $api_params, @options) = @_;
|
||||
|
||||
|
||||
my $ua = LWP::UserAgent->new();
|
||||
$ua->timeout($options->{lwp_timeout});
|
||||
# Enable environmental proxy settings
|
||||
$ua->env_proxy;
|
||||
# Enable in-memory cookie management
|
||||
$ua->cookie_jar( {} );
|
||||
|
||||
# Disable verify host certificate (only needed for self-signed cert)
|
||||
$ua->ssl_opts( 'verify_hostname' => 0 );
|
||||
$ua->ssl_opts( 'SSL_verify_mode' => 0x00 );
|
||||
|
||||
my $response;
|
||||
|
||||
eval {
|
||||
$response = $ua->post($server_url, $api_params, @options);
|
||||
};
|
||||
if ((!$@) && $response->is_success) {
|
||||
return $response->decoded_content;
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
# End of function declaration
|
||||
# End of defined Code
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Server
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.719
|
||||
%define release 180302
|
||||
%define version 7.0NG.720
|
||||
%define release 1
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Server
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.719
|
||||
%define release 180302
|
||||
%define version 7.0NG.720
|
||||
%define release 1
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.719"
|
||||
PI_BUILD="180302"
|
||||
PI_VERSION="7.0NG.720"
|
||||
PI_BUILD="180313"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -33,7 +33,7 @@ use PandoraFMS::Tools;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.719 PS180302";
|
||||
my $version = "7.0NG.720 PS180313";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.719 PS180302";
|
||||
my $version = "7.0NG.720 PS180313";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
Loading…
Reference in New Issue