mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 00:04:37 +02:00
Merge remote-tracking branch 'origin/develop' into ent-4112-Bug-visual-cuadro-de-datos-tipo-string
Conflicts: pandora_console/include/styles/js/jquery-ui_custom.css
This commit is contained in:
commit
c28185965a
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.735, AIX version
|
||||
# Version 7.0NG.736, 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.735, FreeBSD Version
|
||||
# Version 7.0NG.736, 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.735, HP-UX Version
|
||||
# Version 7.0NG.736, 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.735, GNU/Linux
|
||||
# Version 7.0NG.736, 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.735, GNU/Linux
|
||||
# Version 7.0NG.736, 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.735, Solaris Version
|
||||
# Version 7.0NG.736, 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.735
|
||||
# Version 7.0NG.736
|
||||
|
||||
# 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.735, AIX version
|
||||
# Version 7.0NG.736, 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.735
|
||||
# Version 7.0NG.736
|
||||
# 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.735, HPUX Version
|
||||
# Version 7.0NG.736, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.735
|
||||
# Version 7.0NG.736
|
||||
# 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.735
|
||||
# Version 7.0NG.736
|
||||
# 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.735
|
||||
# Version 7.0NG.736
|
||||
# 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.735, Solaris version
|
||||
# Version 7.0NG.736, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.735, AIX version
|
||||
# Version 7.0NG.736, 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.735-190614
|
||||
Version: 7.0NG.736-190628
|
||||
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.735-190614"
|
||||
pandora_version="7.0NG.736-190628"
|
||||
|
||||
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.735, GNU/Linux
|
||||
# Version 7.0NG.736, 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.735, FreeBSD Version
|
||||
# Version 7.0NG.736, 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.735, HP-UX Version
|
||||
# Version 7.0NG.736, 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.735, GNU/Linux
|
||||
# Version 7.0NG.736, 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.735, GNU/Linux
|
||||
# Version 7.0NG.736, 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.735, NetBSD Version
|
||||
# Version 7.0NG.736, 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.735, Solaris Version
|
||||
# Version 7.0NG.736, 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.735';
|
||||
use constant AGENT_BUILD => '190614';
|
||||
use constant AGENT_VERSION => '7.0NG.736';
|
||||
use constant AGENT_BUILD => '190628';
|
||||
|
||||
# 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.735
|
||||
%define release 190614
|
||||
%define version 7.0NG.736
|
||||
%define release 190628
|
||||
|
||||
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.735
|
||||
%define release 190614
|
||||
%define version 7.0NG.736
|
||||
%define release 190628
|
||||
|
||||
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.735"
|
||||
PI_BUILD="190614"
|
||||
PI_VERSION="7.0NG.736"
|
||||
PI_BUILD="190628"
|
||||
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.735
|
||||
# Version 7.0NG.736
|
||||
|
||||
# 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.735}
|
||||
{Pandora FMS Windows Agent v7.0NG.736}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{190614}
|
||||
{190628}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.735(Build 190614)")
|
||||
#define PANDORA_VERSION ("7.0NG.736(Build 190628)")
|
||||
|
||||
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.735(Build 190614))"
|
||||
VALUE "ProductVersion", "(7.0NG.736(Build 190628))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.735-190614
|
||||
Version: 7.0NG.736-190628
|
||||
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.735-190614"
|
||||
pandora_version="7.0NG.736-190628"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -1,23 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Pandora FMS - http://pandorafms.com
|
||||
* ==================================================
|
||||
* Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; version 2
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
$refr = (int) get_parameter('refresh', 0);
|
||||
// By default 30 seconds
|
||||
function mainAgentsModules()
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Load global vars
|
||||
// Load global vars.
|
||||
include_once 'include/config.php';
|
||||
include_once 'include/functions_reporting.php';
|
||||
include_once $config['homedir'].'/include/functions_agents.php';
|
||||
@ -25,7 +26,7 @@ function mainAgentsModules()
|
||||
include_once $config['homedir'].'/include/functions_users.php';
|
||||
|
||||
check_login();
|
||||
// ACL Check
|
||||
// ACL Check.
|
||||
if (! check_acl($config['id_user'], 0, 'AR')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
@ -37,7 +38,7 @@ function mainAgentsModules()
|
||||
|
||||
// Update network modules for this group
|
||||
// Check for Network FLAG change request
|
||||
// Made it a subquery, much faster on both the database and server side
|
||||
// Made it a subquery, much faster on both the database and server side.
|
||||
if (isset($_GET['update_netgroup'])) {
|
||||
$group = get_parameter_get('update_netgroup', 0);
|
||||
if (check_acl($config['id_user'], $group, 'AW')) {
|
||||
@ -62,7 +63,7 @@ function mainAgentsModules()
|
||||
|
||||
$modulegroup = get_parameter('modulegroup', 0);
|
||||
$refr = (int) get_parameter('refresh', 0);
|
||||
// By default 30 seconds
|
||||
// By default 30 seconds.
|
||||
$recursion = get_parameter('recursion', 0);
|
||||
$group_id = (int) get_parameter('group_id', 0);
|
||||
$offset = (int) get_parameter('offset', 0);
|
||||
@ -79,7 +80,8 @@ function mainAgentsModules()
|
||||
$full_modules_selected = explode(';', get_parameter('full_modules_selected', 0));
|
||||
$full_agents_id = explode(';', get_parameter('full_agents_id', 0));
|
||||
|
||||
if ($save_serialize && $update_item == '') {
|
||||
// In full screen there is no pagination neither filters.
|
||||
if (( ($config['pure'] == 0 && $save_serialize) && $update_item == '' ) || ( ($config['pure'] == 1 && $save_serialize == 0) && $update_item == '' )) {
|
||||
$unserialize_modules_selected = unserialize_in_temp($config['id_user'].'_agent_module', true, 1);
|
||||
$unserialize_agents_id = unserialize_in_temp($config['id_user'].'_agents', true, 1);
|
||||
if ($unserialize_modules_selected) {
|
||||
@ -102,7 +104,6 @@ function mainAgentsModules()
|
||||
serialize_in_temp($agents_id, $config['id_user'].'_agents', 1);
|
||||
}
|
||||
|
||||
// if($agents_id != -1) $agents_id = null;
|
||||
if ($config['pure'] == 0) {
|
||||
if ($modules_selected[0] && $agents_id[0]) {
|
||||
$full_modules = urlencode(implode(';', $modules_selected));
|
||||
@ -124,13 +125,13 @@ function mainAgentsModules()
|
||||
}
|
||||
}
|
||||
|
||||
// groups
|
||||
// Groups.
|
||||
$filter_groups_label = '<b>'.__('Group').'</b>';
|
||||
$filter_groups = html_print_select_groups(false, 'AR', true, 'group_id', $group_id, '', '', '', true, false, true, '', false, 'width: auto;');
|
||||
|
||||
$filter_recursion_label = '<b>'.__('Recursion').'</b>';
|
||||
$filter_recursion = html_print_checkbox('recursion', 1, 0, true);
|
||||
// groups module
|
||||
// Groups module.
|
||||
$filter_module_groups_label = '<b>'.__('Module group').'</b>';
|
||||
$filter_module_groups = html_print_select_from_sql(
|
||||
'SELECT * FROM tmodule_group ORDER BY name',
|
||||
@ -146,7 +147,7 @@ function mainAgentsModules()
|
||||
'width: auto;'
|
||||
);
|
||||
|
||||
// agent
|
||||
// Agent.
|
||||
$agents = agents_get_group_agents($group_id);
|
||||
if ((empty($agents)) || $agents == -1) {
|
||||
$agents = [];
|
||||
@ -155,7 +156,7 @@ function mainAgentsModules()
|
||||
$filter_agents_label = '<b>'.__('Agents').'</b>';
|
||||
$filter_agents = html_print_select($agents, 'id_agents2[]', $agents_id, '', '', 0, true, true, true, '', false, 'min-width: 180px; max-width: 200px;');
|
||||
|
||||
// type show
|
||||
// Type show.
|
||||
$selection = [
|
||||
0 => __('Show common modules'),
|
||||
1 => __('Show all modules'),
|
||||
@ -163,12 +164,12 @@ function mainAgentsModules()
|
||||
$filter_type_show_label = '<b>'.__('Show common modules').'</b>';
|
||||
$filter_type_show = html_print_select($selection, 'selection_agent_module', $selection_a_m, '', '', 0, true, false, true, '', false, 'min-width: 180px;');
|
||||
|
||||
// modules
|
||||
// Modules.
|
||||
$all_modules = select_modules_for_agent_group($group_id, $agents_id, $selection_a_m, false);
|
||||
$filter_modules_label = '<b>'.__('Module').'</b>';
|
||||
$filter_modules = html_print_select($all_modules, 'module[]', $modules_selected, '', '', 0, true, true, false, '', false, 'min-width: 180px; max-width: 200px;');
|
||||
|
||||
// update
|
||||
// Update.
|
||||
$filter_update = html_print_submit_button(__('Update item'), 'edit_item', false, 'class="sub upd"', true);
|
||||
|
||||
$onheader = [
|
||||
@ -178,8 +179,11 @@ function mainAgentsModules()
|
||||
'combo_groups' => $filter_groups,
|
||||
];
|
||||
|
||||
// Old style table, we need a lot of special formatting,don't use table function
|
||||
// Prepare old-style table
|
||||
/*
|
||||
* Old style table, we need a lot of special formatting,don't use table function.
|
||||
* Prepare old-style table.
|
||||
*/
|
||||
|
||||
if ($config['pure'] == 0) {
|
||||
// Header.
|
||||
ui_print_page_header(
|
||||
@ -200,38 +204,51 @@ function mainAgentsModules()
|
||||
$full_modules = urlencode(implode(';', $full_modules_selected));
|
||||
$full_agents = urlencode(implode(';', $full_agents_id));
|
||||
|
||||
$url = " index.php?sec=view&sec2=extensions/agents_modules&pure=0&offset=$offset
|
||||
$url = 'index.php?sec=view&sec2=extensions/agents_modules&pure=0&offset=$offset
|
||||
&group_id=$group_id&modulegroup=$modulegroup&refresh=$refr&full_modules_selected=$full_modules
|
||||
&full_agents_id=$full_agents&selection_agent_module=$selection_a_m";
|
||||
&full_agents_id=$full_agents&selection_agent_module=$selection_a_m';
|
||||
} else {
|
||||
$url = " index.php?sec=view&sec2=extensions/agents_modules&pure=0&offset=$offset&group_id=$group_id&modulegroup=$modulegroup&refresh=$refr";
|
||||
$url = 'index.php?sec=view&sec2=extensions/agents_modules&pure=0&offset=$offset&group_id=$group_id&modulegroup=$modulegroup&refresh=$refr';
|
||||
}
|
||||
|
||||
// Floating menu - Start
|
||||
// Floating menu - Start.
|
||||
echo '<div id="vc-controls" style="z-index: 999">';
|
||||
|
||||
echo '<div id="menu_tab">';
|
||||
echo '<ul class="mn">';
|
||||
|
||||
// Quit fullscreen
|
||||
// Quit fullscreen.
|
||||
echo '<li class="nomn">';
|
||||
echo '<a target="_top" href="'.$url.'">';
|
||||
echo html_print_image('images/normal_screen.png', true, ['title' => __('Back to normal mode')]);
|
||||
echo '</a>';
|
||||
echo '</li>';
|
||||
|
||||
// Countdown
|
||||
// Countdown.
|
||||
echo '<li class="nomn">';
|
||||
echo '<div class="vc-refr">';
|
||||
echo '<div class="vc-countdown"></div>';
|
||||
echo '<div class="vc-countdown style="display: inline;"></div>';
|
||||
echo '<div id="vc-refr-form">';
|
||||
echo __('Refresh').':';
|
||||
echo html_print_select(get_refresh_time_array(), 'refresh', $refr, '', '', 0, true, false, false);
|
||||
echo html_print_select(
|
||||
get_refresh_time_array(),
|
||||
'refresh',
|
||||
$refr,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
'margin-top: 3px;'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</li>';
|
||||
|
||||
// Console name
|
||||
// Console name.
|
||||
echo '<li class="nomn">';
|
||||
echo '<div class="vc-title">'.__('Agent/module view').'</div>';
|
||||
echo '</li>';
|
||||
@ -240,35 +257,35 @@ function mainAgentsModules()
|
||||
echo '</div>';
|
||||
|
||||
echo '</div>';
|
||||
// Floating menu - End
|
||||
// Floating menu - End.
|
||||
ui_require_jquery_file('countdown');
|
||||
}
|
||||
|
||||
if ($config['pure'] != 1) {
|
||||
echo '<form method="post" action="'.ui_get_url_refresh(['offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup]).'">';
|
||||
|
||||
echo '<table class="databox filters" cellpadding="0" cellspacing="0" border="0" style="width:100%;">';
|
||||
echo '<tr>';
|
||||
echo '<td>'.$filter_groups_label.'</td>';
|
||||
echo '<td>'.$filter_groups.' '.$filter_recursion_label.$filter_recursion.'</td>';
|
||||
echo '<td></td>';
|
||||
echo '<td></td>';
|
||||
echo '<td>'.$filter_module_groups_label.'</td>';
|
||||
echo '<td>'.$filter_module_groups.'</td>';
|
||||
echo '</tr>';
|
||||
echo '<tr>';
|
||||
echo '<td>'.$filter_agents_label.'</td>';
|
||||
echo '<td>'.$filter_agents.'</td>';
|
||||
echo '<td>'.$filter_type_show_label.'</td>';
|
||||
echo '<td>'.$filter_type_show.'</td>';
|
||||
echo '<td>'.$filter_modules_label.'</td>';
|
||||
echo '<td>'.$filter_modules.'</td>';
|
||||
echo '</tr>';
|
||||
echo '<tr>';
|
||||
echo "<td colspan=6 ><span style='float: right; padding-right: 20px;'>".$filter_update.'</sapn></td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
$show_filters = '<form method="post" action="'.ui_get_url_refresh(['offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup]).'" style="width:100%;">';
|
||||
$show_filters .= '<table class="white_table" cellpadding="0" cellspacing="0" border="0" style="width:100%; border:none;">';
|
||||
$show_filters .= '<tr>';
|
||||
$show_filters .= '<td>'.$filter_groups_label.'</td>';
|
||||
$show_filters .= '<td>'.$filter_groups.' '.$filter_recursion_label.$filter_recursion.'</td>';
|
||||
$show_filters .= '<td></td>';
|
||||
$show_filters .= '<td></td>';
|
||||
$show_filters .= '<td>'.$filter_module_groups_label.'</td>';
|
||||
$show_filters .= '<td>'.$filter_module_groups.'</td>';
|
||||
$show_filters .= '</tr>';
|
||||
$show_filters .= '<tr>';
|
||||
$show_filters .= '<td>'.$filter_agents_label.'</td>';
|
||||
$show_filters .= '<td>'.$filter_agents.'</td>';
|
||||
$show_filters .= '<td>'.$filter_type_show_label.'</td>';
|
||||
$show_filters .= '<td>'.$filter_type_show.'</td>';
|
||||
$show_filters .= '<td>'.$filter_modules_label.'</td>';
|
||||
$show_filters .= '<td>'.$filter_modules.'</td>';
|
||||
$show_filters .= '</tr>';
|
||||
$show_filters .= '<tr>';
|
||||
$show_filters .= "<td colspan=6 ><span style='float: right; padding-right: 20px;'>".$filter_update.'</sapn></td>';
|
||||
$show_filters .= '</tr>';
|
||||
$show_filters .= '</table>';
|
||||
$show_filters .= '</form>';
|
||||
ui_toggle($show_filters, __('Filters'));
|
||||
}
|
||||
|
||||
if ($agents_id[0] != -1) {
|
||||
@ -291,7 +308,7 @@ function mainAgentsModules()
|
||||
|
||||
$count = 0;
|
||||
foreach ($agents as $agent) {
|
||||
// TODO TAGS agents_get_modules
|
||||
// TODO TAGS agents_get_modules.
|
||||
$module = agents_get_modules(
|
||||
$agent,
|
||||
false,
|
||||
@ -339,7 +356,7 @@ function mainAgentsModules()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// TODO TAGS agents_get_modules
|
||||
// TODO TAGS agents_get_modules.
|
||||
$all_modules = agents_get_modules(
|
||||
$agents,
|
||||
false,
|
||||
@ -414,11 +431,11 @@ function mainAgentsModules()
|
||||
|
||||
if ($hor_offset > 0) {
|
||||
$new_hor_offset = ($hor_offset - $block);
|
||||
echo "<th width='20px' "."style='vertical-align:top; padding-top: 35px;' "."rowspan='".($nagents + 1)."'>"."<a href='index.php?".'extension_in_menu=estado&'.'sec=extensions&'.'sec2=extensions/agents_modules&'.'refr=0&'.'save_serialize=1&'.'selection_a_m='.$selection_a_m.'&'.'hor_offset='.$new_hor_offset.'&'.'offset='.$offset."'>".html_print_image(
|
||||
'images/arrow_left.png',
|
||||
echo "<th width='20px' style='vertical-align: middle; text-align: center;' rowspan='".($nagents + 1)."'><a href='index.php?".'extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&refr=0&save_serialize=1&selection_a_m='.$selection_a_m.'&hor_offset='.$new_hor_offset.'&offset='.$offset."'>".html_print_image(
|
||||
'images/arrow_left_green.png',
|
||||
true,
|
||||
['title' => __('Previous modules')]
|
||||
).'</a>'.'</th>';
|
||||
).'</a></th>';
|
||||
}
|
||||
|
||||
$nmodules = 0;
|
||||
@ -440,11 +457,11 @@ function mainAgentsModules()
|
||||
|
||||
if (($hor_offset + $block) < $nmodules) {
|
||||
$new_hor_offset = ($hor_offset + $block);
|
||||
echo "<th width='20px' "."style='vertical-align:top; padding-top: 35px;' "."rowspan='".($nagents + 1)."'>"."<a href='index.php?".'extension_in_menu=estado&'.'sec=extensions&'.'sec2=extensions/agents_modules&'.'save_serialize=1&'.'selection_a_m='.$selection_a_m.'&'.'hor_offset='.$new_hor_offset.'&'.'offset='.$offset."'>".html_print_image(
|
||||
'images/arrow.png',
|
||||
echo "<th width='20px' style='vertical-align: middle; text-align: center;' rowspan='".($nagents + 1)."'><a href='index.php?".'extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&selection_a_m='.$selection_a_m.'&hor_offset='.$new_hor_offset.'&offset='.$offset."'>".html_print_image(
|
||||
'images/arrow_right_green.png',
|
||||
true,
|
||||
['title' => __('More modules')]
|
||||
).'</a>'.'</th>';
|
||||
).'</a></th>';
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
@ -457,12 +474,12 @@ function mainAgentsModules()
|
||||
$filter_agents['id_grupo'] = $group_id;
|
||||
}
|
||||
|
||||
// Prepare pagination
|
||||
$url = 'index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&'.'hor_offset='.$hor_offset.'&selection_a_m='.$selection_a_m;
|
||||
// Prepare pagination.
|
||||
$url = 'index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&hor_offset='.$hor_offset.'&selection_a_m='.$selection_a_m;
|
||||
ui_pagination($total_pagination, $url);
|
||||
|
||||
foreach ($agents as $agent) {
|
||||
// Get stats for this group
|
||||
// Get stats for this group.
|
||||
$agent_status = agents_get_status($agent['id_agente']);
|
||||
$alias = db_get_row('tagente', 'id_agente', $agent['id_agente']);
|
||||
if (empty($alias['alias'])) {
|
||||
@ -471,29 +488,29 @@ function mainAgentsModules()
|
||||
|
||||
switch ($agent_status) {
|
||||
case 4:
|
||||
// Alert fired status
|
||||
// Alert fired status.
|
||||
$rowcolor = 'group_view_alrm';
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// Critical status
|
||||
// Critical status.
|
||||
$rowcolor = 'group_view_crit';
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// Warning status
|
||||
// Warning status.
|
||||
$rowcolor = 'group_view_warn';
|
||||
break;
|
||||
|
||||
case 0:
|
||||
// Normal status
|
||||
// Normal status.
|
||||
$rowcolor = 'group_view_ok';
|
||||
break;
|
||||
|
||||
case 3:
|
||||
case -1:
|
||||
default:
|
||||
// Unknown status
|
||||
// Unknown status.
|
||||
$rowcolor = 'group_view_unk';
|
||||
break;
|
||||
}
|
||||
@ -502,7 +519,7 @@ function mainAgentsModules()
|
||||
|
||||
echo "<td class='$rowcolor'>
|
||||
<a class='$rowcolor' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$agent['id_agente']."'>".$alias['alias'].'</a></td>';
|
||||
// TODO TAGS agents_get_modules
|
||||
// TODO TAGS agents_get_modules.
|
||||
$agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, true);
|
||||
|
||||
$nmodules = 0;
|
||||
@ -572,18 +589,23 @@ function mainAgentsModules()
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo "<div class='legend_basic' style='width: 96%'>";
|
||||
$show_legend = "<div class='legend_white'>";
|
||||
$show_legend .= "<div style='display: flex;align-items: center;'>
|
||||
<div class='legend_square_simple'><div style='background-color: ".COL_ALERTFIRED.";'></div></div>".__('Orange cell when the module has fired alerts').'</div>';
|
||||
$show_legend .= "<div style='display: flex;align-items: center;'>
|
||||
<div class='legend_square_simple'><div style='background-color: ".COL_CRITICAL.";'></div></div>".__('Red cell when the module has a critical status').'
|
||||
</div>';
|
||||
$show_legend .= "<div style='display: flex;align-items: center;'>
|
||||
<div class='legend_square_simple'><div style='background-color: ".COL_WARNING.";'></div></div>".__('Yellow cell when the module has a warning status').'</div>';
|
||||
$show_legend .= "<div style='display: flex;align-items: center;'>
|
||||
<div class='legend_square_simple'><div style='background-color: ".COL_NORMAL.";'></div></div>".__('Green cell when the module has a normal status').'</div>';
|
||||
$show_legend .= "<div style='display: flex;align-items: center;'>
|
||||
<div class='legend_square_simple'><div style='background-color: ".COL_UNKNOWN.";'></div></div>".__('Grey cell when the module has an unknown status').'</div>';
|
||||
$show_legend .= "<div style='display: flex;align-items: center;'>
|
||||
<div class='legend_square_simple'><div style='background-color: ".COL_NOTINIT.";'></div></div>".__("Cell turns blue when the module is in 'not initialize' status").'</div>';
|
||||
$show_legend .= '</div>';
|
||||
ui_toggle($show_legend, __('Legend'));
|
||||
|
||||
echo '<table>';
|
||||
echo "<tr><td colspan='2' style='padding-bottom: 10px;'><b>".__('Legend').'</b></td></tr>';
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_ALERTFIRED.";'></div></td><td>".__('Orange cell when the module has fired alerts').'</td></tr>';
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_CRITICAL.";'></div></td><td>".__('Red cell when the module has a critical status').'</td></tr>';
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_WARNING.";'></div></td><td>".__('Yellow cell when the module has a warning status').'</td></tr>';
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NORMAL.";'></div></td><td>".__('Green cell when the module has a normal status').'</td></tr>';
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_UNKNOWN.";'></div></td><td>".__('Grey cell when the module has an unknown status').'</td></tr>';
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NOTINIT.";'></div></td><td>".__("Cell turns blue when the module is in 'not initialize' status").'</td></tr>';
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
$pure_var = $config['pure'];
|
||||
if ($pure_var) {
|
||||
$pure_var = 1;
|
||||
@ -627,16 +649,14 @@ $ignored_params['refresh'] = '';
|
||||
$.each($('.th_class_module_r'), function (i, elem) {
|
||||
id = $(elem).attr('id').replace('th_module_r_', '');
|
||||
$("#th_module_r_" + id).height(($("#div_module_r_" + id).width() + 10) + 'px');
|
||||
|
||||
//$("#div_module_r_" + id).css('margin-top', (max_width - $("#div_module_r_" + id).width()) + 'px');
|
||||
$("#div_module_r_" + id).css('margin-top', (max_width - 20) + 'px');
|
||||
$("#div_module_r_" + id).show();
|
||||
});
|
||||
|
||||
var refr =" . $refr . ";
|
||||
var pure =" . $pure_var . ";
|
||||
var href ='" . ui_get_url_refresh ($ignored_params) . "';
|
||||
|
||||
var refr = '<?php echo get_parameter('refresh', 0); ?>';
|
||||
var pure = '<?php echo get_parameter('pure', 0); ?>';
|
||||
var href =' <?php echo ui_get_url_refresh($ignored_params); ?>';
|
||||
|
||||
if (pure) {
|
||||
var startCountDown = function (duration, cb) {
|
||||
$('div.vc-countdown').countdown('destroy');
|
||||
@ -646,7 +666,7 @@ $ignored_params['refresh'] = '';
|
||||
$('div.vc-countdown').countdown({
|
||||
until: t,
|
||||
format: 'MS',
|
||||
layout: '(%M%nn%M:%S%nn%S Until refresh)',
|
||||
layout: '(%M%nn%M:%S%nn%S <?php echo __('Until next'); ?>) ',
|
||||
alwaysExpire: true,
|
||||
onExpiry: function () {
|
||||
$('div.vc-countdown').countdown('destroy');
|
||||
@ -655,8 +675,11 @@ $ignored_params['refresh'] = '';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
startCountDown(refr, false);
|
||||
|
||||
if(refr>0){
|
||||
startCountDown(refr, false);
|
||||
}
|
||||
|
||||
var controls = document.getElementById('vc-controls');
|
||||
autoHideElement(controls, 1000);
|
||||
|
||||
|
@ -1,17 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Module groups.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage Module groups view.
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Load global vars
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
@ -32,10 +47,12 @@ if (is_ajax()) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The main function of module groups and the enter point to
|
||||
* execute the code.
|
||||
*/
|
||||
/**
|
||||
* The main function of module groups and the enter point to
|
||||
* execute the code.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function mainModuleGroups()
|
||||
{
|
||||
global $config;
|
||||
@ -68,13 +85,20 @@ function mainModuleGroups()
|
||||
$info = array_filter(
|
||||
$info,
|
||||
function ($v, $k) use ($agent_group_search) {
|
||||
return preg_match("/$agent_group_search/i", $v['name']);
|
||||
return preg_match(
|
||||
'/'.$agent_group_search.'/i',
|
||||
$v['name']
|
||||
);
|
||||
},
|
||||
ARRAY_FILTER_USE_BOTH
|
||||
);
|
||||
|
||||
if (!empty($info)) {
|
||||
$groups_view = $is_not_paginated ? $info : array_slice($info, $offset, $config['block_size']);
|
||||
$groups_view = ($is_not_paginated) ? $info : array_slice(
|
||||
$info,
|
||||
$offset,
|
||||
$config['block_size']
|
||||
);
|
||||
$agents_counters = array_reduce(
|
||||
$groups_view,
|
||||
function ($carry, $item) {
|
||||
@ -113,7 +137,7 @@ function mainModuleGroups()
|
||||
$array_module_group = array_filter(
|
||||
$array_module_group,
|
||||
function ($v, $k) use ($module_group_search) {
|
||||
return preg_match("/$module_group_search/i", $v);
|
||||
return preg_match('/'.$module_group_search.'/i', $v);
|
||||
},
|
||||
ARRAY_FILTER_USE_BOTH
|
||||
);
|
||||
@ -125,66 +149,75 @@ function mainModuleGroups()
|
||||
$array_for_defect[$key]['data']['icon'] = $value['icon'];
|
||||
}
|
||||
|
||||
$sql = "SELECT SUM(IF(tae.alert_fired <> 0, 1, 0)) AS alerts_module_count,
|
||||
SUM(IF($condition_warning, 1, 0)) AS warning_module_count,
|
||||
SUM(IF($condition_unknown, 1, 0)) AS unknown_module_count,
|
||||
SUM(IF($condition_not_init, 1, 0)) AS notInit_module_count,
|
||||
SUM(IF($condition_critical, 1, 0)) AS critical_module_count,
|
||||
SUM(IF($condition_normal, 1, 0)) AS normal_module_count,
|
||||
COUNT(tae.id_agente_modulo) AS total_count,
|
||||
tmg.id_mg,
|
||||
tmg.name as n,
|
||||
tg.id_grupo
|
||||
FROM (
|
||||
SELECT tam.id_agente_modulo,
|
||||
tam.id_module_group,
|
||||
ta.id_grupo AS g,
|
||||
tae.estado,
|
||||
SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
|
||||
FROM tagente_modulo tam
|
||||
LEFT JOIN talert_template_modules tatm
|
||||
ON tatm.id_agent_module = tam.id_agente_modulo
|
||||
AND tatm.times_fired = 1
|
||||
LEFT JOIN tagente_estado tae
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||
INNER JOIN tagente ta
|
||||
ON ta.id_agente = tam.id_agente
|
||||
WHERE ta.disabled = 0
|
||||
AND tam.disabled = 0
|
||||
AND tam.delete_pending = 0
|
||||
AND ta.id_grupo IN ($ids_group)
|
||||
GROUP BY tam.id_agente_modulo
|
||||
UNION ALL
|
||||
SELECT tam.id_agente_modulo,
|
||||
tam.id_module_group,
|
||||
tasg.id_group AS g,
|
||||
tae.estado,
|
||||
SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
|
||||
FROM tagente_modulo tam
|
||||
LEFT JOIN talert_template_modules tatm
|
||||
ON tatm.id_agent_module = tam.id_agente_modulo
|
||||
AND tatm.times_fired = 1
|
||||
LEFT JOIN tagente_estado tae
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||
INNER JOIN tagente ta
|
||||
ON ta.id_agente = tam.id_agente
|
||||
INNER JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE ta.disabled = 0
|
||||
AND tam.disabled = 0
|
||||
AND tam.delete_pending = 0
|
||||
AND tasg.id_group IN ($ids_group)
|
||||
GROUP BY tam.id_agente_modulo, tasg.id_group
|
||||
) AS tae
|
||||
RIGHT JOIN tgrupo tg
|
||||
ON tg.id_grupo = tae.g
|
||||
INNER JOIN (
|
||||
SELECT * FROM tmodule_group
|
||||
UNION ALL
|
||||
SELECT 0 AS 'id_mg', 'Nothing' AS 'name'
|
||||
) AS tmg
|
||||
ON tae.id_module_group = tmg.id_mg
|
||||
GROUP BY tae.g, tmg.id_mg";
|
||||
$sql = sprintf(
|
||||
"SELECT SUM(IF(tae.alert_fired <> 0, 1, 0)) AS alerts_module_count,
|
||||
SUM(IF(%s, 1, 0)) AS warning_module_count,
|
||||
SUM(IF(%s, 1, 0)) AS unknown_module_count,
|
||||
SUM(IF(%s, 1, 0)) AS notInit_module_count,
|
||||
SUM(IF(%s, 1, 0)) AS critical_module_count,
|
||||
SUM(IF(%s, 1, 0)) AS normal_module_count,
|
||||
COUNT(tae.id_agente_modulo) AS total_count,
|
||||
tmg.id_mg,
|
||||
tmg.name as n,
|
||||
tg.id_grupo
|
||||
FROM (
|
||||
SELECT tam.id_agente_modulo,
|
||||
tam.id_module_group,
|
||||
ta.id_grupo AS g,
|
||||
tae.estado,
|
||||
SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
|
||||
FROM tagente_modulo tam
|
||||
LEFT JOIN talert_template_modules tatm
|
||||
ON tatm.id_agent_module = tam.id_agente_modulo
|
||||
AND tatm.times_fired = 1
|
||||
LEFT JOIN tagente_estado tae
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||
INNER JOIN tagente ta
|
||||
ON ta.id_agente = tam.id_agente
|
||||
WHERE ta.disabled = 0
|
||||
AND tam.disabled = 0
|
||||
AND tam.delete_pending = 0
|
||||
AND ta.id_grupo IN (%s)
|
||||
GROUP BY tam.id_agente_modulo
|
||||
UNION ALL
|
||||
SELECT tam.id_agente_modulo,
|
||||
tam.id_module_group,
|
||||
tasg.id_group AS g,
|
||||
tae.estado,
|
||||
SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
|
||||
FROM tagente_modulo tam
|
||||
LEFT JOIN talert_template_modules tatm
|
||||
ON tatm.id_agent_module = tam.id_agente_modulo
|
||||
AND tatm.times_fired = 1
|
||||
LEFT JOIN tagente_estado tae
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||
INNER JOIN tagente ta
|
||||
ON ta.id_agente = tam.id_agente
|
||||
INNER JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE ta.disabled = 0
|
||||
AND tam.disabled = 0
|
||||
AND tam.delete_pending = 0
|
||||
AND tasg.id_group IN (%s)
|
||||
GROUP BY tam.id_agente_modulo, tasg.id_group
|
||||
) AS tae
|
||||
RIGHT JOIN tgrupo tg
|
||||
ON tg.id_grupo = tae.g
|
||||
INNER JOIN (
|
||||
SELECT * FROM tmodule_group
|
||||
UNION ALL
|
||||
SELECT 0 AS 'id_mg', 'Nothing' AS 'name'
|
||||
) AS tmg
|
||||
ON tae.id_module_group = tmg.id_mg
|
||||
GROUP BY tae.g, tmg.id_mg",
|
||||
$condition_warning,
|
||||
$condition_unknown,
|
||||
$condition_not_init,
|
||||
$condition_critical,
|
||||
$condition_normal,
|
||||
$ids_group,
|
||||
$ids_group
|
||||
);
|
||||
|
||||
$array_data_prev = db_get_all_rows_sql($sql);
|
||||
|
||||
@ -220,9 +253,21 @@ function mainModuleGroups()
|
||||
echo '<td>';
|
||||
echo '</tr></table>';
|
||||
|
||||
$cell_style = '
|
||||
min-width: 60px;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
overflow:hidden;
|
||||
text-align: center;
|
||||
padding: 5px;
|
||||
padding-bottom:10px;
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
';
|
||||
|
||||
if (true) {
|
||||
$table = new StdClass();
|
||||
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; padding-right: 10px; min-width: 230px;';
|
||||
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; min-width: 230px;';
|
||||
$table->width = '100%';
|
||||
|
||||
$head[0] = __('Groups');
|
||||
@ -248,28 +293,28 @@ function mainModuleGroups()
|
||||
$color = '#FFA631';
|
||||
// Orange when the cell for this model group and agent has at least one alert fired.
|
||||
} else if ($array_data[$key][$k]['critical_module_count'] != 0) {
|
||||
$color = '#FC4444';
|
||||
$color = '#e63c52';
|
||||
// Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
|
||||
} else if ($array_data[$key][$k]['warning_module_count'] != 0) {
|
||||
$color = '#FAD403';
|
||||
$color = '#f3b200';
|
||||
// Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
|
||||
} else if ($array_data[$key][$k]['unknown_module_count'] != 0) {
|
||||
$color = '#B2B2B2 ';
|
||||
// Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
|
||||
} else if ($array_data[$key][$k]['normal_module_count'] != 0) {
|
||||
$color = '#80BA27';
|
||||
$color = '#82b92e';
|
||||
// Green when the cell for this model group and agent has OK state all modules.
|
||||
} else if ($array_data[$key][$k]['notInit_module_count'] != 0) {
|
||||
$color = '#5BB6E5';
|
||||
// Blue when the cell for this module group and all modules have not init value.
|
||||
}
|
||||
|
||||
$data[$i][$j] = "<div style='background:$color; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
|
||||
$data[$i][$j] = "<div style='".$cell_style.'background:'.$color.";'>";
|
||||
$data[$i][$j] .= "<a class='info_cell' rel='$rel' href='$url' style='color:white;font-size: 18px;'>";
|
||||
$data[$i][$j] .= $array_data[$key][$k]['total_count'];
|
||||
$data[$i][$j] .= '</a></div>';
|
||||
} else {
|
||||
$data[$i][$j] = "<div style='background:white; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
|
||||
$data[$i][$j] = "<div style='background:white;".$cell_style."'>";
|
||||
$data[$i][$j] .= 0;
|
||||
$data[$i][$j] .= '</div>';
|
||||
}
|
||||
@ -278,7 +323,7 @@ function mainModuleGroups()
|
||||
}
|
||||
} else {
|
||||
foreach ($value['gm'] as $k => $v) {
|
||||
$data[$i][$j] = "<div style='background:white; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
|
||||
$data[$i][$j] = "<div style='background:white; min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
|
||||
$data[$i][$j] .= 0;
|
||||
$data[$i][$j] .= '</div>';
|
||||
$j++;
|
||||
|
@ -1,26 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Net tools utils.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage NetTools
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
// Requires.
|
||||
require_once $config['homedir'].'/include/functions.php';
|
||||
|
||||
// This extension is usefull only if the agent has associated IP.
|
||||
$id_agente = get_parameter('id_agente');
|
||||
|
||||
// This extension is usefull only if the agent has associated IP
|
||||
$address = agents_get_address($id_agente);
|
||||
|
||||
if (!empty($address) || empty($id_agente)) {
|
||||
extensions_add_opemode_tab_agent('network_tools', 'Network Tools', 'extensions/net_tools/nettool.png', 'main_net_tools', 'v1r1', 'AW');
|
||||
extensions_add_opemode_tab_agent(
|
||||
'network_tools',
|
||||
'Network Tools',
|
||||
'extensions/net_tools/nettool.png',
|
||||
'main_net_tools',
|
||||
'v1r1',
|
||||
'AW'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Searchs for command.
|
||||
*
|
||||
* @param string $command Command.
|
||||
*
|
||||
* @return string Path.
|
||||
*/
|
||||
function whereis_the_command($command)
|
||||
{
|
||||
global $config;
|
||||
@ -63,6 +97,9 @@ function whereis_the_command($command)
|
||||
return $snmpget_path;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,85 +124,20 @@ function whereis_the_command($command)
|
||||
}
|
||||
|
||||
|
||||
function main_net_tools()
|
||||
/**
|
||||
* Execute net tools action.
|
||||
*
|
||||
* @param integer $operation Operation.
|
||||
* @param string $ip Ip.
|
||||
* @param string $community Community.
|
||||
* @param string $snmp_version SNMP version.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function net_tools_execute($operation, $ip, $community, $snmp_version)
|
||||
{
|
||||
$id_agente = get_parameter('id_agente');
|
||||
$principal_ip = db_get_sql("SELECT direccion FROM tagente WHERE id_agente = $id_agente");
|
||||
|
||||
$list_address = db_get_all_rows_sql('select id_a from taddress_agent where id_agent = '.$id_agente);
|
||||
foreach ($list_address as $address) {
|
||||
$ids[] = join(',', $address);
|
||||
}
|
||||
|
||||
$ids_address = implode(',', $ids);
|
||||
$ips = db_get_all_rows_sql('select ip from taddress where id_a in ('.$ids_address.')');
|
||||
|
||||
if ($ips == '') {
|
||||
echo "<div class='error' style='margin-top:5px'>".__('The agent hasn\'t got IP').'</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
echo "
|
||||
<script type='text/javascript'>
|
||||
function mostrarColumns(ValueSelect) {
|
||||
value = ValueSelect.value;
|
||||
if (value == 3) {
|
||||
$('netToolTable').css('width','100%');
|
||||
$('#snmpcolumn').show();
|
||||
}
|
||||
else {
|
||||
$('netToolTable').css('width','100%');
|
||||
$('#snmpcolumn').hide();
|
||||
}
|
||||
}
|
||||
</script>";
|
||||
|
||||
echo '<div>';
|
||||
echo "<form name='actionbox' method='post'>";
|
||||
echo "<table class='databox filters' width=100% id=netToolTable>";
|
||||
echo '<tr><td>';
|
||||
echo __('Operation');
|
||||
ui_print_help_tip(
|
||||
__('You can set the command path in the menu Administration -> Extensions -> Config Network Tools')
|
||||
);
|
||||
echo '</td><td>';
|
||||
echo "<select name='operation' onChange='mostrarColumns(this);'>";
|
||||
echo "<option value='1'>".__('Traceroute');
|
||||
echo "<option value='2'>".__('Ping host & Latency');
|
||||
echo "<option value='3'>".__('SNMP Interface status');
|
||||
echo "<option value='4'>".__('Basic TCP Port Scan');
|
||||
echo "<option value='5'>".__('DiG/Whois Lookup');
|
||||
echo '</select>';
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
echo __('IP address');
|
||||
echo '</td><td>';
|
||||
echo "<select name='select_ips'>";
|
||||
foreach ($ips as $ip) {
|
||||
if ($ip['ip'] == $principal_ip) {
|
||||
echo "<option value='".$ip['ip']."' selected = 'selected'>".$ip['ip'];
|
||||
} else {
|
||||
echo "<option value='".$ip['ip']."'>".$ip['ip'];
|
||||
}
|
||||
}
|
||||
|
||||
echo '</select>';
|
||||
echo '</td>';
|
||||
echo "<td id='snmpcolumn' style=\"display:none;\">";
|
||||
echo __('SNMP Community').' ';
|
||||
echo "<input name=community type=text value='public'>";
|
||||
echo '</td><td>';
|
||||
echo "<input style='margin:0px;' name=submit type=submit class='sub next' value='".__('Execute')."'>";
|
||||
echo '</td>';
|
||||
echo '</tr></table>';
|
||||
echo '</form>';
|
||||
|
||||
$operation = get_parameter('operation', 0);
|
||||
$community = get_parameter('community', 'public');
|
||||
$ip = get_parameter('select_ips');
|
||||
|
||||
if (!validate_address($ip)) {
|
||||
ui_print_error_message(__('The ip or dns name entered cannot be resolved'));
|
||||
ui_print_error_message(__('The ip or dns name entered cannot be resolved'));
|
||||
} else {
|
||||
switch ($operation) {
|
||||
case 1:
|
||||
@ -175,7 +147,7 @@ function main_net_tools()
|
||||
} else {
|
||||
echo '<h3>'.__('Traceroute to ').$ip.'</h3>';
|
||||
echo '<pre>';
|
||||
echo system("$traceroute $ip");
|
||||
echo system($traceroute.' '.$ip);
|
||||
echo '</pre>';
|
||||
}
|
||||
break;
|
||||
@ -187,7 +159,7 @@ function main_net_tools()
|
||||
} else {
|
||||
echo '<h3>'.__('Ping to %s', $ip).'</h3>';
|
||||
echo '<pre>';
|
||||
echo system("$ping -c 5 $ip");
|
||||
echo system($ping.' -c 5 '.$ip);
|
||||
echo '</pre>';
|
||||
}
|
||||
break;
|
||||
@ -199,7 +171,7 @@ function main_net_tools()
|
||||
} else {
|
||||
echo '<h3>'.__('Basic TCP Scan on ').$ip.'</h3>';
|
||||
echo '<pre>';
|
||||
echo system("$nmap -F $ip");
|
||||
echo system($nmap.' -F '.$ip);
|
||||
echo '</pre>';
|
||||
}
|
||||
break;
|
||||
@ -212,7 +184,7 @@ function main_net_tools()
|
||||
ui_print_error_message(__('Dig executable does not exist.'));
|
||||
} else {
|
||||
echo '<pre>';
|
||||
echo system("dig $ip");
|
||||
echo system('dig '.$ip);
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
@ -221,51 +193,227 @@ function main_net_tools()
|
||||
ui_print_error_message(__('Whois executable does not exist.'));
|
||||
} else {
|
||||
echo '<pre>';
|
||||
echo system("whois $ip");
|
||||
echo system('whois '.$ip);
|
||||
echo '</pre>';
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$snmp_obj = [
|
||||
'ip_target' => $ip,
|
||||
'snmp_version' => $snmp_version,
|
||||
'snmp_community' => $community,
|
||||
'format' => '-Oqn',
|
||||
];
|
||||
|
||||
$snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.3.0';
|
||||
$result = get_h_snmpwalk($snmp_obj);
|
||||
echo '<h3>'.__('SNMP information for ').$ip.'</h3>';
|
||||
|
||||
$snmpget = whereis_the_command('snmpget');
|
||||
if (empty($snmpget)) {
|
||||
ui_print_error_message(__('SNMPget executable does not exist.'));
|
||||
echo '<h4>'.__('Uptime').'</h4>';
|
||||
echo '<pre>';
|
||||
if (empty($result)) {
|
||||
ui_print_error_message(__('Target unreachable.'));
|
||||
break;
|
||||
} else {
|
||||
echo '<h4>'.__('Uptime').'</h4>';
|
||||
echo '<pre>';
|
||||
echo exec("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.3.0 ");
|
||||
echo '</pre>';
|
||||
echo '<h4>'.__('Device info').'</h4>';
|
||||
echo '<pre>';
|
||||
|
||||
echo system("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.1.0 ");
|
||||
echo '</pre>';
|
||||
|
||||
echo '<h4>Interface Information</h4>';
|
||||
echo '<table class=databox>';
|
||||
echo '<tr><th>'.__('Interface');
|
||||
echo '<th>'.__('Status');
|
||||
|
||||
$int_max = exec("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.1.0 ");
|
||||
|
||||
for ($ax = 0; $ax < $int_max; $ax++) {
|
||||
$interface = exec("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.2.$ax ");
|
||||
$estado = exec("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.8.$ax ");
|
||||
echo "<tr><td>$interface<td>$estado";
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
echo array_pop($result);
|
||||
}
|
||||
|
||||
echo '</pre>';
|
||||
echo '<h4>'.__('Device info').'</h4>';
|
||||
echo '<pre>';
|
||||
$snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.1.0';
|
||||
$result = get_h_snmpwalk($snmp_obj);
|
||||
if (empty($result)) {
|
||||
ui_print_error_message(__('Target unreachable.'));
|
||||
break;
|
||||
} else {
|
||||
echo array_pop($result);
|
||||
}
|
||||
|
||||
echo '</pre>';
|
||||
|
||||
echo '<h4>Interface Information</h4>';
|
||||
|
||||
$table = new StdClass();
|
||||
$table->class = 'databox';
|
||||
$table->head = [];
|
||||
$table->head[] = __('Interface');
|
||||
$table->head[] = __('Status');
|
||||
|
||||
$i = 0;
|
||||
|
||||
$base_oid = '.1.3.6.1.2.1.2.2.1';
|
||||
$idx_oids = '.1';
|
||||
$names_oids = '.2';
|
||||
$status_oids = '.8';
|
||||
|
||||
$snmp_obj['base_oid'] = $base_oid.$idx_oids;
|
||||
$idx = get_h_snmpwalk($snmp_obj);
|
||||
|
||||
$snmp_obj['base_oid'] = $base_oid.$names_oids;
|
||||
$names = get_h_snmpwalk($snmp_obj);
|
||||
|
||||
$snmp_obj['base_oid'] = $base_oid.$status_oids;
|
||||
$statuses = get_h_snmpwalk($snmp_obj);
|
||||
|
||||
foreach ($idx as $k => $v) {
|
||||
$index = str_replace($base_oid.$idx_oids, '', $k);
|
||||
$name = $names[$base_oid.$names_oids.$index];
|
||||
|
||||
$status = $statuses[$base_oid.$status_oids.$index];
|
||||
|
||||
$table->data[$i][0] = $name;
|
||||
$table->data[$i++][1] = $status;
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Main function.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function main_net_tools()
|
||||
{
|
||||
$operation = get_parameter('operation', 0);
|
||||
$community = get_parameter('community', 'public');
|
||||
$ip = get_parameter('select_ips');
|
||||
$snmp_version = get_parameter('select_version');
|
||||
|
||||
// Show form.
|
||||
$id_agente = get_parameter('id_agente', 0);
|
||||
$principal_ip = db_get_sql(
|
||||
sprintf(
|
||||
'SELECT direccion FROM tagente WHERE id_agente = %d',
|
||||
$id_agente
|
||||
)
|
||||
);
|
||||
|
||||
$list_address = db_get_all_rows_sql(
|
||||
sprintf(
|
||||
'SELECT id_a FROM taddress_agent WHERE id_agent = %d',
|
||||
$id_agente
|
||||
)
|
||||
);
|
||||
foreach ($list_address as $address) {
|
||||
$ids[] = join(',', $address);
|
||||
}
|
||||
|
||||
$ips = db_get_all_rows_sql(
|
||||
sprintf(
|
||||
'SELECT ip FROM taddress WHERE id_a IN (%s)',
|
||||
join($ids)
|
||||
)
|
||||
);
|
||||
|
||||
if ($ips == '') {
|
||||
echo "<div class='error' style='margin-top:5px'>".__('The agent hasn\'t got IP').'</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
// Javascript.
|
||||
?>
|
||||
<script type='text/javascript'>
|
||||
$(document).ready(function(){
|
||||
mostrarColumns($('#operation :selected').val());
|
||||
});
|
||||
|
||||
function mostrarColumns(value) {
|
||||
if (value == 3) {
|
||||
$('.snmpcolumn').show();
|
||||
}
|
||||
else {
|
||||
$('.snmpcolumn').hide();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
echo '<div>';
|
||||
echo "<form name='actionbox' method='post'>";
|
||||
echo "<table class='databox filters' width=100% id=netToolTable>";
|
||||
echo '<tr><td>';
|
||||
echo __('Operation');
|
||||
ui_print_help_tip(
|
||||
__('You can set the command path in the menu Administration -> Extensions -> Config Network Tools')
|
||||
);
|
||||
echo '</td><td>';
|
||||
|
||||
html_print_select(
|
||||
[
|
||||
1 => __('Traceroute'),
|
||||
2 => __('Ping host & Latency'),
|
||||
3 => __('SNMP Interface status'),
|
||||
4 => __('Basic TCP Port Scan'),
|
||||
5 => __('DiG/Whois Lookup'),
|
||||
],
|
||||
'operation',
|
||||
$operation,
|
||||
'mostrarColumns(this.value)',
|
||||
__('Please select')
|
||||
);
|
||||
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
echo __('IP address');
|
||||
echo '</td><td>';
|
||||
|
||||
$ips_for_select = array_reduce(
|
||||
$ips,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['ip']] = $item['ip'];
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
|
||||
html_print_select(
|
||||
$ips_for_select,
|
||||
'select_ips',
|
||||
$principal_ip
|
||||
);
|
||||
echo '</td>';
|
||||
echo "<td class='snmpcolumn'>";
|
||||
echo __('SNMP Version');
|
||||
html_print_select(
|
||||
[
|
||||
'1' => 'v1',
|
||||
'2c' => 'v2c',
|
||||
],
|
||||
'select_version',
|
||||
$snmp_version
|
||||
);
|
||||
echo '</td><td class="snmpcolumn">';
|
||||
echo __('SNMP Community').' ';
|
||||
html_print_input_text('community', $community);
|
||||
echo '</td><td>';
|
||||
echo "<input style='margin:0px;' name=submit type=submit class='sub next' value='".__('Execute')."'>";
|
||||
echo '</td>';
|
||||
echo '</tr></table>';
|
||||
echo '</form>';
|
||||
|
||||
if ($operation) {
|
||||
// Execute form.
|
||||
net_tools_execute($operation, $ip, $community, $snmp_version);
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add option.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function godmode_net_tools()
|
||||
{
|
||||
global $config;
|
||||
|
@ -11,5 +11,5 @@
|
||||
|
||||
#graph_container {
|
||||
width: 800px;
|
||||
margin: 20px auto !important;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
@ -1,3 +0,0 @@
|
||||
/general/login_identification_wizard.php
|
||||
/general/login_required.php
|
||||
/godmode/update_manager/update_manager.messages.php
|
@ -1,6 +1,28 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tmetaconsole_agent` ADD INDEX `id_tagente_idx` (`id_tagente`);
|
||||
|
||||
DELETE FROM `ttipo_modulo` WHERE `nombre` LIKE 'log4x';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tcredential_store` (
|
||||
`identifier` varchar(100) NOT NULL,
|
||||
`id_group` mediumint(4) unsigned NOT NULL DEFAULT 0,
|
||||
`product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE') default 'CUSTOM',
|
||||
`username` text,
|
||||
`password` text,
|
||||
`extra_1` text,
|
||||
`extra_2` text,
|
||||
PRIMARY KEY (`identifier`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
INSERT INTO `tcredential_store` (`identifier`, `id_group`, `product`, `username`, `password`) VALUES ("imported_aws_account", 0, "AWS", (SELECT `value` FROM `tconfig` WHERE `token` = "aws_access_key_id" LIMIT 1), (SELECT `value` FROM `tconfig` WHERE `token` = "aws_secret_access_key" LIMIT 1));
|
||||
DELETE FROM `tcredential_store` WHERE `username` IS NULL AND `password` IS NULL;
|
||||
|
||||
UPDATE `tagente` ta INNER JOIN `tagente` taa on ta.`id_parent` = taa.`id_agente` AND taa.`nombre` IN ("us-east-1", "us-east-2", "us-west-1", "us-west-2", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "ap-northeast-1", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-south-1", "sa-east-1") SET ta.nombre = md5(concat((SELECT `username` FROM `tcredential_store` WHERE `identifier` = "imported_aws_account" LIMIT 1), ta.`nombre`));
|
||||
|
||||
UPDATE `tagente` SET `nombre` = md5(concat((SELECT `username` FROM `tcredential_store` WHERE `identifier` = "imported_aws_account" LIMIT 1), `nombre`)) WHERE `nombre` IN ("Aws", "us-east-1", "us-east-2", "us-west-1", "us-west-2", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "ap-northeast-1", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-south-1", "sa-east-1");
|
||||
|
||||
UPDATE `trecon_task` SET `auth_strings` = "imported_aws_account" WHERE `type` IN (2,6,7);
|
||||
|
||||
COMMIT;
|
||||
|
@ -1007,10 +1007,12 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
|
||||
`agent_version` varchar(100) default '',
|
||||
`ultimo_contacto_remoto` datetime default '1970-01-01 00:00:00',
|
||||
`disabled` tinyint(2) NOT NULL default '0',
|
||||
`remote` tinyint(1) NOT NULL default '0',
|
||||
`id_parent` int(10) unsigned default '0',
|
||||
`custom_id` varchar(255) default '',
|
||||
`server_name` varchar(100) default '',
|
||||
`cascade_protection` tinyint(2) NOT NULL default '0',
|
||||
`cascade_protection_module` int(10) unsigned default '0',
|
||||
`timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'number of hours of diference with the server timezone' ,
|
||||
`icon_path` VARCHAR(127) NULL DEFAULT NULL COMMENT 'path in the server to the image of the icon representing the agent' ,
|
||||
`update_gis_data` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and do not update it' ,
|
||||
@ -1025,19 +1027,21 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
|
||||
`fired_count` bigint(20) NOT NULL default '0',
|
||||
`update_module_count` tinyint(1) NOT NULL default '0',
|
||||
`update_alert_count` tinyint(1) NOT NULL default '0',
|
||||
`update_secondary_groups` tinyint(1) NOT NULL default '0',
|
||||
`transactional_agent` tinyint(1) NOT NULL default '0',
|
||||
`alias` varchar(600) BINARY NOT NULL default '',
|
||||
`alias_as_name` tinyint(2) NOT NULL default '0',
|
||||
`safe_mode_module` int(10) unsigned NOT NULL default '0',
|
||||
`cps` int NOT NULL default 0,
|
||||
PRIMARY KEY (`id_agente`),
|
||||
KEY `nombre` (`nombre`(255)),
|
||||
KEY `direccion` (`direccion`),
|
||||
KEY `id_tagente_idx` (`id_tagente`),
|
||||
KEY `disabled` (`disabled`),
|
||||
KEY `id_grupo` (`id_grupo`),
|
||||
FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `remote` tinyint(1) NOT NULL default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT '';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `ttransaction`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -1235,13 +1239,13 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 28);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 29);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '735');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '736');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -2192,3 +2196,16 @@ CREATE TABLE `tvisual_console_elements_cache` (
|
||||
ON UPDATE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tcredential_store`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tcredential_store` (
|
||||
`identifier` varchar(100) NOT NULL,
|
||||
`id_group` mediumint(4) unsigned NOT NULL DEFAULT 0,
|
||||
`product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE') default 'CUSTOM',
|
||||
`username` text,
|
||||
`password` text,
|
||||
`extra_1` text,
|
||||
`extra_2` text,
|
||||
PRIMARY KEY (`identifier`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
@ -35,6 +35,7 @@ ui_require_css_file('firts_task');
|
||||
</p>
|
||||
<form action="index.php?sec=gservers&sec2=godmode/servers/discovery" method="post">
|
||||
<input type="submit" class="button_task" value="<?php echo __('Discover'); ?>" />
|
||||
<input type="hidden" name="discovery_hint" value="1"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -20,6 +20,8 @@ if (isset($_SERVER['REQUEST_TIME'])) {
|
||||
$time = get_system_time();
|
||||
}
|
||||
|
||||
ui_require_css_file('footer');
|
||||
|
||||
$license_file = 'general/license/pandora_info_'.$config['language'].'.html';
|
||||
if (! file_exists($config['homedir'].$license_file)) {
|
||||
$license_file = 'general/license/pandora_info_en.html';
|
||||
@ -41,9 +43,17 @@ if ($current_package == 0) {
|
||||
$build_package_version = $current_package;
|
||||
}
|
||||
|
||||
echo sprintf(__('%s %s - Build %s - MR %s', get_product_name(), $pandora_version, $build_package_version, $config['MR']));
|
||||
echo __(
|
||||
'%s %s - Build %s - MR %s',
|
||||
get_product_name(),
|
||||
$pandora_version,
|
||||
$build_package_version,
|
||||
$config['MR']
|
||||
);
|
||||
echo '</a><br />';
|
||||
echo '<small><span>'.__('Page generated on %s', date('Y-m-d H:i:s')).'</span></small>';
|
||||
|
||||
|
||||
echo '</a> ';
|
||||
|
||||
if (isset($config['debug'])) {
|
||||
$cache_info = [];
|
||||
|
@ -19,8 +19,8 @@ if (isset($config['homedir'])) {
|
||||
|
||||
ui_require_css_file('login');
|
||||
|
||||
require_once $homedir.'include/functions_ui.php';
|
||||
require_once $homedir.'include/functions.php';
|
||||
require_once __DIR__.'/../include/functions_ui.php';
|
||||
require_once __DIR__.'/../include/functions.php';
|
||||
require_once __DIR__.'/../include/functions_html.php';
|
||||
|
||||
|
||||
@ -518,6 +518,7 @@ if ($login_screen == 'error_authconfig' || $login_screen == 'error_emptyconfig'
|
||||
ui_require_css_file('dialog');
|
||||
ui_require_css_file('jquery-ui.min', 'include/styles/js/');
|
||||
ui_require_jquery_file('jquery-ui.min');
|
||||
ui_require_jquery_file('jquery-ui_custom');
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
@ -103,199 +103,203 @@ if (!empty($all_data)) {
|
||||
$data['server_sanity'] = format_numeric((100 - $data['module_sanity']), 1);
|
||||
}
|
||||
|
||||
ui_require_css_file('logon');
|
||||
|
||||
?>
|
||||
<table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
|
||||
<td width="25%" style="padding-right: 20px;" valign="top">
|
||||
|
||||
|
||||
<?php
|
||||
//
|
||||
// Overview Table.
|
||||
//
|
||||
$table = new stdClass();
|
||||
$table->class = 'databox';
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->head = [];
|
||||
$table->data = [];
|
||||
$table->headstyle[0] = 'text-align:center;';
|
||||
$table->width = '100%';
|
||||
$table->head[0] = '<span>'.__('%s Overview', get_product_name()).'</span>';
|
||||
$table->head_colspan[0] = 4;
|
||||
echo '<div id="welcome_panel">';
|
||||
|
||||
// Indicators.
|
||||
$tdata = [];
|
||||
$stats = reporting_get_stats_indicators($data, 120, 10, false);
|
||||
$status = '<table class="status_tactical">';
|
||||
foreach ($stats as $stat) {
|
||||
$status .= '<tr><td><b>'.$stat['title'].'</b></td><td>'.$stat['graph'].'</td></tr>';
|
||||
}
|
||||
//
|
||||
// Overview Table.
|
||||
//
|
||||
$table = new stdClass();
|
||||
$table->class = 'no-class';
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->head = [];
|
||||
$table->data = [];
|
||||
$table->headstyle[0] = 'text-align:center;';
|
||||
$table->width = '100%';
|
||||
$table->head_colspan[0] = 4;
|
||||
|
||||
$status .= '</table>';
|
||||
$table->data[0][0] = $status;
|
||||
$table->rowclass[] = '';
|
||||
// Indicators.
|
||||
$tdata = [];
|
||||
$stats = reporting_get_stats_indicators($data, 120, 10, false);
|
||||
$status = '<table class="status_tactical">';
|
||||
foreach ($stats as $stat) {
|
||||
$status .= '<tr><td><b>'.$stat['title'].'</b></td><td>'.$stat['graph'].'</td></tr>';
|
||||
}
|
||||
|
||||
$table->data[] = $tdata;
|
||||
$status .= '</table>';
|
||||
$table->data[0][0] = $status;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
// Alerts.
|
||||
$tdata = [];
|
||||
$tdata[0] = reporting_get_stats_alerts($data);
|
||||
$table->rowclass[] = '';
|
||||
$table->data[] = $tdata;
|
||||
$table->data[] = $tdata;
|
||||
|
||||
// Modules by status.
|
||||
$tdata = [];
|
||||
$tdata[0] = reporting_get_stats_modules_status($data, 180, 100);
|
||||
$table->rowclass[] = '';
|
||||
$table->data[] = $tdata;
|
||||
// Alerts.
|
||||
$tdata = [];
|
||||
$tdata[0] = reporting_get_stats_alerts($data);
|
||||
$table->rowclass[] = '';
|
||||
$table->data[] = $tdata;
|
||||
|
||||
// Total agents and modules.
|
||||
$tdata = [];
|
||||
$tdata[0] = reporting_get_stats_agents_monitors($data);
|
||||
$table->rowclass[] = '';
|
||||
$table->data[] = $tdata;
|
||||
// Modules by status.
|
||||
$tdata = [];
|
||||
$tdata[0] = reporting_get_stats_modules_status($data, 180, 100);
|
||||
$table->rowclass[] = '';
|
||||
$table->data[] = $tdata;
|
||||
|
||||
// Users.
|
||||
if (users_is_admin()) {
|
||||
$tdata = [];
|
||||
$tdata[0] = reporting_get_stats_users($data);
|
||||
$table->rowclass[] = '';
|
||||
$table->data[] = $tdata;
|
||||
}
|
||||
// Total agents and modules.
|
||||
$tdata = [];
|
||||
$tdata[0] = reporting_get_stats_agents_monitors($data);
|
||||
$table->rowclass[] = '';
|
||||
$table->data[] = $tdata;
|
||||
|
||||
html_print_table($table);
|
||||
unset($table);
|
||||
?>
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
<td width="75%" valign="top">
|
||||
|
||||
|
||||
<?php
|
||||
$options = [];
|
||||
$options['id_user'] = $config['id_user'];
|
||||
$options['modal'] = false;
|
||||
$options['limit'] = 3;
|
||||
$news = get_news($options);
|
||||
// Users.
|
||||
if (users_is_admin()) {
|
||||
$tdata = [];
|
||||
$tdata[0] = reporting_get_stats_users($data);
|
||||
$table->rowclass[] = '';
|
||||
$table->data[] = $tdata;
|
||||
}
|
||||
|
||||
ui_toggle(
|
||||
html_print_table($table, true),
|
||||
__('%s Overview', get_product_name()),
|
||||
'',
|
||||
'overview',
|
||||
false
|
||||
);
|
||||
unset($table);
|
||||
|
||||
echo '<div id="right">';
|
||||
|
||||
// News.
|
||||
$options = [];
|
||||
$options['id_user'] = $config['id_user'];
|
||||
$options['modal'] = false;
|
||||
$options['limit'] = 3;
|
||||
$news = get_news($options);
|
||||
|
||||
|
||||
if (!empty($news)) {
|
||||
// NEWS BOARD.
|
||||
echo '<div id="news_board">';
|
||||
if (!empty($news)) {
|
||||
ui_require_css_file('news');
|
||||
// NEWS BOARD.
|
||||
if ($config['prominent_time'] == 'timestamp') {
|
||||
$comparation_suffix = '';
|
||||
} else {
|
||||
$comparation_suffix = __('ago');
|
||||
}
|
||||
|
||||
echo '<table cellpadding="0" width=100% cellspacing="0" class="databox filters">';
|
||||
echo '<tr><th style="text-align:center;"><span >'.__('News board').'</span></th></tr>';
|
||||
if ($config['prominent_time'] == 'timestamp') {
|
||||
$comparation_suffix = '';
|
||||
} else {
|
||||
$comparation_suffix = __('ago');
|
||||
}
|
||||
$output_news = '<div id="news_board" class="new">';
|
||||
foreach ($news as $article) {
|
||||
$image = false;
|
||||
if ($article['text'] == '&lt;p style="text-align: center; font-size: 13px;"&gt;Hello, congratulations, if you've arrived here you already have an operational monitoring console. Remember that our forums and online documentation are available 24x7 to get you out of any trouble. You can replace this message with a personalized one at Admin tools -&amp;gt; Site news.&lt;/p&gt; ') {
|
||||
$image = true;
|
||||
}
|
||||
|
||||
foreach ($news as $article) {
|
||||
$image = false;
|
||||
if ($article['text'] == '&lt;p style="text-align: center; font-size: 13px;"&gt;Hello, congratulations, if you've arrived here you already have an operational monitoring console. Remember that our forums and online documentation are available 24x7 to get you out of any trouble. You can replace this message with a personalized one at Admin tools -&amp;gt; Site news.&lt;/p&gt; ') {
|
||||
$image = true;
|
||||
}
|
||||
$text_bbdd = io_safe_output($article['text']);
|
||||
$text = html_entity_decode($text_bbdd);
|
||||
$output_news .= '<span class="green_title">'.$article['subject'].'</span>';
|
||||
$output_news .= '<div class="new content">';
|
||||
$output_news .= '<p>'.__('by').' <b>'.$article['author'].'</b> <i>'.ui_print_timestamp($article['timestamp'], true).'</i> '.$comparation_suffix.'</p>';
|
||||
if ($image) {
|
||||
$output_news .= '<center><img src="./images/welcome_image.png" alt="img colabora con nosotros - Support" width="191" height="207"></center>';
|
||||
}
|
||||
|
||||
$text_bbdd = io_safe_output($article['text']);
|
||||
$text = html_entity_decode($text_bbdd);
|
||||
echo '<tr><th class="green_title">'.$article['subject'].'</th></tr>';
|
||||
echo '<tr><td>'.__('by').' <b>'.$article['author'].'</b> <i>'.ui_print_timestamp($article['timestamp'], true).'</i> '.$comparation_suffix.'</td></tr>';
|
||||
echo '<tr><td class="datos">';
|
||||
if ($image) {
|
||||
echo '<center><img src="./images/welcome_image.png" alt="img colabora con nosotros - Support" width="191" height="207"></center>';
|
||||
}
|
||||
$output_news .= nl2br($text);
|
||||
$output_news .= '</div>';
|
||||
}
|
||||
|
||||
echo nl2br($text);
|
||||
echo '</td></tr>';
|
||||
}
|
||||
$output_news .= '</div>';
|
||||
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
// News board.
|
||||
echo '<br><br>';
|
||||
// News board.
|
||||
ui_toggle(
|
||||
$output_news,
|
||||
__('News board'),
|
||||
'',
|
||||
'news',
|
||||
false
|
||||
);
|
||||
// END OF NEWS BOARD.
|
||||
}
|
||||
|
||||
// END OF NEWS BOARD.
|
||||
}
|
||||
|
||||
// LAST ACTIVITY.
|
||||
// Show last activity from this user.
|
||||
echo '<div id="activity">';
|
||||
|
||||
$table = new stdClass();
|
||||
$table->class = 'info_table';
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->width = '100%';
|
||||
// Don't specify px.
|
||||
$table->data = [];
|
||||
$table->size = [];
|
||||
$table->size[0] = '5%';
|
||||
$table->size[1] = '15%';
|
||||
$table->size[2] = '15%';
|
||||
$table->size[3] = '10%';
|
||||
$table->size[4] = '25%';
|
||||
$table->head = [];
|
||||
$table->head[0] = __('User');
|
||||
$table->head[1] = __('Action');
|
||||
$table->head[2] = __('Date');
|
||||
$table->head[3] = __('Source IP');
|
||||
$table->head[4] = __('Comments');
|
||||
$table->title = '<span>'.__('This is your last activity performed on the %s console', get_product_name()).'</span>';
|
||||
$sql = sprintf(
|
||||
'SELECT id_usuario,accion, ip_origen,descripcion,utimestamp
|
||||
FROM tsesion
|
||||
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - '.SECONDS_1WEEK.")
|
||||
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10",
|
||||
$config['id_user']
|
||||
);
|
||||
// LAST ACTIVITY.
|
||||
// Show last activity from this user.
|
||||
$table = new stdClass();
|
||||
$table->class = 'no-td-padding info_table';
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->width = '100%';
|
||||
// Don't specify px.
|
||||
$table->data = [];
|
||||
$table->size = [];
|
||||
$table->headstyle = [];
|
||||
$table->size[0] = '5%';
|
||||
$table->size[1] = '15%';
|
||||
$table->headstyle[1] = 'min-width: 12em;';
|
||||
$table->size[2] = '5%';
|
||||
$table->headstyle[2] = 'min-width: 65px;';
|
||||
$table->size[3] = '10%';
|
||||
$table->size[4] = '25%';
|
||||
$table->head = [];
|
||||
$table->head[0] = __('User');
|
||||
$table->head[1] = __('Action');
|
||||
$table->head[2] = __('Date');
|
||||
$table->head[3] = __('Source IP');
|
||||
$table->head[4] = __('Comments');
|
||||
$table->align[4] = 'left';
|
||||
$sql = sprintf(
|
||||
'SELECT id_usuario,accion, ip_origen,descripcion,utimestamp
|
||||
FROM tsesion
|
||||
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - '.SECONDS_1WEEK.")
|
||||
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10",
|
||||
$config['id_user']
|
||||
);
|
||||
|
||||
|
||||
$sessions = db_get_all_rows_sql($sql);
|
||||
$sessions = db_get_all_rows_sql($sql);
|
||||
|
||||
if ($sessions === false) {
|
||||
$sessions = [];
|
||||
}
|
||||
if ($sessions === false) {
|
||||
$sessions = [];
|
||||
}
|
||||
|
||||
foreach ($sessions as $session) {
|
||||
$data = [];
|
||||
$session_id_usuario = $session['id_usuario'];
|
||||
$session_ip_origen = $session['ip_origen'];
|
||||
foreach ($sessions as $session) {
|
||||
$data = [];
|
||||
$session_id_usuario = $session['id_usuario'];
|
||||
$session_ip_origen = $session['ip_origen'];
|
||||
|
||||
|
||||
$data[0] = '<strong>'.$session_id_usuario.'</strong>';
|
||||
$data[1] = ui_print_session_action_icon($session['accion'], true).' '.$session['accion'];
|
||||
$data[2] = ui_print_help_tip(
|
||||
date($config['date_format'], $session['utimestamp']),
|
||||
true
|
||||
).human_time_comparation($session['utimestamp'], 'tiny');
|
||||
$data[3] = $session_ip_origen;
|
||||
$description = str_replace([',', ', '], ', ', $session['descripcion']);
|
||||
if (strlen($description) > 100) {
|
||||
$data[4] = '<div >'.io_safe_output(substr($description, 0, 150).'...').'</div>';
|
||||
} else {
|
||||
$data[4] = '<div >'.io_safe_output($description).'</div>';
|
||||
}
|
||||
|
||||
$data[0] = '<strong>'.$session_id_usuario.'</strong>';
|
||||
$data[1] = ui_print_session_action_icon($session['accion'], true).' '.$session['accion'];
|
||||
$data[2] = ui_print_help_tip(
|
||||
date($config['date_format'], $session['utimestamp']),
|
||||
true
|
||||
).human_time_comparation($session['utimestamp'], 'tiny');
|
||||
$data[3] = $session_ip_origen;
|
||||
$description = str_replace([',', ', '], ', ', $session['descripcion']);
|
||||
if (strlen($description) > 100) {
|
||||
$data[4] = '<div >'.io_safe_output(substr($description, 0, 150).'...').'</div>';
|
||||
} else {
|
||||
$data[4] = '<div >'.io_safe_output($description).'</div>';
|
||||
}
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
$activity .= html_print_table($table, true);
|
||||
unset($table);
|
||||
|
||||
echo "<div style='width:100%; overflow-x:auto;'>";
|
||||
html_print_table($table);
|
||||
unset($table);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
// END OF LAST ACTIVIYY.
|
||||
?>
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
ui_toggle(
|
||||
$activity,
|
||||
__('Latest activity'),
|
||||
'',
|
||||
'activity',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'white-box-content padded'
|
||||
);
|
||||
// END OF LAST ACTIVIYY.
|
||||
// Close right panel.
|
||||
echo '</div>';
|
||||
|
||||
// Close welcome panel.
|
||||
echo '</div>';
|
||||
|
@ -30,12 +30,6 @@ $(document).ready(function(){
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Set the height of the menu.
|
||||
$(window).on('load', function (){
|
||||
$("#menu_full").height($("#container").height());
|
||||
});
|
||||
|
||||
</script>
|
||||
<?php
|
||||
$autohidden_menu = 0;
|
||||
|
@ -94,7 +94,7 @@ $table->data[1] = $data;
|
||||
$form = '<form name="query_sel" method="post" action="index.php?sec=glog&sec2=godmode/admin_access_logs">';
|
||||
$form .= html_print_table($table, true);
|
||||
$form .= '</form>';
|
||||
ui_toggle($form, __('Filter'), '', false);
|
||||
ui_toggle($form, __('Filter'), '', '', false);
|
||||
|
||||
$filter = '1=1';
|
||||
|
||||
|
@ -176,7 +176,7 @@ if ($disk_conf_delete) {
|
||||
@unlink($filename['conf']);
|
||||
}
|
||||
|
||||
echo '<form name="conf_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||
echo '<form autocomplete="new-password" name="conf_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||
|
||||
// Custom ID.
|
||||
$custom_id_div = '<div class="label_select">';
|
||||
@ -245,7 +245,7 @@ if (!$new_agent && $alias != '') {
|
||||
$table_agent_name .= '</div></div></div>';
|
||||
|
||||
// QR code div.
|
||||
$table_qr_code = '<div class="agent_qr white_box">';
|
||||
$table_qr_code = '<div class="box-shadow agent_qr white_box">';
|
||||
$table_qr_code .= '<p class="input_label">'.__('QR Code Agent view').': </p>';
|
||||
$table_qr_code .= '<div id="qr_container_image"></div>';
|
||||
if ($id_agente) {
|
||||
@ -401,7 +401,7 @@ $table_description .= html_print_textarea(
|
||||
|
||||
// QR code.
|
||||
echo '<div class="first_row">
|
||||
<div class="agent_options '.$agent_options_update.' white_box">
|
||||
<div class="box-shadow agent_options '.$agent_options_update.' white_box">
|
||||
<div class="agent_options_column_left">'.$table_agent_name.$table_alias.$table_ip.$table_primary_group.'</div>
|
||||
<div class="agent_options_column_right">'.$table_interval.$table_os.$table_server.$table_description.'</div>
|
||||
</div>';
|
||||
@ -413,8 +413,8 @@ echo '</div>';
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
|
||||
$table_adv_secondary_groups = '<div class="label_select"><p class="input_label">'.__('Secondary groups').': </p></div>';
|
||||
$table_adv_secondary_groups_left = html_print_select_groups(
|
||||
$adv_secondary_groups_label = '<div class="label_select"><p class="input_label">'.__('Secondary groups').': </p></div>';
|
||||
$adv_secondary_groups_left = html_print_select_groups(
|
||||
false,
|
||||
// Use the current user to select the groups.
|
||||
'AR',
|
||||
@ -441,7 +441,7 @@ if (enterprise_installed()) {
|
||||
// CSS classnames (default).
|
||||
false,
|
||||
// Not disabled (default).
|
||||
'width:50%; min-width:170px;',
|
||||
'min-width:170px;',
|
||||
// Inline styles (default).
|
||||
false,
|
||||
// Option style select (default).
|
||||
@ -455,7 +455,7 @@ if (enterprise_installed()) {
|
||||
// Do not show the primary group in this selection.
|
||||
);
|
||||
|
||||
$table_adv_secondary_groups_arrows = html_print_input_image(
|
||||
$adv_secondary_groups_arrows = html_print_input_image(
|
||||
'add_secondary',
|
||||
'images/darrowright_green.png',
|
||||
1,
|
||||
@ -479,7 +479,7 @@ if (enterprise_installed()) {
|
||||
]
|
||||
);
|
||||
|
||||
$table_adv_secondary_groups_right .= html_print_select(
|
||||
$adv_secondary_groups_right .= html_print_select(
|
||||
$secondary_groups_selected['for_select'],
|
||||
// Values.
|
||||
'secondary_groups_selected',
|
||||
@ -502,7 +502,7 @@ if (enterprise_installed()) {
|
||||
// Class.
|
||||
false,
|
||||
// Disabled.
|
||||
'width:50%; min-width:170px;'
|
||||
'min-width:170px;'
|
||||
// Style.
|
||||
);
|
||||
|
||||
@ -579,7 +579,7 @@ if (enterprise_installed()) {
|
||||
}
|
||||
|
||||
|
||||
$table_adv_parent = '<div class="label_select"><p class="input_label">'.__('Parent').': </p>';
|
||||
$table_adv_parent = '<div class="label_select"><label class="input_label">'.__('Parent').': </label>';
|
||||
$params = [];
|
||||
$params['return'] = true;
|
||||
$params['show_helptip'] = true;
|
||||
@ -648,13 +648,15 @@ $table_adv_module_mode .= html_print_radio_button_extended(
|
||||
$table_adv_module_mode .= '</div></div>';
|
||||
|
||||
// Status (Disabled / Enabled).
|
||||
$table_adv_status = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Disabled').': '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).'</p>';
|
||||
$table_adv_status = '<div class="label_select_simple label_simple_one_item">';
|
||||
$table_adv_status .= html_print_checkbox_switch(
|
||||
'disabled',
|
||||
1,
|
||||
$disabled,
|
||||
true
|
||||
).'</div>';
|
||||
);
|
||||
$table_adv_status .= '<p class="input_label input_label_simple">'.__('Disabled').': '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).'</p>';
|
||||
$table_adv_status .= '</div>';
|
||||
|
||||
// Url address.
|
||||
if (enterprise_installed()) {
|
||||
@ -665,7 +667,14 @@ if (enterprise_installed()) {
|
||||
'',
|
||||
45,
|
||||
255,
|
||||
true
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
// Autocomplete.
|
||||
'new-password'
|
||||
).'</div>';
|
||||
} else {
|
||||
$table_adv_url = '<div class="label_select"><p class="input_label">'.__('Url address').': </p></div>';
|
||||
@ -679,9 +688,11 @@ if (enterprise_installed()) {
|
||||
).'</div>';
|
||||
}
|
||||
|
||||
$table_adv_quiet = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Quiet').': ';
|
||||
$table_adv_quiet = '<div class="label_select_simple label_simple_one_item">';
|
||||
$table_adv_quiet .= html_print_checkbox_switch('quiet', 1, $quiet, true);
|
||||
$table_adv_quiet .= '<p class="input_label input_label_simple">'.__('Quiet').': ';
|
||||
$table_adv_quiet .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true).'</p>';
|
||||
$table_adv_quiet .= html_print_checkbox_switch('quiet', 1, $quiet, true).'</div>';
|
||||
$table_adv_quiet .= '</div>';
|
||||
|
||||
$listIcons = gis_get_array_list_icons();
|
||||
|
||||
@ -753,31 +764,46 @@ if ($config['activate_gis']) {
|
||||
|
||||
|
||||
// General display distribution.
|
||||
$table_adv_options = $table_adv_secondary_groups.'<div class="secondary_groups_select" style="margin-bottom:30px;">
|
||||
<div class="secondary_groups_list_left">
|
||||
'.$table_adv_secondary_groups_left.'
|
||||
$table_adv_options = '
|
||||
<div class="secondary_groups_list">
|
||||
'.$adv_secondary_groups_label.'
|
||||
<div class="sg_source">
|
||||
'.$adv_secondary_groups_left.'
|
||||
</div>
|
||||
<div class="secondary_group_arrows">
|
||||
'.$adv_secondary_groups_arrows.'
|
||||
</div>
|
||||
<div class="sg_target">
|
||||
'.$adv_secondary_groups_right.'
|
||||
</div>
|
||||
</div>
|
||||
<div class="secondary_groups_select_arrows">
|
||||
'.$table_adv_secondary_groups_arrows.'
|
||||
</div>
|
||||
<div class="secondary_groups_list_right">
|
||||
'.$table_adv_secondary_groups_right.'
|
||||
</div>
|
||||
</div>
|
||||
<div class="agent_options agent_options_adv">
|
||||
<div class="agent_options_column_left" >'.$table_adv_parent.$table_adv_module_mode.$table_adv_cascade;
|
||||
<div class="agent_av_opt_right" >
|
||||
'.$table_adv_parent.$table_adv_module_mode.$table_adv_cascade;
|
||||
|
||||
if ($new_agent) {
|
||||
// If agent is new, show custom id as old style format.
|
||||
$table_adv_options .= $custom_id_div;
|
||||
}
|
||||
|
||||
$table_adv_options .= $table_adv_gis.'</div>
|
||||
<div class="agent_options_column_right" >'.$table_adv_agent_icon.$table_adv_url.$table_adv_quiet.$table_adv_status.$table_adv_remote.$table_adv_safe.'</div>
|
||||
</div>';
|
||||
$table_adv_options .= '</div>';
|
||||
|
||||
$table_adv_options .= '
|
||||
<div class="agent_av_opt_left" >
|
||||
'.$table_adv_gis.$table_adv_agent_icon.$table_adv_url.$table_adv_quiet.$table_adv_status.$table_adv_remote.$table_adv_safe.'
|
||||
</div>';
|
||||
|
||||
|
||||
echo '<div class="ui_toggle">';
|
||||
ui_toggle($table_adv_options, __('Advanced options'), '', true, false, 'white_box white_box_opened');
|
||||
ui_toggle(
|
||||
$table_adv_options,
|
||||
__('Advanced options'),
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
'white_box white_box_opened',
|
||||
'no-border flex'
|
||||
);
|
||||
echo '</div>';
|
||||
|
||||
|
||||
@ -831,7 +857,7 @@ foreach ($fields as $field) {
|
||||
$custom_value = '';
|
||||
}
|
||||
|
||||
$table->rowstyle[$i] = 'cursor: pointer;';
|
||||
$table->rowstyle[$i] = 'cursor: pointer;user-select: none;';
|
||||
if (!empty($custom_value)) {
|
||||
$table->rowstyle[($i + 1)] = 'display: table-row;';
|
||||
} else {
|
||||
@ -895,14 +921,16 @@ foreach ($fields as $field) {
|
||||
|
||||
if (!empty($fields)) {
|
||||
echo '<div class="ui_toggle">';
|
||||
ui_toggle(
|
||||
html_print_table($table, true),
|
||||
__('Custom fields'),
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
'white_box white_box_opened'
|
||||
);
|
||||
ui_toggle(
|
||||
html_print_table($table, true),
|
||||
__('Custom fields'),
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
'white_box white_box_opened',
|
||||
'no-border'
|
||||
);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ if ($create_modules) {
|
||||
} else if (preg_match('/ifAdminStatus/', $name_array[1])) {
|
||||
$module_type = 2;
|
||||
} else if (preg_match('/ifOperStatus/', $name_array[1])) {
|
||||
$module_type = 18;
|
||||
$module_type = 2;
|
||||
} else {
|
||||
$module_type = 4;
|
||||
}
|
||||
@ -608,11 +608,11 @@ ui_require_jquery_file('bgiframe');
|
||||
|
||||
$(document).ready (function () {
|
||||
var inputActive = true;
|
||||
|
||||
|
||||
$(document).data('text_for_module', $("#none_text").html());
|
||||
|
||||
|
||||
$("#id_snmp").change(snmp_changed_by_multiple_snmp);
|
||||
|
||||
|
||||
$("#snmp_version").change(function () {
|
||||
if (this.value == "3") {
|
||||
$("#snmp3_options").css("display", "");
|
||||
@ -621,7 +621,7 @@ $(document).ready (function () {
|
||||
$("#snmp3_options").css("display", "none");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#walk_form").submit(function() {
|
||||
$("#submit-snmp_walk").disable ();
|
||||
$("#oid_loading").show ();
|
||||
@ -632,15 +632,15 @@ $(document).ready (function () {
|
||||
|
||||
function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
||||
var idSNMP = Array();
|
||||
|
||||
|
||||
jQuery.each ($("#id_snmp option:selected"), function (i, val) {
|
||||
idSNMP.push($(val).val());
|
||||
});
|
||||
$('#module').attr ('disabled', 1);
|
||||
$('#module').empty ();
|
||||
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
|
||||
|
||||
jQuery.post ('ajax.php',
|
||||
|
||||
jQuery.post ('ajax.php',
|
||||
{"page" : "godmode/agentes/agent_manager",
|
||||
"get_modules_json_for_multiple_snmp": 1,
|
||||
"id_snmp[]": idSNMP,
|
||||
@ -655,7 +655,7 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
||||
$('#module').fadeIn ('normal');
|
||||
c++;
|
||||
});
|
||||
|
||||
|
||||
if (c == 0) {
|
||||
if (typeof($(document).data('text_for_module')) != 'undefined') {
|
||||
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).prop('selected', true));
|
||||
@ -666,11 +666,11 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
||||
}
|
||||
else {
|
||||
var anyText = $("#any_text").html(); //Trick for catch the translate text.
|
||||
|
||||
|
||||
if (anyText == null) {
|
||||
anyText = 'Any';
|
||||
}
|
||||
|
||||
|
||||
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).prop('selected', true));
|
||||
}
|
||||
}
|
||||
@ -684,4 +684,3 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
||||
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
||||
|
@ -1213,7 +1213,7 @@ if ($update_module || $create_module) {
|
||||
|
||||
$max_timeout = (int) get_parameter('max_timeout');
|
||||
$max_retries = (int) get_parameter('max_retries');
|
||||
$min = (int) get_parameter_post('min');
|
||||
$min = (int) get_parameter('min');
|
||||
$max = (int) get_parameter('max');
|
||||
$interval = (int) get_parameter('module_interval', $intervalo);
|
||||
$ff_interval = (int) get_parameter('module_ff_interval');
|
||||
|
@ -163,7 +163,7 @@ echo '<td>';
|
||||
|
||||
echo __('Group').' ';
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
|
||||
if (!$own_info['is_admin'] && check_acl($config['id_user'], 0, 'AW')) {
|
||||
$return_all_group = false;
|
||||
} else {
|
||||
$return_all_group = true;
|
||||
|
@ -267,10 +267,10 @@ if ($id_agent_module) {
|
||||
$cron_interval = explode(' ', $module['cron_interval']);
|
||||
if (isset($cron_interval[4])) {
|
||||
$minute_from = $cron_interval[0];
|
||||
$min = explode('-', $minute_from);
|
||||
$minute_from = $min[0];
|
||||
if (isset($min[1])) {
|
||||
$minute_to = $min[1];
|
||||
$minute = explode('-', $minute_from);
|
||||
$minute_from = $minute[0];
|
||||
if (isset($minute[1])) {
|
||||
$minute_to = $minute[1];
|
||||
}
|
||||
|
||||
$hour_from = $cron_interval[1];
|
||||
@ -583,7 +583,13 @@ echo '<h3 id="message" class="error invisible"></h3>';
|
||||
// TODO: Change to the ui_print_error system
|
||||
echo '<form method="post" id="module_form">';
|
||||
|
||||
html_print_table($table_simple);
|
||||
ui_toggle(
|
||||
html_print_table($table_simple, true),
|
||||
__('Base options'),
|
||||
'',
|
||||
'',
|
||||
false
|
||||
);
|
||||
|
||||
ui_toggle(
|
||||
html_print_table($table_advanced, true),
|
||||
|
@ -162,7 +162,7 @@ $edit_module = (bool) get_parameter_get('edit_module');
|
||||
$table_simple = new stdClass();
|
||||
$table_simple->id = 'simple';
|
||||
$table_simple->width = '100%';
|
||||
$table_simple->class = 'databox';
|
||||
$table_simple->class = 'no-class';
|
||||
$table_simple->data = [];
|
||||
$table_simple->style = [];
|
||||
$table_simple->style[0] = 'font-weight: bold; width: 25%;';
|
||||
@ -637,7 +637,7 @@ if ($disabledBecauseInPolicy) {
|
||||
$table_advanced = new stdClass();
|
||||
$table_advanced->id = 'advanced';
|
||||
$table_advanced->width = '100%';
|
||||
$table_advanced->class = 'databox filters';
|
||||
$table_advanced->class = 'no-class';
|
||||
$table_advanced->data = [];
|
||||
$table_advanced->style = [];
|
||||
$table_advanced->style[0] = $table_advanced->style[3] = $table_advanced->style[5] = 'font-weight: bold;';
|
||||
@ -1066,7 +1066,7 @@ if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$table_macros = new stdClass();
|
||||
$table_macros->id = 'module_macros';
|
||||
$table_macros->width = '100%';
|
||||
$table_macros->class = 'databox filters';
|
||||
$table_macros->class = 'no-class';
|
||||
$table_macros->data = [];
|
||||
$table_macros->style = [];
|
||||
$table_macros->style[0] = 'font-weight: bold;';
|
||||
@ -1107,7 +1107,7 @@ html_print_input_hidden('module_macro_count', $macro_count);
|
||||
$table_new_relations = new stdClass();
|
||||
$table_new_relations->id = 'module_new_relations';
|
||||
$table_new_relations->width = '100%';
|
||||
$table_new_relations->class = 'databox filters';
|
||||
$table_new_relations->class = 'no-class';
|
||||
$table_new_relations->data = [];
|
||||
$table_new_relations->style = [];
|
||||
$table_new_relations->style[0] = 'width: 10%; font-weight: bold;';
|
||||
|
@ -37,14 +37,10 @@ $table->head = [];
|
||||
$table->data = [];
|
||||
$table->size = [];
|
||||
$table->size = [];
|
||||
$table->size[0] = '5%';
|
||||
$table->size[1] = '25%';
|
||||
$table->size[2] = '5%';
|
||||
$table->size[3] = '20%';
|
||||
$table->style[0] = 'font-weight: bold; ';
|
||||
$table->style[1] = 'font-weight: bold; ';
|
||||
$table->style[2] = 'font-weight: bold; ';
|
||||
$table->style[3] = 'font-weight: bold; ';
|
||||
$table->style[0] = 'font-weight: bold;';
|
||||
$table->style[1] = 'font-weight: bold;display: flex;align-items: baseline;';
|
||||
$table->style[2] = 'font-weight: bold;';
|
||||
$table->style[3] = 'font-weight: bold;';
|
||||
|
||||
// This is because if this view is reused after list alert view then
|
||||
// styles in the previous view can affect this table.
|
||||
@ -89,7 +85,7 @@ $table->data[0][1] = html_print_select(
|
||||
true,
|
||||
'',
|
||||
($id_agente == 0),
|
||||
'width: 250px;'
|
||||
'min-width: 250px;margin-right: 0.5em;'
|
||||
);
|
||||
$table->data[0][1] .= ' <span id="latest_value" class="invisible">'.__('Latest value').': ';
|
||||
$table->data[0][1] .= '<span id="value"> </span></span>';
|
||||
@ -117,7 +113,7 @@ $table->data[1][1] = html_print_select(
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 250px;'
|
||||
'min-width: 250px;'
|
||||
);
|
||||
$table->data[1][1] .= '<span id="advanced_action" class="advanced_actions invisible"><br>';
|
||||
$table->data[1][1] .= __('Number of alerts match from').' ';
|
||||
@ -127,9 +123,9 @@ $table->data[1][1] .= html_print_input_text('fires_max', '', '', 4, 10, true);
|
||||
|
||||
$table->data[1][1] .= '</span>';
|
||||
if (check_acl($config['id_user'], 0, 'LM')) {
|
||||
$table->data[1][1] .= '<a style="margin-left:5px;" href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
|
||||
$table->data[1][1] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
|
||||
$table->data[1][1] .= html_print_image('images/add.png', true);
|
||||
$table->data[1][1] .= '<span style="margin-left:5px;vertical-align:middle;">'.__('Create Action').'</span>';
|
||||
$table->data[1][1] .= '<span style="margin-left:0.5em;">'.__('Create Action').'</span>';
|
||||
$table->data[1][1] .= '</a>';
|
||||
}
|
||||
|
||||
@ -162,13 +158,13 @@ if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (check_acl($config['id_user'], 0, 'LM')) {
|
||||
$table->data[2][1] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
|
||||
$table->data[2][1] .= html_print_image('images/add.png', true);
|
||||
$table->data[2][1] .= '<span style="margin-left:5px;vertical-align:middle;">'.__('Create Template').'</span>';
|
||||
$table->data[2][1] .= '<span style="margin-left:0.5em;">'.__('Create Template').'</span>';
|
||||
$table->data[2][1] .= '</a>';
|
||||
}
|
||||
|
||||
$table->data[3][0] = __('Threshold');
|
||||
$table->data[3][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true);
|
||||
$table->data[3][1] .= ' '.__('seconds');
|
||||
$table->data[3][1] .= '<span style="margin-left:0.5em;">'.__('seconds').'</span>';
|
||||
|
||||
if (!isset($step)) {
|
||||
echo '<form class="add_alert_form" method="post">';
|
||||
|
@ -438,11 +438,11 @@ if (! $id_agente) {
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold;';
|
||||
$table->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown);
|
||||
$table->size[0] = '4%';
|
||||
$table->size[1] = '8%';
|
||||
$table->size[2] = '8%';
|
||||
$table->size[3] = '4%';
|
||||
$table->size[4] = '4%';
|
||||
$table->headstyle[0] = 'width: 100%; min-width: 12em;';
|
||||
$table->headstyle[1] = 'min-width: 15em;';
|
||||
$table->headstyle[2] = 'min-width: 20em;';
|
||||
$table->headstyle[3] = 'min-width: 1em;';
|
||||
$table->headstyle[4] = 'min-width: 15em;';
|
||||
|
||||
/*
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
@ -450,16 +450,11 @@ if (! $id_agente) {
|
||||
}*/
|
||||
} else {
|
||||
$table->head[0] = __('Module').ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
|
||||
// Different sizes or the layout screws up
|
||||
$table->size[0] = '0%';
|
||||
$table->size[1] = '10%';
|
||||
$table->size[2] = '30%';
|
||||
/*
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->size[4] = '25%';
|
||||
} */
|
||||
$table->size[3] = '1%';
|
||||
$table->size[4] = '1%';
|
||||
$table->headstyle[0] = 'width: 100%; min-width: 15em;';
|
||||
$table->headstyle[1] = 'min-width: 15em;';
|
||||
$table->headstyle[2] = 'min-width: 20em;';
|
||||
$table->headstyle[3] = 'min-width: 1em;';
|
||||
$table->headstyle[4] = 'min-width: 15em;';
|
||||
}
|
||||
|
||||
$table->head[1] = __('Template').ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
|
||||
|
@ -317,9 +317,9 @@ $(document).ready (function () {
|
||||
jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,
|
||||
values,
|
||||
function (data, status) {
|
||||
original_command = js_html_entity_decode (data["command"]);
|
||||
original_command = data["command"];
|
||||
render_command_preview (original_command);
|
||||
command_description = js_html_entity_decode (data["description"]);
|
||||
command_description = data["description"];
|
||||
render_command_description(command_description);
|
||||
|
||||
var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>');
|
||||
|
@ -60,96 +60,12 @@ $fields_selected = explode(',', $config['event_fields']);
|
||||
|
||||
$result_selected = [];
|
||||
|
||||
// show list of fields selected.
|
||||
// Show list of fields selected.
|
||||
if ($fields_selected[0] != '') {
|
||||
foreach ($fields_selected as $field_selected) {
|
||||
switch ($field_selected) {
|
||||
case 'id_evento':
|
||||
$result = __('Event Id');
|
||||
break;
|
||||
|
||||
case 'evento':
|
||||
$result = __('Event Name');
|
||||
break;
|
||||
|
||||
case 'id_agente':
|
||||
$result = __('Agent Name');
|
||||
break;
|
||||
|
||||
case 'id_usuario':
|
||||
$result = __('User');
|
||||
break;
|
||||
|
||||
case 'id_grupo':
|
||||
$result = __('Group');
|
||||
break;
|
||||
|
||||
case 'estado':
|
||||
$result = __('Status');
|
||||
break;
|
||||
|
||||
case 'timestamp':
|
||||
$result = __('Timestamp');
|
||||
break;
|
||||
|
||||
case 'event_type':
|
||||
$result = __('Event Type');
|
||||
break;
|
||||
|
||||
case 'id_agentmodule':
|
||||
$result = __('Module Name');
|
||||
break;
|
||||
|
||||
case 'id_alert_am':
|
||||
$result = __('Alert');
|
||||
break;
|
||||
|
||||
case 'criticity':
|
||||
$result = __('Severity');
|
||||
break;
|
||||
|
||||
case 'user_comment':
|
||||
$result = __('Comment');
|
||||
break;
|
||||
|
||||
case 'tags':
|
||||
$result = __('Tags');
|
||||
break;
|
||||
|
||||
case 'source':
|
||||
$result = __('Source');
|
||||
break;
|
||||
|
||||
case 'id_extra':
|
||||
$result = __('Extra Id');
|
||||
break;
|
||||
|
||||
case 'owner_user':
|
||||
$result = __('Owner');
|
||||
break;
|
||||
|
||||
case 'ack_utimestamp':
|
||||
$result = __('ACK Timestamp');
|
||||
break;
|
||||
|
||||
case 'instructions':
|
||||
$result = __('Instructions');
|
||||
break;
|
||||
|
||||
case 'server_name':
|
||||
$result = __('Server Name');
|
||||
break;
|
||||
|
||||
case 'data':
|
||||
$result = __('Data');
|
||||
break;
|
||||
|
||||
case 'module_status':
|
||||
$result = __('Module Status');
|
||||
break;
|
||||
}
|
||||
|
||||
$result_selected[$field_selected] = $result;
|
||||
$result_selected[$field_selected] = events_get_column_name(
|
||||
$field_selected
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,7 +93,8 @@ $fields_available = [];
|
||||
|
||||
$fields_available['id_evento'] = __('Event Id');
|
||||
$fields_available['evento'] = __('Event Name');
|
||||
$fields_available['id_agente'] = __('Agent Name');
|
||||
$fields_available['id_agente'] = __('Agent ID');
|
||||
$fields_available['agent_name'] = __('Agent Name');
|
||||
$fields_available['id_usuario'] = __('User');
|
||||
$fields_available['id_grupo'] = __('Group');
|
||||
$fields_available['estado'] = __('Status');
|
||||
@ -196,13 +113,13 @@ $fields_available['instructions'] = __('Instructions');
|
||||
$fields_available['server_name'] = __('Server Name');
|
||||
$fields_available['data'] = __('Data');
|
||||
$fields_available['module_status'] = __('Module Status');
|
||||
$fields_available['mini_severity'] = __('Severity mini');
|
||||
|
||||
// remove fields already selected
|
||||
|
||||
// Remove fields already selected.
|
||||
foreach ($fields_available as $key => $available) {
|
||||
foreach ($result_selected as $selected) {
|
||||
if ($selected == $available) {
|
||||
unset($fields_available[$key]);
|
||||
}
|
||||
if (isset($result_selected[$key])) {
|
||||
unset($fields_available[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,17 +50,10 @@ if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&section=responses&pure='.$config['pure'].'">'.html_print_image('images/event_responses.png', true, ['title' => __('Event responses')]).'</a>',
|
||||
];
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
$buttons['fields'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&section=fields&pure='.$config['pure'].'">'.html_print_image('images/custom_columns.png', true, ['title' => __('Custom fields')]).'</a>',
|
||||
];
|
||||
} else {
|
||||
$buttons['fields'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=eventos&sec2=event/custom_events&section=fields&pure='.$config['pure'].'">'.html_print_image('images/custom_columns.png', true, ['title' => __('Custom fields')]).'</a>',
|
||||
];
|
||||
}
|
||||
$buttons['fields'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&section=fields&pure='.$config['pure'].'">'.html_print_image('images/custom_columns.png', true, ['title' => __('Custom fields')]).'</a>',
|
||||
];
|
||||
}
|
||||
|
||||
switch ($section) {
|
||||
|
632
pandora_console/godmode/groups/credential_store.php
Normal file
632
pandora_console/godmode/groups/credential_store.php
Normal file
@ -0,0 +1,632 @@
|
||||
<?php
|
||||
/**
|
||||
* Credentials management view.
|
||||
*
|
||||
* @category Credentials management
|
||||
* @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.
|
||||
global $config;
|
||||
|
||||
// Check access.
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access event viewer'
|
||||
);
|
||||
|
||||
if (is_ajax()) {
|
||||
return ['error' => 'noaccess'];
|
||||
}
|
||||
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
// Required files.
|
||||
ui_require_css_file('credential_store');
|
||||
require_once $config['homedir'].'/include/functions_credential_store.php';
|
||||
require_once $config['homedir'].'/include/functions_io.php';
|
||||
|
||||
if (is_ajax()) {
|
||||
$draw = get_parameter('draw', 0);
|
||||
$filter = get_parameter('filter', []);
|
||||
$get_key = get_parameter('get_key', 0);
|
||||
$new_form = get_parameter('new_form', 0);
|
||||
$new_key = get_parameter('new_key', 0);
|
||||
$update_key = get_parameter('update_key', 0);
|
||||
$delete_key = get_parameter('delete_key', 0);
|
||||
|
||||
if ($new_form) {
|
||||
echo print_inputs();
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($delete_key) {
|
||||
$identifier = get_parameter('identifier', null);
|
||||
|
||||
if (empty($identifier)) {
|
||||
ajax_msg('error', __('identifier cannot be empty'));
|
||||
}
|
||||
|
||||
if (db_process_sql_delete(
|
||||
'tcredential_store',
|
||||
['identifier' => $identifier]
|
||||
) === false
|
||||
) {
|
||||
ajax_msg('error', $config['dbconnection']->error, true);
|
||||
} else {
|
||||
ajax_msg('result', $identifier, true);
|
||||
}
|
||||
}
|
||||
|
||||
if ($update_key) {
|
||||
$data = get_parameter('values', null);
|
||||
|
||||
if ($data === null || !is_array($data)) {
|
||||
echo json_encode(['error' => __('Invalid parameters, please retry')]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$values = [];
|
||||
foreach ($data as $key => $value) {
|
||||
if ($key == 'identifier') {
|
||||
$identifier = base64_decode($value);
|
||||
} else if ($key == 'product') {
|
||||
$product = base64_decode($value);
|
||||
} else {
|
||||
$values[$key] = base64_decode($value);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($identifier)) {
|
||||
ajax_msg('error', __('identifier cannot be empty'));
|
||||
}
|
||||
|
||||
if (empty($product)) {
|
||||
ajax_msg('error', __('product cannot be empty'));
|
||||
}
|
||||
|
||||
if (db_process_sql_update(
|
||||
'tcredential_store',
|
||||
$values,
|
||||
['identifier' => $identifier]
|
||||
) === false
|
||||
) {
|
||||
ajax_msg('error', $config['dbconnection']->error);
|
||||
} else {
|
||||
ajax_msg('result', $identifier);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($new_key) {
|
||||
$data = get_parameter('values', null);
|
||||
|
||||
if ($data === null || !is_array($data)) {
|
||||
echo json_encode(['error' => __('Invalid parameters, please retry')]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$values = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$values[$key] = base64_decode($value);
|
||||
if ($key == 'identifier') {
|
||||
$values[$key] = preg_replace('/\s+/', '-', trim($values[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
$identifier = $values['identifier'];
|
||||
|
||||
if (empty($identifier)) {
|
||||
ajax_msg('error', __('identifier cannot be empty'));
|
||||
}
|
||||
|
||||
if (empty($values['product'])) {
|
||||
ajax_msg('error', __('product cannot be empty'));
|
||||
}
|
||||
|
||||
if (db_process_sql_insert('tcredential_store', $values) === false) {
|
||||
ajax_msg('error', $config['dbconnection']->error);
|
||||
} else {
|
||||
ajax_msg('result', $identifier);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($get_key) {
|
||||
$identifier = get_parameter('identifier', null);
|
||||
|
||||
$key = get_key($identifier);
|
||||
echo print_inputs($key);
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($draw) {
|
||||
// Datatables offset, limit and order.
|
||||
$start = get_parameter('start', 0);
|
||||
$length = get_parameter('length', $config['block_size']);
|
||||
$order = get_datatable_order(true);
|
||||
try {
|
||||
ob_start();
|
||||
|
||||
$fields = [
|
||||
'cs.*',
|
||||
'tg.nombre as `group`',
|
||||
];
|
||||
|
||||
// Retrieve data.
|
||||
$data = credentials_get_all(
|
||||
// Fields.
|
||||
$fields,
|
||||
// Filter.
|
||||
$filter,
|
||||
// Offset.
|
||||
$start,
|
||||
// Limit.
|
||||
$length,
|
||||
// Order.
|
||||
$order['direction'],
|
||||
// Sort field.
|
||||
$order['field']
|
||||
);
|
||||
|
||||
// Retrieve counter.
|
||||
$count = credentials_get_all(
|
||||
'count',
|
||||
$filter
|
||||
);
|
||||
|
||||
if ($data) {
|
||||
$data = array_reduce(
|
||||
$data,
|
||||
function ($carry, $item) {
|
||||
// Transforms array of arrays $data into an array
|
||||
// of objects, making a post-process of certain fields.
|
||||
$tmp = (object) $item;
|
||||
$tmp->username = io_safe_output($tmp->username);
|
||||
|
||||
if (empty($tmp->group)) {
|
||||
$tmp->group = __('All');
|
||||
} else {
|
||||
$tmp->group = io_safe_output($tmp->group);
|
||||
}
|
||||
|
||||
$carry[] = $tmp;
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Datatables format: RecordsTotal && recordsfiltered.
|
||||
echo json_encode(
|
||||
[
|
||||
'data' => $data,
|
||||
'recordsTotal' => $count,
|
||||
'recordsFiltered' => $count,
|
||||
]
|
||||
);
|
||||
// Capture output.
|
||||
$response = ob_get_clean();
|
||||
} catch (Exception $e) {
|
||||
return json_encode(['error' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
// If not valid, show error with issue.
|
||||
json_decode($response);
|
||||
if (json_last_error() == JSON_ERROR_NONE) {
|
||||
// If valid dump.
|
||||
echo $response;
|
||||
} else {
|
||||
echo json_encode(
|
||||
['error' => $response]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
// Datatables list.
|
||||
try {
|
||||
$columns = [
|
||||
'group',
|
||||
'identifier',
|
||||
'product',
|
||||
'username',
|
||||
'options',
|
||||
];
|
||||
|
||||
$column_names = [
|
||||
__('Group'),
|
||||
__('Identifier'),
|
||||
__('Product'),
|
||||
__('User'),
|
||||
[
|
||||
'text' => __('Options'),
|
||||
'class' => 'action_buttons',
|
||||
],
|
||||
];
|
||||
|
||||
$table_id = 'keystore';
|
||||
// Load datatables user interface.
|
||||
ui_print_datatable(
|
||||
[
|
||||
'id' => $table_id,
|
||||
'class' => 'info_table',
|
||||
'style' => 'width: 100%',
|
||||
'columns' => $columns,
|
||||
'column_names' => $column_names,
|
||||
'ajax_url' => 'godmode/groups/credential_store',
|
||||
'ajax_postprocess' => 'process_datatables_item(item)',
|
||||
'no_sortable_columns' => [-1],
|
||||
'order' => [
|
||||
'field' => 'identifier',
|
||||
'direction' => 'asc',
|
||||
],
|
||||
'search_button_class' => 'sub filter float-right',
|
||||
'form' => [
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => __('Group'),
|
||||
'type' => 'select',
|
||||
'id' => 'filter_id_group',
|
||||
'name' => 'filter_id_group',
|
||||
'options' => users_get_groups_for_select(
|
||||
$config['id_user'],
|
||||
'AR',
|
||||
true,
|
||||
true,
|
||||
false
|
||||
),
|
||||
],
|
||||
[
|
||||
'label' => __('Free search'),
|
||||
'type' => 'text',
|
||||
'class' => 'mw250px',
|
||||
'id' => 'free_search',
|
||||
'name' => 'free_search',
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
// Auxiliar div.
|
||||
$new = '<div id="new_key" style="display: none"><form id="form_new">';
|
||||
$new .= '</form></div>';
|
||||
$details = '<div id="info_key" style="display: none"><form id="form_update">';
|
||||
$details .= '</form></div>';
|
||||
$aux = '<div id="aux" style="display: none"></div>';
|
||||
|
||||
|
||||
echo $new.$details.$aux;
|
||||
|
||||
// Create button.
|
||||
echo '<div class="w100p flex-content-right">';
|
||||
html_print_submit_button(
|
||||
__('Add key'),
|
||||
'create',
|
||||
false,
|
||||
'class="sub next"'
|
||||
);
|
||||
echo '</div>';
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
function process_datatables_item(item) {
|
||||
item.options = '<a href="javascript:" onclick="display_key(\'';
|
||||
item.options += item.identifier;
|
||||
item.options += '\')" ><?php echo html_print_image('images/eye.png', true, ['title' => __('Show')]); ?></a>';
|
||||
|
||||
item.options += '<a href="javascript:" onclick="delete_key(\'';
|
||||
item.options += item.identifier;
|
||||
item.options += '\')" ><?php echo html_print_image('images/cross.png', true, ['title' => __('Delete')]); ?></a>';
|
||||
}
|
||||
|
||||
function handle_response(data) {
|
||||
var title = "<?php echo __('Success'); ?>";
|
||||
var text = '';
|
||||
var failed = 0;
|
||||
try {
|
||||
data = JSON.parse(data);
|
||||
text = data['result'];
|
||||
} catch (err) {
|
||||
title = "<?php echo __('Failed'); ?>";
|
||||
text = err.message;
|
||||
failed = 1;
|
||||
}
|
||||
if (!failed && data['error']) {
|
||||
title = "<?php echo __('Failed'); ?>";
|
||||
text = data['error'];
|
||||
failed = 1;
|
||||
}
|
||||
|
||||
$('#aux').empty();
|
||||
$('#aux').html(text);
|
||||
$('#aux').dialog({
|
||||
width: 450,
|
||||
position: {
|
||||
my: 'center',
|
||||
at: 'center',
|
||||
of: window,
|
||||
collision: 'fit'
|
||||
},
|
||||
title: title,
|
||||
buttons: [
|
||||
{
|
||||
text: 'OK',
|
||||
click: function(e) {
|
||||
if (!failed) {
|
||||
dt_<?php echo $table_id; ?>.draw(0);
|
||||
$(".ui-dialog-content").dialog("close");
|
||||
cleanupDOM();
|
||||
} else {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
function delete_key(id) {
|
||||
$('#aux').empty();
|
||||
$('#aux').text('<?php echo __('Are you sure?'); ?>');
|
||||
$('#aux').dialog({
|
||||
title: '<?php echo __('Delete'); ?> ' + id,
|
||||
buttons: [
|
||||
{
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
||||
text: '<?php echo __('Cancel'); ?>',
|
||||
click: function(e) {
|
||||
$(this).dialog('close');
|
||||
cleanupDOM();
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Delete',
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
||||
click: function(e) {
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
data: {
|
||||
page: 'godmode/groups/credential_store',
|
||||
delete_key: 1,
|
||||
identifier: id
|
||||
},
|
||||
datatype: "json",
|
||||
success: function (data) {
|
||||
handle_response(data);
|
||||
},
|
||||
error: function(e) {
|
||||
handle_response(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
function display_key(id) {
|
||||
$('#form_update').empty();
|
||||
$('#form_update').html('Loading...');
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
data: {
|
||||
page: 'godmode/groups/credential_store',
|
||||
get_key: 1,
|
||||
identifier: id
|
||||
},
|
||||
success: function (data) {
|
||||
$('#info_key').dialog({
|
||||
width: 580,
|
||||
height: 400,
|
||||
position: {
|
||||
my: 'center',
|
||||
at: 'center',
|
||||
of: window,
|
||||
collision: 'fit'
|
||||
},
|
||||
title: id,
|
||||
buttons: [
|
||||
{
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
||||
text: '<?php echo __('Cancel'); ?>',
|
||||
click: function(e) {
|
||||
$(this).dialog('close');
|
||||
cleanupDOM();
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Update',
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
||||
click: function(e) {
|
||||
var values = {};
|
||||
|
||||
$('#form_update :input').each(function() {
|
||||
values[this.name] = btoa($(this).val());
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
data: {
|
||||
page: 'godmode/groups/credential_store',
|
||||
update_key: 1,
|
||||
values: values
|
||||
},
|
||||
datatype: "json",
|
||||
success: function (data) {
|
||||
handle_response(data);
|
||||
},
|
||||
error: function(e) {
|
||||
handle_response(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
$('#form_update').html(data);
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
function cleanupDOM() {
|
||||
$('#div-identifier').empty();
|
||||
$('#div-product').empty();
|
||||
$('#div-username').empty();
|
||||
$('#div-password').empty();
|
||||
$('#div-extra_1').empty();
|
||||
$('#div-extra_2').empty();
|
||||
}
|
||||
|
||||
function calculate_inputs() {
|
||||
if ($('#product :selected').val() == "CUSTOM") {
|
||||
$('#div-username label').text('<?php echo __('Username'); ?>');
|
||||
$('#div-password label').text('<?php echo __('Password'); ?>');
|
||||
$('#div-extra_1 label').text('<?php echo __('Extra'); ?>');
|
||||
$('#div-extra_2 label').text('<?php echo __('Extra (2)'); ?>');
|
||||
$('#div-extra_1').show();
|
||||
$('#div-extra_2').show();
|
||||
} else if ($('#product :selected').val() == "AWS") {
|
||||
$('#div-username label').text('<?php echo __('Access key ID'); ?>');
|
||||
$('#div-password label').text('<?php echo __('Secret access key'); ?>');
|
||||
$('#div-extra_1').hide();
|
||||
$('#div-extra_2').hide();
|
||||
} else if ($('#product :selected').val() == "AZURE") {
|
||||
$('#div-username label').text('<?php echo __('Account ID'); ?>');
|
||||
$('#div-password label').text('<?php echo __('Password'); ?>');
|
||||
$('#div-extra_1 label').text('<?php echo __('Tenant or domain name'); ?>');
|
||||
$('#div-extra_2 label').text('<?php echo __('Subscription id'); ?>');
|
||||
$('#div-extra_1').show();
|
||||
$('#div-extra_2').show();
|
||||
}
|
||||
}
|
||||
|
||||
function add_key() {
|
||||
// Clear form.
|
||||
$('#form_update').empty();
|
||||
$('#form_update').html('Loading...');
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
data: {
|
||||
page: 'godmode/groups/credential_store',
|
||||
new_form: 1
|
||||
},
|
||||
success: function(data) {
|
||||
$('#form_new').html(data);
|
||||
$('#id_group').val(0);
|
||||
// By default AWS.
|
||||
$('#product').val('AWS');
|
||||
calculate_inputs();
|
||||
|
||||
$('#product').on('change', function() {
|
||||
calculate_inputs()
|
||||
});
|
||||
|
||||
// Show form.
|
||||
$('#new_key').dialog({
|
||||
width: 580,
|
||||
height: 400,
|
||||
position: {
|
||||
my: 'center',
|
||||
at: 'center',
|
||||
of: window,
|
||||
collision: 'fit'
|
||||
},
|
||||
title: "<?php echo __('Register new key into keystore'); ?>",
|
||||
buttons: [
|
||||
{
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
||||
text: "<?php echo __('Cancel'); ?>",
|
||||
click: function(e) {
|
||||
$(this).dialog('close');
|
||||
cleanupDOM();
|
||||
}
|
||||
},
|
||||
{
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
||||
text: 'OK',
|
||||
click: function(e) {
|
||||
var values = {};
|
||||
|
||||
console.log($('#form_new'));
|
||||
|
||||
$('#form_new :input').each(function() {
|
||||
values[this.name] = btoa($(this).val());
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
data: {
|
||||
page: 'godmode/groups/credential_store',
|
||||
new_key: 1,
|
||||
values: values
|
||||
},
|
||||
datatype: "json",
|
||||
success: function (data) {
|
||||
handle_response(data);
|
||||
},
|
||||
error: function(e) {
|
||||
handle_response(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
]
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
$(document).ready(function(){
|
||||
|
||||
$("#submit-create").on('click', function(){
|
||||
add_key();
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
@ -1,20 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Group management view.
|
||||
*
|
||||
* @category Group View
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// 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.
|
||||
// Begin.
|
||||
ui_require_css_file('tree');
|
||||
ui_require_css_file('fixed-bottom-box');
|
||||
|
||||
// Load global vars
|
||||
// Load global vars.
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
@ -76,15 +92,17 @@ if (is_ajax()) {
|
||||
$recursion = (int) get_parameter('recursion', 0);
|
||||
$privilege = (string) get_parameter('privilege', '');
|
||||
$all_agents = (int) get_parameter('all_agents', 0);
|
||||
// Is is possible add keys prefix to avoid auto sorting in js object conversion
|
||||
// Is is possible add keys prefix to avoid auto sorting in
|
||||
// js object conversion.
|
||||
$keys_prefix = (string) get_parameter('keys_prefix', '');
|
||||
// This attr is for the operation "bulk alert accions add", it controls the query that take the agents
|
||||
// from db
|
||||
// This attr is for the operation "bulk alert accions add", it controls
|
||||
// the query that take the agents from db.
|
||||
$add_alert_bulk_op = get_parameter('add_alert_bulk_op', false);
|
||||
// Ids of agents to be include in the SQL clause as id_agent IN ()
|
||||
// Ids of agents to be include in the SQL clause as id_agent IN ().
|
||||
$filter_agents_json = (string) get_parameter('filter_agents_json', '');
|
||||
$status_agents = (int) get_parameter('status_agents', AGENT_STATUS_ALL);
|
||||
// Juanma (22/05/2014) Fix: If setted remove void agents from result (by default and for compatibility show void agents)
|
||||
// Juanma (22/05/2014) Fix: If setted remove void agents from result
|
||||
// (by default and for compatibility show void agents).
|
||||
$show_void_agents = (int) get_parameter('show_void_agents', 1);
|
||||
$serialized = (bool) get_parameter('serialized', false);
|
||||
$serialized_separator = (string) get_parameter('serialized_separator', '|');
|
||||
@ -121,7 +139,7 @@ if (is_ajax()) {
|
||||
$filter['status'] = $status_agents;
|
||||
}
|
||||
|
||||
// Juanma (22/05/2014) Fix: If remove void agents setted
|
||||
// Juanma (22/05/2014) Fix: If remove void agents set.
|
||||
$_sql_post = ' 1=1 ';
|
||||
if ($show_void_agents == 0) {
|
||||
$_sql_post .= ' AND id_agente IN (SELECT a.id_agente FROM tagente a, tagente_modulo b WHERE a.id_agente=b.id_agente AND b.delete_pending=0) AND \'1\'';
|
||||
@ -131,8 +149,9 @@ if (is_ajax()) {
|
||||
$id_groups_get_agents = $id_group;
|
||||
if ($id_group == 0 && $privilege != '') {
|
||||
$groups = users_get_groups($config['id_user'], $privilege, false);
|
||||
// if group ID doesn't matter and $privilege is specified (like 'AW'),
|
||||
// retruns all agents that current user has $privilege privilege for.
|
||||
// If group ID doesn't matter and $privilege is specified
|
||||
// (like 'AW'), retruns all agents that current user has $privilege
|
||||
// privilege for.
|
||||
$id_groups_get_agents = array_keys($groups);
|
||||
}
|
||||
|
||||
@ -149,13 +168,13 @@ if (is_ajax()) {
|
||||
);
|
||||
|
||||
$agents_disabled = [];
|
||||
// Add keys prefix
|
||||
// Add keys prefix.
|
||||
if ($keys_prefix !== '') {
|
||||
foreach ($agents as $k => $v) {
|
||||
$agents[$keys_prefix.$k] = $v;
|
||||
unset($agents[$k]);
|
||||
if ($all_agents) {
|
||||
// Unserialize to get the status
|
||||
// Unserialize to get the status.
|
||||
if ($serialized && is_metaconsole()) {
|
||||
$agent_info = explode($serialized_separator, $k);
|
||||
$agent_disabled = db_get_value_filter(
|
||||
@ -174,7 +193,8 @@ if (is_ajax()) {
|
||||
['id_agente' => $agent_info[1]]
|
||||
);
|
||||
} else if (!$serialized && is_metaconsole()) {
|
||||
// Cannot retrieve the disabled status. Mark all as not disabled
|
||||
// Cannot retrieve the disabled status.
|
||||
// Mark all as not disabled.
|
||||
$agent_disabled = 0;
|
||||
} else {
|
||||
$agent_disabled = db_get_value_filter(
|
||||
@ -226,11 +246,13 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
}
|
||||
|
||||
$sec = defined('METACONSOLE') ? 'advanced' : 'gagente';
|
||||
$url_tree = "index.php?sec=$sec&sec2=godmode/groups/group_list&tab=tree";
|
||||
$url_groups = "index.php?sec=$sec&sec2=godmode/groups/group_list&tab=groups";
|
||||
$url_credbox = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=credbox';
|
||||
$url_tree = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=tree';
|
||||
$url_groups = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=groups';
|
||||
|
||||
$buttons['tree'] = [
|
||||
'active' => false,
|
||||
'text' => "<a href='$url_tree'>".html_print_image(
|
||||
'text' => '<a href="'.$url_tree.'">'.html_print_image(
|
||||
'images/gm_massive_operations.png',
|
||||
true,
|
||||
[
|
||||
@ -241,7 +263,7 @@ $buttons['tree'] = [
|
||||
|
||||
$buttons['groups'] = [
|
||||
'active' => false,
|
||||
'text' => "<a href='$url_groups'>".html_print_image(
|
||||
'text' => '<a href="'.$url_groups.'">'.html_print_image(
|
||||
'images/group.png',
|
||||
true,
|
||||
[
|
||||
@ -250,21 +272,38 @@ $buttons['groups'] = [
|
||||
).'</a>',
|
||||
];
|
||||
|
||||
$buttons['credbox'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$url_credbox.'">'.html_print_image(
|
||||
'images/key.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Credential Store'),
|
||||
]
|
||||
).'</a>',
|
||||
];
|
||||
|
||||
$tab = (string) get_parameter('tab', 'groups');
|
||||
|
||||
// Marks correct tab
|
||||
$title = __('Groups defined in %s', get_product_name());
|
||||
// Marks correct tab.
|
||||
switch ($tab) {
|
||||
case 'tree':
|
||||
$buttons['tree']['active'] = true;
|
||||
break;
|
||||
|
||||
case 'credbox':
|
||||
$buttons['credbox']['active'] = true;
|
||||
$title = __('Credential store');
|
||||
break;
|
||||
|
||||
case 'groups':
|
||||
default:
|
||||
$buttons['groups']['active'] = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// Header
|
||||
// Header.
|
||||
if (defined('METACONSOLE')) {
|
||||
agents_meta_print_header();
|
||||
echo '<div class="notify">';
|
||||
@ -272,7 +311,7 @@ if (defined('METACONSOLE')) {
|
||||
echo '</div>';
|
||||
} else {
|
||||
ui_print_page_header(
|
||||
__('Groups defined in %s', get_product_name()),
|
||||
$title,
|
||||
'images/group.png',
|
||||
false,
|
||||
'group_list_tab',
|
||||
@ -281,12 +320,19 @@ if (defined('METACONSOLE')) {
|
||||
);
|
||||
}
|
||||
|
||||
// Load credential store view before parse list-tree forms.
|
||||
if ($tab == 'credbox') {
|
||||
include_once __DIR__.'/credential_store.php';
|
||||
// Stop script.
|
||||
return;
|
||||
}
|
||||
|
||||
$create_group = (bool) get_parameter('create_group');
|
||||
$update_group = (bool) get_parameter('update_group');
|
||||
$delete_group = (bool) get_parameter('delete_group');
|
||||
$pure = get_parameter('pure', 0);
|
||||
|
||||
// Create group
|
||||
// Create group.
|
||||
if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
|
||||
$name = (string) get_parameter('name');
|
||||
$icon = (string) get_parameter('icon');
|
||||
@ -301,7 +347,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
|
||||
$check = db_get_value('nombre', 'tgrupo', 'nombre', $name);
|
||||
$propagate = (bool) get_parameter('propagate');
|
||||
|
||||
// Check if name field is empty
|
||||
// Check if name field is empty.
|
||||
if ($name != '') {
|
||||
if (!$check) {
|
||||
$values = [
|
||||
@ -328,12 +374,11 @@ if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
|
||||
ui_print_error_message(__('Each group must have a different name'));
|
||||
}
|
||||
} else {
|
||||
// $result = false;
|
||||
ui_print_error_message(__('Group must have a name'));
|
||||
}
|
||||
}
|
||||
|
||||
// Update group
|
||||
// Update group.
|
||||
if ($update_group) {
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
$name = (string) get_parameter('name');
|
||||
@ -349,49 +394,35 @@ if ($update_group) {
|
||||
$contact = (string) get_parameter('contact');
|
||||
$other = (string) get_parameter('other');
|
||||
|
||||
// Check if name field is empty
|
||||
// Check if name field is empty.
|
||||
if ($name != '') {
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$sql = sprintf(
|
||||
'UPDATE tgrupo SET nombre = "%s",
|
||||
icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d, description = "%s", contact = "%s", other = "%s", password = "%s"
|
||||
WHERE id_grupo = %d',
|
||||
$name,
|
||||
empty($icon) ? '' : substr($icon, 0, -4),
|
||||
!$alerts_enabled,
|
||||
$id_parent,
|
||||
$custom_id,
|
||||
$propagate,
|
||||
$skin,
|
||||
$description,
|
||||
$contact,
|
||||
$other,
|
||||
$group_pass,
|
||||
$id_group
|
||||
);
|
||||
break;
|
||||
|
||||
case 'postgresql':
|
||||
case 'oracle':
|
||||
$sql = sprintf(
|
||||
'UPDATE tgrupo SET nombre = \'%s\',
|
||||
icon = \'%s\', disabled = %d, parent = %d, custom_id = \'%s\', propagate = %d, id_skin = %d, description = \'%s\', contact = \'%s\', other = \'%s\'
|
||||
WHERE id_grupo = %d',
|
||||
$name,
|
||||
substr($icon, 0, -4),
|
||||
!$alerts_enabled,
|
||||
$id_parent,
|
||||
$custom_id,
|
||||
$propagate,
|
||||
$skin,
|
||||
$description,
|
||||
$contact,
|
||||
$other,
|
||||
$id_group
|
||||
);
|
||||
break;
|
||||
}
|
||||
$sql = sprintf(
|
||||
'UPDATE tgrupo
|
||||
SET nombre = "%s",
|
||||
icon = "%s",
|
||||
disabled = %d,
|
||||
parent = %d,
|
||||
custom_id = "%s",
|
||||
propagate = %d,
|
||||
id_skin = %d,
|
||||
description = "%s",
|
||||
contact = "%s",
|
||||
other = "%s",
|
||||
password = "%s"
|
||||
WHERE id_grupo = %d',
|
||||
$name,
|
||||
empty($icon) ? '' : substr($icon, 0, -4),
|
||||
!$alerts_enabled,
|
||||
$id_parent,
|
||||
$custom_id,
|
||||
$propagate,
|
||||
$skin,
|
||||
$description,
|
||||
$contact,
|
||||
$other,
|
||||
$group_pass,
|
||||
$id_group
|
||||
);
|
||||
|
||||
$result = db_process_sql($sql);
|
||||
} else {
|
||||
@ -405,7 +436,7 @@ if ($update_group) {
|
||||
}
|
||||
}
|
||||
|
||||
// Delete group
|
||||
// Delete group.
|
||||
if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) {
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
|
||||
@ -445,7 +476,14 @@ if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Credential store is loaded previously in this document to avoid
|
||||
// process group tree - list forms.
|
||||
if ($tab == 'tree') {
|
||||
/*
|
||||
* Group tree view.
|
||||
*/
|
||||
|
||||
echo html_print_image(
|
||||
'images/spinner.gif',
|
||||
true,
|
||||
@ -456,6 +494,10 @@ if ($tab == 'tree') {
|
||||
);
|
||||
echo "<div id='tree-controller-recipient'></div>";
|
||||
} else {
|
||||
/*
|
||||
* Group list view.
|
||||
*/
|
||||
|
||||
$acl = '';
|
||||
$search_name = '';
|
||||
$offset = (int) get_parameter('offset', 0);
|
||||
@ -463,17 +505,22 @@ if ($tab == 'tree') {
|
||||
$block_size = $config['block_size'];
|
||||
|
||||
if (!empty($search)) {
|
||||
$search_name = "AND t.nombre LIKE '%$search%'";
|
||||
$search_name = 'AND t.nombre LIKE "%'.$search.'%"';
|
||||
}
|
||||
|
||||
if (!users_can_manage_group_all('AR')) {
|
||||
$user_groups_acl = users_get_groups(false, 'AR');
|
||||
$groups_acl = implode(',', $user_groups_ACL);
|
||||
if (empty($groups_acl)) {
|
||||
return ui_print_info_message(['no_close' => true, 'message' => __('There are no defined groups') ]);
|
||||
return ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('There are no defined groups'),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$acl = "AND t.id_grupo IN ($groups_acl)";
|
||||
$acl = 'AND t.id_grupo IN ('.$groups_acl.')';
|
||||
}
|
||||
|
||||
$form = "<form method='post' action=''>";
|
||||
@ -488,29 +535,37 @@ if ($tab == 'tree') {
|
||||
|
||||
echo $form;
|
||||
|
||||
$groups_sql = "SELECT t.*,
|
||||
$groups_sql = sprintf(
|
||||
'SELECT t.*,
|
||||
p.nombre AS parent_name,
|
||||
IF(t.parent=p.id_grupo, 1, 0) AS has_child
|
||||
FROM tgrupo t
|
||||
LEFT JOIN tgrupo p
|
||||
FROM tgrupo t
|
||||
LEFT JOIN tgrupo p
|
||||
ON t.parent=p.id_grupo
|
||||
WHERE 1=1
|
||||
$acl
|
||||
$search_name
|
||||
WHERE 1=1
|
||||
%s
|
||||
%s
|
||||
ORDER BY nombre
|
||||
LIMIT $offset, $block_size
|
||||
";
|
||||
LIMIT %d, %d',
|
||||
$acl,
|
||||
$search_name,
|
||||
$offset,
|
||||
$block_size
|
||||
);
|
||||
|
||||
$groups = db_get_all_rows_sql($groups_sql);
|
||||
|
||||
if (!empty($groups)) {
|
||||
// Count all groups for pagination only saw user and filters
|
||||
$groups_sql_count = "SELECT count(*)
|
||||
// Count all groups for pagination only saw user and filters.
|
||||
$groups_sql_count = sprintf(
|
||||
'SELECT count(*)
|
||||
FROM tgrupo t
|
||||
WHERE 1=1
|
||||
$acl
|
||||
$search_name
|
||||
";
|
||||
%s
|
||||
%s',
|
||||
$acl,
|
||||
$search_name
|
||||
);
|
||||
$groups_count = db_get_value_sql($groups_sql_count);
|
||||
|
||||
$table = new StdClass();
|
||||
@ -545,7 +600,7 @@ if ($tab == 'tree') {
|
||||
$url = 'index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group='.$group['id_grupo'];
|
||||
$url_delete = 'index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group='.$group['id_grupo'];
|
||||
$table->data[$key][0] = $group['id_grupo'];
|
||||
$table->data[$key][1] = "<a href='$url'>".$group['nombre'].'</a>';
|
||||
$table->data[$key][1] = '<a href="'.$url.'">'.$group['nombre'].'</a>';
|
||||
if ($group['icon'] != '') {
|
||||
$table->data[$key][2] = html_print_image(
|
||||
'images/groups_small/'.$group['icon'].'.png',
|
||||
@ -553,22 +608,25 @@ if ($tab == 'tree') {
|
||||
[
|
||||
'style' => '',
|
||||
'class' => 'bot',
|
||||
'alt' => $group['nombre'],
|
||||
'alt' => $group['nombre'],
|
||||
'title' => $group['nombre'],
|
||||
false, false, false, true
|
||||
]
|
||||
],
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$table->data[$key][2] = '';
|
||||
}
|
||||
|
||||
|
||||
// reporting_get_group_stats
|
||||
$table->data[$key][3] = $group['disabled'] ? __('Disabled') : __('Enabled');
|
||||
// Reporting_get_group_stats.
|
||||
$table->data[$key][3] = ($group['disabled']) ? __('Disabled') : __('Enabled');
|
||||
$table->data[$key][4] = $group['parent_name'];
|
||||
$table->data[$key][5] = $group['description'];
|
||||
$table->cellclass[$key][6] = 'action_buttons';
|
||||
$table->data[$key][6] = "<a href='$url'>".html_print_image(
|
||||
$table->data[$key][6] = '<a href="'.$url.'">'.html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
[
|
||||
|
@ -31,6 +31,7 @@ require_once $config['homedir'].'/include/functions_users.php';
|
||||
if (is_ajax()) {
|
||||
$get_agents = (bool) get_parameter('get_agents');
|
||||
$recursion = (int) get_parameter('recursion');
|
||||
$disabled_modules = (int) get_parameter('disabled_modules');
|
||||
|
||||
if ($get_agents) {
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
@ -44,12 +45,18 @@ if (is_ajax()) {
|
||||
$groups = [$id_group];
|
||||
}
|
||||
|
||||
if ($disabled_modules == 0) {
|
||||
$filter['tagente_modulo.disabled'] = '<> 1';
|
||||
} else {
|
||||
unset($filter['tagente_modulo.disabled']);
|
||||
}
|
||||
|
||||
$agents_alerts = [];
|
||||
foreach ($groups as $group) {
|
||||
$agents_alerts_one_group = alerts_get_agents_with_alert_template(
|
||||
$id_alert_template,
|
||||
$group,
|
||||
false,
|
||||
$filter,
|
||||
[
|
||||
'tagente.alias',
|
||||
'tagente.id_agente',
|
||||
@ -253,6 +260,11 @@ $table->data[1][1] = html_print_select_groups(
|
||||
'',
|
||||
$id_alert_template == 0
|
||||
);
|
||||
|
||||
$table->data[0][2] = __('Show alerts on disabled modules');
|
||||
$table->data[0][3] = html_print_checkbox('disabled_modules', 1, false, true, false);
|
||||
|
||||
|
||||
$table->data[1][2] = __('Group recursion');
|
||||
$table->data[1][3] = html_print_checkbox('recursion', 1, false, true, false);
|
||||
|
||||
@ -360,6 +372,7 @@ $(document).ready (function () {
|
||||
"get_agents" : 1,
|
||||
"id_group" : this.value,
|
||||
"recursion" : $("#checkbox-recursion").is(":checked") ? 1 : 0,
|
||||
"disabled_modules" : $("#checkbox-disabled_modules").is(":checked") ? 1 : 0,
|
||||
"id_alert_template" : $("#id_alert_template").val(),
|
||||
// Add a key prefix to avoid auto sorting in js object conversion
|
||||
"keys_prefix" : "_"
|
||||
@ -387,6 +400,10 @@ $(document).ready (function () {
|
||||
$("#modules_selection_mode").change (function() {
|
||||
$("#id_agents").trigger('change');
|
||||
});
|
||||
|
||||
$("#checkbox-disabled_modules").click(function () {
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
@ -208,7 +208,7 @@ if (!empty($sub)) {
|
||||
}
|
||||
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, 'RR')) {
|
||||
if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'PM')) {
|
||||
// Servers
|
||||
$menu_godmode['gservers']['text'] = __('Servers');
|
||||
$menu_godmode['gservers']['sec2'] = 'godmode/servers/modificar_server';
|
||||
@ -418,9 +418,11 @@ if (is_array($config['extensions'])) {
|
||||
$sub['godmode/extensions']['type'] = 'direct';
|
||||
$sub['godmode/extensions']['subtype'] = 'nolink';
|
||||
|
||||
$submenu = array_merge($menu_godmode['gextensions']['sub'], $sub);
|
||||
if ($menu_godmode['gextensions']['sub'] != null) {
|
||||
$menu_godmode['gextensions']['sub'] = $submenu;
|
||||
if (is_array($menu_godmode['gextensions']['sub'])) {
|
||||
$submenu = array_merge($menu_godmode['gextensions']['sub'], $sub);
|
||||
if ($menu_godmode['gextensions']['sub'] != null) {
|
||||
$menu_godmode['gextensions']['sub'] = $submenu;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,9 @@ require_once $config['homedir'].'/include/functions_component_groups.php';
|
||||
if (defined('METACONSOLE')) {
|
||||
components_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
|
||||
$id_modulo = (int) get_parameter('id_component_type');
|
||||
$new_component = (bool) get_parameter('new_component');
|
||||
} else {
|
||||
/*
|
||||
Hello there! :)
|
||||
|
@ -414,7 +414,7 @@ if ($edit_container) {
|
||||
echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
|
||||
echo '<tr>';
|
||||
echo '<td>';
|
||||
echo ui_toggle($single_table, 'Simple module graph', '', true, true);
|
||||
echo ui_toggle($single_table, 'Simple module graph', '', '', true);
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
@ -466,7 +466,7 @@ if ($edit_container) {
|
||||
echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
|
||||
echo '<tr>';
|
||||
echo '<td>';
|
||||
echo ui_toggle(html_print_table($table, true), 'Custom graph', '', true, true);
|
||||
echo ui_toggle(html_print_table($table, true), 'Custom graph', '', '', true);
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
@ -561,7 +561,7 @@ if ($edit_container) {
|
||||
echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
|
||||
echo '<tr>';
|
||||
echo '<td>';
|
||||
echo ui_toggle(html_print_table($table, true), 'Dynamic rules for simple module graph', '', true, true);
|
||||
echo ui_toggle(html_print_table($table, true), 'Dynamic rules for simple module graph', '', '', true);
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
|
@ -356,9 +356,35 @@ echo "<td style='vertical-align: top;'>".__('Agents').'</td>';
|
||||
echo '<td></td>';
|
||||
echo "<td style='vertical-align: top;'>".__('Modules').'</td>';
|
||||
echo '</tr><tr>';
|
||||
echo '<td>'.html_print_select(agents_get_group_agents(), 'id_agents[]', 0, false, '', '', true, true, true, '', false, '').'</td>';
|
||||
echo "<td style='vertical-align: center; text-align: center;'>".html_print_image('images/darrowright.png', true).'</td>';
|
||||
echo '<td>'.html_print_select([], 'module[]', 0, false, '', 0, true, true, true, '', false, '').'</td>';
|
||||
echo '<td style="width: 50%;">'.html_print_select(
|
||||
agents_get_group_agents(),
|
||||
'id_agents[]',
|
||||
0,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'w100p',
|
||||
false,
|
||||
''
|
||||
).'</td>';
|
||||
echo "<td style='width: 3em;vertical-align: center; text-align: center;'>".html_print_image('images/darrowright.png', true).'</td>';
|
||||
echo '<td style="width: 50%;">'.html_print_select(
|
||||
[],
|
||||
'module[]',
|
||||
0,
|
||||
false,
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'w100p',
|
||||
false,
|
||||
''
|
||||
).'</td>';
|
||||
echo '</tr><tr>';
|
||||
echo "<td colspan='3'>";
|
||||
echo "<table cellpadding='4'><tr>";
|
||||
|
@ -3526,6 +3526,7 @@ $(document).ready (function () {
|
||||
|
||||
$("#submit-create_item").click(function () {
|
||||
var type = $('#type').val();
|
||||
var name = $('#text-name').val();
|
||||
switch (type){
|
||||
case 'alert_report_module':
|
||||
case 'alert_report_agent':
|
||||
@ -3556,6 +3557,13 @@ $(document).ready (function () {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if($('#text-name').val() == ''){
|
||||
alert( <?php echo "'".__('Please insert a name')."'"; ?> );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$("#submit-edit_item").click(function () {
|
||||
|
@ -774,31 +774,28 @@ switch ($action) {
|
||||
$table->head[1] = __('Description');
|
||||
$table->head[2] = __('HTML');
|
||||
$table->head[3] = __('XML');
|
||||
$table->size[0] = '20%';
|
||||
$table->size[1] = '30%';
|
||||
$table->size[0] = '60%';
|
||||
$table->size[1] = '20%';
|
||||
$table->size[2] = '2%';
|
||||
$table->headstyle[2] = 'min-width: 35px;';
|
||||
$table->headstyle[2] = 'min-width: 35px;text-align: center;';
|
||||
$table->size[3] = '2%';
|
||||
$table->headstyle[3] = 'min-width: 35px;';
|
||||
$table->headstyle[3] = 'min-width: 35px;text-align: center;';
|
||||
$table->size[4] = '2%';
|
||||
$table->headstyle[4] = 'min-width: 35px;';
|
||||
$table->size[5] = '2%';
|
||||
$table->headstyle[5] = 'min-width: 35px;';
|
||||
$table->size[6] = '2%';
|
||||
$table->headstyle[6] = 'min-width: 35px;';
|
||||
$table->size[7] = '5%';
|
||||
$table->headstyle['csv'] = 'min-width: 65px;';
|
||||
$table->style[7] = 'text-align: center;';
|
||||
|
||||
$table->headstyle[9] = 'min-width: 100px;';
|
||||
$table->style[9] = 'text-align: center;';
|
||||
$table->headstyle[4] = 'min-width: 35px;text-align: center;';
|
||||
|
||||
$next = 4;
|
||||
// Calculate dinamically the number of the column.
|
||||
if (enterprise_hook('load_custom_reporting_1') !== ENTERPRISE_NOT_HOOK) {
|
||||
if (enterprise_hook('load_custom_reporting_1', [$table]) !== ENTERPRISE_NOT_HOOK) {
|
||||
$next = 7;
|
||||
}
|
||||
|
||||
$table->size[$next] = '2%';
|
||||
$table->style[$next] = 'text-align: center;';
|
||||
|
||||
$table->headstyle[($next + 2)] = 'min-width: 100px;';
|
||||
$table->style[($next + 2)] = 'text-align: center;';
|
||||
|
||||
|
||||
// Admin options only for RM flag.
|
||||
if (check_acl($config['id_user'], 0, 'RM')) {
|
||||
$table->head[$next] = __('Private');
|
||||
|
@ -254,10 +254,12 @@ function update_button_palette_callback() {
|
||||
var values = {};
|
||||
|
||||
values = readFields();
|
||||
if (values["map_linked"] == 0) {
|
||||
if (values["agent"] == "" || values["agent"] == "none") {
|
||||
dialog_message("#message_alert_no_agent");
|
||||
return false;
|
||||
if (selectedItem == "static_graph") {
|
||||
if (values["map_linked"] == 0) {
|
||||
if (values["agent"] == "" || values["agent"] == "none") {
|
||||
dialog_message("#message_alert_no_agent");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO VALIDATE DATA
|
||||
|
@ -25,6 +25,8 @@ if (empty($visualConsole)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
ui_require_css_file('visual_maps');
|
||||
|
||||
// ACL for the existing visual console
|
||||
// if (!isset($vconsole_read))
|
||||
// $vconsole_read = check_acl ($config['id_user'], $visualConsole['id_group'], "VR");
|
||||
@ -170,6 +172,7 @@ echo "<div id='delete_in_progress_dialog' style='display: none; text-align: cent
|
||||
// CSS
|
||||
ui_require_css_file('color-picker', 'include/styles/js/');
|
||||
ui_require_css_file('jquery-ui.min', 'include/styles/js/');
|
||||
ui_require_jquery_file('jquery-ui_custom');
|
||||
|
||||
// Javascript
|
||||
ui_require_jquery_file('colorpicker');
|
||||
|
@ -130,5 +130,11 @@ if ($classname_selected === null) {
|
||||
}
|
||||
}
|
||||
|
||||
// Show hints if there is no task
|
||||
if (get_parameter('discovery_hint', 0)) {
|
||||
ui_require_css_file('discovery-hint');
|
||||
ui_print_info_message(__('You must create a task first'));
|
||||
}
|
||||
|
||||
Wizard::printBigButtonsList($wiz_data);
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ if (($create != '') || ($view != '')) {
|
||||
} else {
|
||||
if ($create != '') {
|
||||
ui_print_page_header(
|
||||
__('Plugin creation'),
|
||||
__('Plugin registration'),
|
||||
'images/gm_servers.png',
|
||||
false,
|
||||
'plugin_definition',
|
||||
|
@ -51,11 +51,11 @@ $table->style[0] = 'font-weight: bold';
|
||||
$table->align = [];
|
||||
$table->align[1] = 'center';
|
||||
$table->align[3] = 'center';
|
||||
$table->align[8] = 'center';
|
||||
$table->align[8] = 'right';
|
||||
|
||||
$table->headstyle[1] = 'text-align:center';
|
||||
$table->headstyle[3] = 'text-align:center';
|
||||
$table->headstyle[8] = 'text-align:center';
|
||||
$table->headstyle[8] = 'text-align:right;width: 120px;';
|
||||
|
||||
// $table->title = __('Tactical server information');
|
||||
$table->titleclass = 'tabletitle';
|
||||
@ -234,7 +234,8 @@ if ($tiny) {
|
||||
ui_toggle(
|
||||
html_print_table($table, true),
|
||||
__('Tactical server information'),
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
$hidden_toggle
|
||||
);
|
||||
} else {
|
||||
|
@ -135,7 +135,9 @@ $table->data[9][0] = '<strong>'.__('Licensed to').'</strong>';
|
||||
$table->data[9][1] = html_print_input_text('licensed_to', $license['licensed_to'], '', 64, 255, true, true);
|
||||
|
||||
html_print_table($table);
|
||||
if (enterprise_installed()) {
|
||||
|
||||
// If DESTDIR is defined the enterprise license is expired.
|
||||
if (enterprise_installed() || defined('DESTDIR')) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_input_hidden('update_settings', 1);
|
||||
html_print_submit_button(__('Validate'), 'update_button', false, 'class="sub upd"');
|
||||
|
@ -1113,15 +1113,6 @@ $row++;
|
||||
|
||||
|
||||
|
||||
$table_other->data[$row][0] = __('Show QR Code icon in the header');
|
||||
$table_other->data[$row][1] = html_print_checkbox_switch(
|
||||
'show_qr_code_header',
|
||||
1,
|
||||
$config['show_qr_code_header'],
|
||||
true
|
||||
);
|
||||
$row++;
|
||||
|
||||
$table_other->data[$row][0] = __('Custom graphviz directory').ui_print_help_tip(__('Custom directory where the graphviz binaries are stored.'), true);
|
||||
$table_other->data[$row][1] = html_print_input_text(
|
||||
'graphviz_bin_dir',
|
||||
|
@ -1275,7 +1275,7 @@ if ($create_alert || $update_alert) {
|
||||
$table->align[7] = 'left';
|
||||
|
||||
$table->head[8] = __('Action');
|
||||
$table->size[8] = '90px';
|
||||
$table->size[8] = '120px';
|
||||
$table->align[8] = 'left';
|
||||
|
||||
$table->head[9] = html_print_checkbox('all_delete_box', '1', false, true);
|
||||
|
@ -34,7 +34,7 @@
|
||||
float: none;
|
||||
}
|
||||
#drop_file a {
|
||||
background-color: #80ba27;
|
||||
background-color: #82b92e;
|
||||
border-radius: 2px;
|
||||
color: #ffffff;
|
||||
cursor: pointer;
|
||||
@ -101,7 +101,7 @@
|
||||
width: 15px;
|
||||
}
|
||||
.fileupload_form ul li div {
|
||||
display: block !important;
|
||||
display: block;
|
||||
}
|
||||
.fileupload_form ul li.working span {
|
||||
background-position: 0 -12px;
|
||||
@ -183,39 +183,22 @@ div#box_online * {
|
||||
|
||||
.update_text a {
|
||||
font-size: 11pt;
|
||||
color: #82b92e !important;
|
||||
color: #82b92e;
|
||||
}
|
||||
|
||||
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
|
||||
float: left !important;
|
||||
float: left;
|
||||
padding-left: 19px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.ui-dialog-buttonset > button.ui-button.ui-corner-all.ui-widget {
|
||||
background-color: #cecece !important;
|
||||
border: none !important;
|
||||
border-radius: 2px !important;
|
||||
text-transform: uppercase !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.ui-dialog-buttonset > button.success_button.ui-button.ui-corner-all.ui-widget,
|
||||
.update_manager_button {
|
||||
background-color: #82b92e !important;
|
||||
color: #fff !important;
|
||||
border-radius: 2px !important;
|
||||
text-transform: uppercase !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
a.update_manager_button {
|
||||
padding: 10px 12px;
|
||||
margin-top: 10px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
font-size: 16px !important;
|
||||
border-radius: 4px !important;
|
||||
font-size: 16px;
|
||||
border-radius: 4px;
|
||||
text-decoration: none;
|
||||
font-family: "Open Sans", sans-serif;
|
||||
}
|
||||
@ -231,7 +214,7 @@ a.update_manager_button:after {
|
||||
|
||||
.ui-draggable,
|
||||
.ui-draggable .ui-dialog-titlebar {
|
||||
cursor: default !important;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
#box_online #pkg_version {
|
||||
@ -242,10 +225,10 @@ a.update_manager_button:after {
|
||||
|
||||
/* METACONSOLE */
|
||||
.box_online_meta {
|
||||
background: none !important;
|
||||
min-height: 400px !important;
|
||||
background: none;
|
||||
min-height: 400px;
|
||||
text-align: center;
|
||||
border: none !important;
|
||||
border: none;
|
||||
}
|
||||
|
||||
div#box_online.box_online_meta * {
|
||||
@ -277,7 +260,7 @@ div#box_online.box_online_meta * {
|
||||
}
|
||||
|
||||
.update_manager_warning p {
|
||||
font-size: 10pt !important;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
.update_manager_warning img {
|
||||
@ -287,8 +270,8 @@ div#box_online.box_online_meta * {
|
||||
|
||||
a.update_manager_button_open {
|
||||
padding: 5px 10px;
|
||||
font-size: 16px !important;
|
||||
border-radius: 4px !important;
|
||||
font-size: 16px;
|
||||
border-radius: 4px;
|
||||
text-decoration: none;
|
||||
border: 1px solid #82b92e;
|
||||
color: #82b92e;
|
||||
|
@ -297,7 +297,14 @@ if (defined('METACONSOLE')) {
|
||||
$form_filter = "<form method='post'>";
|
||||
$form_filter .= html_print_table($table, true);
|
||||
$form_filter .= '</form>';
|
||||
ui_toggle($form_filter, __('Users control filter'), __('Toggle filter(s)'), !$search);
|
||||
ui_toggle(
|
||||
$form_filter,
|
||||
__('Users control filter'),
|
||||
__('Toggle filter(s)'),
|
||||
'',
|
||||
'',
|
||||
!$search
|
||||
);
|
||||
}
|
||||
|
||||
// Urls to sort the table.
|
||||
|
@ -651,20 +651,24 @@ class DiscoveryTaskList extends Wizard
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
echo '<h2>'.__('Server tasks').'</h2>';
|
||||
if (empty($table->data)) {
|
||||
echo '<div class="nf">'.__('Server').' '.$server_name.' '.__('has no discovery tasks assigned').'</div>';
|
||||
return false;
|
||||
$content = '<div class="nf">'.__('Server').' '.$server_name.' '.__('has no discovery tasks assigned').'</div>';
|
||||
$return = false;
|
||||
} else {
|
||||
html_print_table($table);
|
||||
$content = html_print_table($table, true);
|
||||
$return = true;
|
||||
}
|
||||
|
||||
ui_toggle($content, __('Server Tasks'), '', '', false);
|
||||
|
||||
// Div neccesary for modal map task.
|
||||
echo '<div id="map_task" style="display:none"></div>';
|
||||
|
||||
unset($table);
|
||||
|
||||
ui_require_javascript_file('pandora_taskList');
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -695,7 +699,7 @@ class DiscoveryTaskList extends Wizard
|
||||
if ($script !== false) {
|
||||
switch ($script['type']) {
|
||||
case DISCOVERY_SCRIPT_CLOUD_AWS:
|
||||
return 'wiz=cloud&mode=amazonws&page=1';
|
||||
return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&page=1';
|
||||
|
||||
case DISCOVERY_SCRIPT_APP_VMWARE:
|
||||
return 'wiz=app&mode=vmware&page=0';
|
||||
@ -718,10 +722,10 @@ class DiscoveryTaskList extends Wizard
|
||||
|
||||
case DISCOVERY_CLOUD_AWS:
|
||||
case DISCOVERY_CLOUD_AWS_EC2:
|
||||
return 'wiz=cloud&mode=amazonws&page=1';
|
||||
return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&page=1';
|
||||
|
||||
case DISCOVERY_CLOUD_AWS_RDS:
|
||||
return 'wiz=cloud&mode=amazonws&sub=rds&page=0';
|
||||
return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&sub=rds&page=0';
|
||||
|
||||
default:
|
||||
if ($task['description'] == 'console_task') {
|
||||
|
@ -1048,7 +1048,7 @@ class Wizard
|
||||
*/
|
||||
public static function printBigButtonsList($list_data)
|
||||
{
|
||||
echo '<ul>';
|
||||
echo '<ul class="bigbuttonlist">';
|
||||
array_map('self::printBigButtonElement', $list_data);
|
||||
echo '</ul>';
|
||||
}
|
||||
|
BIN
pandora_console/images/arrow_left_green.png
Normal file
BIN
pandora_console/images/arrow_left_green.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 276 B |
BIN
pandora_console/images/heartbeat_green.gif
Normal file
BIN
pandora_console/images/heartbeat_green.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
BIN
pandora_console/images/heartbeat_red.gif
Normal file
BIN
pandora_console/images/heartbeat_red.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
File diff suppressed because it is too large
Load Diff
@ -392,11 +392,16 @@ if (check_login()) {
|
||||
switch ($row['module_type']) {
|
||||
case 15:
|
||||
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module_id);
|
||||
// System Uptime:
|
||||
// In case of System Uptime module, shows data in format "Days hours minutes seconds" if and only if
|
||||
// selected module unit is "_timeticks_"
|
||||
// Take notice that selected unit may not be postrocess unit
|
||||
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
|
||||
if ($post_process > 0) {
|
||||
$data[] = human_milliseconds_to_string(($row['data'] / $post_process));
|
||||
$data_macro = modules_get_unit_macro($row[$attr[0]], $unit);
|
||||
if ($data_macro) {
|
||||
$data[] = $data_macro;
|
||||
} else {
|
||||
$data[] = human_milliseconds_to_string($row['data']);
|
||||
$data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision']));
|
||||
}
|
||||
} else {
|
||||
$data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision']));
|
||||
@ -824,23 +829,28 @@ if (check_login()) {
|
||||
$table->head[7] = __('Data');
|
||||
$table->head[8] = __('Graph');
|
||||
$table->head[9] = __('Last contact').ui_get_sorting_arrows($url_up_last, $url_down_last, $selectLastContactUp, $selectLastContactDown);
|
||||
$table->align = [
|
||||
'left',
|
||||
'left',
|
||||
'left',
|
||||
'left',
|
||||
'left',
|
||||
'left',
|
||||
'left',
|
||||
'left',
|
||||
'left',
|
||||
];
|
||||
$table->align = [];
|
||||
$table->align[0] = 'center';
|
||||
$table->align[1] = 'left';
|
||||
$table->align[2] = 'left';
|
||||
$table->align[3] = 'left';
|
||||
$table->align[4] = 'left';
|
||||
$table->align[5] = 'left';
|
||||
$table->align[6] = 'center';
|
||||
$table->align[7] = 'left';
|
||||
$table->align[8] = 'center';
|
||||
$table->align[9] = 'right';
|
||||
|
||||
$table->headstyle[2] = 'min-width: 60px';
|
||||
$table->headstyle[3] = 'min-width: 100px';
|
||||
$table->headstyle[5] = 'min-width: 60px';
|
||||
$table->headstyle[8] = 'min-width: 85px';
|
||||
$table->headstyle[9] = 'min-width: 100px';
|
||||
$table->headstyle[2] = 'min-width: 85px';
|
||||
$table->headstyle[3] = 'min-width: 130px';
|
||||
$table->size[3] = '30%';
|
||||
$table->style[3] = 'max-width: 28em;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;';
|
||||
$table->size[4] = '30%';
|
||||
$table->headstyle[5] = 'min-width: 85px';
|
||||
$table->headstyle[6] = 'min-width: 125px; text-align: center;';
|
||||
$table->headstyle[7] = 'min-width: 125px;';
|
||||
$table->headstyle[8] = 'min-width: 100px; text-align: center;';
|
||||
$table->headstyle[9] = 'min-width: 120px; text-align: right;';
|
||||
|
||||
$last_modulegroup = 0;
|
||||
$rowIndex = 0;
|
||||
@ -879,14 +889,14 @@ if (check_login()) {
|
||||
$last_modulegroup = $module['id_module_group'];
|
||||
}
|
||||
|
||||
// End of title of group
|
||||
// End of title of group.
|
||||
}
|
||||
|
||||
$data = [];
|
||||
if (($module['id_modulo'] != 1) && ($module['id_tipo_modulo'] != 100)) {
|
||||
if ($agent_w) {
|
||||
if ($module['flag'] == 0) {
|
||||
$data[0] = '<a href="index.php?'.'sec=estado&'.'sec2=operation/agentes/ver_agente&'.'id_agente='.$id_agente.'&'.'id_agente_modulo='.$module['id_agente_modulo'].'&'.'flag=1&'.'refr=60">'.html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force')]).'</a>';
|
||||
$data[0] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&id_agente_modulo='.$module['id_agente_modulo'].'&flag=1&refr=60">'.html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force')]).'</a>';
|
||||
} else {
|
||||
$data[0] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&id_agente_modulo='.$module['id_agente_modulo'].'&refr=60">'.html_print_image('images/refresh.png', true, ['border' => '0', 'title' => __('Refresh')]).'</a>';
|
||||
}
|
||||
@ -1074,7 +1084,7 @@ if (check_login()) {
|
||||
if ($data_macro) {
|
||||
$salida = $data_macro;
|
||||
} else {
|
||||
$salida .= ' '.'<i>'.io_safe_output($module['unit']).'</i>';
|
||||
$salida .= ' <i>'.io_safe_output($module['unit']).'</i>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -1120,17 +1130,17 @@ if (check_login()) {
|
||||
$draw_events = 0;
|
||||
}
|
||||
|
||||
$link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&'.'id='.$module['id_agente_modulo'].'&'.'label='.rawurlencode(
|
||||
$link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&id='.$module['id_agente_modulo'].'&label='.rawurlencode(
|
||||
urlencode(
|
||||
base64_encode($module['nombre'])
|
||||
)
|
||||
).'&'.'refresh='.SECONDS_10MINUTES.'&'."draw_events=$draw_events', 'day_".$win_handle."', 1000, 650)";
|
||||
).'&refresh='.SECONDS_10MINUTES.'&'."draw_events=$draw_events', 'day_".$win_handle."', 1000, 700)";
|
||||
if (!is_snapshot_data($module['datos'])) {
|
||||
$data[8] .= '<a href="javascript:'.$link.'">'.html_print_image('images/chart_curve.png', true, ['border' => '0', 'alt' => '']).'</a> ';
|
||||
}
|
||||
|
||||
$server_name = '';
|
||||
$data[8] .= "<a href='javascript: ".'show_module_detail_dialog('.$module['id_agente_modulo'].', '.$id_agente.', '.'"'.$server_name.'", '.(0).', '.SECONDS_1DAY.', " '.modules_get_agentmodule_name($module['id_agente_modulo'])."\")'>".html_print_image('images/binary.png', true, ['border' => '0', 'alt' => '']).'</a>';
|
||||
$data[8] .= "<a href='javascript: ".'show_module_detail_dialog('.$module['id_agente_modulo'].', '.$id_agente.', "'.$server_name.'", '.(0).', '.SECONDS_1DAY.', " '.modules_get_agentmodule_name($module['id_agente_modulo'])."\")'>".html_print_image('images/binary.png', true, ['border' => '0', 'alt' => '']).'</a>';
|
||||
}
|
||||
|
||||
if ($module['estado'] == 3) {
|
||||
@ -1177,7 +1187,7 @@ if (check_login()) {
|
||||
ui_print_info_message([ 'no_close' => true, 'message' => __('This agent doesn\'t have any active monitors.') ]);
|
||||
}
|
||||
} else {
|
||||
$url = 'index.php?'.'sec=estado&'.'sec2=operation/agentes/ver_agente&'.'id_agente='.$id_agente.'&'.'refr=&filter_monitors=1&'.'status_filter_monitor='.$status_filter_monitor.'&'.'status_text_monitor='.$status_text_monitor.'&'.'status_module_group='.$status_module_group;
|
||||
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&refr=&filter_monitors=1&status_filter_monitor='.$status_filter_monitor.'&status_text_monitor='.$status_text_monitor.'&status_module_group='.$status_module_group;
|
||||
|
||||
if ($paginate_module) {
|
||||
ui_pagination(
|
||||
|
@ -151,6 +151,10 @@ if (is_ajax()) {
|
||||
|
||||
ob_clean();
|
||||
|
||||
echo '<style type="text/css">';
|
||||
include_once __DIR__.'/../styles/progress.css';
|
||||
echo '</style>';
|
||||
|
||||
echo '<div class="left_align">';
|
||||
if (!empty($id) && !empty($type)) {
|
||||
switch ($type) {
|
||||
|
@ -1206,6 +1206,8 @@ switch ($action) {
|
||||
switch ($type) {
|
||||
case 'auto_sla_graph':
|
||||
$elementFields['event_max_time_row'] = $elementFields['period'];
|
||||
break;
|
||||
|
||||
case 'percentile_item':
|
||||
case 'percentile_bar':
|
||||
$elementFields['width_percentile'] = $elementFields['width'];
|
||||
|
@ -1257,11 +1257,8 @@ function fill_permissions_ldap($sr)
|
||||
global $config;
|
||||
$permissions = [];
|
||||
$permissions_profile = [];
|
||||
if (defined('METACONSOLE')) {
|
||||
$meta = true;
|
||||
}
|
||||
|
||||
if ($meta && (bool) $config['ldap_save_profile'] === false && $config['ldap_advanced_config'] == 0) {
|
||||
if ((bool) $config['ldap_save_profile'] === false && ($config['ldap_advanced_config'] == 0 || $config['ldap_advanced_config'] == '')) {
|
||||
$result = 0;
|
||||
$result = db_get_all_rows_filter(
|
||||
'tusuario_perfil',
|
||||
@ -1287,43 +1284,9 @@ function fill_permissions_ldap($sr)
|
||||
return $permissions_profile;
|
||||
}
|
||||
|
||||
if ((bool) $config['ldap_save_profile'] === false && $config['ldap_advanced_config'] == '') {
|
||||
$result = db_get_all_rows_filter(
|
||||
'tusuario_perfil',
|
||||
['id_usuario' => $sr['uid'][0]]
|
||||
);
|
||||
if ($result == false) {
|
||||
$permissions[0]['profile'] = $config['default_remote_profile'];
|
||||
$permissions[0]['groups'][] = $config['default_remote_group'];
|
||||
$permissions[0]['tags'] = $config['default_assign_tags'];
|
||||
$permissions[0]['no_hierarchy'] = $config['default_no_hierarchy'];
|
||||
return $permissions;
|
||||
}
|
||||
|
||||
foreach ($result as $perms) {
|
||||
$permissions_profile[] = [
|
||||
'profile' => $perms['id_perfil'],
|
||||
'groups' => [$perms['id_grupo']],
|
||||
'tags' => $perms['tags'],
|
||||
'no_hierarchy' => (bool) $perms['no_hierarchy'] ? 1 : 0,
|
||||
];
|
||||
}
|
||||
|
||||
return $permissions_profile;
|
||||
}
|
||||
|
||||
if ($config['ldap_advanced_config'] == 1 && $config['ldap_save_profile'] == 1) {
|
||||
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
|
||||
foreach ($ldap_adv_perms as $ldap_adv_perm) {
|
||||
$permissions[] = [
|
||||
'profile' => $ldap_adv_perm['profile'],
|
||||
'groups' => $ldap_adv_perm['group'],
|
||||
'tags' => implode(',', $ldap_adv_perm['tags']),
|
||||
'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
|
||||
];
|
||||
}
|
||||
|
||||
return $permissions;
|
||||
return get_advanced_permissions($ldap_adv_perms, $sr);
|
||||
}
|
||||
|
||||
if ($config['ldap_advanced_config'] == 1 && $config['ldap_save_profile'] == 0) {
|
||||
@ -1333,25 +1296,16 @@ function fill_permissions_ldap($sr)
|
||||
);
|
||||
if ($result == false) {
|
||||
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
|
||||
foreach ($ldap_adv_perms as $ldap_adv_perm) {
|
||||
$permissions[] = [
|
||||
'profile' => $ldap_adv_perm['profile'],
|
||||
'groups' => $ldap_adv_perm['group'],
|
||||
'tags' => implode(',', $ldap_adv_perm['tags']),
|
||||
'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
|
||||
];
|
||||
}
|
||||
|
||||
return $permissions;
|
||||
return get_advanced_permissions($ldap_adv_perms, $sr);
|
||||
}
|
||||
|
||||
foreach ($result as $perms) {
|
||||
$permissions_profile[] = [
|
||||
'profile' => $perms['id_perfil'],
|
||||
'groups' => [$perms['id_grupo']],
|
||||
'tags' => $perms['tags'],
|
||||
'no_hierarchy' => (bool) $perms['no_hierarchy'] ? 1 : 0,
|
||||
];
|
||||
$permissions_profile[] = [
|
||||
'profile' => $perms['id_perfil'],
|
||||
'groups' => [$perms['id_grupo']],
|
||||
'tags' => $perms['tags'],
|
||||
'no_hierarchy' => (bool) $perms['no_hierarchy'] ? 1 : 0,
|
||||
];
|
||||
};
|
||||
|
||||
return $permissions_profile;
|
||||
@ -1365,22 +1319,43 @@ function fill_permissions_ldap($sr)
|
||||
return $permissions;
|
||||
}
|
||||
|
||||
// Decode permissions in advanced mode
|
||||
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
|
||||
return $permissions;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get permissions in advanced mode.
|
||||
*
|
||||
* @param array ldap_adv_perms
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_advanced_permissions($ldap_adv_perms, $sr)
|
||||
{
|
||||
$permissions = [];
|
||||
foreach ($ldap_adv_perms as $ldap_adv_perm) {
|
||||
$attributes = $ldap_adv_perm['groups_ldap'];
|
||||
foreach ($attributes as $attr) {
|
||||
$attr = explode('=', $attr, 2);
|
||||
foreach ($sr[$attr[0]] as $s_attr) {
|
||||
if (preg_match('/'.$attr[1].'/', $s_attr)) {
|
||||
$permissions[] = [
|
||||
'profile' => $ldap_adv_perm['profile'],
|
||||
'groups' => $ldap_adv_perm['group'],
|
||||
'tags' => implode(',', $ldap_adv_perm['tags']),
|
||||
'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
|
||||
];
|
||||
if (!empty($attributes[0])) {
|
||||
foreach ($attributes as $attr) {
|
||||
$attr = explode('=', $attr, 2);
|
||||
foreach ($sr[$attr[0]] as $s_attr) {
|
||||
if (preg_match('/'.$attr[1].'/', $s_attr)) {
|
||||
$permissions[] = [
|
||||
'profile' => $ldap_adv_perm['profile'],
|
||||
'groups' => $ldap_adv_perm['group'],
|
||||
'tags' => implode(',', $ldap_adv_perm['tags']),
|
||||
'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$permissions[] = [
|
||||
'profile' => $ldap_adv_perm['profile'],
|
||||
'groups' => $ldap_adv_perm['group'],
|
||||
'tags' => implode(',', $ldap_adv_perm['tags']),
|
||||
'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,7 @@ if (file_exists('languages/'.$user_language.'.mo')) {
|
||||
<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>
|
||||
<script language="javascript" type='text/javascript' src='javascript/jquery.pandora.js'></script>
|
||||
|
@ -32,6 +32,7 @@ require_once $config['homedir'].'/include/functions_db.php';
|
||||
require_once $config['homedir'].'/include/functions_io.php';
|
||||
require_once $config['homedir'].'/include/functions_notifications.php';
|
||||
require_once $config['homedir'].'/include/functions_servers.php';
|
||||
require_once $config['homedir'].'/include/functions_update_manager.php';
|
||||
|
||||
// Enterprise includes.
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
@ -1940,6 +1941,7 @@ class ConsoleSupervisor
|
||||
public function checkUpdateManagerRegistration()
|
||||
{
|
||||
global $config;
|
||||
include_once $config['homedir'].'/include/functions_update_manager.php';
|
||||
$login = get_parameter('login', false);
|
||||
|
||||
if (update_manager_verify_registration() === false) {
|
||||
@ -2244,6 +2246,7 @@ class ConsoleSupervisor
|
||||
public function getUMMessages()
|
||||
{
|
||||
global $config;
|
||||
include_once $config['homedir'].'/include/functions_update_manager.php';
|
||||
|
||||
if (update_manager_verify_registration() === false) {
|
||||
// Console not subscribed.
|
||||
@ -2261,8 +2264,6 @@ class ConsoleSupervisor
|
||||
$future = (time() + 2 * SECONDS_1HOUR);
|
||||
config_update_value('last_um_check', $future);
|
||||
|
||||
include_once $config['homedir'].'/include/functions_update_manager.php';
|
||||
|
||||
$params = [
|
||||
'pandora_uid' => $config['pandora_uid'],
|
||||
'timezone' => $config['timezone'],
|
||||
|
@ -2845,6 +2845,7 @@ class NetworkMap
|
||||
html_print_table($table, true),
|
||||
__('Node Details'),
|
||||
__('Node Details'),
|
||||
'',
|
||||
false,
|
||||
true
|
||||
);
|
||||
@ -2897,6 +2898,7 @@ class NetworkMap
|
||||
html_print_table($table, true),
|
||||
__('Node Details'),
|
||||
__('Node Details'),
|
||||
'',
|
||||
false,
|
||||
true
|
||||
);
|
||||
@ -2922,6 +2924,7 @@ class NetworkMap
|
||||
html_print_table($table, true),
|
||||
__('Interface Information (SNMP)'),
|
||||
__('Interface Information (SNMP)'),
|
||||
'',
|
||||
true,
|
||||
true
|
||||
);
|
||||
@ -2996,6 +2999,7 @@ class NetworkMap
|
||||
html_print_table($table, true),
|
||||
__('Node options'),
|
||||
__('Node options'),
|
||||
'',
|
||||
true,
|
||||
true
|
||||
);
|
||||
@ -3056,6 +3060,7 @@ class NetworkMap
|
||||
html_print_table($table, true),
|
||||
__('Relations'),
|
||||
__('Relations'),
|
||||
'',
|
||||
true,
|
||||
true
|
||||
);
|
||||
@ -3165,6 +3170,7 @@ class NetworkMap
|
||||
$add_agent_node_html,
|
||||
__('Add agent node'),
|
||||
__('Add agent node'),
|
||||
'',
|
||||
false,
|
||||
true
|
||||
);
|
||||
@ -3216,6 +3222,7 @@ class NetworkMap
|
||||
$add_agent_node_html,
|
||||
__('Add agent node (filter by group)'),
|
||||
__('Add agent node'),
|
||||
'',
|
||||
true,
|
||||
true
|
||||
);
|
||||
@ -3256,6 +3263,7 @@ class NetworkMap
|
||||
$add_agent_node_html,
|
||||
__('Add fictional point'),
|
||||
__('Add agent node'),
|
||||
'',
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
@ -72,6 +72,8 @@ class TreeService extends Tree
|
||||
|
||||
protected function getFirstLevel()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$processed_items = $this->getProcessedServices();
|
||||
$ids = array_keys($processed_items);
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC190614';
|
||||
$pandora_version = 'v7.0NG.735';
|
||||
$build_version = 'PC190628';
|
||||
$pandora_version = 'v7.0NG.736';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
@ -39,10 +39,11 @@ define('TIME_FORMAT', 'H:i:s');
|
||||
define('TIME_FORMAT_JS', 'HH:mm:ss');
|
||||
|
||||
// Events state constants.
|
||||
define('EVENT_ALL', -1);
|
||||
define('EVENT_NEW', 0);
|
||||
define('EVENT_VALIDATE', 1);
|
||||
define('EVENT_PROCESS', 2);
|
||||
|
||||
define('EVENT_NO_VALIDATED', 3);
|
||||
|
||||
|
||||
// Agents disabled status.
|
||||
@ -65,7 +66,7 @@ define('ERR_NODATA', -70000);
|
||||
define('ERR_CONNECTION', -80000);
|
||||
define('ERR_DISABLED', -90000);
|
||||
define('ERR_WRONG', -100000);
|
||||
define('ERR_WRONG_NAME', -100001);
|
||||
define('ERR_WRONG_MR', -100001);
|
||||
define('ERR_WRONG_PARAMETERS', -100002);
|
||||
define('ERR_ACL', -110000);
|
||||
define('ERR_AUTH', -120000);
|
||||
@ -137,19 +138,19 @@ switch ($config['dbtype']) {
|
||||
|
||||
|
||||
// Color constants.
|
||||
define('COL_CRITICAL', '#FC4444');
|
||||
define('COL_WARNING', '#FAD403');
|
||||
define('COL_CRITICAL', '#e63c52');
|
||||
define('COL_WARNING', '#f3b200');
|
||||
define('COL_WARNING_DARK', '#FFB900');
|
||||
define('COL_NORMAL', '#80BA27');
|
||||
define('COL_NOTINIT', '#3BA0FF');
|
||||
define('COL_NORMAL', '#82b92e');
|
||||
define('COL_NOTINIT', '#4a83f3');
|
||||
define('COL_UNKNOWN', '#B2B2B2');
|
||||
define('COL_DOWNTIME', '#976DB1');
|
||||
define('COL_IGNORED', '#DDD');
|
||||
define('COL_ALERTFIRED', '#FFA631');
|
||||
define('COL_MINOR', '#F099A2');
|
||||
define('COL_ALERTFIRED', '#F36201');
|
||||
define('COL_MINOR', '#B2B2B2');
|
||||
define('COL_MAJOR', '#C97A4A');
|
||||
define('COL_INFORMATIONAL', '#E4E4E4');
|
||||
define('COL_MAINTENANCE', '#3BA0FF');
|
||||
define('COL_MAINTENANCE', '#4a83f3');
|
||||
|
||||
define('COL_GRAPH1', '#C397F2');
|
||||
define('COL_GRAPH2', '#FFE66C');
|
||||
|
@ -902,6 +902,47 @@ function set_cookie($name, $value)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns database ORDER clause from datatables AJAX call.
|
||||
*
|
||||
* @param boolean $as_array Return as array or as string.
|
||||
*
|
||||
* @return string Order or empty.
|
||||
*/
|
||||
function get_datatable_order($as_array=false)
|
||||
{
|
||||
$order = get_parameter('order');
|
||||
|
||||
if (is_array($order)) {
|
||||
$column = $order[0]['column'];
|
||||
$direction = $order[0]['dir'];
|
||||
}
|
||||
|
||||
if (!isset($column) || !isset($direction)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$columns = get_parameter('columns');
|
||||
|
||||
if (is_array($columns)) {
|
||||
$column_name = $columns[$column]['data'];
|
||||
}
|
||||
|
||||
if (!isset($column_name)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($as_array) {
|
||||
return [
|
||||
'direction' => $direction,
|
||||
'field' => $column_name,
|
||||
];
|
||||
}
|
||||
|
||||
return $column_name.' '.$direction;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a parameter from a request.
|
||||
*
|
||||
@ -1392,6 +1433,11 @@ function enterprise_installed()
|
||||
{
|
||||
$return = false;
|
||||
|
||||
// Load enterprise extensions.
|
||||
if (defined('DESTDIR')) {
|
||||
return $return;
|
||||
}
|
||||
|
||||
if (defined('PANDORA_ENTERPRISE')) {
|
||||
if (PANDORA_ENTERPRISE) {
|
||||
$return = true;
|
||||
@ -1444,7 +1490,7 @@ function enterprise_include($filename)
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Load enterprise extensions
|
||||
// Load enterprise extensions.
|
||||
if (defined('DESTDIR')) {
|
||||
$destdir = DESTDIR;
|
||||
} else {
|
||||
@ -1470,11 +1516,24 @@ function enterprise_include($filename)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Includes a file from enterprise section.
|
||||
*
|
||||
* @param string $filename Target file.
|
||||
*
|
||||
* @return mixed Result code.
|
||||
*/
|
||||
function enterprise_include_once($filename)
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Load enterprise extensions
|
||||
// Load enterprise extensions.
|
||||
if (defined('DESTDIR')) {
|
||||
$destdir = DESTDIR;
|
||||
} else {
|
||||
$destdir = '';
|
||||
}
|
||||
|
||||
$filepath = realpath($config['homedir'].'/'.ENTERPRISE_DIR.'/'.$filename);
|
||||
|
||||
if ($filepath === false) {
|
||||
@ -1574,6 +1633,11 @@ function safe_sql_string($string)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Verifies if current Pandora FMS installation is a Metaconsole.
|
||||
*
|
||||
* @return boolean True metaconsole installation, false if not.
|
||||
*/
|
||||
function is_metaconsole()
|
||||
{
|
||||
global $config;
|
||||
@ -1581,6 +1645,18 @@ function is_metaconsole()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if current Pandora FMS installation has joined a Metaconsole env.
|
||||
*
|
||||
* @return boolean True joined, false if not.
|
||||
*/
|
||||
function has_metaconsole()
|
||||
{
|
||||
global $config;
|
||||
return (bool) $config['node_metaconsole'] && (bool) $config['metaconsole_node_id'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Check if there is management operations are allowed in current context
|
||||
* (node // meta)
|
||||
@ -1760,6 +1836,52 @@ function array_key_to_offset($array, $key)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param array $arguments Following format:
|
||||
* [
|
||||
* 'ip_target'
|
||||
* 'snmp_version'
|
||||
* 'snmp_community'
|
||||
* 'snmp3_auth_user'
|
||||
* 'snmp3_security_level'
|
||||
* 'snmp3_auth_method'
|
||||
* 'snmp3_auth_pass'
|
||||
* 'snmp3_privacy_method'
|
||||
* 'snmp3_privacy_pass'
|
||||
* 'quick_print'
|
||||
* 'base_oid'
|
||||
* 'snmp_port'
|
||||
* 'server_to_exec'
|
||||
* 'extra_arguments'
|
||||
* 'format'
|
||||
* ]
|
||||
*
|
||||
* @return array SNMP result.
|
||||
*/
|
||||
function get_h_snmpwalk(array $arguments)
|
||||
{
|
||||
return get_snmpwalk(
|
||||
$arguments['ip_target'],
|
||||
$arguments['snmp_version'],
|
||||
isset($arguments['snmp_community']) ? $arguments['snmp_community'] : '',
|
||||
isset($arguments['snmp3_auth_user']) ? $arguments['snmp3_auth_user'] : '',
|
||||
isset($arguments['snmp3_security_level']) ? $arguments['snmp3_security_level'] : '',
|
||||
isset($arguments['snmp3_auth_method']) ? $arguments['snmp3_auth_method'] : '',
|
||||
isset($arguments['snmp3_auth_pass']) ? $arguments['snmp3_auth_pass'] : '',
|
||||
isset($arguments['snmp3_privacy_method']) ? $arguments['snmp3_privacy_method'] : '',
|
||||
isset($arguments['snmp3_privacy_pass']) ? $arguments['snmp3_privacy_pass'] : '',
|
||||
isset($arguments['quick_print']) ? $arguments['quick_print'] : 0,
|
||||
isset($arguments['base_oid']) ? $arguments['base_oid'] : '',
|
||||
isset($arguments['snmp_port']) ? $arguments['snmp_port'] : '',
|
||||
isset($arguments['server_to_exec']) ? $arguments['server_to_exec'] : 0,
|
||||
isset($arguments['extra_arguments']) ? $arguments['extra_arguments'] : '',
|
||||
isset($arguments['format']) ? $arguments['format'] : '-Oa'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make a snmpwalk and return it.
|
||||
*
|
||||
@ -1880,11 +2002,16 @@ function get_snmpwalk(
|
||||
exec($command_str, $output, $rc);
|
||||
}
|
||||
|
||||
// Parse the output of snmpwalk
|
||||
// Parse the output of snmpwalk.
|
||||
$snmpwalk = [];
|
||||
foreach ($output as $line) {
|
||||
// Separate the OID from the value
|
||||
$full_oid = explode(' = ', $line);
|
||||
// Separate the OID from the value.
|
||||
if (strpos($format, 'q') === false) {
|
||||
$full_oid = explode(' = ', $line, 2);
|
||||
} else {
|
||||
$full_oid = explode(' ', $line, 2);
|
||||
}
|
||||
|
||||
if (isset($full_oid[1])) {
|
||||
$snmpwalk[$full_oid[0]] = $full_oid[1];
|
||||
}
|
||||
|
@ -1614,9 +1614,9 @@ function agents_get_interval($id_agent)
|
||||
*
|
||||
* @param Agent object.
|
||||
*
|
||||
* @return The interval value and status of last contact
|
||||
* @return The interval value and status of last contact or True /False
|
||||
*/
|
||||
function agents_get_interval_status($agent)
|
||||
function agents_get_interval_status($agent, $return_html=true)
|
||||
{
|
||||
$return = '';
|
||||
$last_time = time_w_fixed_tz($agent['ultimo_contacto']);
|
||||
@ -1624,9 +1624,18 @@ function agents_get_interval_status($agent)
|
||||
$diferencia = ($now - $last_time);
|
||||
$time = ui_print_timestamp($last_time, true, ['style' => 'font-size:6.5pt']);
|
||||
$min_interval = modules_get_agentmodule_mininterval_no_async($agent['id_agente']);
|
||||
$return = $time;
|
||||
if ($return_html) {
|
||||
$return = $time;
|
||||
} else {
|
||||
$return = true;
|
||||
}
|
||||
|
||||
if ($diferencia > ($min_interval['min_interval'] * 2) && $min_interval['num_interval'] > 0) {
|
||||
$return = '<b><span style="color: #ff0000;">'.$time.'</span></b>';
|
||||
if ($return_html) {
|
||||
$return = '<b><span style="color: #ff0000;">'.$time.'</span></b>';
|
||||
} else {
|
||||
$return = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
@ -3367,3 +3376,35 @@ function agents_get_image_status($status)
|
||||
|
||||
return $image_status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Animation GIF to show agent's status.
|
||||
*
|
||||
* @return string HTML code with heartbeat image.
|
||||
*/
|
||||
function agents_get_status_animation($up=true)
|
||||
{
|
||||
switch ($up) {
|
||||
case true:
|
||||
default:
|
||||
return html_print_image(
|
||||
'images/heartbeat_green.gif',
|
||||
true,
|
||||
[
|
||||
'width' => '170',
|
||||
'height' => '40',
|
||||
]
|
||||
);
|
||||
|
||||
case false:
|
||||
return html_print_image(
|
||||
'images/heartbeat_red.gif',
|
||||
true,
|
||||
[
|
||||
'width' => '170',
|
||||
'height' => '40',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1783,12 +1783,14 @@ function alerts_validate_alert_agent_module($id_alert_agent_module, $noACLs=fals
|
||||
['id' => $id]
|
||||
);
|
||||
|
||||
$template_name = io_safe_output(db_get_value('name', 'talert_templates', 'id', $alert['id_alert_template']));
|
||||
$module_name = io_safe_output(db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $alert['id_agent_module']));
|
||||
if ($result > 0) {
|
||||
// Update fired alert count on the agent
|
||||
db_process_sql(sprintf('UPDATE tagente SET update_alert_count=1 WHERE id_agente = %d', $agent_id));
|
||||
|
||||
events_create_event(
|
||||
'Manual validation of alert for '.alerts_get_alert_template_description($alert['id_alert_template']),
|
||||
'Manual validation of alert '.$template_name.' assigned to '.$module_name.'',
|
||||
$group_id,
|
||||
$agent_id,
|
||||
1,
|
||||
@ -1914,7 +1916,6 @@ function alerts_get_agents_with_alert_template($id_alert_template, $id_group, $f
|
||||
$filter[] = 'tagente_modulo.id_agente_modulo = talert_template_modules.id_agent_module';
|
||||
$filter[] = 'tagente_modulo.id_agente = tagente.id_agente';
|
||||
$filter['id_alert_template'] = $id_alert_template;
|
||||
$filter['tagente_modulo.disabled'] = '<> 1';
|
||||
$filter['delete_pending'] = '<> 1';
|
||||
|
||||
if (empty($id_agents)) {
|
||||
|
@ -11519,7 +11519,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
|
||||
|
||||
if ($other['data'][18] != '') {
|
||||
$values['id_extra'] = $other['data'][18];
|
||||
$sql_validation = 'SELECT id_evento FROM tevento where estado=0 and id_extra ="'.$other['data'][18].'";';
|
||||
$sql_validation = 'SELECT id_evento FROM tevento where estado IN (0,2) and id_extra ="'.$other['data'][18].'";';
|
||||
$validation = db_get_all_rows_sql($sql_validation);
|
||||
if ($validation) {
|
||||
foreach ($validation as $val) {
|
||||
|
439
pandora_console/include/functions_credential_store.php
Normal file
439
pandora_console/include/functions_credential_store.php
Normal file
@ -0,0 +1,439 @@
|
||||
<?php
|
||||
/**
|
||||
* Credentials management auxiliary functions.
|
||||
*
|
||||
* @category Credentials management library.
|
||||
* @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.
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array with all the credentials matching filter and ACL.
|
||||
*
|
||||
* @param array $fields Fields array or 'count' keyword to retrieve count.
|
||||
* @param array $filter Filters to be applied.
|
||||
* @param integer $offset Offset (pagination).
|
||||
* @param integer $limit Limit (pagination).
|
||||
* @param string $order Sort order.
|
||||
* @param string $sort_field Sort field.
|
||||
*
|
||||
* @return array With all results or false if error.
|
||||
* @throws Exception On error.
|
||||
*/
|
||||
function credentials_get_all(
|
||||
$fields,
|
||||
array $filter,
|
||||
$offset=null,
|
||||
$limit=null,
|
||||
$order=null,
|
||||
$sort_field=null
|
||||
) {
|
||||
$sql_filters = [];
|
||||
$order_by = '';
|
||||
$pagination = '';
|
||||
|
||||
global $config;
|
||||
|
||||
$user_is_admin = users_is_admin();
|
||||
|
||||
if (!is_array($filter)) {
|
||||
error_log('[credential_get_all] Filter must be an array.');
|
||||
throw new Exception('[credential_get_all] Filter must be an array.');
|
||||
}
|
||||
|
||||
$count = false;
|
||||
if (!is_array($fields) && $fields == 'count') {
|
||||
$fields = ['cs.*'];
|
||||
$count = true;
|
||||
} else if (!is_array($fields)) {
|
||||
error_log('[credential_get_all] Fields must be an array or "count".');
|
||||
throw new Exception('[credential_get_all] Fields must be an array or "count".');
|
||||
}
|
||||
|
||||
if (isset($filter['free_search']) && !empty($filter['free_search'])) {
|
||||
$sql_filters[] = vsprintf(
|
||||
' AND (lower(cs.username) like lower("%%%s%%")
|
||||
OR cs.identifier like "%%%s%%"
|
||||
OR lower(cs.product) like lower("%%%s%%"))',
|
||||
array_fill(0, 3, $filter['free_search'])
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($filter['filter_id_group']) && $filter['filter_id_group'] > 0) {
|
||||
$propagate = db_get_value(
|
||||
'propagate',
|
||||
'tgrupo',
|
||||
'id_grupo',
|
||||
$filter['filter_id_group']
|
||||
);
|
||||
|
||||
if (!$propagate) {
|
||||
$sql_filters[] = sprintf(
|
||||
' AND cs.id_group = %d ',
|
||||
$filter['filter_id_group']
|
||||
);
|
||||
} else {
|
||||
$groups = [ $filter['filter_id_group'] ];
|
||||
$childrens = groups_get_childrens($id_group, null, true);
|
||||
if (!empty($childrens)) {
|
||||
foreach ($childrens as $child) {
|
||||
$groups[] = (int) $child['id_grupo'];
|
||||
}
|
||||
}
|
||||
|
||||
$filter['filter_id_group'] = $groups;
|
||||
$sql_filters[] = sprintf(
|
||||
' AND cs.id_group IN (%s) ',
|
||||
join(',', $filter['filter_id_group'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($filter['group_list']) && is_array($filter['group_list'])) {
|
||||
$sql_filters[] = sprintf(
|
||||
' AND cs.id_group IN (%s) ',
|
||||
join(',', $filter['group_list'])
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($order)) {
|
||||
$dir = 'asc';
|
||||
if ($order == 'desc') {
|
||||
$dir = 'desc';
|
||||
};
|
||||
|
||||
if (in_array(
|
||||
$sort_field,
|
||||
[
|
||||
'group',
|
||||
'identifier',
|
||||
'product',
|
||||
'username',
|
||||
'options',
|
||||
]
|
||||
)
|
||||
) {
|
||||
$order_by = sprintf(
|
||||
'ORDER BY `%s` %s',
|
||||
$sort_field,
|
||||
$dir
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($limit) && $limit > 0
|
||||
&& isset($offset) && $offset >= 0
|
||||
) {
|
||||
$pagination = sprintf(
|
||||
' LIMIT %d OFFSET %d ',
|
||||
$limit,
|
||||
$offset
|
||||
);
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT %s
|
||||
FROM tcredential_store cs
|
||||
LEFT JOIN tgrupo tg
|
||||
ON tg.id_grupo = cs.id_group
|
||||
WHERE 1=1
|
||||
%s
|
||||
%s
|
||||
%s',
|
||||
join(',', $fields),
|
||||
join(',', $sql_filters),
|
||||
$order_by,
|
||||
$pagination
|
||||
);
|
||||
|
||||
if ($count) {
|
||||
$sql = sprintf('SELECT count(*) as n FROM ( %s ) tt', $sql);
|
||||
|
||||
return db_get_value_sql($sql);
|
||||
}
|
||||
|
||||
return db_get_all_rows_sql($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves target key from keystore or false in case of error.
|
||||
*
|
||||
* @param string $identifier Key identifier.
|
||||
*
|
||||
* @return array Key or false if error.
|
||||
*/
|
||||
function get_key($identifier)
|
||||
{
|
||||
return db_get_row_filter(
|
||||
'tcredential_store',
|
||||
[ 'identifier' => $identifier ]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Minor function to dump json message as ajax response.
|
||||
*
|
||||
* @param string $type Type: result || error.
|
||||
* @param string $msg Message.
|
||||
* @param boolean $delete Deletion messages.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function ajax_msg($type, $msg, $delete=false)
|
||||
{
|
||||
$msg_err = 'Failed while saving: %s';
|
||||
$msg_ok = 'Successfully saved into keystore ';
|
||||
|
||||
if ($delete) {
|
||||
$msg_err = 'Failed while removing: %s';
|
||||
$msg_ok = 'Successfully deleted ';
|
||||
}
|
||||
|
||||
if ($type == 'error') {
|
||||
echo json_encode(
|
||||
[
|
||||
$type => ui_print_error_message(
|
||||
__(
|
||||
$msg_err,
|
||||
$msg
|
||||
),
|
||||
'',
|
||||
true
|
||||
),
|
||||
]
|
||||
);
|
||||
} else {
|
||||
echo json_encode(
|
||||
[
|
||||
$type => ui_print_success_message(
|
||||
__(
|
||||
$msg_ok,
|
||||
$msg
|
||||
),
|
||||
'',
|
||||
true
|
||||
),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for new/update forms.
|
||||
*
|
||||
* @param array $values Values or null.
|
||||
*
|
||||
* @return string Inputs.
|
||||
*/
|
||||
function print_inputs($values=null)
|
||||
{
|
||||
if (!is_array($values)) {
|
||||
$values = [];
|
||||
}
|
||||
|
||||
$return = '';
|
||||
$return .= html_print_input(
|
||||
[
|
||||
'label' => __('Identifier'),
|
||||
'name' => 'identifier',
|
||||
'input_class' => 'flex-row',
|
||||
'type' => 'text',
|
||||
'value' => $values['identifier'],
|
||||
'disabled' => (bool) $values['identifier'],
|
||||
'return' => true,
|
||||
'script' => 'alert(\'puta\')',
|
||||
]
|
||||
);
|
||||
$return .= html_print_input(
|
||||
[
|
||||
'label' => __('Group'),
|
||||
'name' => 'id_group',
|
||||
'id' => 'id_group',
|
||||
'input_class' => 'flex-row',
|
||||
'type' => 'select_groups',
|
||||
'selected' => $values['id_group'],
|
||||
'return' => true,
|
||||
'class' => 'w50p',
|
||||
]
|
||||
);
|
||||
$return .= html_print_input(
|
||||
[
|
||||
'label' => __('Product'),
|
||||
'name' => 'product',
|
||||
'input_class' => 'flex-row',
|
||||
'type' => 'select',
|
||||
'script' => 'calculate_inputs()',
|
||||
'fields' => [
|
||||
// 'CUSTOM' => __('Custom'),
|
||||
'AWS' => __('Aws'),
|
||||
// 'AZURE' => __('Azure'),
|
||||
// 'GOOGLE' => __('Google'),
|
||||
],
|
||||
'selected' => $values['product'],
|
||||
'disabled' => (bool) $values['product'],
|
||||
'return' => true,
|
||||
]
|
||||
);
|
||||
$user_label = __('Username');
|
||||
$pass_label = __('Password');
|
||||
$extra_1_label = __('Extra');
|
||||
$extra_2_label = __('Extra (2)');
|
||||
$extra1 = true;
|
||||
$extra2 = true;
|
||||
|
||||
// Remember to update credential_store.php also.
|
||||
switch ($values['product']) {
|
||||
case 'AWS':
|
||||
$user_label = __('Access key ID');
|
||||
$pass_label = __('Secret access key');
|
||||
$extra1 = false;
|
||||
$extra2 = false;
|
||||
break;
|
||||
|
||||
case 'AZURE':
|
||||
$user_label = __('Account ID');
|
||||
$pass_label = __('Password');
|
||||
$extra_1_label = __('Tenant or domain name');
|
||||
$extra_2_label = __('Subscription id');
|
||||
break;
|
||||
|
||||
case 'GOOGLE':
|
||||
// Need further investigation.
|
||||
case 'CUSTOM':
|
||||
default:
|
||||
// Use defaults.
|
||||
break;
|
||||
}
|
||||
|
||||
$return .= html_print_input(
|
||||
[
|
||||
'label' => $user_label,
|
||||
'name' => 'username',
|
||||
'input_class' => 'flex-row',
|
||||
'type' => 'text',
|
||||
'value' => $values['username'],
|
||||
'return' => true,
|
||||
]
|
||||
);
|
||||
$return .= html_print_input(
|
||||
[
|
||||
'label' => $pass_label,
|
||||
'name' => 'password',
|
||||
'input_class' => 'flex-row',
|
||||
'type' => 'password',
|
||||
'value' => $values['password'],
|
||||
'return' => true,
|
||||
]
|
||||
);
|
||||
if ($extra1) {
|
||||
$return .= html_print_input(
|
||||
[
|
||||
'label' => $extra_1_label,
|
||||
'name' => 'extra_1',
|
||||
'input_class' => 'flex-row',
|
||||
'type' => 'password',
|
||||
'value' => $values['extra_1'],
|
||||
'return' => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if ($extra2) {
|
||||
$return .= html_print_input(
|
||||
[
|
||||
'label' => $extra_2_label,
|
||||
'name' => 'extra_2',
|
||||
'input_class' => 'flex-row',
|
||||
'type' => 'password',
|
||||
'value' => $values['extra_2'],
|
||||
'return' => true,
|
||||
'display' => $extra2,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve all identifiers available for current user.
|
||||
*
|
||||
* @param string $product Target product.
|
||||
*
|
||||
* @return array Of account identifiers.
|
||||
*/
|
||||
function credentials_list_accounts($product)
|
||||
{
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
include_once $config['homedir'].'/include/functions_users.php';
|
||||
|
||||
static $user_groups;
|
||||
|
||||
if (!isset($user_groups)) {
|
||||
$user_groups = users_get_groups(
|
||||
$config['id_user'],
|
||||
'AR'
|
||||
);
|
||||
|
||||
// Always add group 'ALL' because 'ALL' group credentials
|
||||
// must be available for all users.
|
||||
if (is_array($user_groups)) {
|
||||
$user_groups = ([0] + array_keys($user_groups));
|
||||
} else {
|
||||
$user_groups = [0];
|
||||
}
|
||||
}
|
||||
|
||||
$creds = credentials_get_all(
|
||||
['identifier'],
|
||||
[
|
||||
'product' => $product,
|
||||
'group_list' => $user_groups,
|
||||
]
|
||||
);
|
||||
|
||||
if ($creds === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$ret = array_reduce(
|
||||
$creds,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['identifier']] = $item['identifier'];
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
|
||||
return $ret;
|
||||
}
|
@ -184,7 +184,7 @@ function custom_graphs_search($id_group, $search)
|
||||
FROM tgraph_source
|
||||
WHERE id_graph = '.$graph['id_graph'].''
|
||||
);
|
||||
|
||||
$graphs[$graph['id_graph']]['id_graph'] = $graph['id_graph'];
|
||||
$graphs[$graph['id_graph']]['graphs_count'] = $graphsCount;
|
||||
$graphs[$graph['id_graph']]['name'] = $graph['name'];
|
||||
$graphs[$graph['id_graph']]['description'] = $graph['description'];
|
||||
|
@ -2023,3 +2023,58 @@ function db_check_minor_relase_available_to_um($package, $ent, $offline)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tries to get a lock with current name.
|
||||
*
|
||||
* @param string $lockname Lock name.
|
||||
* @param integer $expiration_time Expiration time.
|
||||
*
|
||||
* @return integer 1 - lock OK, able to continue executing
|
||||
* 0 - already locked by another process.
|
||||
* NULL: something really bad happened
|
||||
*/
|
||||
function db_get_lock($lockname, $expiration_time=86400)
|
||||
{
|
||||
$lock_status = db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT IS_FREE_LOCK("%s")',
|
||||
$lockname
|
||||
)
|
||||
);
|
||||
|
||||
if ($lock_status == 1) {
|
||||
$lock_status = db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT GET_LOCK("%s", %d)',
|
||||
$lockname,
|
||||
$expiration_time
|
||||
)
|
||||
);
|
||||
|
||||
return $lock_status;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Release a previously defined lock.
|
||||
*
|
||||
* @param string $lockname Lock name.
|
||||
*
|
||||
* @return integer 1 Lock released.
|
||||
* 0 cannot release (not owned).
|
||||
* NULL lock does not exist.
|
||||
*/
|
||||
function db_release_lock($lockname)
|
||||
{
|
||||
return db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT RELEASE_LOCK("%s")',
|
||||
$lockname
|
||||
)
|
||||
);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user