Merge branch 'develop' into 'ent-4766-feedback-de-ayudas'
# Conflicts: # pandora_console/include/functions_ui.php
This commit is contained in:
commit
613e5741fb
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, AIX version
|
||||
# Version 7.0NG.740, 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.739, FreeBSD Version
|
||||
# Version 7.0NG.740, 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.739, HP-UX Version
|
||||
# Version 7.0NG.740, 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.739, GNU/Linux
|
||||
# Version 7.0NG.740, 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.739, GNU/Linux
|
||||
# Version 7.0NG.740, 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.739, Solaris Version
|
||||
# Version 7.0NG.740, 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.739
|
||||
# Version 7.0NG.740
|
||||
|
||||
# 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.739, AIX version
|
||||
# Version 7.0NG.740, 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.739
|
||||
# Version 7.0NG.740
|
||||
# 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.739, HPUX Version
|
||||
# Version 7.0NG.740, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739
|
||||
# Version 7.0NG.740
|
||||
# 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.739
|
||||
# Version 7.0NG.740
|
||||
# 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.739
|
||||
# Version 7.0NG.740
|
||||
# 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.739, Solaris version
|
||||
# Version 7.0NG.740, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, AIX version
|
||||
# Version 7.0NG.740, 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.739-191010
|
||||
Version: 7.0NG.740-191029
|
||||
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.739-191010"
|
||||
pandora_version="7.0NG.740-191029"
|
||||
|
||||
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.739, GNU/Linux
|
||||
# Version 7.0NG.740, 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.739, FreeBSD Version
|
||||
# Version 7.0NG.740, 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.739, HP-UX Version
|
||||
# Version 7.0NG.740, 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.739, GNU/Linux
|
||||
# Version 7.0NG.740, 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.739, GNU/Linux
|
||||
# Version 7.0NG.740, 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.739, NetBSD Version
|
||||
# Version 7.0NG.740, 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.739, Solaris Version
|
||||
# Version 7.0NG.740, 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.739';
|
||||
use constant AGENT_BUILD => '191010';
|
||||
use constant AGENT_VERSION => '7.0NG.740';
|
||||
use constant AGENT_BUILD => '191029';
|
||||
|
||||
# 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.739
|
||||
%define release 191010
|
||||
%define version 7.0NG.740
|
||||
%define release 191029
|
||||
|
||||
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.739
|
||||
%define release 191010
|
||||
%define version 7.0NG.740
|
||||
%define release 191029
|
||||
|
||||
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.739"
|
||||
PI_BUILD="191010"
|
||||
PI_VERSION="7.0NG.740"
|
||||
PI_BUILD="191029"
|
||||
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.739
|
||||
# Version 7.0NG.740
|
||||
|
||||
# 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.739}
|
||||
{Pandora FMS Windows Agent v7.0NG.740}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{191010}
|
||||
{191029}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.739(Build 191010)")
|
||||
#define PANDORA_VERSION ("7.0NG.740(Build 191029)")
|
||||
|
||||
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.739(Build 191010))"
|
||||
VALUE "ProductVersion", "(7.0NG.740(Build 191029))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.739-191010
|
||||
Version: 7.0NG.740-191029
|
||||
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.739-191010"
|
||||
pandora_version="7.0NG.740-191029"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -765,7 +765,7 @@ $table_adv_agent_icon .= html_print_select(
|
|||
).'</div>';
|
||||
|
||||
if ($config['activate_gis']) {
|
||||
$table_adv_gis = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Ignore new GIS data:').'</p>';
|
||||
$table_adv_gis = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Update new GIS data:').'</p>';
|
||||
if ($new_agent) {
|
||||
$update_gis_data = true;
|
||||
}
|
||||
|
|
|
@ -842,7 +842,9 @@ foreach ($modules as $module) {
|
|||
$module['str_warning'],
|
||||
$module['max_critical'],
|
||||
$module['min_critical'],
|
||||
$module['str_critical']
|
||||
$module['str_critical'],
|
||||
$module['warning_inverse'],
|
||||
$module['critical_inverse']
|
||||
);
|
||||
} else {
|
||||
$data[7] = '';
|
||||
|
|
|
@ -59,8 +59,10 @@ if ($update_agents) {
|
|||
$values['id_grupo'] = get_parameter('group');
|
||||
}
|
||||
|
||||
if (get_parameter('interval', 0) != 0) {
|
||||
$values['intervalo'] = get_parameter('interval');
|
||||
if (!(get_parameter('interval_select') == -1 && empty(get_parameter('interval_text')))) {
|
||||
if (get_parameter('interval', 0) != 0) {
|
||||
$values['intervalo'] = get_parameter('interval');
|
||||
}
|
||||
}
|
||||
|
||||
if (get_parameter('id_os', '') != -1) {
|
||||
|
@ -523,7 +525,7 @@ $table->data[1][1] = html_print_select_groups(false, 'AR', false, 'group', $grou
|
|||
|
||||
$table->data[2][0] = __('Interval');
|
||||
|
||||
$table->data[2][1] = html_print_extended_select_for_time('interval', 0, '', __('No change'), '0', 10, true, 'width: 150px');
|
||||
$table->data[2][1] = html_print_extended_select_for_time('interval', 0, '', __('No change'), '0', 10, true, 'width: 150px', false);
|
||||
|
||||
$table->data[3][0] = __('OS');
|
||||
$table->data[3][1] = html_print_select_from_sql(
|
||||
|
|
|
@ -16,10 +16,10 @@ global $config;
|
|||
// Check user credentials
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'RR')) {
|
||||
if (! check_acl($config['id_user'], 0, 'RR') || enterprise_installed() === false) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Inventory Module Management'
|
||||
'Trying to access Graph container'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
|
|
|
@ -71,10 +71,12 @@ switch ($activeTab) {
|
|||
break;
|
||||
}
|
||||
|
||||
$buttons['graph_container'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container">'.html_print_image('images/graph-container.png', true, ['title' => __('Graphs containers')]).'</a>',
|
||||
];
|
||||
if ($enterpriseEnable) {
|
||||
$buttons['graph_container'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container">'.html_print_image('images/graph-container.png', true, ['title' => __('Graphs containers')]).'</a>',
|
||||
];
|
||||
}
|
||||
|
||||
$delete_graph = (bool) get_parameter('delete_graph');
|
||||
$view_graph = (bool) get_parameter('view_graph');
|
||||
|
|
|
@ -240,7 +240,7 @@ switch ($action) {
|
|||
$hide_notinit_agents = $style['hide_notinit_agents'];
|
||||
$dyn_height = $style['dyn_height'];
|
||||
$type = $item['type'];
|
||||
$name = $item['name'];
|
||||
$name = $style['name_label'];
|
||||
|
||||
switch ($type) {
|
||||
case 'event_report_log':
|
||||
|
|
|
@ -1,18 +1,34 @@
|
|||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for 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.
|
||||
/**
|
||||
* Report item list.
|
||||
*
|
||||
* @category Reporting
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
// Login check
|
||||
// Login check.
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'RW')) {
|
||||
|
@ -39,12 +55,16 @@ switch ($config['dbtype']) {
|
|||
'type'
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
|
||||
$report_w = check_acl($config['id_user'], 0, 'RW');
|
||||
$report_m = check_acl($config['id_user'], 0, 'RM');
|
||||
|
||||
if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
|
||||
if (is_metaconsole()) {
|
||||
$agents = [];
|
||||
$agents = metaconsole_get_report_agents($idReport);
|
||||
$modules = [];
|
||||
|
@ -52,7 +72,7 @@ if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
|
|||
$types = [];
|
||||
$types = metaconsole_get_report_types($idReport);
|
||||
} else {
|
||||
// FORM FILTER
|
||||
// FORM FILTER.
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
|
@ -87,7 +107,10 @@ if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
|
|||
ON (t4.id_agent = t5.id_agente OR t4.id_agente = t5.id_agente)
|
||||
WHERE t4.id_report = '.$idReport
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -124,6 +147,10 @@ if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
|
|||
WHERE t1.id_report = '.$idReport
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
|
||||
if ($rows === false) {
|
||||
|
@ -135,8 +162,8 @@ if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
|
|||
$modules[$row['id_agent_module']] = $row['nombre'];
|
||||
}
|
||||
|
||||
// Filter report items created from metaconsole in normal console list and the opposite
|
||||
if (defined('METACONSOLE') and $config['metaconsole'] == 1) {
|
||||
// Filter report items created from metaconsole in normal console list and the opposite.
|
||||
if (is_metaconsole()) {
|
||||
$where_types = ' AND ((server_name IS NOT NULL AND length(server_name) != 0) OR '.$type_escaped.' IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
|
||||
} else {
|
||||
$where_types = ' AND ((server_name IS NULL OR length(server_name) = 0) OR '.$type_escaped.' IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
|
||||
|
@ -184,7 +211,6 @@ if (!defined('METACONSOLE')) {
|
|||
$table->data[0][1] .= html_print_select($modules, 'module_filter', $moduleFilter, '', __('All'), 0, true);
|
||||
$table->data[0][2] = __('Type');
|
||||
$table->data[0][2] .= html_print_select($types, 'type_filter', $typeFilter, '', __('All'), 0, true);
|
||||
// $table->data[1][2] = $table->data[1][3] = '';
|
||||
$form = '<form method="post" action ="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=filter&id_report='.$idReport.'">';
|
||||
$form .= html_print_table($table, true);
|
||||
$form .= '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
@ -265,13 +291,6 @@ if ($moduleFilter != 0) {
|
|||
$where .= ' AND id_agent_module = '.$moduleFilter;
|
||||
}
|
||||
|
||||
// Filter report items created from metaconsole in normal console list and the opposite
|
||||
if (defined('METACONSOLE') and $config['metaconsole'] == 1) {
|
||||
$where .= ' AND ((server_name IS NOT NULL AND length(server_name) != 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'availability_graph\', \'top_n\',\'SLA_monthly\',\'SLA_weekly\',\'SLA_hourly\',\'text\'))';
|
||||
} else {
|
||||
$where .= ' AND ((server_name IS NULL OR length(server_name) = 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'top_n\'))';
|
||||
}
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$items = db_get_all_rows_sql(
|
||||
|
@ -306,13 +325,17 @@ switch ($config['dbtype']) {
|
|||
'AND',
|
||||
false
|
||||
);
|
||||
// Delete rnum row generated by oracle_recode_query() function
|
||||
// Delete rnum row generated by oracle_recode_query() function.
|
||||
if ($items !== false) {
|
||||
for ($i = 0; $i < count($items); $i++) {
|
||||
unset($items[$i]['rnum']);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
|
||||
$countItems = db_get_sql(
|
||||
|
@ -421,29 +444,30 @@ foreach ($items as $item) {
|
|||
|
||||
$row[1] = get_report_name($item['type']);
|
||||
|
||||
if ($item['type'] == 'custom_graph') {
|
||||
$custom_graph_name = db_get_row_sql('select name from tgraph where id_graph = '.$item['id_gs']);
|
||||
$row[1] = get_report_name($item['type']).' ('.$custom_graph_name['name'].')';
|
||||
}
|
||||
|
||||
$server_name = $item['server_name'];
|
||||
|
||||
if (($config['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE')) {
|
||||
if (is_metaconsole()) {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (metaconsole_load_external_db($connection) != NOERR) {
|
||||
// ui_print_error_message ("Error connecting to ".$server_name);
|
||||
}
|
||||
}
|
||||
|
||||
if ($item['type'] == 'custom_graph') {
|
||||
$custom_graph_name = db_get_row_sql('SELECT name FROM tgraph WHERE id_graph = '.$item['id_gs']);
|
||||
$row[1] = get_report_name($item['type']).' ('.$custom_graph_name['name'].')';
|
||||
}
|
||||
|
||||
|
||||
if ($item['id_agent'] == 0) {
|
||||
$is_inventory_item = $item['type'] == 'inventory' || $item['type'] == 'inventory_changes';
|
||||
|
||||
// Due to SLA or top N or general report items
|
||||
// Due to SLA or top N or general report items.
|
||||
if (!$is_inventory_item && ($item['id_agent_module'] == '' || $item['id_agent_module'] == 0)) {
|
||||
$row[2] = '';
|
||||
$row[3] = '';
|
||||
} else {
|
||||
// The inventory items have the agents and modules in json format in the field external_source
|
||||
// The inventory items have the agents and modules in json format in the field external_source.
|
||||
if ($is_inventory_item) {
|
||||
$external_source = json_decode($item['external_source'], true);
|
||||
$agents = $external_source['id_agents'];
|
||||
|
@ -522,7 +546,7 @@ foreach ($items as $item) {
|
|||
|
||||
$table->data[] = $row;
|
||||
$count++;
|
||||
// Restore db connection
|
||||
// Restore db connection.
|
||||
if (($config['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE')) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
|
|
@ -3144,17 +3144,19 @@ if ($enterpriseEnable && defined('METACONSOLE')) {
|
|||
break;
|
||||
}
|
||||
|
||||
ui_print_page_header(
|
||||
$textReportName,
|
||||
'images/op_reporting.png',
|
||||
false,
|
||||
$helpers,
|
||||
false,
|
||||
$buttons,
|
||||
false,
|
||||
'',
|
||||
60
|
||||
);
|
||||
if ($action !== 'update' && !is_metaconsole()) {
|
||||
ui_print_page_header(
|
||||
$textReportName,
|
||||
'images/op_reporting.png',
|
||||
false,
|
||||
$helpers,
|
||||
false,
|
||||
$buttons,
|
||||
false,
|
||||
'',
|
||||
60
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($resultOperationDB !== null) {
|
||||
|
@ -3176,6 +3178,26 @@ if ($resultOperationDB !== null) {
|
|||
__('Successfull action'),
|
||||
__('Unsuccessful action<br><br>'.$err)
|
||||
);
|
||||
|
||||
if ($action == 'update') {
|
||||
$buttons[$activeTab]['active'] = false;
|
||||
$activeTab = 'list_items';
|
||||
$buttons[$activeTab]['active'] = true;
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
ui_print_page_header(
|
||||
$textReportName,
|
||||
'images/op_reporting.png',
|
||||
false,
|
||||
$helpers,
|
||||
false,
|
||||
$buttons,
|
||||
false,
|
||||
'',
|
||||
60
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ($activeTab) {
|
||||
|
|
|
@ -928,10 +928,10 @@ if (($create != '') || ($view != '')) {
|
|||
$other['plugin_type'] = $plugin_meta['plugin_type'];
|
||||
$other['macros'] = urlencode($plugin_meta['macros']);
|
||||
$other['parameters'] = urlencode($plugin_meta['parameters']);
|
||||
$other = implode('%7C', $other);
|
||||
$other = implode('%7E', $other);
|
||||
|
||||
$auth_token = json_decode($value['auth_token']);
|
||||
$url = $value['server_url'].'include/api.php?op=set&op2=push_plugin'.'&id='.$pluginid.'&other_mode=url_encode_separator_%7C&other='.$other."&apipass=$auth_token->api_password"."&user=$auth_token->console_user&pass=$auth_token->console_password";
|
||||
$url = $value['server_url'].'include/api.php?op=set&op2=push_plugin'.'&id='.$pluginid.'&other_mode=url_encode_separator_%7E&other='.$other."&apipass=$auth_token->api_password"."&user=$auth_token->console_user&pass=$auth_token->console_password";
|
||||
$file_path = realpath($plugin_meta['execute']);
|
||||
$post = '';
|
||||
if (file_exists($file_path)) {
|
||||
|
|
|
@ -18,7 +18,7 @@ check_login();
|
|||
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (! check_acl($config['id_user'], 0, 'UM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Profile Management'
|
||||
|
@ -320,24 +320,29 @@ if ($id_profile || $new_profile) {
|
|||
$table->data['IM'] = $row;
|
||||
$table->data[] = '<hr>';
|
||||
|
||||
$disable_option = 'javascript: return false;';
|
||||
if (check_acl($config['id_user'], 0, 'PM') || users_is_admin()) {
|
||||
$disable_option = '';
|
||||
}
|
||||
|
||||
// Users
|
||||
$row = [];
|
||||
$row['name'] = __('Manage users');
|
||||
$row['input'] = html_print_checkbox('user_management', 1, $user_management, true);
|
||||
$row['input'] = html_print_checkbox('user_management', 1, $user_management, true, false, $disable_option);
|
||||
$table->data['UM'] = $row;
|
||||
$table->data[] = '<hr>';
|
||||
|
||||
// DB
|
||||
$row = [];
|
||||
$row['name'] = __('Manage database');
|
||||
$row['input'] = html_print_checkbox('db_management', 1, $db_management, true);
|
||||
$row['input'] = html_print_checkbox('db_management', 1, $db_management, true, false, $disable_option);
|
||||
$table->data['DM'] = $row;
|
||||
$table->data[] = '<hr>';
|
||||
|
||||
// Pandora
|
||||
$row = [];
|
||||
$row['name'] = __('%s management', get_product_name());
|
||||
$row['input'] = html_print_checkbox('pandora_management', 1, $pandora_management, true);
|
||||
$row['input'] = html_print_checkbox('pandora_management', 1, $pandora_management, true, false, $disable_option);
|
||||
$table->data['PM'] = $row;
|
||||
$table->data[] = '<hr>';
|
||||
|
||||
|
@ -359,3 +364,18 @@ if ($id_profile || $new_profile) {
|
|||
}
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
$(document).ready (function () {
|
||||
var disable_option = '<?php echo $disable_option; ?>';
|
||||
|
||||
if (disable_option != '') {
|
||||
var ids = ['#checkbox-db_management', '#checkbox-user_management', '#checkbox-pandora_management'];
|
||||
ids.forEach(id => {
|
||||
$(id).css({'cursor':'not-allowed', 'opacity':'0.5'});
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -362,7 +362,10 @@ foreach ($profiles as $profile) {
|
|||
$data['PM'] = ($profile['pandora_management'] ? $img : '');
|
||||
$table->cellclass[]['operations'] = 'action_buttons';
|
||||
$data['operations'] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.html_print_image('images/config.png', true, ['title' => __('Edit')]).'</a>';
|
||||
$data['operations'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/users/profile_list&delete_profile=1&id='.$profile['id_perfil'].'&pure='.$pure.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true).'</a>';
|
||||
if (check_acl($config['id_user'], 0, 'PM') || users_is_admin()) {
|
||||
$data['operations'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/users/profile_list&delete_profile=1&id='.$profile['id_perfil'].'&pure='.$pure.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true).'</a>';
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
|
|
|
@ -420,7 +420,9 @@ else {
|
|||
$u = get_user_info($key);
|
||||
$g = users_get_groups($key, 'AR', $u['is_admin']);
|
||||
$result = array_intersect($g, $own_groups);
|
||||
if (!$usr['is_admin'] && !empty($result)) {
|
||||
|
||||
// Show users without profile too.
|
||||
if (!$usr['is_admin'] && !empty($result) || (!$usr['is_admin'] && db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $usr['id_user']) === false)) {
|
||||
$info[$key] = $usr;
|
||||
}
|
||||
|
||||
|
|
|
@ -1113,7 +1113,7 @@ if (check_login()) {
|
|||
}
|
||||
|
||||
if ($module['id_tipo_modulo'] != 25) {
|
||||
$data[6] = ui_print_module_warn_value($module['max_warning'], $module['min_warning'], $module['str_warning'], $module['max_critical'], $module['min_critical'], $module['str_critical']);
|
||||
$data[6] = ui_print_module_warn_value($module['max_warning'], $module['min_warning'], $module['str_warning'], $module['max_critical'], $module['min_critical'], $module['str_critical'], $module['warning_inverse'], $module['critical_inverse']);
|
||||
} else {
|
||||
$data[6] = '';
|
||||
}
|
||||
|
|
|
@ -1,15 +1,32 @@
|
|||
<?php
|
||||
// Pandora FMS- http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser 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.
|
||||
/**
|
||||
* Pandora FMS integration API.
|
||||
*
|
||||
* @category API
|
||||
* @package Pandora FMS
|
||||
* @subpackage Console
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
require_once 'config.php';
|
||||
require_once 'functions_api.php';
|
||||
|
||||
|
@ -18,7 +35,7 @@ global $config;
|
|||
define('DEBUG', 0);
|
||||
define('VERBOSE', 0);
|
||||
|
||||
// TESTING THE UPDATE MANAGER
|
||||
// TESTING THE UPDATE MANAGER.
|
||||
enterprise_include_once('include/functions_enterprise_api.php');
|
||||
|
||||
$ipOrigin = $_SERVER['REMOTE_ADDR'];
|
||||
|
@ -41,26 +58,30 @@ $info = get_parameter('info', '');
|
|||
$other = parseOtherParameter($otherSerialize, $otherMode);
|
||||
|
||||
$other = parseOtherParameter($otherSerialize, $otherMode);
|
||||
$apiPassword = io_output_password(db_get_value_filter('value', 'tconfig', ['token' => 'api_password']));
|
||||
$apiPassword = io_output_password(
|
||||
db_get_value_filter(
|
||||
'value',
|
||||
'tconfig',
|
||||
['token' => 'api_password']
|
||||
)
|
||||
);
|
||||
|
||||
$correctLogin = false;
|
||||
$no_login_msg = '';
|
||||
|
||||
// Clean unwanted output
|
||||
// Clean unwanted output.
|
||||
ob_clean();
|
||||
|
||||
// READ THIS:
|
||||
// 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
|
||||
switch ($info) {
|
||||
case 'version':
|
||||
if (!$config['MR']) {
|
||||
$config['MR'] = 0;
|
||||
}
|
||||
|
||||
echo 'Pandora FMS '.$pandora_version.' - '.$build_version.' MR'.$config['MR'];
|
||||
// Don't change the format, it is parsed by applications.
|
||||
if ($info == 'version') {
|
||||
if (!$config['MR']) {
|
||||
$config['MR'] = 0;
|
||||
}
|
||||
|
||||
echo 'Pandora FMS '.$pandora_version.' - '.$build_version.' MR'.$config['MR'];
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -68,14 +89,19 @@ if (isInACL($ipOrigin)) {
|
|||
if (empty($apiPassword) || (!empty($apiPassword) && $api_password === $apiPassword)) {
|
||||
$user_in_db = process_user_login($user, $password, true);
|
||||
if ($user_in_db !== false) {
|
||||
$config['id_usuario'] = $user_in_db;
|
||||
// Compat.
|
||||
$config['id_user'] = $user_in_db;
|
||||
$correctLogin = true;
|
||||
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
$_SESSION = [];
|
||||
}
|
||||
|
||||
$_SESSION['id_usuario'] = $user;
|
||||
|
||||
config_prepare_session();
|
||||
session_write_close();
|
||||
} else {
|
||||
$no_login_msg = 'Incorrect user credentials';
|
||||
|
@ -84,7 +110,7 @@ if (isInACL($ipOrigin)) {
|
|||
$no_login_msg = 'Incorrect given API password';
|
||||
}
|
||||
} else {
|
||||
$no_login_msg = "IP $ipOrigin is not in ACL list";
|
||||
$no_login_msg = 'IP '.$ipOrigin.' is not in ACL list';
|
||||
}
|
||||
|
||||
if ($correctLogin) {
|
||||
|
@ -93,11 +119,14 @@ if ($correctLogin) {
|
|||
} else {
|
||||
$function_name = '';
|
||||
|
||||
// Check if is an extension function and get the function name
|
||||
// Check if is an extension function and get the function name.
|
||||
if ($op2 == 'extension') {
|
||||
$extension_api_url = $config['homedir'].'/'.EXTENSIONS_DIR."/$ext_name/$ext_name.api.php";
|
||||
// The extension API file must exist and the extension must be enabled
|
||||
if (file_exists($extension_api_url) && !in_array($ext_name, extensions_get_disabled_extensions())) {
|
||||
$extension_api_url = $config['homedir'].'/'.EXTENSIONS_DIR.'/'.$ext_name.'/'.$ext_name.'.api.php';
|
||||
// The extension API file must exist and the extension must be
|
||||
// enabled.
|
||||
if (file_exists($extension_api_url)
|
||||
&& !in_array($ext_name, extensions_get_disabled_extensions())
|
||||
) {
|
||||
include_once $extension_api_url;
|
||||
$function_name = 'apiextension_'.$op.'_'.$ext_function;
|
||||
}
|
||||
|
@ -107,16 +136,19 @@ if ($correctLogin) {
|
|||
if ($op == 'set' && $id) {
|
||||
switch ($op2) {
|
||||
case 'update_agent':
|
||||
|
||||
case 'add_module_in_conf':
|
||||
case 'update_module_in_conf':
|
||||
case 'delete_module_in_conf':
|
||||
|
||||
$id_os = db_get_value_sql('select id_os from tagente where id_agente = '.$id);
|
||||
|
||||
if ($id_os == 100) {
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
return false;
|
||||
$agent = agents_locate_agent($id);
|
||||
if ($agent !== false) {
|
||||
$id_os = $agent['id_os'];
|
||||
if ($id_os == 100) {
|
||||
returnError(
|
||||
'not_allowed_operation_cluster',
|
||||
$returnType
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -127,12 +159,16 @@ if ($correctLogin) {
|
|||
case 'create_snmp_module':
|
||||
case 'delete_module':
|
||||
case 'delete_agent':
|
||||
|
||||
$id_os = db_get_value_sql('select id_os from tagente where nombre = "'.$id.'"');
|
||||
|
||||
if ($id_os == 100) {
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
return false;
|
||||
$agent = agents_locate_agent($id);
|
||||
if ($agent !== false) {
|
||||
$id_os = $agent['id_os'];
|
||||
if ($id_os == 100) {
|
||||
returnError(
|
||||
'not_allowed_operation_cluster',
|
||||
$returnType
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -141,60 +177,98 @@ if ($correctLogin) {
|
|||
case 'update_data_module':
|
||||
case 'update_snmp_module':
|
||||
|
||||
$id_os = db_get_value_sql('select id_os from tagente where id_agente = (select id_agente from tagente_modulo where id_agente_modulo ='.$id.')');
|
||||
$id_os = db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT id_os
|
||||
FROM tagente
|
||||
WHERE id_agente = (
|
||||
SELECT id_agente
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente_modulo = %d
|
||||
)',
|
||||
$id
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
if ($id_os == 100) {
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
returnError(
|
||||
'not_allowed_operation_cluster',
|
||||
$returnType
|
||||
);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete_user_permission':
|
||||
|
||||
if ($user_db === '') {
|
||||
returnError(__('User or group not specified'), __('User, group not specified'));
|
||||
returnError(
|
||||
__('User or group not specified'),
|
||||
__('User, group not specified')
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
$id_os = api_set_delete_user_profiles($thrash1, $thrash2, $other, $returnType);
|
||||
$id_os = api_set_delete_user_profiles(
|
||||
$thrash1,
|
||||
$thrash2,
|
||||
$other,
|
||||
$returnType
|
||||
);
|
||||
|
||||
if ($id_os != 100) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id_os == false) {
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
returnError(
|
||||
'not_allowed_operation_cluster',
|
||||
$returnType
|
||||
);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add_permission_user_to_group':
|
||||
|
||||
if ($user_db == null || $group_db == null || $id_up == null) {
|
||||
returnError(__('User, group or profile not specified'), __('User, group or profile status not specified'));
|
||||
if ($user_db == null
|
||||
|| $group_db == null
|
||||
|| $id_up == null
|
||||
) {
|
||||
returnError(
|
||||
__('User, group or profile not specified'),
|
||||
__('User, group or profile status not specified')
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
$id_os = api_set_add_permission_user_to_group($thrash1, $thrash2, $other, $returnType);
|
||||
$id_os = api_set_add_permission_user_to_group(
|
||||
$thrash1,
|
||||
$thrash2,
|
||||
$other,
|
||||
$returnType
|
||||
);
|
||||
|
||||
if ($id_os != 100) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id_os == false) {
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
returnError(
|
||||
'not_allowed_operation_cluster',
|
||||
$returnType
|
||||
);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
// break;
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the function exists
|
||||
// Check if the function exists.
|
||||
if (function_exists($function_name)) {
|
||||
if (!DEBUG) {
|
||||
error_reporting(0);
|
||||
|
@ -205,18 +279,37 @@ if ($correctLogin) {
|
|||
ini_set('display_errors', 1);
|
||||
}
|
||||
|
||||
call_user_func($function_name, $id, $id2, $other, $returnType, $user_in_db);
|
||||
call_user_func(
|
||||
$function_name,
|
||||
$id,
|
||||
$id2,
|
||||
$other,
|
||||
$returnType,
|
||||
$user_in_db
|
||||
);
|
||||
} else {
|
||||
returnError('no_exist_operation', $returnType);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// TODO: Implement a new switch in config to enable / disable
|
||||
// ACL auth failure: if enabled and have lots of traffic can produce millions
|
||||
// of records and a considerable OVERHEAD in the system :(
|
||||
// db_pandora_audit("API access Failed", $no_login_msg, $user, $ipOrigin);
|
||||
/*
|
||||
* //TODO: Implement a new switch in config to enable / disable
|
||||
* ACL auth failure: if enabled and have lots of traffic can produce
|
||||
* millions of records and a considerable OVERHEAD in the system :(
|
||||
* db_pandora_audit("API access Failed", $no_login_msg, $user, $ipOrigin);
|
||||
*/
|
||||
|
||||
sleep(15);
|
||||
|
||||
// Protection on DoS attacks
|
||||
// Protection on DoS attacks.
|
||||
echo 'auth error';
|
||||
}
|
||||
|
||||
// Logout.
|
||||
if (session_status() === PHP_SESSION_ACTIVE) {
|
||||
$_SESSION = [];
|
||||
// Could give a warning if no session file is created. Ignore.
|
||||
@session_destroy();
|
||||
header_remove('Set-Cookie');
|
||||
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
||||
}
|
||||
|
|
|
@ -1,22 +1,39 @@
|
|||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Global & session manageme
|
||||
session_id($_REQUEST['session_id']);
|
||||
/**
|
||||
* Generate charts with given parameters.
|
||||
*
|
||||
* @category ChartGenerator.
|
||||
* @package Pandora FMS
|
||||
* @subpackage Opensource.
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
require_once 'config.php';
|
||||
require_once $config['homedir'].'/include/auth/mysql.php';
|
||||
require_once $config['homedir'].'/include/functions.php';
|
||||
require_once $config['homedir'].'/include/functions_db.php';
|
||||
|
||||
require_once __DIR__.'/config.php';
|
||||
require_once __DIR__.'/functions.php';
|
||||
require_once __DIR__.'/functions_db.php';
|
||||
require_once __DIR__.'/auth/mysql.php';
|
||||
require_once $config['homedir'].'/include/lib/User.php';
|
||||
require_once $config['homedir'].'/include/functions_reporting.php';
|
||||
require_once $config['homedir'].'/include/functions_graph.php';
|
||||
require_once $config['homedir'].'/include/functions_custom_graphs.php';
|
||||
|
@ -24,32 +41,91 @@ require_once $config['homedir'].'/include/functions_modules.php';
|
|||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_tags.php';
|
||||
|
||||
check_login();
|
||||
|
||||
/**
|
||||
* Echo to stdout a PhantomJS callback call.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function echoPhantomCallback()
|
||||
{
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('document').ready(function () {
|
||||
setTimeout(function () {
|
||||
try {
|
||||
var status = window.callPhantom({ status: "loaded" });
|
||||
} catch (error) {
|
||||
console.log("CALLBACK ERROR", error.message)
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
// Initialize session.
|
||||
global $config;
|
||||
// get_parameter(array)('data', '');
|
||||
|
||||
// Try to initialize session using existing php session id.
|
||||
$user = new PandoraFMS\User(['phpsessionid' => $_REQUEST['session_id']]);
|
||||
if (check_login(false) === false) {
|
||||
// Error handler.
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Access denied</title>
|
||||
<link rel="stylesheet" href="styles/pandora.css" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/pandora_minimal.css" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/js/jquery-ui.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/js/jquery-ui_custom.css" type="text/css" />
|
||||
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/jquery-3.3.1.min.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Access is not granted</h1>
|
||||
<?php echoPhantomCallback(); ?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
|
||||
// Access granted.
|
||||
$params = json_decode($_REQUEST['data'], true);
|
||||
|
||||
// Metaconsole connection to the node
|
||||
// Metaconsole connection to the node.
|
||||
$server_id = $params['server_id'];
|
||||
|
||||
if ($config['metaconsole'] && !empty($server_id)) {
|
||||
$server = metaconsole_get_connection_by_id($server_id);
|
||||
// Error connecting
|
||||
// Error connecting.
|
||||
if (metaconsole_connect($server) !== NOERR) {
|
||||
echo '<html>';
|
||||
echo '<body>';
|
||||
ui_print_error_message(__('There was a problem connecting with the node'));
|
||||
echo '</body>';
|
||||
echo '</html>';
|
||||
?>
|
||||
<html>
|
||||
<body>
|
||||
<?php
|
||||
ui_print_error_message(
|
||||
__('There was a problem connecting with the node')
|
||||
);
|
||||
echoPhantomCallback();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$user_language = get_user_language($config['id_user']);
|
||||
if (file_exists('languages/'.$user_language.'.mo')) {
|
||||
$l10n = new gettext_reader(new CachedFileReader('languages/'.$user_language.'.mo'));
|
||||
if (file_exists('languages/'.$user_language.'.mo') === true) {
|
||||
$cfr = new CachedFileReader('languages/'.$user_language.'.mo');
|
||||
$l10n = new gettext_reader($cfr);
|
||||
$l10n->load_tables();
|
||||
}
|
||||
|
||||
|
@ -85,16 +161,18 @@ if (file_exists('languages/'.$user_language.'.mo')) {
|
|||
<body bgcolor="#ffffff" style='background:#ffffff;'>
|
||||
<?php
|
||||
$params['only_image'] = false;
|
||||
$params['width'] = (int) $_REQUEST['viewport_width'];
|
||||
$params['menu'] = false;
|
||||
$params['width'] = (int) $_REQUEST['viewport_width'];
|
||||
$params['menu'] = false;
|
||||
|
||||
if ((!isset($params['width']) || ($params['width'] <= 0))) {
|
||||
if ((isset($params['width']) === false
|
||||
|| ($params['width'] <= 0))
|
||||
) {
|
||||
$params['width'] = 650;
|
||||
}
|
||||
|
||||
$params_combined = json_decode($_REQUEST['data_combined'], true);
|
||||
$module_list = json_decode($_REQUEST['data_module_list'], true);
|
||||
$type_graph_pdf = $_REQUEST['type_graph_pdf'];
|
||||
$module_list = json_decode($_REQUEST['data_module_list'], true);
|
||||
$type_graph_pdf = $_REQUEST['type_graph_pdf'];
|
||||
|
||||
echo '<div>';
|
||||
switch ($type_graph_pdf) {
|
||||
|
@ -208,25 +286,12 @@ if (file_exists('languages/'.$user_language.'.mo')) {
|
|||
break;
|
||||
|
||||
default:
|
||||
// code...
|
||||
// Code...
|
||||
break;
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echoPhantomCallback();
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('document').ready(function () {
|
||||
setTimeout(function () {
|
||||
try {
|
||||
var status = window.callPhantom({ status: "loaded" });
|
||||
} catch (error) {
|
||||
console.log("CALLBACK ERROR", error.message)
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC191010';
|
||||
$pandora_version = 'v7.0NG.739';
|
||||
$build_version = 'PC191029';
|
||||
$pandora_version = 'v7.0NG.740';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4615,7 +4615,7 @@ function events_page_comments($event, $ajax=false)
|
|||
foreach ($comm as $c) {
|
||||
$data[0] = '<b>'.$c['action'].' by '.$c['id_user'].'</b>';
|
||||
$data[0] .= '<br><br><i>'.date($config['date_format'], $c['utimestamp']).'</i>';
|
||||
$data[1] = $c['comment'];
|
||||
$data[1] = '<p style="word-break: break-word;">'.$c['comment'].'</p>';
|
||||
$table_comments->data[] = $data;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3595,7 +3595,32 @@ function graph_custom_sql_graph(
|
|||
|
||||
$SQL_GRAPH_MAX_LABEL_SIZE = 20;
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$server = metaconsole_get_connection_names();
|
||||
$connection = metaconsole_get_connection($server);
|
||||
metaconsole_connect($connection);
|
||||
}
|
||||
|
||||
$report_content = db_get_row('treport_content', 'id_rc', $id);
|
||||
|
||||
if ($report_content == false || $report_content == '') {
|
||||
$report_content = db_get_row('treport_content_template', 'id_rc', $id);
|
||||
}
|
||||
|
||||
if ($report_content == false || $report_content == '') {
|
||||
enterprise_hook('metaconsole_restore_db');
|
||||
$report_content = db_get_row('treport_content', 'id_rc', $id);
|
||||
if ($report_content == false || $report_content == '') {
|
||||
$report_content = db_get_row('treport_content_template', 'id_rc', $id);
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$server = metaconsole_get_connection_names();
|
||||
$connection = metaconsole_get_connection($server);
|
||||
metaconsole_connect($connection);
|
||||
}
|
||||
}
|
||||
|
||||
if ($id != null) {
|
||||
$historical_db = db_get_value_sql('SELECT historical_db from treport_content where id_rc ='.$id);
|
||||
} else {
|
||||
|
@ -3609,22 +3634,9 @@ function graph_custom_sql_graph(
|
|||
$sql = io_safe_output($sql['sql']);
|
||||
}
|
||||
|
||||
if (($config['metaconsole'] == 1) && defined('METACONSOLE')) {
|
||||
$metaconsole_connection = enterprise_hook('metaconsole_get_connection', [$report_content['server_name']]);
|
||||
|
||||
if ($metaconsole_connection === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (enterprise_hook('metaconsole_load_external_db', [$metaconsole_connection]) != NOERR) {
|
||||
// ui_print_error_message ("Error connecting to ".$server_name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$data_result = db_get_all_rows_sql($sql, $historical_db);
|
||||
|
||||
if (($config['metaconsole'] == 1) && defined('METACONSOLE')) {
|
||||
if (is_metaconsole()) {
|
||||
enterprise_hook('metaconsole_restore_db');
|
||||
}
|
||||
|
||||
|
|
|
@ -2327,7 +2327,13 @@ function migrate_older_open_maps($id)
|
|||
$new_map_filter = [];
|
||||
$new_map_filter['dont_show_subgroups'] = $old_networkmap['dont_show_subgroups'];
|
||||
$new_map_filter['node_radius'] = 40;
|
||||
$new_map_filter['id_migrate_map'] = $id;
|
||||
$new_map_filter['x_offs'] = 0;
|
||||
$new_map_filter['y_offs'] = 0;
|
||||
$new_map_filter['z_dash'] = '0.5';
|
||||
$new_map_filter['node_sep'] = '0.1';
|
||||
$new_map_filter['rank_sep'] = 1;
|
||||
$new_map_filter['mindist'] = 1;
|
||||
$new_map_filter['kval'] = '0.1';
|
||||
$map_values['filter'] = json_encode($new_map_filter);
|
||||
|
||||
$map_values['description'] = 'Mapa open migrado';
|
||||
|
@ -2340,11 +2346,7 @@ function migrate_older_open_maps($id)
|
|||
$map_values['source_period'] = 60;
|
||||
$map_values['source'] = 0;
|
||||
$map_values['source_data'] = $old_networkmap['id_group'];
|
||||
if ($old_networkmap['type'] == 'radial_dinamic') {
|
||||
$map_values['generation_method'] = 6;
|
||||
} else {
|
||||
$map_values['generation_method'] = 4;
|
||||
}
|
||||
$map_values['generation_method'] = 3;
|
||||
|
||||
$map_values['generated'] = 0;
|
||||
|
||||
|
|
|
@ -796,6 +796,11 @@ function planned_downtimes_created($values)
|
|||
'return' => false,
|
||||
'message' => __('Not created. Error inserting data').'. '.__('There is no group with such id'),
|
||||
];
|
||||
} else if (!$values['date_from'] || !$values['date_to']) {
|
||||
return [
|
||||
'return' => false,
|
||||
'message' => __('Not created. Error inserting data').'. '.__('Date is wrong formatted'),
|
||||
];
|
||||
} else {
|
||||
if (trim(io_safe_output($values['name'])) != '') {
|
||||
if (!$check) {
|
||||
|
|
|
@ -282,6 +282,15 @@ function reporting_make_reporting_data(
|
|||
$agents_to_macro = $content['id_agent'];
|
||||
}
|
||||
|
||||
// Metaconsole connection.
|
||||
if (is_metaconsole()) {
|
||||
$server = metaconsole_get_connection_names();
|
||||
$connection = metaconsole_get_connection($server);
|
||||
if (metaconsole_connect($connection) != NOERR) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($content['style']['name_label'])) {
|
||||
// Add macros name.
|
||||
$items_label = [];
|
||||
|
@ -294,14 +303,6 @@ function reporting_make_reporting_data(
|
|||
$metaconsole_on = is_metaconsole();
|
||||
$server_name = $content['server_name'];
|
||||
|
||||
// Metaconsole connection.
|
||||
if ($metaconsole_on && $server_name != '') {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$items_label['agent_description'] = agents_get_description(
|
||||
$content['id_agent']
|
||||
);
|
||||
|
@ -2824,13 +2825,12 @@ function reporting_group_report($report, $content)
|
|||
$content['name'] = __('Group Report');
|
||||
}
|
||||
|
||||
if ($config['metaconsole']) {
|
||||
$id_meta = metaconsole_get_id_server($content['server_name']);
|
||||
|
||||
$server = metaconsole_get_connection_by_id($id_meta);
|
||||
metaconsole_connect($server);
|
||||
if (is_metaconsole()) {
|
||||
$server = metaconsole_get_connection_names();
|
||||
$connection = metaconsole_get_connection($server);
|
||||
}
|
||||
|
||||
$return['server_name'] = $server[0];
|
||||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = groups_get_name($content['id_group'], true);
|
||||
$return['description'] = $content['description'];
|
||||
|
@ -3488,7 +3488,7 @@ function reporting_network_interfaces_report($report, $content, $type='dinamic',
|
|||
$return['failed'] = null;
|
||||
$return['data'] = [];
|
||||
|
||||
if ($config['metaconsole']) {
|
||||
if (is_metaconsole()) {
|
||||
$server_names = metaconsole_get_connection_names();
|
||||
if (isset($server_names) && is_array($server_names)) {
|
||||
foreach ($server_names as $key => $value) {
|
||||
|
@ -3505,7 +3505,8 @@ function reporting_network_interfaces_report($report, $content, $type='dinamic',
|
|||
$content,
|
||||
$report,
|
||||
$fullscale,
|
||||
$pdf
|
||||
$pdf,
|
||||
$id_meta
|
||||
);
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
@ -4190,6 +4191,19 @@ function reporting_sql_graph(
|
|||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text();
|
||||
|
||||
$module_source = db_get_all_rows_sql(
|
||||
'SELECT id_agent_module
|
||||
FROM tgraph_source
|
||||
WHERE id_graph = '.$content['id_gs']
|
||||
);
|
||||
|
||||
if (isset($module_source) && is_array($module_source)) {
|
||||
$modules = [];
|
||||
foreach ($module_source as $key => $value) {
|
||||
$modules[$key] = $value['id_agent_module'];
|
||||
}
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'dinamic':
|
||||
case 'static':
|
||||
|
@ -4206,6 +4220,16 @@ function reporting_sql_graph(
|
|||
break;
|
||||
|
||||
case 'data':
|
||||
$data = [];
|
||||
foreach ($modules as $key => $value) {
|
||||
$data[$value] = modules_get_agentmodule_data(
|
||||
$value,
|
||||
$content['period'],
|
||||
$report['datetime']
|
||||
);
|
||||
}
|
||||
|
||||
$return['chart'] = $data;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4406,6 +4430,7 @@ function reporting_netflow(
|
|||
switch ($type) {
|
||||
case 'dinamic':
|
||||
case 'static':
|
||||
case 'data':
|
||||
$return['chart'] = netflow_draw_item(
|
||||
($report['datetime'] - $content['period']),
|
||||
$report['datetime'],
|
||||
|
@ -4879,22 +4904,23 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
|
||||
if ($content['visual_format'] != 2) {
|
||||
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module'], true);
|
||||
for ($i = $report['datetime']; $i > ($report['datetime'] - $content['period']); $i -= $content['lapse']) {
|
||||
|
||||
for ($i = ($report['datetime'] - $content['period']); $i < $report['datetime']; $i += $content['lapse']) {
|
||||
$row = [];
|
||||
$row[__('Lapse')] = date('Y-m-d H:i:s', ($i - $content['lapse'] + 1)).' to '.date('Y-m-d H:i:s', $i);
|
||||
$row[__('Lapse')] = date('Y-m-d H:i:s', ($i + 1)).' to '.date('Y-m-d H:i:s', (($i + $content['lapse']) ));
|
||||
|
||||
if ($i > $time_begin['utimestamp']) {
|
||||
switch ($type) {
|
||||
case 'max':
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['lapse'], $i), $config['graph_precision']).' '.$unit;
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
|
||||
break;
|
||||
|
||||
case 'min':
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['lapse'], $i), $config['graph_precision']).' '.$unit;
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
|
||||
break;
|
||||
|
||||
case 'avg':
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['lapse'], $i), $config['graph_precision']).' '.$unit;
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
@ -7560,8 +7586,35 @@ function reporting_custom_graph(
|
|||
$content['name'] = __('Simple graph');
|
||||
}
|
||||
|
||||
$module_source = db_get_all_rows_sql(
|
||||
'SELECT id_agent_module
|
||||
FROM tgraph_source
|
||||
WHERE id_graph = '.$content['id_gs']
|
||||
);
|
||||
|
||||
if (isset($module_source) && is_array($module_source)) {
|
||||
$modules = [];
|
||||
foreach ($module_source as $key => $value) {
|
||||
$modules[$key] = $value['id_agent_module'];
|
||||
}
|
||||
}
|
||||
|
||||
$agent_description = agents_get_description($id_agent);
|
||||
$agent_group = agents_get_agent_group($id_agent);
|
||||
$agent_address = agents_get_address($id_agent);
|
||||
$agent_alias = agents_get_alias($id_agent);
|
||||
$module_name = modules_get_agentmodule_name(
|
||||
$id_agent_module
|
||||
);
|
||||
|
||||
$module_description = modules_get_agentmodule_descripcion(
|
||||
$id_agent_module
|
||||
);
|
||||
|
||||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = io_safe_output($graph['name']);
|
||||
$return['agent_name'] = $agent_alias;
|
||||
$return['module_name'] = $module_name;
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text(
|
||||
$report,
|
||||
|
@ -7605,6 +7658,19 @@ function reporting_custom_graph(
|
|||
);
|
||||
|
||||
break;
|
||||
|
||||
case 'data':
|
||||
$data = [];
|
||||
foreach ($modules as $key => $value) {
|
||||
$data[$value] = modules_get_agentmodule_data(
|
||||
$value,
|
||||
$content['period'],
|
||||
$report['datetime']
|
||||
);
|
||||
}
|
||||
|
||||
$return['chart'] = $data;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($type_report == 'custom_graph') {
|
||||
|
|
|
@ -769,22 +769,34 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||
'optgroup' => __('Grouped'),
|
||||
'name' => __('General'),
|
||||
];
|
||||
$types['group_report'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
'name' => __('Group report'),
|
||||
];
|
||||
if (is_metaconsole()) {
|
||||
if ($template === false) {
|
||||
$types['group_report'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
'name' => __('Group report'),
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$types['group_report'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
'name' => __('Group report'),
|
||||
];
|
||||
}
|
||||
|
||||
$types['exception'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
'name' => __('Exception'),
|
||||
];
|
||||
if ($config['metaconsole'] != 1) {
|
||||
$types['agent_module'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
'name' => __('Agents/Modules'),
|
||||
];
|
||||
if (!$template) {
|
||||
$types['agent_module'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
'name' => __('Agents/Modules'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Only pandora managers have access to the whole database
|
||||
// Only pandora managers have access to the whole database.
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$types['sql'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
|
@ -878,7 +890,7 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||
];
|
||||
}
|
||||
|
||||
if ($config['enterprise_installed']) {
|
||||
if ($config['enterprise_installed'] && $template === false) {
|
||||
$types['event_report_log'] = [
|
||||
'optgroup' => __('Log'),
|
||||
'name' => __('Log report'),
|
||||
|
|
|
@ -39,7 +39,7 @@ if (isset($config['homedir'])) {
|
|||
|
||||
|
||||
/**
|
||||
* Transform bbcode to HTML.
|
||||
* Transform bbcode to HTML and truncate log.
|
||||
*
|
||||
* @param string $text Text.
|
||||
* @param array $allowed_tags Allowed_tags.
|
||||
|
@ -48,16 +48,22 @@ if (isset($config['homedir'])) {
|
|||
*/
|
||||
function ui_bbcode_to_html($text, $allowed_tags=['[url]'])
|
||||
{
|
||||
if (array_search('[url]', $allowed_tags) !== false) {
|
||||
// If link hasn't http, add it.
|
||||
if (preg_match('/https?:\/\//', $text)) {
|
||||
$html_bbcode = '<a target="_blank" rel="noopener noreferrer" href="$1">$2</a>';
|
||||
if (array_search('[url]', $allowed_tags) !== false || a) {
|
||||
// Replace bbcode format [url=www.example.org] String [/url] with or without http and slashes
|
||||
preg_match('/\[url(?|](((?:https?:\/\/)?[^[]+))|(?:=[\'"]?((?:https?:\/\/)?[^]]+?)[\'"]?)](.+?))\[\/url]/', $text, $matches);
|
||||
if ($matches) {
|
||||
$url = $matches[1];
|
||||
// Truncate text
|
||||
$t_text = ui_print_truncate_text($matches[2]);
|
||||
// If link hasn't http, add it.
|
||||
if (preg_match('/https?:\/\//', $text)) {
|
||||
$return = '<a target="_blank" rel="noopener noreferrer" href="'.$matches[1].'">'.$t_text.'</a>';
|
||||
} else {
|
||||
$return = '<a target="_blank" rel="noopener noreferrer" href="http://'.$matches[1].'">'.$t_text.'</a>';
|
||||
}
|
||||
} else {
|
||||
$html_bbcode = '<a target="_blank" rel="noopener noreferrer" href="http://$1">$2</a>';
|
||||
$return = ui_print_truncate_text($text);
|
||||
}
|
||||
|
||||
// Replace bbcode format [url=www.example.org] String [/url] with or without http and slashes.
|
||||
$return = preg_replace('/\[url(?|](((?:https?:\/\/)?[^[]+))|(?:=[\'"]?((?:https?:\/\/)?[^]]+?)[\'"]?)](.+?))\[\/url]/', $html_bbcode, $text);
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
@ -2521,9 +2527,22 @@ function ui_print_module_warn_value(
|
|||
$str_warning,
|
||||
$max_critical,
|
||||
$min_critical,
|
||||
$str_critical
|
||||
$str_critical,
|
||||
$warning_inverse=0,
|
||||
$critical_inverse=0
|
||||
) {
|
||||
$data = "<span title='".__('Warning').': '.__('Max').$max_warning.'/'.__('Min').$min_warning.' - '.__('Critical').': '.__('Max').$max_critical.'/'.__('Min').$min_critical."'>";
|
||||
$war_inv = '';
|
||||
$crit_inv = '';
|
||||
|
||||
if ($warning_inverse == 1) {
|
||||
$war_inv = ' (inv)';
|
||||
}
|
||||
|
||||
if ($critical_inverse == 1) {
|
||||
$crit_inv = ' (inv)';
|
||||
}
|
||||
|
||||
$data = "<span title='".__('Warning').': '.__('Max').$max_warning.'/'.__('Min').$min_warning.$war_inv.' - '.__('Critical').': '.__('Max').$max_critical.'/'.__('Min').$min_critical.$crit_inv."'>";
|
||||
|
||||
if ($max_warning != $min_warning) {
|
||||
$data .= format_for_graph($max_warning).'/'.format_for_graph($min_warning);
|
||||
|
@ -3191,14 +3210,18 @@ function ui_print_datatable(array $parameters)
|
|||
$.fn.dataTable.ext.errMode = "none";
|
||||
$.fn.dataTable.ext.classes.sPageButton = "'.$pagination_class.'";
|
||||
dt_'.$table_id.' = $("#'.$table_id.'").DataTable({
|
||||
';
|
||||
drawCallback: function(settings) {';
|
||||
if (isset($parameters['drawCallback'])) {
|
||||
$js .= 'drawCallback: function(settings) {
|
||||
'.$parameters['drawCallback'].'
|
||||
},';
|
||||
$js .= $parameters['drawCallback'];
|
||||
}
|
||||
|
||||
$js .= '
|
||||
if (dt_'.$table_id.'.page.info().pages > 1) {
|
||||
$("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers").show()
|
||||
} else {
|
||||
$("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers").hide()
|
||||
}
|
||||
},
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
paging: true,
|
||||
|
@ -3303,6 +3326,7 @@ function ui_print_datatable(array $parameters)
|
|||
dt_'.$table_id.'.draw().page(0)
|
||||
});
|
||||
});
|
||||
|
||||
</script>';
|
||||
|
||||
// Order.
|
||||
|
@ -5650,3 +5674,62 @@ function ui_print_breadcrums($tab_name)
|
|||
|
||||
return $section;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show last comment
|
||||
*
|
||||
* @param array $comments array with comments
|
||||
*
|
||||
* @return string HTML string with the last comment of the events.
|
||||
*/
|
||||
function ui_print_comments($comments)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$comments = explode('<br>', $comments);
|
||||
$comments = str_replace(["\n", '
'], '<br>', $comments);
|
||||
if (is_array($comments)) {
|
||||
foreach ($comments as $comm) {
|
||||
if (empty($comm)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$comments_array[] = json_decode(io_safe_output($comm), true);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($comments_array as $comm) {
|
||||
// Show the comments more recent first.
|
||||
if (is_array($comm)) {
|
||||
$last_comment[] = array_reverse($comm);
|
||||
}
|
||||
}
|
||||
|
||||
// Only show the last comment. If commment its too long,the comment will short with ...
|
||||
// If $config['prominent_time'] is timestamp the date show Month, day, hour and minutes.
|
||||
// Else show comments hours ago
|
||||
if ($last_comment[0][0]['action'] != 'Added comment') {
|
||||
$last_comment[0][0]['comment'] = $last_comment[0][0]['action'];
|
||||
}
|
||||
|
||||
$short_comment = substr($last_comment[0][0]['comment'], 0, '80px');
|
||||
if ($config['prominent_time'] == 'timestamp') {
|
||||
$comentario = '<i>'.date($config['date_format'], $last_comment[0][0]['utimestamp']).' ('.$last_comment[0][0]['id_user'].'): '.$last_comment[0][0]['comment'].'';
|
||||
|
||||
if (strlen($comentario) > '200px') {
|
||||
$comentario = '<i>'.date($config['date_format'], $last_comment[0][0]['utimestamp']).' ('.$last_comment[0][0]['id_user'].'): '.$short_comment.'...';
|
||||
}
|
||||
} else {
|
||||
$rest_time = (time() - $last_comment[0][0]['utimestamp']);
|
||||
$time_last = (($rest_time / 60) / 60);
|
||||
$comentario = '<i>'.number_format($time_last, 0).' Hours ('.$last_comment[0][0]['id_user'].'): '.$last_comment[0][0]['comment'].'';
|
||||
|
||||
if (strlen($comentario) > '200px') {
|
||||
$comentario = '<i>'.number_format($time_last, 0).' Hours ('.$last_comment[0][0]['id_user'].'): '.$short_comment.'...';
|
||||
}
|
||||
}
|
||||
|
||||
return io_safe_output($comentario);
|
||||
|
||||
}
|
||||
|
|
|
@ -170,17 +170,7 @@ function vbar_graph(
|
|||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
||||
if (empty($chart_data)) {
|
||||
return html_print_image(
|
||||
$no_data_image,
|
||||
true,
|
||||
[
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'title' => __('No data to show'),
|
||||
],
|
||||
false,
|
||||
true
|
||||
);
|
||||
return graph_nodata_image($width, $height, 'vbar');
|
||||
}
|
||||
|
||||
if ($ttl == 2) {
|
||||
|
@ -357,17 +347,7 @@ function hbar_graph(
|
|||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
||||
if (empty($chart_data)) {
|
||||
return html_print_image(
|
||||
$no_data_image,
|
||||
true,
|
||||
[
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'title' => __('No data to show'),
|
||||
],
|
||||
false,
|
||||
true
|
||||
);
|
||||
return graph_nodata_image($width, $height, 'hbar');
|
||||
}
|
||||
|
||||
if ($ttl == 2) {
|
||||
|
|
|
@ -172,7 +172,6 @@ function pandoraFlotPieCustom(
|
|||
show: true,
|
||||
radius: 5 / 8,
|
||||
formatter: function(label, series) {
|
||||
console.log(series);
|
||||
return (
|
||||
'<div style="font-size:' +
|
||||
font_size +
|
||||
|
@ -783,9 +782,7 @@ function pandoraFlotSlicebar(
|
|||
graph_id,
|
||||
values,
|
||||
datacolor,
|
||||
labels,
|
||||
legend,
|
||||
acumulate_data,
|
||||
intervaltick,
|
||||
font,
|
||||
font_size,
|
||||
|
@ -794,12 +791,11 @@ function pandoraFlotSlicebar(
|
|||
id_agent,
|
||||
full_legend,
|
||||
not_interactive,
|
||||
show_date
|
||||
show_date,
|
||||
datelimit
|
||||
) {
|
||||
values = values.split(separator2);
|
||||
labels = labels.split(separator);
|
||||
legend = legend.split(separator);
|
||||
acumulate_data = acumulate_data.split(separator);
|
||||
datacolor = datacolor.split(separator);
|
||||
|
||||
if (full_legend != false) {
|
||||
|
@ -822,9 +818,7 @@ function pandoraFlotSlicebar(
|
|||
var serie = values[i].split(separator);
|
||||
|
||||
var aux = new Array();
|
||||
$.each(serie, function(i, v) {
|
||||
aux.push([v, i]);
|
||||
});
|
||||
aux.push([parseInt(serie[0]), 0]);
|
||||
|
||||
datas.push({
|
||||
data: aux,
|
||||
|
@ -902,18 +896,16 @@ function pandoraFlotSlicebar(
|
|||
}
|
||||
|
||||
$("#extra_" + graph_id).text(from + "-" + to);
|
||||
var extra_height = parseInt(
|
||||
$("#extra_" + graph_id)
|
||||
.css("height")
|
||||
.split("px")[0]
|
||||
);
|
||||
var extra_width = parseInt(
|
||||
$("#extra_" + graph_id)
|
||||
.css("width")
|
||||
.split("px")[0]
|
||||
);
|
||||
$("#extra_" + graph_id).css("left", pos.pageX - extra_width / 4 + "px");
|
||||
//$('#extra_'+graph_id).css('top',plot.offset().top-extra_height-5+'px');
|
||||
|
||||
$("#extra_" + graph_id).css(
|
||||
"left",
|
||||
parseInt(pos.pageX - extra_width - 200) + "px"
|
||||
);
|
||||
$("#extra_" + graph_id).show();
|
||||
}
|
||||
});
|
||||
|
@ -992,13 +984,33 @@ function pandoraFlotSlicebar(
|
|||
|
||||
// Format functions
|
||||
function xFormatter(v, axis) {
|
||||
v = new Date(1000 * v);
|
||||
date_format =
|
||||
(v.getHours() < 10 ? "0" : "") +
|
||||
v.getHours() +
|
||||
d = new Date(1000 * (v + datelimit));
|
||||
var monthNames = [
|
||||
"Jan",
|
||||
"Feb",
|
||||
"Mar",
|
||||
"Apr",
|
||||
"May",
|
||||
"Jun",
|
||||
"Jul",
|
||||
"Aug",
|
||||
"Sep",
|
||||
"Oct",
|
||||
"Nov",
|
||||
"Dec"
|
||||
];
|
||||
|
||||
var date_format =
|
||||
(d.getDate() < 10 ? "0" : "") +
|
||||
d.getDate() +
|
||||
" " +
|
||||
monthNames[d.getMonth()] +
|
||||
"<br>" +
|
||||
(d.getHours() < 10 ? "0" : "") +
|
||||
d.getHours() +
|
||||
":" +
|
||||
(v.getMinutes() < 10 ? "0" : "") +
|
||||
v.getMinutes();
|
||||
(d.getMinutes() < 10 ? "0" : "") +
|
||||
d.getMinutes();
|
||||
return date_format;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -786,6 +786,8 @@ function flot_slicesbar_graph(
|
|||
// Get a unique identifier to graph
|
||||
$graph_id = uniqid('graph_');
|
||||
|
||||
$height = ((int) $height + 15);
|
||||
|
||||
// Set some containers to legend, graph, timestamp tooltip, etc.
|
||||
if ($stat_win) {
|
||||
$return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width.'%; height: '.$height."px; display: inline-block;'></div>";
|
||||
|
@ -804,8 +806,6 @@ function flot_slicesbar_graph(
|
|||
$separator2 = ':,:,,,:,:';
|
||||
|
||||
// Transform data from our format to library format
|
||||
$labels = [];
|
||||
$a = [];
|
||||
$vars = [];
|
||||
|
||||
$datacolor = [];
|
||||
|
@ -819,12 +819,12 @@ function flot_slicesbar_graph(
|
|||
$fontsize = $config['font_size'];
|
||||
$fontpath = $config['fontpath'];
|
||||
|
||||
$extra_height = 15;
|
||||
$extra_height = 40;
|
||||
if (defined('METACONSOLE')) {
|
||||
$extra_height = 20;
|
||||
$extra_height = 50;
|
||||
}
|
||||
|
||||
$return .= "<div id='extra_$graph_id' style='font-size: ".$fontsize.'pt; display:none; position:absolute; overflow: auto; height: '.$extra_height."px; background:#fff; padding: 2px 2px 2px 2px; border: solid #000 1px;'></div>";
|
||||
$return .= '<div id="extra_'.$graph_id.'" class="slicebar-box-hover-styles" style="display:none; font-size:'.$fontsize.'"></div>';
|
||||
|
||||
$maxticks = (int) 20;
|
||||
|
||||
|
@ -842,11 +842,7 @@ function flot_slicesbar_graph(
|
|||
|
||||
$intervaltick = (int) $intervaltick;
|
||||
|
||||
$acumulate = 0;
|
||||
$c = 0;
|
||||
$acumulate_data = [];
|
||||
foreach ($graph_data as $label => $values) {
|
||||
$labels[] = $label;
|
||||
$i--;
|
||||
|
||||
foreach ($values as $key => $value) {
|
||||
|
@ -857,19 +853,10 @@ function flot_slicesbar_graph(
|
|||
}
|
||||
|
||||
$data[$jsvar][] = $value;
|
||||
|
||||
$acumulate_data[$c] = $acumulate;
|
||||
$acumulate += $value;
|
||||
$c++;
|
||||
|
||||
if ($value > $max) {
|
||||
$max = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store serialized data to use it from javascript
|
||||
$labels = implode($separator, $labels);
|
||||
// Store serialized data to use it from javascript.
|
||||
$datacolor = implode($separator, $datacolor);
|
||||
if (is_array($legend)) {
|
||||
$legend = io_safe_output(implode($separator, $legend));
|
||||
|
@ -881,19 +868,11 @@ function flot_slicesbar_graph(
|
|||
$full_legend_date = false;
|
||||
}
|
||||
|
||||
$acumulate_data = io_safe_output(implode($separator, $acumulate_data));
|
||||
|
||||
// Store data series in javascript format
|
||||
$jsvars = '';
|
||||
$jsseries = [];
|
||||
|
||||
$date = get_system_time();
|
||||
$datelimit = (($date - $period) * 1000);
|
||||
$datelimit = (($date - $period));
|
||||
|
||||
$i = 0;
|
||||
|
||||
$values2 = [];
|
||||
|
||||
foreach ($data as $jsvar => $values) {
|
||||
$values2[] = implode($separator, $values);
|
||||
$i ++;
|
||||
|
@ -901,10 +880,10 @@ function flot_slicesbar_graph(
|
|||
|
||||
$values = implode($separator2, $values2);
|
||||
|
||||
// Javascript code
|
||||
// Javascript code.
|
||||
$return .= "<script type='text/javascript'>";
|
||||
$return .= "//<![CDATA[\n";
|
||||
$return .= "pandoraFlotSlicebar('$graph_id','$values','$datacolor','$labels','$legend','$acumulate_data',$intervaltick,'$fontpath',$fontsize,'$separator','$separator2',$id_agent,'$full_legend_date',$not_interactive, '$show')";
|
||||
$return .= "pandoraFlotSlicebar('$graph_id','$values','$datacolor','$legend',$intervaltick,'$fontpath',$fontsize,'$separator','$separator2',$id_agent,'$full_legend_date',$not_interactive, '$show', $datelimit)";
|
||||
$return .= "\n//]]>";
|
||||
$return .= '</script>';
|
||||
|
||||
|
|
|
@ -87,9 +87,9 @@ function js_refreshParentLines(layerName) {
|
|||
{
|
||||
strokeWidth: 2,
|
||||
fillOpacity: 0.2,
|
||||
fillColor: "red",
|
||||
fillColor: "black",
|
||||
strokeDashstyle: "dash",
|
||||
strokeColor: "red"
|
||||
strokeColor: "black"
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -63,6 +63,20 @@ function show_event_dialog(event, dialog_page, result) {
|
|||
height: 600
|
||||
})
|
||||
.show();
|
||||
$.post({
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: "include/ajax/events",
|
||||
get_comments: 1,
|
||||
event: event,
|
||||
filter: values
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#extended_event_comments_page").empty();
|
||||
$("#extended_event_comments_page").html(data);
|
||||
}
|
||||
});
|
||||
|
||||
$("#refrcounter").countdown("pause");
|
||||
$("div.vc-countdown").countdown("pause");
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP script to manage Pandora FMS websockets.
|
||||
*
|
||||
* @category Websocket
|
||||
* @package Pandora FMS
|
||||
* @subpackage Console
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
namespace PandoraFMS;
|
||||
|
||||
/**
|
||||
* Object user.
|
||||
*/
|
||||
class User
|
||||
{
|
||||
|
||||
/**
|
||||
* Current 'id_usuario'.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $idUser;
|
||||
|
||||
/**
|
||||
* Current PHP session ids.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $sessions = [];
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a user object.
|
||||
*
|
||||
* @param array $data User information
|
||||
* - Username
|
||||
* - PHP session ID.
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Unset user.
|
||||
unset($config['id_usuario']);
|
||||
unset($_SESSION['id_usuario']);
|
||||
|
||||
if (is_array($data) === true) {
|
||||
if (isset($data['phpsessionid']) === true) {
|
||||
$this->sessions[$data['phpsessionid']] = 1;
|
||||
$info = \db_get_row_filter(
|
||||
'tsessions_php',
|
||||
['id_session' => $data['phpsessionid']]
|
||||
);
|
||||
|
||||
if ($info !== false) {
|
||||
// Process.
|
||||
$session_data = session_decode($info['data']);
|
||||
$this->idUser = $_SESSION['id_usuario'];
|
||||
|
||||
// Valid session.
|
||||
return $this;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isset($data['id_usuario']) === true
|
||||
&& isset($data['password']) === true
|
||||
) {
|
||||
$user_in_db = process_user_login($user, $password, true);
|
||||
if ($user_in_db !== false) {
|
||||
$config['id_usuario'] = $user_in_db;
|
||||
$correctLogin = true;
|
||||
|
||||
// Originally at api.php.
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
$_SESSION['id_usuario'] = $user;
|
||||
session_write_close();
|
||||
|
||||
$this->idUser = $data['id_usuario'];
|
||||
// Valid session.
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -91,11 +91,6 @@ function pandora_session_write($session_id, $data)
|
|||
{
|
||||
$session_id = addslashes($session_id);
|
||||
|
||||
// If it's an api call, the session must not be created.
|
||||
if (get_parameter('op', false) && get_parameter('op2', false)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_ajax()) {
|
||||
// Avoid session upadte while processing ajax responses - notifications.
|
||||
if (get_parameter('check_new_notifications', false)) {
|
||||
|
@ -166,7 +161,7 @@ function pandora_session_gc($max_lifetime=300)
|
|||
if (isset($config['session_timeout'])) {
|
||||
$session_timeout = $config['session_timeout'];
|
||||
} else {
|
||||
// if $config doesn`t work ...
|
||||
// If $config doesn`t work ...
|
||||
$session_timeout = db_get_value(
|
||||
'value',
|
||||
'tconfig',
|
||||
|
@ -175,9 +170,9 @@ function pandora_session_gc($max_lifetime=300)
|
|||
);
|
||||
}
|
||||
|
||||
if (!empty($session_timeout)) {
|
||||
if (empty($session_timeout) === false) {
|
||||
if ($session_timeout == -1) {
|
||||
// The session expires in 10 years
|
||||
// The session expires in 10 years.
|
||||
$session_timeout = 315576000;
|
||||
} else {
|
||||
$session_timeout *= 60;
|
||||
|
@ -196,15 +191,14 @@ function pandora_session_gc($max_lifetime=300)
|
|||
);
|
||||
|
||||
// Deleting cron and empty sessions.
|
||||
$sql = "DELETE FROM tsessions_php WHERE
|
||||
data IS NULL OR id_session REGEXP '^cron-'";
|
||||
$sql = 'DELETE FROM tsessions_php WHERE data IS NULL';
|
||||
db_process_sql($sql);
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
|
||||
// FIXME: SAML should work with pandora session handlers
|
||||
// TODO: SAML should work with pandora session handlers.
|
||||
if (db_get_value('value', 'tconfig', 'token', 'auth') != 'saml') {
|
||||
$result_handler = session_set_save_handler(
|
||||
'pandora_session_open',
|
||||
|
|
|
@ -261,6 +261,7 @@ div.login_button_saml input:hover {
|
|||
.login_back input {
|
||||
background-image: url("../../images/back_login.png");
|
||||
background-position: left 5% center;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.login_back input:hover {
|
||||
|
|
|
@ -5888,3 +5888,18 @@ table.table_modal_alternate tr td:first-child {
|
|||
.fullwidth {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.slicebar-box-hover-styles {
|
||||
position: absolute;
|
||||
background-color: #fff;
|
||||
width: 80px;
|
||||
height: 20px;
|
||||
text-align: center;
|
||||
font-family: arial, sans-serif, verdana;
|
||||
padding: 3px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.flot-text {
|
||||
width: 101%;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* Wux style
|
||||
*/
|
||||
|
||||
.wux_execution_result_transaction {
|
||||
width: auto;
|
||||
height: auto;
|
||||
float: right;
|
||||
margin-right: 200px;
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
var system = require("system");
|
||||
|
||||
/* global phantom */
|
||||
|
||||
if (system.args.length < 3 || system.args.length > 11) {
|
||||
phantom.exit(1);
|
||||
}
|
||||
|
@ -14,6 +16,7 @@ var viewport_width = system.args[7];
|
|||
var viewport_height = system.args[8];
|
||||
var session_id = system.args[9];
|
||||
var base_64 = system.args[10];
|
||||
var post_data = "";
|
||||
|
||||
if (!viewport_width) {
|
||||
viewport_width = 750;
|
||||
|
@ -47,6 +50,29 @@ if (type_graph_pdf == "combined") {
|
|||
|
||||
var page = require("webpage").create();
|
||||
|
||||
page.onResourceError = function(resourceError) {
|
||||
console.log(
|
||||
"Unable to load resource (#" +
|
||||
resourceError.id +
|
||||
"URL:" +
|
||||
resourceError.url +
|
||||
")"
|
||||
);
|
||||
console.log(
|
||||
"Error code: " +
|
||||
resourceError.errorCode +
|
||||
". Description: " +
|
||||
resourceError.errorString
|
||||
);
|
||||
phantom.exit(1);
|
||||
};
|
||||
|
||||
// Not supposed to be prompted messages.
|
||||
page.onPrompt = function() {
|
||||
console.log("Prompt message detected.");
|
||||
phantom.exit(1);
|
||||
};
|
||||
|
||||
page.viewportSize = {
|
||||
width: viewport_width,
|
||||
height: viewport_height
|
||||
|
@ -64,7 +90,7 @@ page.onError = function(msg) {
|
|||
phantom.exit();
|
||||
};
|
||||
|
||||
page.onCallback = function(st) {
|
||||
page.onCallback = function() {
|
||||
if (!base_64) {
|
||||
page.render(output_filename, { format: "png" });
|
||||
} else {
|
||||
|
@ -81,3 +107,21 @@ page.open(url, "POST", post_data, function(status) {
|
|||
phantom.exit();
|
||||
}
|
||||
});
|
||||
|
||||
phantom.onError = function(msg, trace) {
|
||||
var msgStack = ["PHANTOM ERROR: " + msg];
|
||||
if (trace && trace.length) {
|
||||
msgStack.push("TRACE:");
|
||||
trace.forEach(function(t) {
|
||||
msgStack.push(
|
||||
" -> " +
|
||||
(t.file || t.sourceURL) +
|
||||
": " +
|
||||
t.line +
|
||||
(t.function ? " (in function " + t.function + ")" : "")
|
||||
);
|
||||
});
|
||||
}
|
||||
console.log(msgStack.join("\n"));
|
||||
phantom.exit(1);
|
||||
};
|
||||
|
|
|
@ -128,8 +128,8 @@
|
|||
</div>
|
||||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.739';
|
||||
$build = '191010';
|
||||
$version = '7.0NG.740';
|
||||
$build = '191029';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -166,6 +166,19 @@ class ModuleGraph
|
|||
$time_compare = 'overlapped';
|
||||
}
|
||||
|
||||
// Graph TIP view.
|
||||
if (!isset($config['full_scale_option']) || $config['full_scale_option'] == 0) {
|
||||
$fullscale = 0;
|
||||
} else if ($config['full_scale_option'] == 1) {
|
||||
$fullscale = 1;
|
||||
} else if ($config['full_scale_option'] == 2) {
|
||||
if ($this->graph_type == 'boolean') {
|
||||
$fullscale = 1;
|
||||
} else {
|
||||
$fullscale = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
switch ($this->graph_type) {
|
||||
case 'boolean':
|
||||
|
@ -188,6 +201,7 @@ class ModuleGraph
|
|||
'menu' => false,
|
||||
'type_graph' => $config['type_module_charts'],
|
||||
'vconsole' => true,
|
||||
'fullscale' => $fullscale,
|
||||
];
|
||||
|
||||
$graph = grafico_modulo_sparse($params);
|
||||
|
|
|
@ -97,17 +97,6 @@ echo '<td>';
|
|||
html_print_submit_button(__('Refresh path'), 'refresh', false, 'class = "sub upd" style="margin-top:0px"');
|
||||
echo '</table></form>';
|
||||
|
||||
// Get the total number of Elements for the pagination
|
||||
$sqlCount = sprintf(
|
||||
'SELECT COUNT(*)
|
||||
FROM tgis_data_history
|
||||
WHERE tagente_id_agente = %d AND end_timestamp > FROM_UNIXTIME(%d)
|
||||
ORDER BY end_timestamp DESC',
|
||||
$agentId,
|
||||
(get_system_time() - $period)
|
||||
);
|
||||
$countData = (int) db_get_value_sql($sqlCount);
|
||||
|
||||
// Get the elements to present in this page
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
|
@ -147,33 +136,39 @@ switch ($config['dbtype']) {
|
|||
|
||||
$result = db_get_all_rows_sql($sql, true);
|
||||
|
||||
if ($result === false) {
|
||||
$sql2 = sprintf(
|
||||
'
|
||||
SELECT current_longitude AS longitude, current_latitude AS latitude, current_altitude AS altitude,
|
||||
start_timestamp, description, number_of_packages, manual_placement
|
||||
FROM tgis_data_status
|
||||
WHERE tagente_id_agente = %d
|
||||
ORDER BY start_timestamp DESC
|
||||
LIMIT %d OFFSET %d',
|
||||
$agentId,
|
||||
$config['block_size'],
|
||||
(int) get_parameter('offset')
|
||||
);
|
||||
$sql2 = sprintf(
|
||||
'
|
||||
SELECT current_longitude AS longitude, current_latitude AS latitude, current_altitude AS altitude,
|
||||
start_timestamp, description, number_of_packages, manual_placement
|
||||
FROM tgis_data_status
|
||||
WHERE tagente_id_agente = %d
|
||||
ORDER BY start_timestamp DESC
|
||||
LIMIT %d OFFSET %d',
|
||||
$agentId,
|
||||
$config['block_size'],
|
||||
(int) get_parameter('offset')
|
||||
);
|
||||
|
||||
$result2 = db_get_all_rows_sql($sql2, true);
|
||||
|
||||
if ($result2 === false) {
|
||||
if ($result === false && $result2 === false) {
|
||||
ui_print_empty_data(__('This agent doesn\'t have any GIS data.'));
|
||||
} else {
|
||||
if ($result === false) {
|
||||
$result = $result2;
|
||||
} else {
|
||||
$result2[0]['end_timestamp'] = date('Y-m-d H:i:s');
|
||||
$result = $result2;
|
||||
array_unshift($result, $result2[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($result !== false) {
|
||||
echo '<h4>'.__('Positional data from the last').' '.human_time_description_raw($period).'</h4>';
|
||||
|
||||
// Get the total elements for UI pagination
|
||||
$countData = count($result);
|
||||
|
||||
if ($countData > 0) {
|
||||
ui_pagination($countData, false);
|
||||
}
|
||||
|
|
|
@ -713,11 +713,7 @@ if (is_ajax()) {
|
|||
|
||||
$values['options'] = json_encode($options);
|
||||
|
||||
$return_update = db_process_sql_update('tnetworkmap_enterprise', $values, ['id' => $id_ent_map]);
|
||||
if (!$return_update) {
|
||||
$return_data['ent'] = false;
|
||||
break;
|
||||
}
|
||||
db_process_sql_update('tnetworkmap_enterprise', $values, ['id' => $id_ent_map]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -735,11 +731,7 @@ if (is_ajax()) {
|
|||
} else {
|
||||
$values['text_filter'] = 'migrated';
|
||||
|
||||
$return_update = db_process_sql_update('tnetwork_map', $values, ['id_networkmap' => $id_open_map]);
|
||||
if (!$return_update) {
|
||||
$return_data['open'] = false;
|
||||
break;
|
||||
}
|
||||
db_process_sql_update('tnetwork_map', $values, ['id_networkmap' => $id_open_map]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1541,7 +1541,9 @@ if (!empty($result)) {
|
|||
$row['str_warning'],
|
||||
$row['max_critical'],
|
||||
$row['min_critical'],
|
||||
$row['str_critical']
|
||||
$row['str_critical'],
|
||||
$row['warning_inverse'],
|
||||
$row['critical_inverse']
|
||||
);
|
||||
|
||||
if (is_numeric($row['datos']) && !modules_is_string_type($row['module_type'])) {
|
||||
|
|
|
@ -280,6 +280,14 @@ if (is_ajax()) {
|
|||
$events,
|
||||
function ($carry, $item) {
|
||||
$tmp = (object) $item;
|
||||
$tmp->meta = is_metaconsole();
|
||||
if (is_metaconsole()) {
|
||||
if ($tmp->server_name !== null) {
|
||||
$tmp->data_server = metaconsole_get_servers($tmp->server_id);
|
||||
$tmp->server_url_hash = metaconsole_get_servers_url_hash($tmp->data_server);
|
||||
}
|
||||
}
|
||||
|
||||
$tmp->evento = str_replace('"', '', io_safe_output($tmp->evento));
|
||||
if (strlen($tmp->evento) >= 255) {
|
||||
$tmp->evento = ui_print_truncate_text($tmp->evento, 255, $tmp->evento, true, false);
|
||||
|
@ -289,6 +297,10 @@ if (is_ajax()) {
|
|||
$tmp->module_name = io_safe_output($tmp->module_name);
|
||||
}
|
||||
|
||||
if ($tmp->comments) {
|
||||
$tmp->comments = ui_print_comments($tmp->comments);
|
||||
}
|
||||
|
||||
$tmp->agent_name = io_safe_output($tmp->agent_name);
|
||||
$tmp->ack_utimestamp = ui_print_timestamp(
|
||||
$tmp->ack_utimestamp,
|
||||
|
@ -1594,6 +1606,28 @@ function process_datatables_callback(table, settings) {
|
|||
|
||||
function process_datatables_item(item) {
|
||||
|
||||
// Url to go to node from meta.
|
||||
var server_url = '';
|
||||
var hashdata = '';
|
||||
if(item.meta === true){
|
||||
if(typeof item.data_server !== 'undefined' && typeof item.server_url_hash !== 'undefined'){
|
||||
server_url = item.data_server.server_url;
|
||||
hashdata = item.server_url_hash;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Show comments events.
|
||||
item.user_comment = item.comments
|
||||
|
||||
if(item.comments.length > 80){
|
||||
|
||||
item.user_comment += ' <a id="show_comments" href="javascript:" onclick="show_event_dialog(\'';
|
||||
item.user_comment += item.b64+"','comments'," + $("#group_rep").val()+');">';
|
||||
item.user_comment += '<?php echo html_print_image('images/eye.png', true, ['title' => __('Show more')]); ?></a>';
|
||||
|
||||
}
|
||||
|
||||
// Grouped events.
|
||||
if(item.max_id_evento) {
|
||||
item.id_evento = item.max_id_evento
|
||||
|
@ -1828,9 +1862,19 @@ function process_datatables_item(item) {
|
|||
|
||||
/* Update column content now to avoid json poisoning. */
|
||||
|
||||
|
||||
// Url to agent view.
|
||||
var url_link = '<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>';
|
||||
var url_link_hash = '';
|
||||
if(item.meta === true){
|
||||
url_link = server_url+'/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=';
|
||||
url_link_hash = hashdata;
|
||||
}
|
||||
|
||||
|
||||
/* Agent name link */
|
||||
if (item.id_agente > 0) {
|
||||
item.agent_name = '<a href="<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>' +item.id_agente+'">' + item.agent_name + '</a>';
|
||||
item.agent_name = '<a href="'+url_link+item.id_agente+url_link_hash+'">' + item.agent_name + '</a>';
|
||||
} else {
|
||||
item.agent_name = '';
|
||||
}
|
||||
|
@ -1840,11 +1884,11 @@ function process_datatables_item(item) {
|
|||
<?php
|
||||
if (in_array('agent_name', $fields)) {
|
||||
?>
|
||||
item.id_agente = '<a href="<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>'+item.id_agente+'">' + item.id_agente + '</a>';
|
||||
item.id_agente = '<a href="'+url_link+item.id_agente+url_link_hash+'">' + item.id_agente + '</a>';
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
item.id_agente = '<a href="<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>'+item.id_agente+'">' + item.agent_name + '</a>';
|
||||
item.id_agente = '<a href="'+url_link+item.id_agente+url_link_hash+'">' + item.agent_name + '</a>';
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -18,6 +18,11 @@ enterprise_include_once('include/functions_policies.php');
|
|||
|
||||
$searchpolicies = check_acl($config['id_user'], 0, 'AW');
|
||||
|
||||
if (!$searchpolicies) {
|
||||
$totalPolicies = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
$selectpolicieIDUp = '';
|
||||
$selectpolicieIDDown = '';
|
||||
$selectNameUp = '';
|
||||
|
@ -169,7 +174,7 @@ switch ($sortField) {
|
|||
break;
|
||||
}
|
||||
|
||||
if ($searchpolicies == 0) {
|
||||
if ($searchpolicies) {
|
||||
/*
|
||||
We take the user groups to get policies that meet the requirements of the search
|
||||
and which the user have permission on this groups
|
||||
|
@ -189,6 +194,7 @@ if ($searchpolicies == 0) {
|
|||
|
||||
$policies = db_process_sql($sql);
|
||||
|
||||
|
||||
if ($policies !== false) {
|
||||
$totalPolicies = count($policies);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ require_once $config['homedir'].'/include/functions_reporting.php';
|
|||
enterprise_include('operation/reporting/custom_reporting.php');
|
||||
|
||||
$searchAgents = $searchAlerts = $searchModules = check_acl($config['id_user'], 0, 'AR');
|
||||
$searchUsers = $searchPolicies = check_acl($config['id_user'], 0, 'AW');
|
||||
$searchUsers = $searchPolicies = check_acl($config['id_user'], 0, 'AR');
|
||||
$searchMaps = $searchReports = $searchGraphs = check_acl($config['id_user'], 0, 'IR');
|
||||
$searchMain = true;
|
||||
$searchHelps = true;
|
||||
|
|
|
@ -18,6 +18,10 @@ require_once $config['homedir'].'/include/functions_users.php';
|
|||
require_once $config['homedir'].'/include/functions_groups.php';
|
||||
|
||||
$searchUsers = check_acl($config['id_user'], 0, 'UM');
|
||||
if (!$searchUsers) {
|
||||
$totalUsers = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
$selectUserIDUp = '';
|
||||
$selectUserIDDown = '';
|
||||
|
|
|
@ -91,7 +91,7 @@ if (!$users || !$searchUsers) {
|
|||
}
|
||||
|
||||
echo '<br />';
|
||||
ui_pagination($totalUsers);
|
||||
// ui_pagination($totalUsers);
|
||||
html_print_table($table);
|
||||
unset($table);
|
||||
ui_pagination($totalUsers);
|
||||
|
|
|
@ -462,6 +462,8 @@ $autorefresh_list_out['operation/agentes/status_monitor'] = 'Monitor detail';
|
|||
$autorefresh_list_out['enterprise/operation/services/services'] = 'Services';
|
||||
$autorefresh_list_out['enterprise/dashboard/main_dashboard'] = 'Dashboard';
|
||||
$autorefresh_list_out['operation/reporting/graph_viewer'] = 'Graph Viewer';
|
||||
$autorefresh_list_out['operation/gis_maps/render_view'] = 'Gis Map';
|
||||
|
||||
$autorefresh_list_out['operation/snmpconsole/snmp_view'] = 'SNMP console';
|
||||
$autorefresh_list_out['operation/agentes/pandora_networkmap'] = 'Network map';
|
||||
$autorefresh_list_out['operation/visual_console/render_view'] = 'Visual console';
|
||||
|
@ -1150,7 +1152,7 @@ function ehorus_connection_test(host, port) {
|
|||
var user = $('input#text-ehorus_user_level_user').val();
|
||||
var pass = $('input#password-ehorus_user_level_pass').val();
|
||||
|
||||
debugger;
|
||||
|
||||
var badRequestMessage = '<?php echo __('Empty user or password'); ?>';
|
||||
var notFoundMessage = '<?php echo __('User not found'); ?>';
|
||||
var invalidPassMessage = '<?php echo __('Invalid password'); ?>';
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.739
|
||||
%define release 191010
|
||||
%define version 7.0NG.740
|
||||
%define release 191029
|
||||
|
||||
# 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.739
|
||||
%define release 191010
|
||||
%define version 7.0NG.740
|
||||
%define release 191029
|
||||
|
||||
# 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.739
|
||||
%define release 191010
|
||||
%define version 7.0NG.740
|
||||
%define release 191029
|
||||
%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.739"
|
||||
PI_VERSION="7.0NG.740"
|
||||
FORCE=0
|
||||
DESTDIR=""
|
||||
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
||||
|
|
|
@ -112,7 +112,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('MR', 32),
|
||||
('identification_reminder', 1),
|
||||
('identification_reminder_timestamp', 0),
|
||||
('current_package_enterprise', '739'),
|
||||
('current_package_enterprise', '740'),
|
||||
('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,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.739-191010
|
||||
Version: 7.0NG.740-191029
|
||||
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.739-191010"
|
||||
pandora_version="7.0NG.740-191029"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#############################################################################
|
||||
# Pandora FMS Server Parameters
|
||||
# Pandora FMS, the Flexible Monitoring System.
|
||||
# Version 7.0NG.739
|
||||
# Version 7.0NG.740
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2017 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -44,8 +44,8 @@ our @EXPORT = qw(
|
|||
);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.739";
|
||||
my $pandora_build = "191010";
|
||||
my $pandora_version = "7.0NG.740";
|
||||
my $pandora_build = "191029";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -1141,21 +1141,21 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
|||
#logger($pa_config, "Clean name ".$clean_name, 10);
|
||||
# User defined alert
|
||||
if ($action->{'internal'} == 0) {
|
||||
$macros{_field1_} = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$macros{_field2_} = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$macros{_field3_} = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$macros{_field4_} = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$macros{_field5_} = subst_alert_macros ($field5, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$macros{_field6_} = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$macros{_field7_} = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$macros{_field8_} = subst_alert_macros ($field8, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$macros{_field9_} = subst_alert_macros ($field9, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$macros{_field10_} = subst_alert_macros ($field10, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$macros{_field11_} = subst_alert_macros ($field11, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$macros{_field12_} = subst_alert_macros ($field12, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$macros{_field13_} = subst_alert_macros ($field13, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$macros{_field14_} = subst_alert_macros ($field14, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$macros{_field15_} = subst_alert_macros ($field15, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$macros{_field1_} = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$macros{_field2_} = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$macros{_field3_} = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$macros{_field4_} = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$macros{_field5_} = subst_alert_macros ($field5, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$macros{_field6_} = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$macros{_field7_} = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$macros{_field8_} = subst_alert_macros ($field8, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$macros{_field9_} = subst_alert_macros ($field9, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$macros{_field10_} = subst_alert_macros ($field10, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$macros{_field11_} = subst_alert_macros ($field11, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$macros{_field12_} = subst_alert_macros ($field12, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$macros{_field13_} = subst_alert_macros ($field13, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$macros{_field14_} = subst_alert_macros ($field14, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$macros{_field15_} = subst_alert_macros ($field15, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
|
||||
my @command_args = ();
|
||||
# divide command into words based on quotes and whitespaces
|
||||
|
@ -1186,7 +1186,7 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
|||
|
||||
# Internal Audit
|
||||
} elsif ($clean_name eq "Internal Audit") {
|
||||
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
pandora_audit ($pa_config, $field1, defined ($agent) ? safe_output($agent->{'alias'}) : 'N/A', 'Alert (' . safe_output($alert->{'description'}) . ')', $dbh);
|
||||
|
||||
# Email
|
||||
|
@ -1363,12 +1363,12 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
|||
|
||||
# Pandora FMS Event
|
||||
} elsif ($clean_name eq "Monitoring Event") {
|
||||
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field6 = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field7 = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field8 = subst_alert_macros ($field8, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$field6 = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$field7 = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$field8 = subst_alert_macros ($field8, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
|
||||
# Field 1 (event text)
|
||||
my $event_text = $field1;
|
||||
|
@ -1448,13 +1448,13 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
|||
my $config_api_pass = pandora_get_tconfig_token ($dbh, 'integria_api_pass', '');
|
||||
my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', '');
|
||||
my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'integria_pass', '');
|
||||
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field2 = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field5 = subst_alert_macros ($field5, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field6 = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field7 = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$field2 = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$field5 = subst_alert_macros ($field5, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$field6 = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
$field7 = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
|
||||
# Field 1 (Integria IMS API path)
|
||||
my $api_path = $config_api_path . "/integria/include/api.php";
|
||||
|
@ -1513,8 +1513,7 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
|||
} elsif ($clean_name eq "Generate Notification") {
|
||||
|
||||
# Translate macros
|
||||
$field3 = subst_alert_macros($field3, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field4 = subst_alert_macros($field4, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field3 = subst_alert_macros($field3, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
|
||||
# If no targets ignore notification
|
||||
if (defined($field1) && defined($field2) && ($field1 ne "" || $field2 ne "")) {
|
||||
|
@ -3259,7 +3258,7 @@ sub pandora_create_agent ($$$$$$$$$$;$$$$$$$$$$) {
|
|||
'custom_id' => $custom_id,
|
||||
'url_address' => $url_address,
|
||||
'timezone_offset' => $timezone_offset,
|
||||
'alias' => $alias,
|
||||
'alias' => safe_input($alias),
|
||||
'update_module_count' => 1, # Force to replicate in metaconsole
|
||||
});
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ our @EXPORT = qw(
|
|||
get_addr_id
|
||||
get_agent_addr_id
|
||||
get_agent_id
|
||||
get_agent_ids_from_alias
|
||||
get_agent_address
|
||||
get_agent_alias
|
||||
get_agent_group
|
||||
|
@ -232,6 +233,17 @@ sub get_agent_id ($$) {
|
|||
return defined ($rc) ? $rc : -1;
|
||||
}
|
||||
|
||||
########################################################################
|
||||
## Return agent IDs given an agent alias.
|
||||
########################################################################
|
||||
sub get_agent_ids_from_alias ($$) {
|
||||
my ($dbh, $agent_alias) = @_;
|
||||
|
||||
my @rc = get_db_rows ($dbh, "SELECT id_agente, nombre FROM tagente WHERE alias = ?", safe_input($agent_alias));
|
||||
|
||||
return @rc;
|
||||
}
|
||||
|
||||
########################################################################
|
||||
## Return server ID given the name of server.
|
||||
########################################################################
|
||||
|
@ -956,7 +968,7 @@ sub db_process_insert($$$$;@) {
|
|||
}
|
||||
}
|
||||
my $columns_string = join(',', @columns_array);
|
||||
|
||||
|
||||
my $res = db_insert ($dbh,
|
||||
$index,
|
||||
"INSERT INTO $table ($columns_string) VALUES " . $wildcards, @values_array);
|
||||
|
|
|
@ -230,7 +230,7 @@ sub data_consumer ($$) {
|
|||
}
|
||||
|
||||
# Ignore the timestamp in the XML and use the file timestamp instead
|
||||
$xml_data->{'timestamp'} = strftime ("%Y-%m-%d %H:%M:%S", localtime((stat($file_name))[9])) if ($pa_config->{'use_xml_timestamp'} eq '1' || ! defined ($xml_data->{'timestamp'}));
|
||||
$xml_data->{'timestamp'} = strftime ("%Y-%m-%d %H:%M:%S", localtime((stat($file_name))[9])) if ($pa_config->{'use_xml_timestamp'} eq '0' || ! defined ($xml_data->{'timestamp'}));
|
||||
|
||||
# Double check that the file exists
|
||||
if (! -f $file_name) {
|
||||
|
|
|
@ -360,8 +360,9 @@ sub PandoraFMS::Recon::Base::guess_os($$) {
|
|||
if (-x $self->{'pa_config'}->{'xprobe2'}) {
|
||||
my $return = `"$self->{pa_config}->{xprobe2}" $device 2>$DEVNULL`;
|
||||
if ($? == 0) {
|
||||
my ($output) = $a =~ /Running OS:(.*)/;
|
||||
return pandora_get_os($self->{'dbh'}, $output);
|
||||
if($return =~ /Running OS:(.*)/) {
|
||||
return pandora_get_os($self->{'dbh'}, $1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -370,8 +371,9 @@ sub PandoraFMS::Recon::Base::guess_os($$) {
|
|||
my $return = `"$self->{pa_config}->{nmap}" -F -O $device 2>$DEVNULL`;
|
||||
return OS_OTHER if ($? != 0);
|
||||
|
||||
my ($output) = $return =~ /Aggressive OS guesses:\s*(.*)/;
|
||||
return pandora_get_os($self->{'dbh'}, $output);
|
||||
if ($return =~ /Aggressive OS guesses:\s*(.*)/) {
|
||||
return pandora_get_os($self->{'dbh'}, $1);
|
||||
}
|
||||
}
|
||||
|
||||
return OS_OTHER;
|
||||
|
@ -536,7 +538,7 @@ sub PandoraFMS::Recon::Base::create_agents($$) {
|
|||
return undef;
|
||||
}
|
||||
|
||||
if ($agent->{'address'} ne '') {
|
||||
if (defined($agent->{'address'}) && $agent->{'address'} ne '') {
|
||||
pandora_add_agent_address(
|
||||
$pa_config, $agent_id, $agent->{'agent_name'},
|
||||
$agent->{'address'}, $dbh
|
||||
|
@ -582,44 +584,14 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
|||
# Clean name.
|
||||
$device = clean_blank($device);
|
||||
|
||||
my @agents = get_db_rows($self->{'dbh'},
|
||||
'SELECT * FROM taddress, taddress_agent, tagente
|
||||
WHERE tagente.id_agente = taddress_agent.id_agent
|
||||
AND taddress_agent.id_a = taddress.id_a
|
||||
AND ip = ?', $device
|
||||
);
|
||||
|
||||
# Does the host already exist?
|
||||
my $agent;
|
||||
foreach my $candidate (@agents) {
|
||||
$agent = {map {$_} %$candidate}; # copy contents, do not use shallow copy
|
||||
# exclude $device itself, because it handle corner case when target includes NAT
|
||||
my @registered = map {$_->{ip}} get_db_rows($self->{'dbh'},
|
||||
'SELECT ip FROM taddress, taddress_agent, tagente
|
||||
WHERE tagente.id_agente = taddress_agent.id_agent
|
||||
AND taddress_agent.id_a = taddress.id_a
|
||||
AND tagente.id_agente = ?
|
||||
AND taddress.ip != ?', $agent->{id_agente}, $device
|
||||
);
|
||||
foreach my $ip_addr (@registered) {
|
||||
my @matched = grep { $_ =~ /^$ip_addr$/ } $self->get_addresses($device);
|
||||
if (scalar(@matched) == 0) {
|
||||
$agent = undef;
|
||||
last;
|
||||
}
|
||||
}
|
||||
last if(defined($agent)); # exit loop if match all ip_addr
|
||||
}
|
||||
|
||||
if (!defined($agent)) {
|
||||
$agent = get_agent_from_name($self->{'dbh'}, $device);
|
||||
}
|
||||
# Resolve hostnames.
|
||||
my $host_name = (($self->{'resolve_names'} == 1) ? gethostbyaddr(inet_aton($device), AF_INET) : $device);
|
||||
# Fallback to device IP if host name could not be resolved.
|
||||
$host_name = $device if (!defined($host_name) || $host_name eq '');
|
||||
my $agent = locate_agent($self->{'pa_config'}, $self->{'dbh'}, $host_name);
|
||||
|
||||
my ($agent_id, $agent_learning);
|
||||
if (!defined($agent)) {
|
||||
|
||||
# Resolve hostnames.
|
||||
my $host_name = $self->{'resolve_names'} == 1 ? gethostbyaddr (inet_aton($device), AF_INET) : $device;
|
||||
$host_name = $device unless defined ($host_name);
|
||||
|
||||
# Guess the OS.
|
||||
|
|
|
@ -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.739";
|
||||
my $pandora_build = "191010";
|
||||
my $pandora_version = "7.0NG.740";
|
||||
my $pandora_build = "191029";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
@ -762,7 +762,7 @@ sub transfer_xml {
|
|||
my $file_path;
|
||||
|
||||
if (! (empty ($name))) {
|
||||
$file_name = $name . "." . sprintf("%d",time()) . ".data";
|
||||
$file_name = $name . "." . sprintf("%d",getCurrentUTimeMilis(). (rand()*10000)) . ".data";
|
||||
}
|
||||
else {
|
||||
# Inherit file name
|
||||
|
|
|
@ -141,6 +141,7 @@ our @EXPORT = qw(
|
|||
long_to_ip
|
||||
ip_to_long
|
||||
get_enabled_servers
|
||||
dateTimeToTimestamp
|
||||
);
|
||||
|
||||
# ID of the different servers
|
||||
|
@ -641,19 +642,29 @@ sub logger ($$;$) {
|
|||
# Set the security level
|
||||
my $security_level = 'info';
|
||||
if ($level < 2) {
|
||||
$security = 'crit';
|
||||
$security_level = 'crit';
|
||||
} elsif ($level < 5) {
|
||||
$security = 'warn';
|
||||
$security_level = 'warn';
|
||||
}
|
||||
|
||||
openlog('pandora_server', 'ndelay', 'daemon');
|
||||
syslog($security_level, $message);
|
||||
closelog();
|
||||
} else {
|
||||
# Obtain the script that invoke this log
|
||||
my $parent_caller = "";
|
||||
$parent_caller = ( caller(2) )[1];
|
||||
if (defined $parent_caller) {
|
||||
$parent_caller = (split '/', $parent_caller)[-1];
|
||||
$parent_caller =~ s/\.[^.]+$//;
|
||||
$parent_caller = " ** " . $parent_caller . " **: ";
|
||||
} else {
|
||||
$parent_caller = " ";
|
||||
}
|
||||
open (FILE, ">> $file") or die "[FATAL] Could not open logfile '$file'";
|
||||
# Get an exclusive lock on the file (LOCK_EX)
|
||||
flock (FILE, 2);
|
||||
print FILE strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " " . (defined($pa_config->{'servername'}) ? $pa_config->{'servername'} : '') . " [V". $level ."] " . $message . "\n";
|
||||
print FILE strftime ("%Y-%m-%d %H:%M:%S", localtime()) . $parent_caller . (defined($pa_config->{'servername'}) ? $pa_config->{'servername'} : '') . " [V". $level ."] " . $message . "\n";
|
||||
close (FILE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Server
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.739
|
||||
%define release 191010
|
||||
%define version 7.0NG.740
|
||||
%define release 191029
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Server
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.739
|
||||
%define release 191010
|
||||
%define version 7.0NG.740
|
||||
%define release 191029
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.739"
|
||||
PI_BUILD="191010"
|
||||
PI_VERSION="7.0NG.740"
|
||||
PI_BUILD="191029"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -34,7 +34,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.739 PS191010";
|
||||
my $version = "7.0NG.740 PS191029";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue