Merge branch 'develop' of brutus.artica.lan:artica/pandorafms into ent-3432-Nueva-cabecera-y-menu-lateral
Conflicts: pandora_console/godmode/setup/setup_visuals.php pandora_console/install.php Former-commit-id: 1c1a318ae74ab3a363a88d99cc079eea6e213171
This commit is contained in:
commit
12a287f322
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, AIX version
|
||||
# Version 7.0NG.732, 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.731, FreeBSD Version
|
||||
# Version 7.0NG.732, 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.731, HP-UX Version
|
||||
# Version 7.0NG.732, 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.731, GNU/Linux
|
||||
# Version 7.0NG.732, 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.731, GNU/Linux
|
||||
# Version 7.0NG.732, 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.731, Solaris Version
|
||||
# Version 7.0NG.732, 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.731
|
||||
# Version 7.0NG.732
|
||||
|
||||
# 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.731, AIX version
|
||||
# Version 7.0NG.732, 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.731
|
||||
# Version 7.0NG.732
|
||||
# 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.731, HPUX Version
|
||||
# Version 7.0NG.732, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731
|
||||
# Version 7.0NG.732
|
||||
# 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.731
|
||||
# Version 7.0NG.732
|
||||
# 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.731
|
||||
# Version 7.0NG.732
|
||||
# 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.731, Solaris version
|
||||
# Version 7.0NG.732, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, AIX version
|
||||
# Version 7.0NG.732, 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.731-190226
|
||||
Version: 7.0NG.732-190304
|
||||
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.731-190226"
|
||||
pandora_version="7.0NG.732-190304"
|
||||
|
||||
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.731, GNU/Linux
|
||||
# Version 7.0NG.732, 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.731, FreeBSD Version
|
||||
# Version 7.0NG.732, 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.731, HP-UX Version
|
||||
# Version 7.0NG.732, 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.731, GNU/Linux
|
||||
# Version 7.0NG.732, 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.731, GNU/Linux
|
||||
# Version 7.0NG.732, 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.731, NetBSD Version
|
||||
# Version 7.0NG.732, 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.731, Solaris Version
|
||||
# Version 7.0NG.732, 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.731';
|
||||
use constant AGENT_BUILD => '190226';
|
||||
use constant AGENT_VERSION => '7.0NG.732';
|
||||
use constant AGENT_BUILD => '190304';
|
||||
|
||||
# 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.731
|
||||
%define release 190226
|
||||
%define version 7.0NG.732
|
||||
%define release 190304
|
||||
|
||||
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.731
|
||||
%define release 190226
|
||||
%define version 7.0NG.732
|
||||
%define release 190304
|
||||
|
||||
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.731"
|
||||
PI_BUILD="190226"
|
||||
PI_VERSION="7.0NG.732"
|
||||
PI_BUILD="190304"
|
||||
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.731
|
||||
# Version 7.0NG.732
|
||||
|
||||
# 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.731}
|
||||
{Pandora FMS Windows Agent v7.0NG.732}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{190226}
|
||||
{190304}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.731(Build 190226)")
|
||||
#define PANDORA_VERSION ("7.0NG.732(Build 190304)")
|
||||
|
||||
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.731(Build 190226))"
|
||||
VALUE "ProductVersion", "(7.0NG.732(Build 190304))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.731-190226
|
||||
Version: 7.0NG.732-190304
|
||||
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.731-190226"
|
||||
pandora_version="7.0NG.732-190304"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -1199,13 +1199,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', 24);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 25);
|
||||
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', '731');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '732');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
|
|
|
@ -334,6 +334,9 @@ require_once 'include/functions_notifications.php';
|
|||
<!-- Notifications content wrapper-->
|
||||
<div id='notification-content' style='display:none;' /></div>
|
||||
|
||||
<!-- Old style div wrapper -->
|
||||
<div id="alert_messages" style="display: none"></div>;
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ var autohidden_menu = <?php echo $autohidden_menu; ?>;
|
|||
<?php
|
||||
// echo json_encode((bool) $config_fixed_menu);
|
||||
?>
|
||||
;
|
||||
|
||||
var fixed_header = <?php echo json_encode((bool) $config_fixed_header); ?>;
|
||||
var id_user = "<?php echo $config['id_user']; ?>";
|
||||
var cookie_name = id_user + '-pandora_menu_state';
|
||||
|
@ -170,7 +170,7 @@ var click_display = "<?php echo $config['click_display']; ?>";
|
|||
<?php
|
||||
// echo $config['classic_menu'];
|
||||
?>
|
||||
");
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@ $edit_file = get_parameter('edit_file', false);
|
|||
$update_file = get_parameter('update_file', false);
|
||||
$plugin_command = get_parameter('plugin_command', '');
|
||||
$tab = get_parameter('tab', '');
|
||||
$deploy_plugin = get_parameter('deploy_plugin', 0);
|
||||
|
||||
if ($view != '') {
|
||||
$form_id = $view;
|
||||
|
@ -192,9 +193,8 @@ if ($filemanager) {
|
|||
// If is win compatible and the compatibility must be unix
|
||||
if ($is_win_compatible !== false && $compatibility == 'unix') {
|
||||
$contentFile = str_replace("\r\n", "\n", $contentFile);
|
||||
}
|
||||
// If is unix compatible and the compatibility must be win
|
||||
else if ($is_win_compatible === false && $compatibility == 'windows') {
|
||||
} else if ($is_win_compatible === false && $compatibility == 'windows') {
|
||||
// If is unix compatible and the compatibility must be win
|
||||
$contentFile = str_replace("\n", "\r\n", $contentFile);
|
||||
}
|
||||
|
||||
|
@ -268,12 +268,16 @@ if ($filemanager) {
|
|||
// =====================================================================
|
||||
$sec = 'gservers';
|
||||
|
||||
if (($create != '') or ($view != '')) {
|
||||
if (($create != '') || ($view != '')) {
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
components_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
$management_allowed = is_management_allowed();
|
||||
if (!$management_allowed) {
|
||||
ui_print_warning_message(__('To manage plugin you must activate centralized management'));
|
||||
}
|
||||
} else {
|
||||
if ($create != '') {
|
||||
ui_print_page_header(
|
||||
|
@ -292,6 +296,16 @@ if (($create != '') or ($view != '')) {
|
|||
true
|
||||
);
|
||||
}
|
||||
|
||||
$management_allowed = !is_central_policies_on_node();
|
||||
if (!$management_allowed) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This console is not manager of this environment,
|
||||
please manage this feature from centralized manager console (Metaconsole).'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -564,9 +578,53 @@ if (($create != '') or ($view != '')) {
|
|||
if (defined('METACONSOLE')) {
|
||||
components_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
$management_allowed = is_management_allowed();
|
||||
if (!$management_allowed) {
|
||||
ui_print_warning_message(__('To manage plugin you must activate centralized management'));
|
||||
}
|
||||
|
||||
if (!$config['metaconsole_deploy_plugin_server'] && $management_allowed) {
|
||||
$deploy_plugin_server = true;
|
||||
|
||||
echo '<div id="deploy_messages" style="display: none">';
|
||||
echo '<span>'.__('The previous configuration of plugins has been imported from the nodes. Please check that the definitions are correct.').'</br></br>'.'<b>'.__('Note:').'</b>'.__(
|
||||
'These definitions will not be operational until you manually
|
||||
copy the files from the nodes to the atachment/plugin/ directory of the meta console.'
|
||||
).'</br></br>'.__('You can find more information at:')."<a href='https://wiki.pandorafms.com'>https://wiki.pandorafms.com</a>".'</span>';
|
||||
echo '</div>';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$("#deploy_messages").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 220,
|
||||
title: '<?php echo __('Warning'); ?>',
|
||||
width: 528,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
config_update_value('metaconsole_deploy_plugin_server', 1);
|
||||
}
|
||||
} else {
|
||||
ui_print_page_header(__('Plug-ins registered on %s', get_product_name()), 'images/gm_servers.png', false, '', true);
|
||||
|
||||
$management_allowed = !is_central_policies_on_node();
|
||||
if (!$management_allowed) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This console is not manager of this environment,
|
||||
please manage this feature from centralized manager console (Metaconsole).'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
|
||||
if ($is_windows) {
|
||||
echo '<div class="notify">';
|
||||
|
@ -576,9 +634,8 @@ if (($create != '') or ($view != '')) {
|
|||
}
|
||||
|
||||
|
||||
// Update plugin
|
||||
// Update plugin.
|
||||
if (isset($_GET['update_plugin'])) {
|
||||
// if modified any parameter
|
||||
$plugin_id = get_parameter('update_plugin', 0);
|
||||
$plugin_name = get_parameter('form_name', '');
|
||||
$plugin_description = get_parameter('form_description', '');
|
||||
|
@ -709,12 +766,15 @@ if (($create != '') or ($view != '')) {
|
|||
|
||||
$result = db_process_sql_delete('tplugin', ['id' => $plugin_id]);
|
||||
|
||||
if (! $result) {
|
||||
ui_print_error_message(__('Problem deleting plugin'));
|
||||
} else {
|
||||
ui_print_success_message(__('Plugin deleted successfully'));
|
||||
if (!is_metaconsole()) {
|
||||
if (!$result) {
|
||||
ui_print_error_message(__('Problem deleting plugin'));
|
||||
} else {
|
||||
ui_print_success_message(__('Plugin deleted successfully'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($plugin_id != 0) {
|
||||
// Delete all the modules with this plugin
|
||||
$plugin_modules = db_get_all_rows_filter(
|
||||
|
@ -737,6 +797,153 @@ if (($create != '') or ($view != '')) {
|
|||
policies_change_delete_pending_module($policies_id['id']);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
enterprise_include_once('include/functions_plugins.php');
|
||||
$result = plugins_delete_plugin($plugin_id);
|
||||
if (!$result) {
|
||||
ui_print_error_message(__('Problem deleting plugin'));
|
||||
} else {
|
||||
ui_print_success_message(__('Plugin deleted successfully'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($deploy_plugin) {
|
||||
if (is_metaconsole()) {
|
||||
enterprise_include_once('include/functions_plugins.php');
|
||||
$result = plugins_deploy_plugin($deploy_plugin);
|
||||
if (!$result) {
|
||||
ui_print_error_message(__('Problem deploying plugin'));
|
||||
} else {
|
||||
ui_print_success_message(__('Plugin deployed successfully'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($deploy_plugin_server) {
|
||||
$setup = db_get_all_rows_in_table('tmetaconsole_setup');
|
||||
// recorremos todos los nodos.
|
||||
foreach ($setup as $key => $value) {
|
||||
// Obtenemos los plugins de la meta.
|
||||
$all_plugin_meta = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
|
||||
// Conectamos con el nodo.
|
||||
if (metaconsole_connect($value) == NOERR) {
|
||||
$values = [];
|
||||
// Obtenemos los plugin del nodo.
|
||||
$node_plugin_server = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
|
||||
foreach ($node_plugin_server as $key2 => $plugin) {
|
||||
// Comprobamos si el id esta meta y nodo al mismo tiempo.
|
||||
$key_exists = array_search($plugin['id'], array_column($all_plugin_meta, 'id'));
|
||||
if ($key_exists !== false) {
|
||||
// Si el plugin tiene el mismo id pero diferentes datos.
|
||||
if ($all_plugin_meta[$key_exists] != $plugin) {
|
||||
$old_id = $plugin['id'];
|
||||
$new_id = ($plugin['id'] + (1000 * $value['id']));
|
||||
|
||||
// El plugin del nodo pasa a tener otro id y otro nombre.
|
||||
$plugin['id'] = $new_id;
|
||||
$plugin['name'] = $plugin['name'].'_'.$value['server_name'];
|
||||
$result_update = db_process_sql_update(
|
||||
'tplugin',
|
||||
[
|
||||
'id' => $new_id,
|
||||
'name' => $plugin['name'],
|
||||
],
|
||||
['id' => $old_id]
|
||||
);
|
||||
|
||||
if ($result_update) {
|
||||
db_process_sql_update(
|
||||
'tagente_modulo',
|
||||
['id_plugin' => $new_id],
|
||||
['id_plugin' => $old_id]
|
||||
);
|
||||
|
||||
db_process_sql_update(
|
||||
'tnetwork_component',
|
||||
['id_plugin' => $new_id],
|
||||
['id_plugin' => $old_id]
|
||||
);
|
||||
|
||||
db_process_sql_update(
|
||||
'tpolicy_modules',
|
||||
['id_plugin' => $new_id],
|
||||
['id_plugin' => $old_id]
|
||||
);
|
||||
}
|
||||
|
||||
// New plugins to insert in the metaconsole.
|
||||
$values[$plugin['id']] = $plugin;
|
||||
}
|
||||
} else {
|
||||
// Exists in the node, but does not exist in the metaconsole.
|
||||
$values[$plugin['id']] = $plugin;
|
||||
}
|
||||
}
|
||||
|
||||
// Restore to metaconsole.
|
||||
metaconsole_restore_db();
|
||||
|
||||
// Insert in metaconsole.
|
||||
if (!empty($values)) {
|
||||
foreach ($values as $key2 => $val) {
|
||||
// Insert into metaconsole.
|
||||
$result_insert = db_process_sql_insert('tplugin', $val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$all_plugin_meta = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
|
||||
|
||||
foreach ($setup as $key => $value) {
|
||||
if (metaconsole_connect($value) == NOERR) {
|
||||
$all_plugin_node = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
|
||||
|
||||
$array_diff = array_diff(array_column($all_plugin_meta, 'id'), array_column($all_plugin_node, 'id'));
|
||||
foreach ($array_diff as $key2 => $pluginid) {
|
||||
$other = [];
|
||||
$plugin_meta = $all_plugin_meta[$key2];
|
||||
|
||||
unset($plugin_meta['id']);
|
||||
$other['name'] = urlencode($plugin_meta['name']);
|
||||
$other['description'] = urlencode($plugin_meta['description']);
|
||||
$other['max_timeout'] = $plugin_meta['max_timeout'];
|
||||
$other['max_retries'] = $plugin_meta['max_retries'];
|
||||
$other['execute'] = urlencode($plugin_meta['execute']);
|
||||
$other['net_dst_opt'] = $plugin_meta['net_dst_opt'];
|
||||
$other['net_port_opt'] = $plugin_meta['net_port_opt'];
|
||||
$other['user_opt'] = $plugin_meta['user_opt'];
|
||||
$other['pass_opt'] = $plugin_meta['pass_opt'];
|
||||
$other['plugin_type'] = $plugin_meta['plugin_type'];
|
||||
$other['macros'] = urlencode($plugin_meta['macros']);
|
||||
$other['parameters'] = urlencode($plugin_meta['parameters']);
|
||||
$other = implode('%7C', $other);
|
||||
|
||||
$auth_token = json_decode($value['auth_token']);
|
||||
$url = $value['server_url'].'include/api.php?op=set&op2=push_plugin'.'&id='.$pluginid.'&other_mode=url_encode_separator_%7C&other='.$other."&apipass=$auth_token->api_password"."&user=$auth_token->console_user&pass=$auth_token->console_password";
|
||||
$file_path = realpath($plugin_meta['execute']);
|
||||
$post = '';
|
||||
if (file_exists($file_path)) {
|
||||
$post = ['file' => curl_file_create($file_path)];
|
||||
}
|
||||
|
||||
$curlObj = curl_init();
|
||||
curl_setopt($curlObj, CURLOPT_URL, $url);
|
||||
curl_setopt($curlObj, CURLOPT_POST, 1);
|
||||
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $post);
|
||||
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, false);
|
||||
|
||||
$api_result = curl_exec($curlObj);
|
||||
curl_close($curlObj);
|
||||
}
|
||||
}
|
||||
|
||||
// restore to metaconsole
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -753,7 +960,10 @@ if (($create != '') or ($view != '')) {
|
|||
echo '<th>'.__('Name').'</th>';
|
||||
echo '<th>'.__('Type').'</th>';
|
||||
echo '<th>'.__('Command').'</th>';
|
||||
echo "<th style='width: 90px;'>".'<span title="Operations">'.__('Op.').'</span>'.'</th>';
|
||||
if ($management_allowed) {
|
||||
echo "<th style='width: 120px;'>".'<span title="Operations">'.__('Op.').'</span>'.'</th>';
|
||||
}
|
||||
|
||||
$color = 0;
|
||||
|
||||
foreach ($rows as $row) {
|
||||
|
@ -767,7 +977,10 @@ if (($create != '') or ($view != '')) {
|
|||
|
||||
echo '<tr>';
|
||||
echo "<td class=$tdcolor>";
|
||||
echo "<b><a href='index.php?sec=$sec&sec2=godmode/servers/plugin&view=".$row['id'].'&tab=plugins&pure='.$config['pure']."'>";
|
||||
if ($management_allowed) {
|
||||
echo "<b><a href='index.php?sec=$sec&sec2=godmode/servers/plugin&view=".$row['id'].'&tab=plugins&pure='.$config['pure']."'>";
|
||||
}
|
||||
|
||||
echo $row['name'];
|
||||
echo '</a></b></td>';
|
||||
echo "<td class=$tdcolor>";
|
||||
|
@ -780,31 +993,38 @@ if (($create != '') or ($view != '')) {
|
|||
echo "</td><td class=$tdcolor>";
|
||||
echo $row['execute'];
|
||||
echo '</td>';
|
||||
echo "<td class='$tdcolor' align='center'>";
|
||||
if ($management_allowed) {
|
||||
echo "<td class='$tdcolor' align='center'>";
|
||||
|
||||
// Show it is locket
|
||||
$modules_using_plugin = db_get_value_filter(
|
||||
'count(*)',
|
||||
'tagente_modulo',
|
||||
[
|
||||
'delete_pending' => 0,
|
||||
'id_plugin' => $row['id'],
|
||||
]
|
||||
);
|
||||
$components_using_plugin = db_get_value_filter(
|
||||
'count(*)',
|
||||
'tnetwork_component',
|
||||
['id_plugin' => $row['id']]
|
||||
);
|
||||
if (($components_using_plugin + $modules_using_plugin) > 0) {
|
||||
echo '<a href="javascript: show_locked_dialog('.$row['id'].', \''.$row['name'].'\');">';
|
||||
html_print_image('images/lock.png');
|
||||
echo '</a>';
|
||||
// Show it is locket
|
||||
$modules_using_plugin = db_get_value_filter(
|
||||
'count(*)',
|
||||
'tagente_modulo',
|
||||
[
|
||||
'delete_pending' => 0,
|
||||
'id_plugin' => $row['id'],
|
||||
]
|
||||
);
|
||||
$components_using_plugin = db_get_value_filter(
|
||||
'count(*)',
|
||||
'tnetwork_component',
|
||||
['id_plugin' => $row['id']]
|
||||
);
|
||||
if (($components_using_plugin + $modules_using_plugin) > 0) {
|
||||
echo '<a href="javascript: show_locked_dialog('.$row['id'].', \''.$row['name'].'\');">';
|
||||
html_print_image('images/lock.png');
|
||||
echo '</a>';
|
||||
}
|
||||
|
||||
echo "<a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&view=".$row['id'].'&tab=plugins&pure='.$config['pure']."'>".html_print_image('images/config.png', true, ['title' => __('Edit')]).'</a> ';
|
||||
echo "<a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&kill_plugin=".$row['id'].'&tab=plugins&pure='.$config['pure']."' onclick='javascript: if (!confirm(\"".__('All the modules that are using this plugin will be deleted').'. '.__('Are you sure?')."\")) return false;'>".html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
|
||||
if (is_metaconsole()) {
|
||||
echo " <a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&deploy_plugin=".$row['id'].'&tab=plugins&pure='.$config['pure']."'>".html_print_image('images/deploy.png', true, ['title' => __('Deploy'), 'width' => '21 px']).'</a> ';
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
echo "<a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&view=".$row['id'].'&tab=plugins&pure='.$config['pure']."'>".html_print_image('images/config.png', true, ['title' => __('Edit')]).'</a> ';
|
||||
echo "<a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&kill_plugin=".$row['id'].'&tab=plugins&pure='.$config['pure']."' onclick='javascript: if (!confirm(\"".__('All the modules that are using this plugin will be deleted').'. '.__('Are you sure?')."\")) return false;'>".html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
|
@ -813,12 +1033,15 @@ if (($create != '') or ($view != '')) {
|
|||
ui_print_info_message(['no_close' => true, 'message' => __('There are no plugins in the system') ]);
|
||||
}
|
||||
|
||||
echo "<table width='100%'>";
|
||||
if ($management_allowed) {
|
||||
echo "<table width='100%'>";
|
||||
|
||||
echo '<tr><td align=right>';
|
||||
echo "<form name=plugin method='post' action='index.php?sec=gservers&sec2=godmode/servers/plugin&tab=$tab&create=1&pure=".$config['pure']."'>";
|
||||
echo "<input name='crtbutton' type='submit' class='sub next' value='".__('Add')."'>";
|
||||
echo '</td></tr></table>';
|
||||
echo '<tr><td align=right>';
|
||||
echo "<form name=plugin method='post' action='index.php?sec=gservers&sec2=godmode/servers/plugin&tab=$tab&create=1&pure=".$config['pure']."'>";
|
||||
echo "<input name='crtbutton' type='submit' class='sub next' value='".__('Add')."'>";
|
||||
echo '</td></tr></table>';
|
||||
echo '<div id="deploy_messages" style="display: none">';
|
||||
}
|
||||
|
||||
// The '%s' will be replaced in the javascript code of the function 'show_locked_dialog'
|
||||
echo "<div id='dialog_locked' title='".__('List of modules and components created by "%s" ')."' style='display: none; text-align: left;'>";
|
||||
|
@ -828,7 +1051,6 @@ if (($create != '') or ($view != '')) {
|
|||
}
|
||||
|
||||
ui_require_javascript_file('pandora_modules');
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -594,7 +594,7 @@ $table_other->data[3][1] = html_print_input_text(
|
|||
);
|
||||
|
||||
$table_other->data[5][0] = __('Use realtime statistics');
|
||||
$table_other->data[5][1] = html_print_checkbox_toogle_switch(
|
||||
$table_other->data[5][1] = html_print_checkbox_switch(
|
||||
'realtimestats',
|
||||
1,
|
||||
$config['realtimestats'],
|
||||
|
@ -616,7 +616,7 @@ $table_other->data[6][1] = html_print_input_text(
|
|||
);
|
||||
|
||||
$table_other->data[7][0] = __('Use agent access graph').ui_print_help_icon('agent_access', true);
|
||||
$table_other->data[7][1] = html_print_checkbox_toogle_switch('agentaccess', 1, $config['agentaccess'], true);
|
||||
$table_other->data[7][1] = html_print_checkbox_switch('agentaccess', 1, $config['agentaccess'], true);
|
||||
|
||||
$table_other->data[8][0] = __('Max. recommended number of files in attachment directory');
|
||||
$table_other->data[8][0] .= ui_print_help_tip(
|
||||
|
@ -633,7 +633,7 @@ $table_other->data[8][1] = html_print_input_text(
|
|||
);
|
||||
|
||||
$table_other->data[9][0] = __('Delete not init modules');
|
||||
$table_other->data[9][1] = html_print_checkbox_toogle_switch('delete_notinit', 1, $config['delete_notinit'], true);
|
||||
$table_other->data[9][1] = html_print_checkbox_switch('delete_notinit', 1, $config['delete_notinit'], true);
|
||||
|
||||
$table_other->data[10][0] = __('Big Operation Step to purge old data');
|
||||
$table_other->data[10][0] .= ui_print_help_tip(
|
||||
|
|
|
@ -44,14 +44,14 @@ if (is_ajax()) {
|
|||
// Fallback to local authentication
|
||||
$row = [];
|
||||
$row['name'] = __('Fallback to local authentication').ui_print_help_tip(__('Enable this option if you want to fallback to local authentication when remote (ldap etc...) authentication failed.'), true);
|
||||
$row['control'] = html_print_checkbox_toogle_switch('fallback_local_auth', 1, $config['fallback_local_auth'], true);
|
||||
$row['control'] = html_print_checkbox_switch('fallback_local_auth', 1, $config['fallback_local_auth'], true);
|
||||
$table->data['fallback_local_auth'] = $row;
|
||||
|
||||
if (enterprise_installed()) {
|
||||
// Autocreate remote users
|
||||
$row = [];
|
||||
$row['name'] = __('Autocreate remote users');
|
||||
$row['control'] = html_print_checkbox_toogle_switch_extended('autocreate_remote_users', 1, $config['autocreate_remote_users'], false, '', '', true).' ';
|
||||
$row['control'] = html_print_checkbox_switch_extended('autocreate_remote_users', 1, $config['autocreate_remote_users'], false, '', '', true).' ';
|
||||
$table->data['autocreate_remote_users'] = $row;
|
||||
|
||||
add_enterprise_auth_autocreate_profiles($table, $type_auth);
|
||||
|
@ -89,7 +89,7 @@ if (is_ajax()) {
|
|||
// Start TLS
|
||||
$row = [];
|
||||
$row['name'] = __('Start TLS');
|
||||
$row['control'] = html_print_checkbox_toogle_switch('ldap_start_tls', 1, $config['ldap_start_tls'], true);
|
||||
$row['control'] = html_print_checkbox_switch('ldap_start_tls', 1, $config['ldap_start_tls'], true);
|
||||
$table->data['ldap_start_tls'] = $row;
|
||||
|
||||
// Base DN
|
||||
|
@ -135,7 +135,7 @@ if (is_ajax()) {
|
|||
$row = [];
|
||||
$row['name'] = __('Double authentication').ui_print_help_tip(__('If this option is enabled, the users can use double authentication with their accounts'), true);
|
||||
$row['control'] = html_print_input_hidden('double_auth_enabled', 0);
|
||||
$row['control'] .= html_print_checkbox_toogle_switch('double_auth_enabled', 1, $config['double_auth_enabled'], true);
|
||||
$row['control'] .= html_print_checkbox_switch('double_auth_enabled', 1, $config['double_auth_enabled'], true);
|
||||
$table->data['double_auth_enabled'] = $row;
|
||||
|
||||
// Session timeout
|
||||
|
|
|
@ -82,17 +82,17 @@ $sources['sql'] = __('Database');
|
|||
$table->data[9][1] = html_print_select($sources, 'timesource', $config['timesource'], '', '', '', true);
|
||||
|
||||
$table->data[10][0] = __('Automatic check for updates');
|
||||
$table->data[10][1] = html_print_checkbox_toogle_switch('autoupdate', 1, $config['autoupdate'], true);
|
||||
$table->data[10][1] = html_print_checkbox_switch('autoupdate', 1, $config['autoupdate'], true);
|
||||
|
||||
echo "<div id='dialog' title='".__('Enforce https Information')."' style='display:none;'>";
|
||||
echo "<p style='text-align: center;'>".__('If SSL is not properly configured you will lose access to ').get_product_name().__(' Console').'</p>';
|
||||
echo '</div>';
|
||||
|
||||
$table->data[11][0] = __('Enforce https');
|
||||
$table->data[11][1] = html_print_checkbox_toogle_switch_extended('https', 1, $config['https'], false, '', '', true);
|
||||
$table->data[11][1] = html_print_checkbox_switch_extended('https', 1, $config['https'], false, '', '', true);
|
||||
|
||||
$table->data[12][0] = __('Use cert of SSL');
|
||||
$table->data[12][1] = html_print_checkbox_toogle_switch_extended('use_cert', 1, $config['use_cert'], false, '', '', true);
|
||||
$table->data[12][1] = html_print_checkbox_switch_extended('use_cert', 1, $config['use_cert'], false, '', '', true);
|
||||
|
||||
$table->rowstyle[13] = 'display: none;';
|
||||
$table->data[13][0] = __('Path of SSL Cert.').ui_print_help_tip(__('Path where you put your cert and name of this cert. Remember your cert only in .pem extension.'), true);
|
||||
|
@ -114,7 +114,7 @@ $table->data[16][0] = __('API password').ui_print_help_tip(__('Please be careful
|
|||
$table->data[16][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true);
|
||||
|
||||
$table->data[17][0] = __('Enable GIS features');
|
||||
$table->data[17][1] = html_print_checkbox_toogle_switch('activate_gis', 1, $config['activate_gis'], true);
|
||||
$table->data[17][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true);
|
||||
|
||||
$table->data[19][0] = __('Enable Netflow');
|
||||
$rbt_disabled = false;
|
||||
|
@ -123,7 +123,7 @@ if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
|
|||
$table->data[19][0] .= ui_print_help_tip(__('Not supported in Windows systems'), true);
|
||||
}
|
||||
|
||||
$table->data[19][1] = html_print_checkbox_toogle_switch_extended('activate_netflow', 1, $config['activate_netflow'], $rbt_disabled, '', '', true);
|
||||
$table->data[19][1] = html_print_checkbox_switch_extended('activate_netflow', 1, $config['activate_netflow'], $rbt_disabled, '', '', true);
|
||||
|
||||
|
||||
$zone_name = [
|
||||
|
@ -202,15 +202,15 @@ $table->data[28][1] = html_print_input_text('public_url', $config['public_url'],
|
|||
|
||||
$table->data[29][0] = __('Referer security');
|
||||
$table->data[29][0] .= ui_print_help_tip(__("If enabled, actively checks if the user comes from %s's URL", get_product_name()), true);
|
||||
$table->data[29][1] = html_print_checkbox_toogle_switch('referer_security', 1, $config['referer_security'], true);
|
||||
$table->data[29][1] = html_print_checkbox_switch('referer_security', 1, $config['referer_security'], true);
|
||||
|
||||
$table->data[30][0] = __('Event storm protection');
|
||||
$table->data[30][0] .= ui_print_help_tip(__('If set to yes no events or alerts will be generated, but agents will continue receiving data.'), true);
|
||||
$table->data[30][1] = html_print_checkbox_toogle_switch('event_storm_protection', 1, $config['event_storm_protection'], true);
|
||||
$table->data[30][1] = html_print_checkbox_switch('event_storm_protection', 1, $config['event_storm_protection'], true);
|
||||
|
||||
|
||||
$table->data[31][0] = __('Command Snapshot').ui_print_help_tip(__('The string modules with several lines show as command output'), true);
|
||||
$table->data[31][1] = html_print_checkbox_toogle_switch('command_snapshot', 1, $config['command_snapshot'], true);
|
||||
$table->data[31][1] = html_print_checkbox_switch('command_snapshot', 1, $config['command_snapshot'], true);
|
||||
|
||||
$table->data[32][0] = __('Server logs directory').ui_print_help_tip(__('Directory where the server logs are stored.'), true);
|
||||
$table->data[32][1] = html_print_input_text(
|
||||
|
@ -250,7 +250,7 @@ $table->data['tutorial_mode'][1] = html_print_select(
|
|||
|
||||
$config['past_planned_downtimes'] = isset($config['past_planned_downtimes']) ? $config['past_planned_downtimes'] : 1;
|
||||
$table->data[34][0] = __('Allow create planned downtimes in the past').ui_print_help_tip(__('The planned downtimes created in the past will affect the SLA reports'), true);
|
||||
$table->data[34][1] = html_print_checkbox_toogle_switch('past_planned_downtimes', 1, $config['past_planned_downtimes'], true);
|
||||
$table->data[34][1] = html_print_checkbox_switch('past_planned_downtimes', 1, $config['past_planned_downtimes'], true);
|
||||
|
||||
$table->data[35][0] = __('Limit for bulk operations').ui_print_help_tip(__('Your PHP environment is set to 1000 max_input_vars. This parameter should have the same value or lower.', ini_get('max_input_vars')), true);
|
||||
$table->data[35][1] = html_print_input_text(
|
||||
|
@ -263,7 +263,7 @@ $table->data[35][1] = html_print_input_text(
|
|||
);
|
||||
|
||||
$table->data[36][0] = __('Include agents manually disabled');
|
||||
$table->data[36][1] = html_print_checkbox_toogle_switch('include_agents', 1, $config['include_agents'], true);
|
||||
$table->data[36][1] = html_print_checkbox_switch('include_agents', 1, $config['include_agents'], true);
|
||||
|
||||
$table->data[37][0] = __('Audit log directory').ui_print_help_tip(__('Directory where audit log is stored.'), true);
|
||||
$table->data[37][1] = html_print_input_text('auditdir', io_safe_output($config['auditdir']), '', 30, 100, true);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -30,6 +30,7 @@ require_once __DIR__.'/Wizard.main.php';
|
|||
require_once $config['homedir'].'/include/functions_users.php';
|
||||
require_once $config['homedir'].'/include/functions_reports.php';
|
||||
require_once $config['homedir'].'/include/functions_cron.php';
|
||||
enterprise_include('include/functions_tasklist.php');
|
||||
|
||||
/**
|
||||
* Defined as wizard to guide user to explore running tasks.
|
||||
|
@ -72,6 +73,9 @@ class DiscoveryTaskList extends Wizard
|
|||
/**
|
||||
* Implements run method.
|
||||
*
|
||||
* @param string $message Redirected input.
|
||||
* @param boolean $status Redirected input.
|
||||
*
|
||||
* @return mixed Returns null if wizard is ongoing. Result if done.
|
||||
*/
|
||||
public function run($message='', $status=null)
|
||||
|
@ -115,43 +119,39 @@ class DiscoveryTaskList extends Wizard
|
|||
|
||||
if (enterprise_installed()) {
|
||||
// This check only applies to enterprise users.
|
||||
// Check if DiscoveryCronTasks is running. Warn user if not.
|
||||
if ($config['cron_last_run'] == 0
|
||||
|| (get_system_time() - $config['cron_last_run']) > 3600
|
||||
) {
|
||||
$message_conf_cron = __('DiscoveryConsoleTasks is not running properly').'. ';
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
|
||||
$message_conf_cron .= __('Discovery relies on a proper setup of cron, the time-based scheduling service');
|
||||
$message_conf_cron .= '. '.__('Please, add the following line to your crontab file:');
|
||||
$message_conf_cron .= '<b><pre style="color: #333;">* * * * * <user> wget -q -O - --no-check-certificate ';
|
||||
$message_conf_cron .= str_replace(
|
||||
ENTERPRISE_DIR.'/meta/',
|
||||
'',
|
||||
ui_get_full_url(false)
|
||||
);
|
||||
$message_conf_cron .= ENTERPRISE_DIR.'/'.EXTENSIONS_DIR;
|
||||
$message_conf_cron .= '/cron/cron.php >> ';
|
||||
$message_conf_cron .= $config['homedir'].'/pandora_console.log</pre></b>';
|
||||
}
|
||||
enterprise_hook('tasklist_checkrunning');
|
||||
|
||||
if (isset($config['cron_last_run']) === true
|
||||
&& $config['cron_last_run'] > 0
|
||||
) {
|
||||
$message_conf_cron .= '<p style="color: #333;">'.__('Last execution').': ';
|
||||
$message_conf_cron .= date('Y/m/d H:i:s', $config['cron_last_run']).'</p>';
|
||||
$message_conf_cron .= '<p style="color: #333;">';
|
||||
$message_conf_cron .= __('Please check process is no locked.').'</p>';
|
||||
}
|
||||
|
||||
ui_print_warning_message($message_conf_cron, '', false);
|
||||
}
|
||||
$ret = $this->showListConsoleTask();
|
||||
} else {
|
||||
$ret = false;
|
||||
}
|
||||
|
||||
$ret = $this->showListConsoleTask();
|
||||
$ret2 = $this->showList();
|
||||
|
||||
if ($ret === false && $ret2 === false) {
|
||||
include_once $config['homedir'].'/general/firts_task/recon_view.php';
|
||||
} else {
|
||||
$form = [
|
||||
'form' => [
|
||||
'method' => 'POST',
|
||||
'action' => ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery'
|
||||
),
|
||||
],
|
||||
'inputs' => [
|
||||
[
|
||||
'arguments' => [
|
||||
'name' => 'submit',
|
||||
'label' => __('Go back'),
|
||||
'type' => 'submit',
|
||||
'attributes' => 'class="sub cancel"',
|
||||
'return' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$this->printForm($form);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
@ -237,7 +237,7 @@ class DiscoveryTaskList extends Wizard
|
|||
$id_console_task = (int) get_parameter('id_console_task');
|
||||
|
||||
if ($id_console_task !== null) {
|
||||
cron_task_run($id_console_task, true);
|
||||
enterprise_include('cron_task_run', $id_console_task, true);
|
||||
// Trick to avoid double execution.
|
||||
header('Location: '.$this->url);
|
||||
}
|
||||
|
@ -306,262 +306,247 @@ class DiscoveryTaskList extends Wizard
|
|||
return false;
|
||||
}
|
||||
|
||||
// Get all recon servers.
|
||||
// Get all discovery servers.
|
||||
$servers = db_get_all_rows_sql('SELECT * FROM tserver WHERE server_type = 3');
|
||||
if ($servers === false) {
|
||||
$servers = [];
|
||||
ui_print_error_message(__('Discovery Server is disabled'));
|
||||
return false;
|
||||
$check = db_get_all_rows_sql('SELECT * FROM trecon_task');
|
||||
return (bool) $check;
|
||||
} else {
|
||||
$recon_task = db_get_all_rows_sql('SELECT * FROM trecon_task');
|
||||
if ($recon_task === false) {
|
||||
return false;
|
||||
} else {
|
||||
include_once $config['homedir'].'/include/functions_graph.php';
|
||||
include_once $config['homedir'].'/include/functions_servers.php';
|
||||
include_once $config['homedir'].'/include/functions_network_profiles.php';
|
||||
include_once $config['homedir'].'/include/functions_graph.php';
|
||||
include_once $config['homedir'].'/include/functions_servers.php';
|
||||
include_once $config['homedir'].'/include/functions_network_profiles.php';
|
||||
|
||||
$modules_server = 0;
|
||||
$total_modules = 0;
|
||||
$total_modules_data = 0;
|
||||
$modules_server = 0;
|
||||
$total_modules = 0;
|
||||
$total_modules_data = 0;
|
||||
|
||||
// --------------------------------
|
||||
// FORCE A RECON TASK
|
||||
// --------------------------------
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (isset($_GET['force'])) {
|
||||
$id = (int) get_parameter_get('force', 0);
|
||||
servers_force_recon_task($id);
|
||||
header(
|
||||
'Location: '.ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($servers as $serverItem) {
|
||||
$id_server = $serverItem['id_server'];
|
||||
$server_name = servers_get_name($id_server);
|
||||
$recon_tasks = db_get_all_rows_field_filter(
|
||||
'trecon_task',
|
||||
'id_recon_server',
|
||||
$id_server
|
||||
);
|
||||
|
||||
$user_groups = implode(',', array_keys(users_get_groups()));
|
||||
$defined_tasks = db_get_all_rows_filter(
|
||||
'tuser_task_scheduled',
|
||||
'id_grupo IN ('.$user_groups.')'
|
||||
);
|
||||
|
||||
if (isset($tasks_console) === true
|
||||
&& is_array($tasks_console) === true
|
||||
) {
|
||||
foreach ($tasks_console as $key => $value) {
|
||||
$value['parameters'] = unserialize(
|
||||
$value['parameters']
|
||||
);
|
||||
|
||||
$value['type'] = 'Cron';
|
||||
array_push($recon_tasks, $value);
|
||||
}
|
||||
}
|
||||
|
||||
// Show network tasks for Recon Server.
|
||||
if ($recon_tasks === false) {
|
||||
$recon_tasks = [];
|
||||
}
|
||||
|
||||
$table = new StdClass();
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox data';
|
||||
$table->head = [];
|
||||
$table->data = [];
|
||||
$table->align = [];
|
||||
$table->headstyle = [];
|
||||
for ($i = 0; $i < 9; $i++) {
|
||||
$table->headstyle[$i] = 'text-align: left;';
|
||||
}
|
||||
|
||||
$table->head[0] = __('Force');
|
||||
$table->align[0] = 'left';
|
||||
|
||||
$table->head[1] = __('Task name');
|
||||
$table->align[1] = 'left';
|
||||
|
||||
$table->head[2] = __('Interval');
|
||||
$table->align[2] = 'left';
|
||||
|
||||
$table->head[3] = __('Network');
|
||||
$table->align[3] = 'left';
|
||||
|
||||
$table->head[4] = __('Status');
|
||||
$table->align[4] = 'left';
|
||||
|
||||
$table->head[5] = __('Task type');
|
||||
$table->align[5] = 'left';
|
||||
|
||||
$table->head[6] = __('Progress');
|
||||
$table->align[6] = 'left';
|
||||
|
||||
$table->head[7] = __('Updated at');
|
||||
$table->align[7] = 'left';
|
||||
|
||||
$table->head[8] = __('Operations');
|
||||
$table->align[8] = 'left';
|
||||
|
||||
foreach ($recon_tasks as $task) {
|
||||
$data = [];
|
||||
|
||||
if ($task['disabled'] == 0) {
|
||||
$data[0] = '<a href="'.ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_server.'&force='.$task['id_rt']
|
||||
).'">';
|
||||
$data[0] .= html_print_image('images/target.png', true, ['title' => __('Force')]);
|
||||
$data[0] .= '</a>';
|
||||
} else if ($task['disabled'] == 2) {
|
||||
$data[0] = ui_print_help_tip(
|
||||
__('This task has not been completely defined, please edit it'),
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$data[0] = '';
|
||||
}
|
||||
|
||||
$data[1] = '<b>'.$task['name'].'</b>';
|
||||
|
||||
if ($task['interval_sweep'] > 0) {
|
||||
$data[2] = human_time_description_raw(
|
||||
$task['interval_sweep']
|
||||
);
|
||||
} else {
|
||||
$data[2] = __('Manual');
|
||||
}
|
||||
|
||||
if ($task['id_recon_script'] == 0) {
|
||||
$data[3] = $task['subnet'];
|
||||
} else {
|
||||
$data[3] = '-';
|
||||
}
|
||||
|
||||
if ($task['status'] <= 0) {
|
||||
$data[4] = __('Done');
|
||||
} else {
|
||||
$data[4] = __('Pending');
|
||||
}
|
||||
|
||||
if ($task['id_recon_script'] == 0) {
|
||||
// Discovery NetScan.
|
||||
$data[5] = html_print_image(
|
||||
'images/network.png',
|
||||
true,
|
||||
['title' => __('Discovery NetScan')]
|
||||
).' ';
|
||||
$data[5] .= network_profiles_get_name(
|
||||
$task['id_network_profile']
|
||||
);
|
||||
} else {
|
||||
// APP recon task.
|
||||
$data[5] = html_print_image(
|
||||
'images/plugin.png',
|
||||
true
|
||||
).' ';
|
||||
$data[5] .= db_get_sql(
|
||||
sprintf(
|
||||
'SELECT name FROM trecon_script WHERE id_recon_script = %d',
|
||||
$task['id_recon_script']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ($task['status'] <= 0 || $task['status'] > 100) {
|
||||
$data[6] = '-';
|
||||
} else {
|
||||
$data[6] = progress_bar(
|
||||
$task['status'],
|
||||
100,
|
||||
20,
|
||||
__('Progress').':'.$task['status'].'%',
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
if ($task['utimestamp'] > 0) {
|
||||
$data[7] = ui_print_timestamp(
|
||||
$task['utimestamp'],
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$data[7] = __('Not executed yet');
|
||||
}
|
||||
|
||||
if (check_acl(
|
||||
$config['id_user'],
|
||||
$task['id_group'],
|
||||
'PM'
|
||||
// --------------------------------
|
||||
// FORCE A RECON TASK
|
||||
// --------------------------------
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (isset($_GET['force'])) {
|
||||
$id = (int) get_parameter_get('force', 0);
|
||||
servers_force_recon_task($id);
|
||||
header(
|
||||
'Location: '.ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist'
|
||||
)
|
||||
) {
|
||||
// Check if is a H&D, Cloud or Application.
|
||||
$data[8] = '<a href="'.ui_get_full_url(
|
||||
sprintf(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
|
||||
$this->getTargetWiz($task),
|
||||
$task['id_rt']
|
||||
)
|
||||
).'">'.html_print_image(
|
||||
'images/config.png',
|
||||
true
|
||||
).'</a>';
|
||||
$data[8] .= '<a href="'.ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&delete=1&task='.$task['id_rt']
|
||||
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true
|
||||
).'</a>';
|
||||
} else {
|
||||
$data[8] = '';
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
if (empty($table->data)) {
|
||||
echo '<div class="nf">'.__('Server').' '.$server_name.' '.__('has no recon tasks assigned').'</div>';
|
||||
} else {
|
||||
echo '<h2>'.__('Server task').'</h2>';
|
||||
html_print_table($table);
|
||||
}
|
||||
|
||||
unset($table);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$recon_tasks = db_get_all_rows_sql('SELECT * FROM trecon_task');
|
||||
$user_groups = implode(',', array_keys(users_get_groups()));
|
||||
|
||||
// Show network tasks for Recon Server.
|
||||
if ($recon_tasks === false) {
|
||||
$recon_tasks = [];
|
||||
}
|
||||
|
||||
$table = new StdClass();
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox data';
|
||||
$table->head = [];
|
||||
$table->data = [];
|
||||
$table->align = [];
|
||||
$table->headstyle = [];
|
||||
for ($i = 0; $i < 9; $i++) {
|
||||
$table->headstyle[$i] = 'text-align: left;';
|
||||
}
|
||||
|
||||
$table->head[0] = __('Force');
|
||||
$table->align[0] = 'left';
|
||||
|
||||
$table->head[1] = __('Task name');
|
||||
$table->align[1] = 'left';
|
||||
|
||||
$table->head[2] = __('Server name');
|
||||
$table->align[2] = 'left';
|
||||
|
||||
$table->head[3] = __('Interval');
|
||||
$table->align[3] = 'left';
|
||||
|
||||
$table->head[4] = __('Network');
|
||||
$table->align[4] = 'left';
|
||||
|
||||
$table->head[5] = __('Status');
|
||||
$table->align[5] = 'left';
|
||||
|
||||
$table->head[6] = __('Task type');
|
||||
$table->align[6] = 'left';
|
||||
|
||||
$table->head[7] = __('Progress');
|
||||
$table->align[7] = 'left';
|
||||
|
||||
$table->head[8] = __('Updated at');
|
||||
$table->align[8] = 'left';
|
||||
|
||||
$table->head[9] = __('Operations');
|
||||
$table->align[9] = 'left';
|
||||
|
||||
foreach ($recon_tasks as $task) {
|
||||
$data = [];
|
||||
$server_name = servers_get_name($task['id_recon_server']);
|
||||
|
||||
// By default.
|
||||
$subnet = $task['subnet'];
|
||||
|
||||
// Exceptions: IPAM.
|
||||
$ipam = false;
|
||||
if ($task['id_recon_script'] != null) {
|
||||
$recon_script_name = db_get_value('name', 'trecon_script', 'id_recon_script', $task['id_recon_script']);
|
||||
if (io_safe_output($recon_script_name) == 'IPAM Recon'
|
||||
&& enterprise_installed()
|
||||
) {
|
||||
$subnet_obj = json_decode($task['macros'], true);
|
||||
$subnet = $subnet_obj['1']['value'];
|
||||
$tipam_task_id = db_get_value('id', 'tipam_network', 'id_recon_task', $task['id_rt']);
|
||||
$ipam = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($task['disabled'] == 0 && $server_name !== '') {
|
||||
$data[0] = '<a href="'.ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_server.'&force='.$task['id_rt']
|
||||
).'">';
|
||||
$data[0] .= html_print_image('images/target.png', true, ['title' => __('Force')]);
|
||||
$data[0] .= '</a>';
|
||||
} else if ($task['disabled'] == 2) {
|
||||
$data[0] = ui_print_help_tip(
|
||||
__('This task has not been completely defined, please edit it'),
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$data[0] = '';
|
||||
}
|
||||
|
||||
$data[1] = '<b>'.$task['name'].'</b>';
|
||||
|
||||
$data[2] = $server_name;
|
||||
|
||||
if ($task['interval_sweep'] > 0) {
|
||||
$data[3] = human_time_description_raw(
|
||||
$task['interval_sweep']
|
||||
);
|
||||
} else {
|
||||
$data[3] = __('Manual');
|
||||
}
|
||||
|
||||
if ($task['id_recon_script'] == 0 || $ipam === true) {
|
||||
$data[4] = $subnet;
|
||||
} else {
|
||||
$data[4] = '-';
|
||||
}
|
||||
|
||||
if ($task['status'] <= 0) {
|
||||
$data[5] = __('Done');
|
||||
} else {
|
||||
$data[5] = __('Pending');
|
||||
}
|
||||
|
||||
if ($task['id_recon_script'] == 0) {
|
||||
// Discovery NetScan.
|
||||
$data[6] = html_print_image(
|
||||
'images/network.png',
|
||||
true,
|
||||
['title' => __('Discovery NetScan')]
|
||||
).' ';
|
||||
$data[6] .= network_profiles_get_name(
|
||||
$task['id_network_profile']
|
||||
);
|
||||
} else {
|
||||
// APP recon task.
|
||||
$data[6] = html_print_image(
|
||||
'images/plugin.png',
|
||||
true
|
||||
).' ';
|
||||
$data[6] .= $recon_script_name;
|
||||
}
|
||||
|
||||
if ($task['status'] <= 0 || $task['status'] > 100) {
|
||||
$data[7] = '-';
|
||||
} else {
|
||||
$data[7] = progress_bar(
|
||||
$task['status'],
|
||||
100,
|
||||
20,
|
||||
__('Progress').':'.$task['status'].'%',
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
if ($task['utimestamp'] > 0) {
|
||||
$data[8] = ui_print_timestamp(
|
||||
$task['utimestamp'],
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$data[8] = __('Not executed yet');
|
||||
}
|
||||
|
||||
if (check_acl(
|
||||
$config['id_user'],
|
||||
$task['id_group'],
|
||||
'PM'
|
||||
)
|
||||
) {
|
||||
if ($ipam === true) {
|
||||
$data[9] = '<a href="'.ui_get_full_url(
|
||||
sprintf(
|
||||
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=%d',
|
||||
$tipam_task_id
|
||||
)
|
||||
).'">'.html_print_image(
|
||||
'images/config.png',
|
||||
true
|
||||
).'</a>';
|
||||
$data[9] .= '<a href="'.ui_get_full_url(
|
||||
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=delete&id='.$tipam_task_id
|
||||
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true
|
||||
).'</a>';
|
||||
} else {
|
||||
// Check if is a H&D, Cloud or Application or IPAM.
|
||||
$data[9] = '<a href="'.ui_get_full_url(
|
||||
sprintf(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
|
||||
$this->getTargetWiz($task),
|
||||
$task['id_rt']
|
||||
)
|
||||
).'">'.html_print_image(
|
||||
'images/config.png',
|
||||
true
|
||||
).'</a>';
|
||||
$data[9] .= '<a href="'.ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&delete=1&task='.$task['id_rt']
|
||||
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true
|
||||
).'</a>';
|
||||
}
|
||||
} else {
|
||||
$data[9] = '';
|
||||
}
|
||||
|
||||
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;
|
||||
} else {
|
||||
html_print_table($table);
|
||||
}
|
||||
|
||||
unset($table);
|
||||
}
|
||||
|
||||
$form = [
|
||||
'form' => [
|
||||
'method' => 'POST',
|
||||
'action' => ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery'
|
||||
),
|
||||
],
|
||||
'inputs' => [
|
||||
[
|
||||
'arguments' => [
|
||||
'name' => 'submit',
|
||||
'label' => __('Go back'),
|
||||
'type' => 'submit',
|
||||
'attributes' => 'class="sub cancel"',
|
||||
'return' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$this->printForm($form);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -573,385 +558,7 @@ class DiscoveryTaskList extends Wizard
|
|||
*/
|
||||
public function showListConsoleTask()
|
||||
{
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access recon task viewer'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return false;
|
||||
}
|
||||
|
||||
$read_perms = check_acl(
|
||||
$config['id_user'],
|
||||
0,
|
||||
'RR'
|
||||
);
|
||||
$write_perms = check_acl(
|
||||
$config['id_user'],
|
||||
0,
|
||||
'RW'
|
||||
);
|
||||
$manage_perms = check_acl(
|
||||
$config['id_user'],
|
||||
0,
|
||||
'RM'
|
||||
);
|
||||
$manage_pandora = check_acl(
|
||||
$config['id_user'],
|
||||
0,
|
||||
'PM'
|
||||
);
|
||||
|
||||
$url = 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&';
|
||||
|
||||
$user_groups = implode(
|
||||
',',
|
||||
array_keys(users_get_groups())
|
||||
);
|
||||
|
||||
$defined_tasks = db_get_all_rows_filter(
|
||||
'tuser_task_scheduled',
|
||||
'id_grupo IN ('.$user_groups.')'
|
||||
);
|
||||
|
||||
if (!check_acl($config['id_user'], 0, 'PM')) {
|
||||
$read_tasks = [];
|
||||
foreach ($defined_tasks as $task) {
|
||||
$function_name = db_get_value(
|
||||
'function_name',
|
||||
'tuser_task',
|
||||
'id',
|
||||
$task['id_user_task']
|
||||
);
|
||||
|
||||
if (($function_name != 'cron_task_execute_custom_script')
|
||||
&& ($function_name != 'cron_task_do_backup')
|
||||
) {
|
||||
$read_tasks[] = $task;
|
||||
}
|
||||
}
|
||||
|
||||
$defined_tasks = $read_tasks;
|
||||
|
||||
if (empty($defined_tasks)) {
|
||||
$defined_tasks = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($defined_tasks !== false) {
|
||||
echo '<h2>'.__('Console task').'</h2>';
|
||||
|
||||
$table = new stdClass();
|
||||
$table->class = 'databox data';
|
||||
$table->width = '100%';
|
||||
$table->data = [];
|
||||
$table->head = [];
|
||||
$table->head[0] = '';
|
||||
$table->head[1] = __('User');
|
||||
$table->head[2] = __('Task');
|
||||
$table->head[3] = __('Scheduled');
|
||||
$table->head[4] = __('Next execution');
|
||||
$table->head[5] = __('Last run');
|
||||
$table->head[6] = __('Group');
|
||||
$table->head[7] = __('Operations');
|
||||
$table->align[7] = 'left';
|
||||
|
||||
foreach ($defined_tasks as $task) {
|
||||
$data = [];
|
||||
|
||||
$function_name = db_get_value(
|
||||
'function_name',
|
||||
'tuser_task',
|
||||
'id',
|
||||
$task['id_user_task']
|
||||
);
|
||||
|
||||
switch ($function_name) {
|
||||
case 'cron_task_generate_report':
|
||||
if ($write_perms || $manage_pandora) {
|
||||
$data[0] = '<a href="'.$url;
|
||||
$data[0] .= 'force_run=1&id_console_task='.$task['id'].'">';
|
||||
$data[0] .= html_print_image(
|
||||
'images/target.png',
|
||||
true,
|
||||
['title' => __('Force run')]
|
||||
);
|
||||
$data[0] .= '</a>';
|
||||
} else {
|
||||
$data[0] = '';
|
||||
}
|
||||
|
||||
$data[1] = $task['id_usuario'];
|
||||
$data[2] = db_get_value(
|
||||
'name',
|
||||
'tuser_task',
|
||||
'id',
|
||||
$task['id_user_task']
|
||||
);
|
||||
$args = unserialize($task['args']);
|
||||
$report = reports_get_report($args[0]);
|
||||
|
||||
// Check ACL in reports_get_report return false.
|
||||
if ($report === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$email = $args[1];
|
||||
$data[2] .= '<br>- '.__('Report').": <a href='index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=".$args[0]."'>";
|
||||
$data[2] .= $report['name'].'</a>';
|
||||
$data[2] .= '<br>- '.__('Email').": <a href='mailto:".$email."'>";
|
||||
$data[2] .= ui_print_truncate_text(
|
||||
$email,
|
||||
60,
|
||||
false
|
||||
).'</a>';
|
||||
break;
|
||||
|
||||
case 'cron_task_generate_report_by_template':
|
||||
if ($write_perms || $manage_pandora) {
|
||||
$data[0] = '<a href="'.$url;
|
||||
$data[0] .= 'force_run=1&id_console_task='.$task['id'].'">';
|
||||
$data[0] .= html_print_image(
|
||||
'images/target.png',
|
||||
true,
|
||||
['title' => __('Force run')]
|
||||
);
|
||||
$data[0] .= '</a>';
|
||||
} else {
|
||||
$data[0] = '';
|
||||
}
|
||||
|
||||
$data[1] = $task['id_usuario'];
|
||||
$data[2] = db_get_value(
|
||||
'name',
|
||||
'tuser_task',
|
||||
'id',
|
||||
$task['id_user_task']
|
||||
);
|
||||
|
||||
$args = unserialize($task['args']);
|
||||
|
||||
$filter = [];
|
||||
$filter['id_report'] = $args[0];
|
||||
$template = db_get_row_filter(
|
||||
'treport_template',
|
||||
$filter,
|
||||
false
|
||||
);
|
||||
|
||||
// Check ACL in reports_get_report return false.
|
||||
if ($template === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$agents_id = $args[1];
|
||||
$id_group = $args[2];
|
||||
$report_per_agent = $args[0];
|
||||
$report_name = $args[3];
|
||||
$email = $args[4];
|
||||
$data[2] .= '<br>- '.__('Template').": <a href='index.php?sec=reporting&sec2=operation/reporting/reporting_viewer";
|
||||
$data[2] .= '&id='.$args[0]."'>".$template['name'].'</a>';
|
||||
$data[2] .= '<br>- '.__('Agents').': '.$agents_id.'</a>';
|
||||
$data[2] .= '<br>- '.__('Report per agent').': '.$report_per_agent.'</a>';
|
||||
$data[2] .= '<br>- '.__('Report name').': '.$report_name.'</a>';
|
||||
$data[2] .= '<br>- '.__('Email').": <a href='mailto:".$email."'>".$email.'</a>';
|
||||
break;
|
||||
|
||||
case 'cron_task_execute_custom_script':
|
||||
if ($manage_pandora) {
|
||||
$data[0] = '<a href="'.$url;
|
||||
$data[0] .= 'force_run=1&id_console_task='.$task['id'].'">';
|
||||
$data[0] .= html_print_image(
|
||||
'images/target.png',
|
||||
true,
|
||||
['title' => __('Force run')]
|
||||
);
|
||||
$data[0] .= '</a>';
|
||||
} else {
|
||||
$data[0] = '';
|
||||
}
|
||||
|
||||
$data[1] = $task['id_usuario'];
|
||||
$data[2] = db_get_value(
|
||||
'name',
|
||||
'tuser_task',
|
||||
'id',
|
||||
$task['id_user_task']
|
||||
);
|
||||
|
||||
$args = unserialize($task['args']);
|
||||
$data[2] .= '<br>- '.__('Custom script').': '.$args[0];
|
||||
break;
|
||||
|
||||
case 'cron_task_save_report_to_disk':
|
||||
if ($write_perms || $manage_pandora) {
|
||||
$data[0] = '<a href="'.$url;
|
||||
$data[0] .= 'force_run=1&id_console_task='.$task['id'].'">';
|
||||
$data[0] .= html_print_image(
|
||||
'images/target.png',
|
||||
true,
|
||||
['title' => __('Force run')]
|
||||
);
|
||||
$data[0] .= '</a>';
|
||||
} else {
|
||||
$data[0] = '';
|
||||
}
|
||||
|
||||
$data[1] = $task['id_usuario'];
|
||||
$data[2] = db_get_value(
|
||||
'name',
|
||||
'tuser_task',
|
||||
'id',
|
||||
$task['id_user_task']
|
||||
);
|
||||
|
||||
$args = unserialize($task['args']);
|
||||
$report = reports_get_report($args[0]);
|
||||
|
||||
// Check ACL in reports_get_report return false.
|
||||
if ($report === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$path = $args[1];
|
||||
$data[2] .= '<br>- '.__('Report').": <a href='index.php?sec=reporting&sec2=operation/reporting/reporting_viewer";
|
||||
$data[2] .= '&id='.$args[0]."'>".$report['name'].'</a>';
|
||||
$data[2] .= '<br>- '.__('Path').': '.$path.'</a>';
|
||||
break;
|
||||
|
||||
case 'cron_task_save_xml_report_to_disk':
|
||||
if ($write_perms || $manage_pandora) {
|
||||
$data[0] = '<a href="'.$url;
|
||||
$data[0] .= 'force_run=1&id_console_task='.$task['id'].'">';
|
||||
$data[0] .= html_print_image(
|
||||
'images/target.png',
|
||||
true,
|
||||
['title' => __('Force run')]
|
||||
);
|
||||
$data[0] .= '</a>';
|
||||
} else {
|
||||
$data[0] = '';
|
||||
}
|
||||
|
||||
$data[1] = $task['id_usuario'];
|
||||
$data[2] = db_get_value('name', 'tuser_task', 'id', $task['id_user_task']);
|
||||
$args = unserialize($task['args']);
|
||||
$report = reports_get_report($args[0]);
|
||||
|
||||
// Check ACL in reports_get_report return false.
|
||||
if ($report === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$path = $args[1];
|
||||
$data[2] .= '<br>- '.__('Report').": <a href='index.php?sec=reporting&sec2=operation/reporting/reporting_viewer";
|
||||
$data[2] .= '&id='.$args[0]."'>".$report['name'].'</a>';
|
||||
$data[2] .= '<br>- '.__('Path').': '.$path.'</a>';
|
||||
break;
|
||||
|
||||
case 'cron_task_do_backup':
|
||||
if ($manage_pandora) {
|
||||
$data[0] = '<a href="'.$url;
|
||||
$data[0] .= 'force_run=1&id_console_task='.$task['id'].'">';
|
||||
$data[0] .= html_print_image(
|
||||
'images/target.png',
|
||||
true,
|
||||
['title' => __('Force run')]
|
||||
);
|
||||
$data[0] .= '</a>';
|
||||
} else {
|
||||
$data[0] = '';
|
||||
}
|
||||
|
||||
$data[1] = $task['id_usuario'];
|
||||
$data[2] = db_get_value(
|
||||
'name',
|
||||
'tuser_task',
|
||||
'id',
|
||||
$task['id_user_task']
|
||||
);
|
||||
$args = unserialize($task['args']);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
|
||||
$data[3] = cron_get_scheduled_string($task['scheduled']);
|
||||
$data[4] = date('Y/m/d H:i:s', $args['first_execution']);
|
||||
$data[5] = empty($task['last_run']) ? __('Never') : date('Y/m/d H:i:s', $task['last_run']);
|
||||
|
||||
$data[6] = ui_print_group_icon($task['id_grupo'], true);
|
||||
|
||||
if ($function_name == 'cron_task_do_backup' || $function_name == 'cron_task_execute_custom_script') {
|
||||
if ($manage_pandora) {
|
||||
$data[7] = '<a href="'.ui_get_full_url(
|
||||
sprintf(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
|
||||
$this->getTargetWiz(['description' => 'console_task']),
|
||||
$task['id']
|
||||
)
|
||||
).'">';
|
||||
$data[7] .= html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
['title' => __('Edit')]
|
||||
).'</a>';
|
||||
}
|
||||
|
||||
if ($manage_pandora) {
|
||||
$data[7] .= '<a href="'.$url;
|
||||
$data[7] .= 'delete_console_task=1&id_console_task='.$task['id'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
$data[7] .= html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
['title' => __('Delete')]
|
||||
);
|
||||
$data[7] .= '</a>';
|
||||
}
|
||||
} else {
|
||||
if ($write_perms || $manage_pandora) {
|
||||
$data[7] = '<a href="'.ui_get_full_url(
|
||||
sprintf(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
|
||||
$this->getTargetWiz(['description' => 'console_task']),
|
||||
$task['id']
|
||||
)
|
||||
).'">';
|
||||
$data[7] .= html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
['title' => __('Edit')]
|
||||
).'</a>';
|
||||
}
|
||||
|
||||
if ($manage_perms || $manage_pandora) {
|
||||
$data[7] .= '<a href="'.$url;
|
||||
$data[7] .= 'delete_console_task=1&id_console_task='.$task['id'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
$data[7] .= html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
['title' => __('Delete')]
|
||||
);
|
||||
$data[7] .= '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return enterprise_hook('tasklist_showListConsoleTask', [$this]);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
require_once __DIR__.'/Wizard.main.php';
|
||||
require_once $config['homedir'].'/include/functions_users.php';
|
||||
enterprise_include('include/class/CSVImportAgents.class.php');
|
||||
enterprise_include_once('include/functions_hostdevices.php');
|
||||
|
||||
/**
|
||||
* Wizard section Host&devices.
|
||||
|
@ -476,6 +477,10 @@ class HostDevices extends Wizard
|
|||
$task_url = '&task='.$this->task['id_rt'];
|
||||
}
|
||||
|
||||
$breadcrum[] = [
|
||||
'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd',
|
||||
'label' => __($this->label),
|
||||
];
|
||||
for ($i = 0; $i < $this->maxPagesNetScan; $i++) {
|
||||
$breadcrum[] = [
|
||||
'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd&mode=netscan&page='.$i.$task_url,
|
||||
|
@ -710,9 +715,6 @@ $("select#interval_manual_defined").change(function() {
|
|||
// XXX: Could be improved validating inputs before continue (JS)
|
||||
// Print NetScan page 0.
|
||||
$this->printForm($form);
|
||||
$this->printGoBackButton(
|
||||
$this->url.'&page='.($this->page - 1).$task_url
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -779,266 +781,17 @@ $("select#interval_manual_defined").change(function() {
|
|||
];
|
||||
}
|
||||
|
||||
// Feature configuration.
|
||||
// Input: SNMP enabled.
|
||||
$form['inputs'][] = [
|
||||
'label' => __('SNMP enabled'),
|
||||
'arguments' => [
|
||||
'name' => 'snmp_enabled',
|
||||
'type' => 'switch',
|
||||
'return' => true,
|
||||
'value' => (isset($this->task['snmp_enabled'])) ? $this->task['snmp_enabled'] : 1,
|
||||
'onclick' => 'extraSNMP();',
|
||||
|
||||
],
|
||||
];
|
||||
|
||||
// SNMP CONFIGURATION.
|
||||
$form['inputs'][] = [
|
||||
'hidden' => 1,
|
||||
'block_id' => 'snmp_extra',
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('SNMP version'),
|
||||
'arguments' => [
|
||||
'name' => 'snmp_version',
|
||||
'fields' => [
|
||||
'1' => 'v. 1',
|
||||
'2c' => 'v. 2c',
|
||||
'3' => 'v. 3',
|
||||
],
|
||||
'type' => 'select',
|
||||
'script' => 'SNMPExtraShow(this.value)',
|
||||
'selected' => $this->task['snmp_version'],
|
||||
'return' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// SNMP Options pack v1.
|
||||
$form['inputs'][] = [
|
||||
'hidden' => 1,
|
||||
'block_id' => 'snmp_options_basic',
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => '<b>'.__('SNMP Default community').'</b>'.ui_print_help_tip(
|
||||
__(
|
||||
'You can specify several values, separated by commas, for example: public,mysecret,1234'
|
||||
),
|
||||
true
|
||||
),
|
||||
'arguments' => [
|
||||
'name' => 'community',
|
||||
'type' => 'text',
|
||||
'value' => $this->task['snmp_community'],
|
||||
'size' => 25,
|
||||
'return' => true,
|
||||
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// SNMP Options pack v3.
|
||||
$form['inputs'][] = [
|
||||
'hidden' => 1,
|
||||
'block_id' => 'snmp_options_v3',
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => '<b>'.__('Context').'</b>',
|
||||
'arguments' => [
|
||||
'name' => 'snmp_context',
|
||||
'type' => 'text',
|
||||
'value' => $this->task['snmp_community'],
|
||||
'size' => 15,
|
||||
'return' => true,
|
||||
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => '<b>'.__('Auth user').'</b>',
|
||||
'arguments' => [
|
||||
'name' => 'snmp_auth_user',
|
||||
'type' => 'text',
|
||||
'value' => $this->task['snmp_auth_user'],
|
||||
'size' => 15,
|
||||
'return' => true,
|
||||
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => '<b>'.__('Auth password').'</b>'.ui_print_help_tip(
|
||||
__(
|
||||
'The pass length must be eight character minimum.'
|
||||
),
|
||||
true
|
||||
),
|
||||
'arguments' => [
|
||||
'name' => 'snmp_auth_pass',
|
||||
'type' => 'password',
|
||||
'value' => $this->task['snmp_auth_pass'],
|
||||
'size' => 15,
|
||||
'return' => true,
|
||||
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => '<b>'.__('Privacy method').'</b>',
|
||||
'arguments' => [
|
||||
'name' => 'snmp_privacy_method',
|
||||
'type' => 'select',
|
||||
'fields' => [
|
||||
'DES' => __('DES'),
|
||||
'AES' => __('AES'),
|
||||
],
|
||||
'selected' => $this->task['snmp_privacy_method'],
|
||||
'size' => 15,
|
||||
'return' => true,
|
||||
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => '<b>'.__('Privacy pass').'</b>'.ui_print_help_tip(
|
||||
__(
|
||||
'The pass length must be eight character minimum.'
|
||||
),
|
||||
true
|
||||
),
|
||||
'arguments' => [
|
||||
'name' => 'snmp_privacy_pass',
|
||||
'type' => 'password',
|
||||
'value' => $this->task['snmp_privacy_pass'],
|
||||
'size' => 15,
|
||||
'return' => true,
|
||||
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => '<b>'.__('Auth method').'</b>',
|
||||
'arguments' => [
|
||||
'name' => 'snmp_auth_method',
|
||||
'type' => 'select',
|
||||
'fields' => [
|
||||
'MD5' => __('MD5'),
|
||||
'SHA' => __('SHA'),
|
||||
],
|
||||
'selected' => $this->task['snmp_auth_method'],
|
||||
'size' => 15,
|
||||
'return' => true,
|
||||
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => '<b>'.__('Security level').'</b>',
|
||||
'arguments' => [
|
||||
'name' => 'snmp_security_level',
|
||||
'type' => 'select',
|
||||
'fields' => [
|
||||
'noAuthNoPriv' => __('Not auth and not privacy method'),
|
||||
'authNoPriv' => __('Auth and not privacy method'),
|
||||
'authPriv' => __('Auth and privacy method'),
|
||||
],
|
||||
'selected' => $this->task['snmp_security_level'],
|
||||
'size' => 15,
|
||||
'return' => true,
|
||||
|
||||
],
|
||||
],
|
||||
|
||||
],
|
||||
];
|
||||
|
||||
// Input: WMI enabled.
|
||||
$form['inputs'][] = [
|
||||
'label' => __('WMI enabled'),
|
||||
'arguments' => [
|
||||
'name' => 'wmi_enabled',
|
||||
'type' => 'switch',
|
||||
'value' => (isset($this->task['wmi_enabled'])) ? $this->task['wmi_enabled'] : 0,
|
||||
'return' => true,
|
||||
'onclick' => 'toggleWMI();',
|
||||
|
||||
],
|
||||
];
|
||||
|
||||
// WMI CONFIGURATION.
|
||||
$form['inputs'][] = [
|
||||
'block_id' => 'wmi_extra',
|
||||
'hidden' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => '<b>'.__('WMI Auth. strings').'</b>'.ui_print_help_tip(
|
||||
__(
|
||||
'Auth strings must be defined as user%pass, comma separated as many you need.'
|
||||
),
|
||||
true
|
||||
),
|
||||
'arguments' => [
|
||||
'name' => 'auth_strings',
|
||||
'type' => 'text',
|
||||
'value' => $this->task['auth_strings'],
|
||||
'return' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// Input: Enforce os detection.
|
||||
$form['inputs'][] = [
|
||||
'label' => __('OS detection'),
|
||||
'arguments' => [
|
||||
'name' => 'os_detect',
|
||||
'type' => 'switch',
|
||||
'return' => true,
|
||||
'value' => (isset($this->task['os_detect'])) ? $this->task['os_detect'] : 1,
|
||||
|
||||
],
|
||||
];
|
||||
|
||||
// Input: Name resolution.
|
||||
$form['inputs'][] = [
|
||||
'label' => __('Name resolution'),
|
||||
'arguments' => [
|
||||
'name' => 'resolve_names',
|
||||
'type' => 'switch',
|
||||
'return' => true,
|
||||
'value' => (isset($this->task['resolve_names'])) ? $this->task['resolve_names'] : 0,
|
||||
],
|
||||
];
|
||||
|
||||
// Input: Parent detection.
|
||||
$form['inputs'][] = [
|
||||
'label' => __('Parent detection'),
|
||||
'arguments' => [
|
||||
'name' => 'parent_detection',
|
||||
'type' => 'switch',
|
||||
'return' => true,
|
||||
'value' => (isset($this->task['parent_detection'])) ? $this->task['parent_detection'] : 1,
|
||||
],
|
||||
];
|
||||
|
||||
// Input: Parent recursion.
|
||||
$form['inputs'][] = [
|
||||
'label' => __('Parent recursion'),
|
||||
'arguments' => [
|
||||
'name' => 'parent_recursion',
|
||||
'type' => 'switch',
|
||||
'return' => true,
|
||||
'value' => (isset($this->task['parent_recursion'])) ? $this->task['parent_recursion'] : 1,
|
||||
],
|
||||
];
|
||||
|
||||
// Input: VLAN enabled.
|
||||
$form['inputs'][] = [
|
||||
'label' => __('VLAN enabled'),
|
||||
'arguments' => [
|
||||
'name' => 'vlan_enabled',
|
||||
'type' => 'switch',
|
||||
'return' => true,
|
||||
'value' => (isset($this->task['vlan_enabled'])) ? $this->task['vlan_enabled'] : 1,
|
||||
],
|
||||
];
|
||||
if (enterprise_installed()) {
|
||||
// Feature configuration.
|
||||
$extra = enterprise_hook('hd_showextrainputs', [$this]);
|
||||
if (is_array($extra) === true) {
|
||||
$form['inputs'] = array_merge(
|
||||
$form['inputs'],
|
||||
$extra['inputs']
|
||||
);
|
||||
$form['js'] = $extra['js'];
|
||||
}
|
||||
}
|
||||
|
||||
// Submit button.
|
||||
$form['inputs'][] = [
|
||||
|
@ -1051,57 +804,6 @@ $("select#interval_manual_defined").change(function() {
|
|||
],
|
||||
];
|
||||
|
||||
$form['js'] = '
|
||||
function SNMPExtraShow(target) {
|
||||
$("#snmp_options_basic").hide();
|
||||
$("#snmp_options_v3").hide();
|
||||
if (document.getElementsByName("snmp_enabled")[0].checked) {
|
||||
$("#snmp_extra").show();
|
||||
if (target == 3) {
|
||||
$("#snmp_options_v3").show();
|
||||
} else {
|
||||
$("#snmp_options_basic").show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function extraSNMP() {
|
||||
if (document.getElementsByName("snmp_enabled")[0].checked) {
|
||||
SNMPExtraShow($("#snmp_version").val());
|
||||
$("#snmp_extra").show();
|
||||
} else {
|
||||
// Hide unusable sections
|
||||
$("#snmp_extra").hide();
|
||||
$("#snmp_options_basic").hide();
|
||||
$("#snmp_options_v3").hide();
|
||||
|
||||
// Disable snmp dependant checks
|
||||
if (document.getElementsByName("parent_recursion")[0].checked)
|
||||
$("input[name=parent_recursion]").click();
|
||||
|
||||
if (document.getElementsByName("parent_detection")[0].checked)
|
||||
$("input[name=parent_detection]").click();
|
||||
|
||||
if (document.getElementsByName("vlan_enabled")[0].checked)
|
||||
$("input[name=vlan_enabled]").click();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function toggleWMI() {
|
||||
if (document.getElementsByName("wmi_enabled")[0].checked)
|
||||
$("#wmi_extra").show();
|
||||
else
|
||||
$("#wmi_extra").hide();
|
||||
}
|
||||
|
||||
$(function() {
|
||||
SNMPExtraShow($("#snmp_version").val());
|
||||
toggleWMI();
|
||||
});
|
||||
';
|
||||
|
||||
$form['form'] = [
|
||||
'method' => 'POST',
|
||||
'action' => $this->url.'&mode=netscan&page='.($this->page + 1).'&task='.$this->task['id_rt'],
|
||||
|
|
|
@ -1,11 +1,39 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Interfaz tope gama que obliga a implementar metodos.
|
||||
* Extension to schedule tasks on Pandora FMS Console
|
||||
*
|
||||
* @category Wizard
|
||||
* @package Pandora FMS
|
||||
* @subpackage Wizard skel
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2');
|
||||
|
||||
/**
|
||||
* Global Wizard generic class. Needs to be inherited.
|
||||
*
|
||||
* Used in Hostdevices class, Applications class and others, is the core of
|
||||
* Discovery proyect.
|
||||
*/
|
||||
class Wizard
|
||||
{
|
||||
|
||||
|
@ -17,9 +45,9 @@ class Wizard
|
|||
public $breadcrum;
|
||||
|
||||
/**
|
||||
* Undocumented variable
|
||||
* Current page
|
||||
*
|
||||
* @var [type]
|
||||
* @var integer
|
||||
*/
|
||||
public $page;
|
||||
|
||||
|
@ -498,6 +526,8 @@ class Wizard
|
|||
/**
|
||||
* Prints a go back button redirecting to main page.
|
||||
*
|
||||
* @param string $url Optional target url.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function printGoBackButton($url=null)
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 329 B |
Binary file not shown.
After Width: | Height: | Size: 401 B |
|
@ -580,7 +580,6 @@ if ($get_extended_event) {
|
|||
dataType : "html",
|
||||
success: function (data) {
|
||||
$("#related_data").html(data);
|
||||
console.log("vamos puta");
|
||||
}
|
||||
});
|
||||
});';
|
||||
|
|
|
@ -43,6 +43,7 @@ if (is_ajax()) {
|
|||
include_once $config['homedir'].'/include/class/TreeModule.class.php';
|
||||
include_once $config['homedir'].'/include/class/TreeTag.class.php';
|
||||
include_once $config['homedir'].'/include/class/TreeGroup.class.php';
|
||||
include_once $config['homedir'].'/include/class/TreeService.class.php';
|
||||
include_once $config['homedir'].'/include/class/TreeGroupEdition.class.php';
|
||||
enterprise_include_once('include/class/TreePolicies.class.php');
|
||||
enterprise_include_once('include/class/TreeGroupMeta.class.php');
|
||||
|
@ -120,6 +121,10 @@ if (is_ajax()) {
|
|||
$tree = new TreeGroupEdition($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
break;
|
||||
|
||||
case 'services':
|
||||
$tree = new TreeService($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
break;
|
||||
|
||||
default:
|
||||
// FIXME. No error handler
|
||||
return;
|
||||
|
@ -127,6 +132,7 @@ if (is_ajax()) {
|
|||
|
||||
$tree->setFilter($filter);
|
||||
ob_clean();
|
||||
|
||||
echo json_encode(['success' => 1, 'tree' => $tree->getArray()]);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1369,8 +1369,12 @@ function local_ldap_search($ldap_host, $ldap_port=389, $ldap_version=3, $dn, $ac
|
|||
$tls = ' -ZZ ';
|
||||
}
|
||||
|
||||
$ldap_host = ' -h '.$ldap_host;
|
||||
$ldap_port = ' -p '.$ldap_port;
|
||||
if (stripos($ldap_host, 'ldap') !== false) {
|
||||
$ldap_host = ' -H '.$ldap_host.':'.$ldap_port;
|
||||
} else {
|
||||
$ldap_host = ' -h '.$ldap_host.' -p '.$ldap_port;
|
||||
}
|
||||
|
||||
$ldap_version = ' -P '.$ldap_version;
|
||||
if (!empty($ldap_admin_user)) {
|
||||
$ldap_admin_user = " -D '".$ldap_admin_user."'";
|
||||
|
@ -1382,7 +1386,7 @@ function local_ldap_search($ldap_host, $ldap_port=389, $ldap_version=3, $dn, $ac
|
|||
|
||||
$dn = " -b '".$dn."'";
|
||||
|
||||
$shell_ldap_search = explode("\n", shell_exec('ldapsearch -LLL -o ldif-wrap=no -x'.$ldap_host.$ldap_port.$ldap_version.' -E pr=10000/noprompt '.$ldap_admin_user.$ldap_admin_pass.$dn.$filter.$tls.' | grep -v "^#\|^$" | sed "s/:\+ /=>/g"'));
|
||||
$shell_ldap_search = explode("\n", shell_exec('ldapsearch -LLL -o ldif-wrap=no -x'.$ldap_host.$ldap_version.' -E pr=10000/noprompt '.$ldap_admin_user.$ldap_admin_pass.$dn.$filter.$tls.' | grep -v "^#\|^$" | sed "s/:\+ /=>/g"'));
|
||||
foreach ($shell_ldap_search as $line) {
|
||||
$values = explode('=>', $line);
|
||||
if (!empty($values[0]) && !empty($values[1])) {
|
||||
|
|
|
@ -57,6 +57,8 @@ class Tree
|
|||
|
||||
protected $L2inner = '';
|
||||
|
||||
protected $avoid_condition = false;
|
||||
|
||||
protected $L3forceTagCondition = false;
|
||||
|
||||
const TV_DEFAULT_AGENT_STATUS = -1;
|
||||
|
@ -77,6 +79,7 @@ class Tree
|
|||
$this->access = $access;
|
||||
|
||||
$userGroupsACL = users_get_groups(false, $this->access);
|
||||
|
||||
$this->userGroupsACL = empty($userGroupsACL) ? false : $userGroupsACL;
|
||||
$this->userGroups = $this->userGroupsACL;
|
||||
$this->userGroupsArray = array_keys($this->userGroups);
|
||||
|
@ -947,7 +950,6 @@ class Tree
|
|||
}
|
||||
|
||||
$this->processAgents($data);
|
||||
|
||||
$this->tree = $data;
|
||||
}
|
||||
|
||||
|
@ -1032,7 +1034,6 @@ class Tree
|
|||
|
||||
$data = $this->getProcessedModules($data);
|
||||
$this->processModules($data);
|
||||
|
||||
$this->tree = $data;
|
||||
}
|
||||
|
||||
|
@ -1051,8 +1052,13 @@ class Tree
|
|||
$tag_condition = $this->getTagCondition();
|
||||
$tag_join = empty($tag_condition) && (!$this->L3forceTagCondition) ? '' : $this->getTagJoin();
|
||||
|
||||
$condition = $this->L2condition;
|
||||
$inner = $this->L2inner;
|
||||
if ($this->avoid_condition === true) {
|
||||
$condition = '';
|
||||
$inner = '';
|
||||
} else {
|
||||
$condition = $this->L2condition;
|
||||
$inner = $this->L2inner;
|
||||
}
|
||||
|
||||
$columns = 'DISTINCT(tam.id_agente_modulo) AS id, tam.nombre AS name,
|
||||
tam.id_tipo_modulo, tam.id_modulo, tae.estado, tae.datos,
|
||||
|
@ -1076,10 +1082,10 @@ class Tree
|
|||
$group_acl
|
||||
$agent_search_filter
|
||||
$agent_status_filter
|
||||
$module_status_filter
|
||||
$module_search_filter
|
||||
$tag_condition
|
||||
ORDER BY tam.nombre ASC, tam.id_agente_modulo ASC";
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@ class TreeGroup extends Tree
|
|||
];
|
||||
|
||||
$this->L2conditionInside = 'AND (
|
||||
ta.id_grupo = '.$this->id.'
|
||||
OR tasg.id_group = '.$this->id.'
|
||||
)';
|
||||
ta.id_grupo = '.$this->id.'
|
||||
OR tasg.id_group = '.$this->id.'
|
||||
)';
|
||||
}
|
||||
|
||||
|
||||
|
@ -198,44 +198,44 @@ class TreeGroup extends Tree
|
|||
$module_search_filter = '';
|
||||
if (!empty($this->filter['searchModule'])) {
|
||||
$module_search_inner = '
|
||||
INNER JOIN tagente_modulo tam
|
||||
ON ta.id_agente = tam.id_agente
|
||||
INNER JOIN tagente_estado tae
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo';
|
||||
INNER JOIN tagente_modulo tam
|
||||
ON ta.id_agente = tam.id_agente
|
||||
INNER JOIN tagente_estado tae
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo';
|
||||
$module_search_filter = "AND tam.disabled = 0
|
||||
AND tam.nombre LIKE '%%".$this->filter['searchModule']."%%' ".$this->getModuleStatusFilterFromTestado();
|
||||
AND tam.nombre LIKE '%%".$this->filter['searchModule']."%%' ".$this->getModuleStatusFilterFromTestado();
|
||||
}
|
||||
|
||||
$table = is_metaconsole() ? 'tmetaconsole_agent' : 'tagente';
|
||||
$table_sec = is_metaconsole() ? 'tmetaconsole_agent_secondary_group' : 'tagent_secondary_group';
|
||||
|
||||
$sql_model = "SELECT %s FROM
|
||||
(
|
||||
SELECT COUNT(DISTINCT(ta.id_agente)) AS total, id_grupo AS g
|
||||
FROM $table ta
|
||||
$module_search_inner
|
||||
WHERE ta.disabled = 0
|
||||
%s
|
||||
$agent_search_filter
|
||||
$agent_status_filter
|
||||
$module_status_filter
|
||||
$module_search_filter
|
||||
$group_acl
|
||||
GROUP BY id_grupo
|
||||
UNION ALL
|
||||
SELECT COUNT(DISTINCT(ta.id_agente)) AS total, id_group AS g
|
||||
FROM $table ta INNER JOIN $table_sec tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
$module_search_inner
|
||||
WHERE ta.disabled = 0
|
||||
%s
|
||||
$agent_search_filter
|
||||
$agent_status_filter
|
||||
$module_status_filter
|
||||
$module_search_filter
|
||||
$secondary_group_acl
|
||||
GROUP BY id_group
|
||||
) x GROUP BY g";
|
||||
(
|
||||
SELECT COUNT(DISTINCT(ta.id_agente)) AS total, id_grupo AS g
|
||||
FROM $table ta
|
||||
$module_search_inner
|
||||
WHERE ta.disabled = 0
|
||||
%s
|
||||
$agent_search_filter
|
||||
$agent_status_filter
|
||||
$module_status_filter
|
||||
$module_search_filter
|
||||
$group_acl
|
||||
GROUP BY id_grupo
|
||||
UNION ALL
|
||||
SELECT COUNT(DISTINCT(ta.id_agente)) AS total, id_group AS g
|
||||
FROM $table ta INNER JOIN $table_sec tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
$module_search_inner
|
||||
WHERE ta.disabled = 0
|
||||
%s
|
||||
$agent_search_filter
|
||||
$agent_status_filter
|
||||
$module_status_filter
|
||||
$module_search_filter
|
||||
$secondary_group_acl
|
||||
GROUP BY id_group
|
||||
) x GROUP BY g";
|
||||
$sql_array = [];
|
||||
foreach ($inside_fields as $inside_field) {
|
||||
$sql_array[] = sprintf(
|
||||
|
@ -247,9 +247,9 @@ class TreeGroup extends Tree
|
|||
}
|
||||
|
||||
$sql = "SELECT $fields FROM (".implode(' UNION ALL ', $sql_array).') x2
|
||||
RIGHT JOIN tgrupo tg
|
||||
ON x2.g = tg.id_grupo
|
||||
GROUP BY tg.id_grupo';
|
||||
RIGHT JOIN tgrupo tg
|
||||
ON x2.g = tg.id_grupo
|
||||
GROUP BY tg.id_grupo';
|
||||
$stats = db_get_all_rows_sql($sql);
|
||||
|
||||
$group_stats = [];
|
||||
|
|
|
@ -0,0 +1,352 @@
|
|||
<?php
|
||||
// Pandora FMS- http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/class/Tree.class.php';
|
||||
|
||||
class TreeService extends Tree
|
||||
{
|
||||
|
||||
protected $propagateCounters = true;
|
||||
|
||||
protected $displayAllGroups = false;
|
||||
|
||||
|
||||
public function __construct($type, $rootType='', $id=-1, $rootID=-1, $serverID=false, $childrenMethod='on_demand', $access='AR')
|
||||
{
|
||||
global $config;
|
||||
|
||||
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
|
||||
$this->L1fieldName = 'id_group';
|
||||
$this->L1extraFields = [
|
||||
'ts.name AS `name`',
|
||||
'ts.id AS `sid`',
|
||||
];
|
||||
|
||||
$this->filter['statusAgent'] = AGENT_STATUS_ALL;
|
||||
|
||||
$this->avoid_condition = true;
|
||||
|
||||
$this->L2inner = 'LEFT JOIN tservice_element tse
|
||||
ON tse.id_agent = ta.id_agente';
|
||||
|
||||
$this->L2condition = 'AND tse.id_service='.$this->id;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function setPropagateCounters($value)
|
||||
{
|
||||
$this->propagateCounters = (bool) $value;
|
||||
}
|
||||
|
||||
|
||||
public function setDisplayAllGroups($value)
|
||||
{
|
||||
$this->displayAllGroups = (bool) $value;
|
||||
}
|
||||
|
||||
|
||||
protected function getData()
|
||||
{
|
||||
if ($this->id == -1) {
|
||||
$this->getFirstLevel();
|
||||
} else if ($this->type == 'services') {
|
||||
$this->getSecondLevel();
|
||||
} else if ($this->type == 'agent') {
|
||||
$this->getThirdLevel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getFirstLevel()
|
||||
{
|
||||
$processed_items = $this->getProcessedServices();
|
||||
$ids = array_keys($processed_items);
|
||||
|
||||
$filter = ['id' => $ids];
|
||||
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
|
||||
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
||||
$display_all_services = true;
|
||||
} else {
|
||||
$display_all_services = false;
|
||||
}
|
||||
|
||||
$this->tree = [];
|
||||
|
||||
$services = services_get_services($filter, false, $display_all_services);
|
||||
|
||||
foreach ($services as $row) {
|
||||
$status = services_get_status($row, true);
|
||||
|
||||
switch ($status) {
|
||||
case SERVICE_STATUS_NORMAL:
|
||||
$processed_items[$row['id']]['statusImageHTML'] = '<img src="images/status_sets/default/agent_ok_ball.png" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="NORMAL status." />';
|
||||
break;
|
||||
|
||||
case SERVICE_STATUS_CRITICAL:
|
||||
$processed_items[$row['id']]['statusImageHTML'] = '<img src="images/status_sets/default/agent_critical_ball.png" data-title="CRITICAL status." data-use_title_for_force_title="1" class="forced_title" alt="CRITICAL status." />';
|
||||
break;
|
||||
|
||||
case SERVICE_STATUS_WARNING:
|
||||
$processed_items[$row['id']][$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_warning_ball.png" data-title="WARNING status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
|
||||
break;
|
||||
|
||||
case SERVICE_STATUS_UNKNOWN:
|
||||
default:
|
||||
$processed_items[$row['id']]['statusImageHTML'] = '<img src="images/status_sets/default/agent_no_data_ball.png" data-title="UNKNOWN status." data-use_title_for_force_title="1" class="forced_title" alt="UNKNOWN status." />';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->tree = $processed_items;
|
||||
}
|
||||
|
||||
|
||||
protected function getProcessedServices()
|
||||
{
|
||||
$fields = $this->getFirstLevelFields();
|
||||
|
||||
if (users_can_manage_group_all('AR')) {
|
||||
$groups_acl = '';
|
||||
} else {
|
||||
$groups_acl = 'AND ts.id_group IN ('.implode(',', $this->userGroupsArray).')';
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
"SELECT t1.*
|
||||
FROM tservice_element tss
|
||||
RIGHT JOIN
|
||||
(SELECT ts.id, ts.id_agent_module, ts.name, ts.name AS `alias`, ts.id AS `rootID`,
|
||||
'services' AS rootType, 'services' AS type,
|
||||
0 AS quiet,
|
||||
SUM(if((tse.id_agent<>0), 1, 0)) AS `total_agents`,
|
||||
SUM(if((tse.id_agente_modulo<>0), 1, 0)) AS `total_modules`,
|
||||
SUM(if((tse.id_service_child<>0), 1, 0)) AS `total_services`
|
||||
FROM tservice ts
|
||||
LEFT JOIN tservice_element tse
|
||||
ON ts.id=tse.id_service
|
||||
GROUP BY id
|
||||
) as t1
|
||||
ON tss.id_service_child = t1.id
|
||||
WHERE tss.id_service_child IS NULL
|
||||
%s
|
||||
",
|
||||
$groups_acl
|
||||
);
|
||||
|
||||
$stats = db_get_all_rows_sql($sql);
|
||||
|
||||
$services = [];
|
||||
|
||||
foreach ($stats as $service) {
|
||||
$services[$service['id']] = $this->getProcessedItem($services[$service['id']]);
|
||||
if (($service['total_services'] + $service['total_agents'] + $service['total_modules']) > 0) {
|
||||
$services[$service['id']]['searchChildren'] = 1;
|
||||
} else {
|
||||
$services[$service['id']]['searchChildren'] = 0;
|
||||
}
|
||||
|
||||
$services[$service['id']]['counters'] = [
|
||||
'total_services' => $service['total_services'],
|
||||
'total_agents' => $service['total_agents'],
|
||||
'total_modules' => $service['total_modules'],
|
||||
];
|
||||
$services[$service['id']]['name'] = $service['name'];
|
||||
$services[$service['id']]['id'] = $service['id'];
|
||||
$services[$service['id']]['serviceDetail'] = 'index.php?sec=network&sec2=enterprise/operation/services/services&tab=service_map&id_service='.(int) $service['id'];
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
|
||||
|
||||
protected function getFirstLevelFields()
|
||||
{
|
||||
$fields = [];
|
||||
|
||||
return implode(',', array_merge($fields, $this->L1extraFields));
|
||||
}
|
||||
|
||||
|
||||
protected function getSecondLevel()
|
||||
{
|
||||
$data = [];
|
||||
$data_agents = [];
|
||||
$data_modules = [];
|
||||
$data_services = [];
|
||||
|
||||
$sql = $this->getSecondLevelSql();
|
||||
$data_agents = db_process_sql($sql);
|
||||
|
||||
if (empty($data_agents)) {
|
||||
$data_agents = [];
|
||||
}
|
||||
|
||||
$this->processAgents($data_agents);
|
||||
|
||||
foreach ($data_agents as $key => $agent) {
|
||||
$data_agents[$key]['showEventsBtn'] = 1;
|
||||
$data_agents[$key]['eventAgent'] = $agent['id'];
|
||||
}
|
||||
|
||||
$sql = $this->getSecondLevelModulesSql();
|
||||
$data_modules = db_process_sql($sql);
|
||||
|
||||
if (empty($data_modules)) {
|
||||
$data_modules = [];
|
||||
} else {
|
||||
foreach ($data_modules as $key => $module) {
|
||||
switch ($module['estado']) {
|
||||
case '0':
|
||||
$data_modules[$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_ok_ball.png" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="NORMAL status." />';
|
||||
break;
|
||||
|
||||
case '1':
|
||||
$data_modules[$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_critical_ball.png" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="CRITICAL status." />';
|
||||
break;
|
||||
|
||||
case '2':
|
||||
$data_modules[$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_warning_ball.png" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
|
||||
break;
|
||||
|
||||
case '4':
|
||||
$data_modules[$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_no_data_ball.png" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="UNKNOWN status." />';
|
||||
break;
|
||||
|
||||
default:
|
||||
// code...
|
||||
break;
|
||||
}
|
||||
|
||||
$data_modules[$key]['showEventsBtn'] = 1;
|
||||
$data_modules[$key]['eventModule'] = $module['id_agente_modulo'];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = $this->getSecondLevelServicesSql();
|
||||
$data_services = db_process_sql($sql);
|
||||
|
||||
$service_stats = [];
|
||||
|
||||
foreach ($data_services as $service) {
|
||||
$service_stats[$service['id']]['id'] = (int) $service['id'];
|
||||
$service_stats[$service['id']]['name'] = $service['name'];
|
||||
$service_stats[$service['id']]['alias'] = $service['name'];
|
||||
if (($service['total_services'] + $service['total_agents'] + $service['total_modules']) > 0) {
|
||||
$service_stats[$service['id']]['searchChildren'] = 1;
|
||||
} else {
|
||||
$services[$service['id']]['searchChildren'] = 0;
|
||||
}
|
||||
|
||||
$service_stats[$service['id']]['rootID'] = $service['rootID'];
|
||||
$service_stats[$service['id']]['rootType'] = $service['rootType'];
|
||||
$service_stats[$service['id']]['type'] = 'services';
|
||||
$service_stats[$service['id']]['children'] = [];
|
||||
$service_stats[$service['id']]['serviceDetail'] = 'index.php?sec=network&sec2=enterprise/operation/services/services&tab=service_map&id_service='.(int) $service['id'];
|
||||
$service_stats[$service['id']]['counters'] = [
|
||||
'total_services' => $service['total_services'],
|
||||
'total_agents' => $service['total_agents'],
|
||||
'total_modules' => $service['total_modules'],
|
||||
];
|
||||
}
|
||||
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
|
||||
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
||||
$display_all_services = true;
|
||||
} else {
|
||||
$display_all_services = false;
|
||||
}
|
||||
|
||||
$services = services_get_services($filter, false, $display_all_services);
|
||||
|
||||
foreach ($services as $row) {
|
||||
if (!array_key_exists($row['id'], $service_stats)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$status = services_get_status($row, true);
|
||||
|
||||
switch ($status) {
|
||||
case SERVICE_STATUS_NORMAL:
|
||||
$service_stats[$row['id']]['statusImageHTML'] = '<img src="images/status_sets/default/agent_ok_ball.png" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="NORMAL status." />';
|
||||
break;
|
||||
|
||||
case SERVICE_STATUS_CRITICAL:
|
||||
$service_stats[$row['id']]['statusImageHTML'] = '<img src="images/status_sets/default/agent_critical_ball.png" data-title="CRITICAL status." data-use_title_for_force_title="1" class="forced_title" alt="CRITICAL status." />';
|
||||
break;
|
||||
|
||||
case SERVICE_STATUS_WARNING:
|
||||
$service_stats[$row['id']][$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_warning_ball.png" data-title="WARNING status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
|
||||
break;
|
||||
|
||||
case SERVICE_STATUS_UNKNOWN:
|
||||
default:
|
||||
$service_stats[$row['id']]['statusImageHTML'] = '<img src="images/status_sets/default/agent_no_data_ball.png" data-title="UNKNOWN status." data-use_title_for_force_title="1" class="forced_title" alt="UNKNOWN status." />';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$data_services = array_values($service_stats);
|
||||
|
||||
$data = array_merge($data_services, $data_agents, $data_modules);
|
||||
|
||||
if (empty($data)) {
|
||||
$this->tree = [];
|
||||
return;
|
||||
}
|
||||
|
||||
$this->tree = $data;
|
||||
}
|
||||
|
||||
|
||||
protected function getSecondLevelServicesSql()
|
||||
{
|
||||
$group_acl = $this->getGroupAclCondition();
|
||||
|
||||
$sql = "SELECT ts.id, ts.name, tse1.id_service AS `rootID`, 'services' AS rootType, 'services' AS type, 0 AS quiet, SUM(if((tse2.id_agent<>0), 1, 0)) AS `total_agents`, SUM(if((tse2.id_agente_modulo<>0), 1, 0)) AS `total_modules`, SUM(if((tse2.id_service_child<>0), 1, 0)) AS `total_services`, 0 AS fired_count, 0 AS normal_count, 0 AS warning_count, 0 AS critical_count, 0 AS unknown_count, 0 AS notinit_count, 0 AS state_critical, 0 AS state_warning, 0 AS state_unknown, 0 AS state_notinit, 0 AS state_normal, 0 AS state_total, '' AS statusImageHTML, '' AS alertImageHTML
|
||||
FROM tservice_element tse1
|
||||
LEFT JOIN tservice_element tse2 ON tse1.id_service_child=tse2.id_service
|
||||
LEFT JOIN tservice ts ON tse1.id_service_child=ts.id
|
||||
WHERE tse1.id_service=$this->id AND tse1.id_service_child<>0
|
||||
GROUP BY tse1.id_service_child
|
||||
";
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
|
||||
protected function getSecondLevelModulesSql()
|
||||
{
|
||||
$sql = "SELECT tse.id_agente_modulo, nombre AS `name`, nombre AS `alias`, tse.id_service AS `rootID`, 'services' AS `rootType`, 'modules' AS `type`, estado
|
||||
FROM tservice_element tse
|
||||
INNER JOIN tagente_modulo tam ON tse.id_agente_modulo=tam.id_agente_modulo
|
||||
INNER JOIN tagente_estado tae ON tam.id_agente_modulo=tae.id_agente_estado
|
||||
WHERE tse.id_service=$this->id AND tse.id_agente_modulo<>0
|
||||
";
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
|
||||
protected function getAgentStatusFilter($status=self::TV_DEFAULT_AGENT_STATUS)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -20,8 +20,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC190226';
|
||||
$pandora_version = 'v7.0NG.731';
|
||||
$build_version = 'PC190304';
|
||||
$pandora_version = 'v7.0NG.732';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
|
@ -1,23 +1,31 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
/**
|
||||
* Pandora FMS - http://pandorafms.com
|
||||
* ==================================================
|
||||
* Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; version 2
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* @package Include
|
||||
* @subpackage Clippy
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
|
||||
|
||||
/**
|
||||
* Starts clippy.
|
||||
*
|
||||
* @param string $sec2 Section.
|
||||
|
||||
* @return void
|
||||
*/
|
||||
function clippy_start($sec2)
|
||||
{
|
||||
global $config;
|
||||
|
@ -28,7 +36,7 @@ function clippy_start($sec2)
|
|||
|
||||
$sec2 = str_replace('/', '_', $sec2);
|
||||
|
||||
// Avoid some case the other parameters in the url
|
||||
// Avoid some case the other parameters in the url.
|
||||
if (strstr($sec2, '&') !== false) {
|
||||
$chunks = explode('&', $sec2);
|
||||
$sec2 = $chunks[0];
|
||||
|
@ -42,7 +50,7 @@ function clippy_start($sec2)
|
|||
clippy_write_javascript_helps_steps($tours);
|
||||
}
|
||||
|
||||
// Add homepage for all pages for to show the "task sugestions"
|
||||
// Add homepage for all pages for to show the "task sugestions".
|
||||
include 'include/help/clippy/homepage.php';
|
||||
|
||||
$tours = clippy_start_page_homepage();
|
||||
|
@ -56,12 +64,24 @@ function clippy_start($sec2)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function clippy_clean_help()
|
||||
{
|
||||
set_cookie('clippy', null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param something $tours Tour.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function clippy_write_javascript_helps_steps($tours)
|
||||
{
|
||||
global $config;
|
||||
|
@ -71,7 +91,7 @@ function clippy_write_javascript_helps_steps($tours)
|
|||
$first_step_by_default = $tours['first_step_by_default'];
|
||||
}
|
||||
|
||||
// For the help context instead the clippy
|
||||
// For the help context instead the clippy.
|
||||
$help_context = false;
|
||||
if (isset($tours['help_context'])) {
|
||||
$help_context = $tours['help_context'];
|
||||
|
@ -86,7 +106,7 @@ function clippy_write_javascript_helps_steps($tours)
|
|||
$clippy = get_cookie('clippy', false);
|
||||
set_cookie('clippy', null);
|
||||
|
||||
// Get the help steps from a task
|
||||
// Get the help steps from a task.
|
||||
$steps = null;
|
||||
if (isset($tours['tours'][$clippy])) {
|
||||
$steps = $tours['tours'][$clippy]['steps'];
|
||||
|
@ -94,7 +114,7 @@ function clippy_write_javascript_helps_steps($tours)
|
|||
|
||||
if ($first_step_by_default) {
|
||||
if (empty($steps)) {
|
||||
// Get the first by default
|
||||
// Get the first by default.
|
||||
$temp = reset($tours['tours']);
|
||||
$steps = $temp['steps'];
|
||||
}
|
||||
|
@ -121,7 +141,7 @@ function clippy_write_javascript_helps_steps($tours)
|
|||
|
||||
if ($first_step_by_default) {
|
||||
if (empty($conf)) {
|
||||
// Get the first by default
|
||||
// Get the first by default.
|
||||
$temp = reset($tours['tours']);
|
||||
$conf = $temp['conf'];
|
||||
}
|
||||
|
@ -137,7 +157,7 @@ function clippy_write_javascript_helps_steps($tours)
|
|||
}
|
||||
|
||||
$autostart = true;
|
||||
if (!is_null($conf['autostart'])) {
|
||||
if (isset($conf['autostart'])) {
|
||||
$autostart = $conf['autostart'];
|
||||
}
|
||||
|
||||
|
@ -185,9 +205,25 @@ function clippy_write_javascript_helps_steps($tours)
|
|||
<?php echo $name_obj_js_tour; ?> = introJs();
|
||||
|
||||
<?php echo $name_obj_js_tour; ?>.setOptions({
|
||||
steps: <?php echo json_encode((bool) $steps); ?>,
|
||||
showBullets: <?php echo json_encode((bool) $show_bullets); ?>,
|
||||
showStepNumbers: <?php echo json_encode((bool) $show_step_numbers); ?>,
|
||||
steps: <?php echo json_encode($steps); ?>,
|
||||
showBullets:
|
||||
<?php
|
||||
if ($show_bullets) {
|
||||
echo 'true';
|
||||
} else {
|
||||
echo 'false';
|
||||
}
|
||||
?>
|
||||
,
|
||||
showStepNumbers:
|
||||
<?php
|
||||
if ($show_step_numbers) {
|
||||
echo 'true';
|
||||
} else {
|
||||
echo 'false';
|
||||
}
|
||||
?>
|
||||
,
|
||||
nextLabel: "<?php echo __('Next →'); ?>",
|
||||
prevLabel: "<?php echo __('← Back'); ?>",
|
||||
skipLabel: "<?php echo $skipLabel; ?>",
|
||||
|
@ -205,13 +241,22 @@ function clippy_write_javascript_helps_steps($tours)
|
|||
return exit;
|
||||
});
|
||||
|
||||
if (<?php echo json_encode(!empty($conf['next_help'])); ?>) {
|
||||
<?php
|
||||
if (!empty($conf['next_help'])) {
|
||||
?>
|
||||
clippy_set_help('<?php echo $conf['next_help']; ?>');
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
if (<?php echo json_encode((bool) $autostart); ?>) {
|
||||
<?php echo $name_obj_js_tour; ?>.start();
|
||||
<?php
|
||||
if ($autostart) {
|
||||
echo $name_obj_js_tour;
|
||||
?>
|
||||
.start();
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
});
|
||||
|
||||
<?php echo $other_js; ?>
|
||||
|
@ -221,6 +266,13 @@ function clippy_write_javascript_helps_steps($tours)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $help Help.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function clippy_context_help($help=null)
|
||||
{
|
||||
global $config;
|
||||
|
@ -244,10 +296,10 @@ function clippy_context_help($help=null)
|
|||
$code = str_replace('{clippy}', '#'.$id, $code);
|
||||
$code = str_replace('{clippy_obj}', 'intro_'.$id, $code);
|
||||
|
||||
$return = $code.'<div id="'.$id.'" style="display: inline;">'.'<a onclick="show_'.$id.'();" href="javascript: void(0);" >'.html_print_image(
|
||||
$return = $code.'<div id="'.$id.'" style="display: inline;"><a onclick="show_'.$id.'();" href="javascript: void(0);" >'.html_print_image(
|
||||
'images/clippy_icon.png',
|
||||
true
|
||||
).'</a>'.'</div>
|
||||
).'</a></div>
|
||||
<script type="text/javascript">
|
||||
|
||||
function show_'.$id.'() {
|
||||
|
|
|
@ -2272,35 +2272,29 @@ function events_page_responses($event, $childrens_ids=[])
|
|||
|
||||
/**
|
||||
* Replace macros in the target of a response and return it.
|
||||
* If server_id > 0, is a metaconsole query.
|
||||
* If server_id > 0, it's a metaconsole query.
|
||||
*
|
||||
* @param integer $event_id Event_id.
|
||||
* @param integer $response_id Response_id.
|
||||
* @param integer $server_id Server_id.
|
||||
* @param boolean $history History.
|
||||
* @param integer $event_id Event identifier.
|
||||
* @param integer $response_id Event response identifier.
|
||||
* @param integer $server_id Node identifier (for metaconsole).
|
||||
* @param boolean $history Use the history database or not.
|
||||
*
|
||||
* @return string Target.
|
||||
* @return string The response text with the macros applied.
|
||||
*/
|
||||
function events_get_response_target(
|
||||
$event_id,
|
||||
$response_id,
|
||||
$server_id,
|
||||
$history=false
|
||||
int $event_id,
|
||||
int $response_id,
|
||||
int $server_id=0,
|
||||
bool $history=false
|
||||
) {
|
||||
global $config;
|
||||
|
||||
$event_response = db_get_row('tevent_response', 'id', $response_id);
|
||||
|
||||
if ($server_id > 0) {
|
||||
$meta = true;
|
||||
} else {
|
||||
$meta = false;
|
||||
}
|
||||
|
||||
// If server_id > 0, it's a metaconsole query.
|
||||
$meta = $server_id > 0;
|
||||
$event_table = events_get_events_table($meta, $history);
|
||||
|
||||
$event = db_get_row($event_table, 'id_evento', $event_id);
|
||||
|
||||
$event_response = db_get_row('tevent_response', 'id', $response_id);
|
||||
$target = io_safe_output($event_response['target']);
|
||||
|
||||
// Substitute each macro.
|
||||
|
@ -2317,7 +2311,7 @@ function events_get_response_target(
|
|||
}
|
||||
|
||||
$ip = db_get_value_filter('direccion', $agente_table_name, $filter);
|
||||
// If agent has not an ip, display N/A.
|
||||
// If agent has not an IP, display N/A.
|
||||
if ($ip === false) {
|
||||
$ip = __('N/A');
|
||||
}
|
||||
|
@ -2499,6 +2493,11 @@ function events_get_response_target(
|
|||
}
|
||||
}
|
||||
|
||||
// This will replace the macro with the current logged user.
|
||||
if (strpos($target, '_current_user_') !== false) {
|
||||
$target = str_replace('_current_user_', $config['id_user'], $target);
|
||||
}
|
||||
|
||||
return $target;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,19 +20,19 @@
|
|||
if (!isset($config)) {
|
||||
$working_dir = getcwd();
|
||||
$working_dir = str_replace('\\', '/', $working_dir);
|
||||
// Windows compatibility
|
||||
// Windows compatibility.
|
||||
$levels = substr_count($working_dir, '/');
|
||||
|
||||
for ($i = 0; $i < $levels; $i++) {
|
||||
if (file_exists(str_repeat('../', $i).'config.php')) {
|
||||
include_once str_repeat('../', $i).'config.php';
|
||||
break;
|
||||
// Skip config.php loading after load the first one
|
||||
// Skip config.php loading after load the first one.
|
||||
} else if (file_exists(str_repeat('../', $i).'include/config.php')) {
|
||||
// For path from the enterprise structure dirs.
|
||||
include_once str_repeat('../', $i).'include/config.php';
|
||||
break;
|
||||
// Skip config.php loading after load the first one
|
||||
// Skip config.php loading after load the first one.
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -2307,7 +2307,7 @@ function html_print_checkbox($name, $value, $checked=false, $return=false, $disa
|
|||
|
||||
|
||||
/**
|
||||
* Render a checkbox button input toogle switch type. Extended version, use html_print_checkbox_toogle_switch() to simplify.
|
||||
* Render a checkbox button input switch type. Extended version, use html_print_checkbox_switch() to simplify.
|
||||
*
|
||||
* @param string Input name.
|
||||
* @param string Input value.
|
||||
|
@ -2321,7 +2321,7 @@ function html_print_checkbox($name, $value, $checked=false, $return=false, $disa
|
|||
*/
|
||||
|
||||
|
||||
function html_print_checkbox_toogle_switch_extended($name, $value, $checked, $disabled, $script, $attributes, $return=false, $id='')
|
||||
function html_print_checkbox_switch_extended($name, $value, $checked, $disabled, $script, $attributes, $return=false, $id='')
|
||||
{
|
||||
static $idcounter = [];
|
||||
|
||||
|
@ -2334,7 +2334,7 @@ function html_print_checkbox_toogle_switch_extended($name, $value, $checked, $di
|
|||
|
||||
$id_aux = preg_replace('/[^a-z0-9\:\;\-\_]/i', '', $name.($idcounter[$name] ? $idcounter[$name] : ''));
|
||||
|
||||
$output = '<label class="toogle_switch"><input name="'.$name.'" type="checkbox" value="'.$value.'" '.($checked ? 'checked="checked"' : '');
|
||||
$output = '<label class="p-switch"><input name="'.$name.'" type="checkbox" value="'.$value.'" '.($checked ? 'checked="checked"' : '');
|
||||
if ($id == '') {
|
||||
$output .= ' id="checkbox-'.$id_aux.'"';
|
||||
} else {
|
||||
|
@ -2350,7 +2350,7 @@ function html_print_checkbox_toogle_switch_extended($name, $value, $checked, $di
|
|||
}
|
||||
|
||||
$output .= ' '.$attributes;
|
||||
$output .= ' /><span class="slider"></span></label>';
|
||||
$output .= ' /><span class="p-slider"></span></label>';
|
||||
$output .= "\n";
|
||||
|
||||
if ($return === false) {
|
||||
|
@ -2362,7 +2362,7 @@ function html_print_checkbox_toogle_switch_extended($name, $value, $checked, $di
|
|||
|
||||
|
||||
/**
|
||||
* Render a checkbox button input toogle switch type.
|
||||
* Render a checkbox button input switch type.
|
||||
*
|
||||
* @param string Input name.
|
||||
* @param string Input value.
|
||||
|
@ -2374,9 +2374,9 @@ function html_print_checkbox_toogle_switch_extended($name, $value, $checked, $di
|
|||
*/
|
||||
|
||||
|
||||
function html_print_checkbox_toogle_switch($name, $value, $checked=false, $return=false, $disabled=false, $script='', $disabled_hidden=false)
|
||||
function html_print_checkbox_switch($name, $value, $checked=false, $return=false, $disabled=false, $script='', $disabled_hidden=false)
|
||||
{
|
||||
$output = html_print_checkbox_toogle_switch_extended($name, $value, (bool) $checked, $disabled, $script, '', true);
|
||||
$output = html_print_checkbox_switch_extended($name, $value, (bool) $checked, $disabled, $script, '', true);
|
||||
if (!$disabled_hidden) {
|
||||
$output .= html_print_input_hidden($name.'_sent', 1, true);
|
||||
}
|
||||
|
@ -3114,4 +3114,3 @@ function html_print_switch($attributes=[])
|
|||
<span class='p-slider'></span>
|
||||
</label>";
|
||||
}
|
||||
|
||||
|
|
|
@ -115,8 +115,21 @@ var TreeController = {
|
|||
}
|
||||
};
|
||||
|
||||
var serviceCounterTitles = {
|
||||
total_services: {
|
||||
totals: "Services"
|
||||
},
|
||||
total_agents: {
|
||||
totals: "Agents"
|
||||
},
|
||||
total_modules: {
|
||||
totals: "Modules"
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
var title = "";
|
||||
|
||||
switch (elementType) {
|
||||
case "group":
|
||||
if (
|
||||
|
@ -144,6 +157,9 @@ var TreeController = {
|
|||
title = defaultCounterTitles[counterType].modules;
|
||||
}
|
||||
break;
|
||||
case "services":
|
||||
title = serviceCounterTitles[counterType].totals;
|
||||
break;
|
||||
default:
|
||||
if (
|
||||
typeof controller.counterTitles != "undefined" &&
|
||||
|
@ -169,109 +185,227 @@ var TreeController = {
|
|||
}
|
||||
}
|
||||
|
||||
var $counters = $("<div></div>");
|
||||
$counters.addClass("tree-node-counters");
|
||||
|
||||
if (typeof counters.total != "undefined" && counters.total >= 0) {
|
||||
var $totalCounter = $("<div></div>");
|
||||
$totalCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html(counters.total);
|
||||
|
||||
_processNodeCounterTitle($totalCounter, type, "total");
|
||||
|
||||
// Open the parentheses
|
||||
$counters.append(" (");
|
||||
|
||||
$counters.append($totalCounter);
|
||||
if (type == "services") {
|
||||
var $counters = $("<div></div>");
|
||||
$counters.addClass("tree-node-counters");
|
||||
|
||||
if (
|
||||
typeof counters.alerts != "undefined" &&
|
||||
counters.alerts > 0
|
||||
counters.total_services +
|
||||
counters.total_agents +
|
||||
counters.total_modules >
|
||||
0
|
||||
) {
|
||||
var $firedCounter = $("<div></div>");
|
||||
$firedCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("alerts")
|
||||
.addClass("orange")
|
||||
.html(counters.alerts);
|
||||
// Open the parentheses
|
||||
$counters.append(" (");
|
||||
|
||||
_processNodeCounterTitle($firedCounter, type, "alerts");
|
||||
if (
|
||||
typeof counters.total_services != "undefined" &&
|
||||
counters.total_services >= 0
|
||||
) {
|
||||
var $servicesCounter = $("<div></div>");
|
||||
$servicesCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html(counters.total_services);
|
||||
|
||||
$counters.append(" : ").append($firedCounter);
|
||||
_processNodeCounterTitle(
|
||||
$servicesCounter,
|
||||
type,
|
||||
"total_services"
|
||||
);
|
||||
|
||||
$counters.append($servicesCounter);
|
||||
} else {
|
||||
var $servicesCounter = $("<div></div>");
|
||||
$servicesCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html("0");
|
||||
|
||||
_processNodeCounterTitle(
|
||||
$servicesCounter,
|
||||
type,
|
||||
"total_services"
|
||||
);
|
||||
|
||||
$counters.append($servicesCounter);
|
||||
}
|
||||
|
||||
if (
|
||||
typeof counters.total_agents != "undefined" &&
|
||||
counters.total_agents > 0
|
||||
) {
|
||||
var $agentsCounter = $("<div></div>");
|
||||
$agentsCounter
|
||||
.addClass("tree-node-counter")
|
||||
.html(counters.total_agents);
|
||||
|
||||
_processNodeCounterTitle(
|
||||
$agentsCounter,
|
||||
type,
|
||||
"total_agents"
|
||||
);
|
||||
|
||||
$counters.append(" : ").append($agentsCounter);
|
||||
} else {
|
||||
var $agentsCounter = $("<div></div>");
|
||||
$agentsCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html("0");
|
||||
|
||||
_processNodeCounterTitle(
|
||||
$agentsCounter,
|
||||
type,
|
||||
"total_agents"
|
||||
);
|
||||
|
||||
$counters.append(" : ").append($agentsCounter);
|
||||
}
|
||||
|
||||
if (
|
||||
typeof counters.total_modules != "undefined" &&
|
||||
counters.total_modules > 0
|
||||
) {
|
||||
var $modulesCounter = $("<div></div>");
|
||||
$modulesCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html(counters.total_modules);
|
||||
|
||||
_processNodeCounterTitle(
|
||||
$modulesCounter,
|
||||
type,
|
||||
"total_modules"
|
||||
);
|
||||
|
||||
$counters.append(" : ").append($modulesCounter);
|
||||
} else {
|
||||
var $modulesCounter = $("<div></div>");
|
||||
$modulesCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html("0");
|
||||
|
||||
_processNodeCounterTitle(
|
||||
$modulesCounter,
|
||||
type,
|
||||
"total_modules"
|
||||
);
|
||||
|
||||
$counters.append(" : ").append($modulesCounter);
|
||||
}
|
||||
|
||||
// Close the parentheses
|
||||
$counters.append(")");
|
||||
|
||||
hasCounters = true;
|
||||
}
|
||||
if (
|
||||
typeof counters.critical != "undefined" &&
|
||||
counters.critical > 0
|
||||
) {
|
||||
var $criticalCounter = $("<div></div>");
|
||||
$criticalCounter
|
||||
} else {
|
||||
var $counters = $("<div></div>");
|
||||
$counters.addClass("tree-node-counters");
|
||||
|
||||
if (typeof counters.total != "undefined" && counters.total >= 0) {
|
||||
var $totalCounter = $("<div></div>");
|
||||
$totalCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("critical")
|
||||
.addClass("red")
|
||||
.html(counters.critical);
|
||||
.addClass("total")
|
||||
.html(counters.total);
|
||||
|
||||
_processNodeCounterTitle($criticalCounter, type, "critical");
|
||||
_processNodeCounterTitle($totalCounter, type, "total");
|
||||
|
||||
$counters.append(" : ").append($criticalCounter);
|
||||
}
|
||||
if (
|
||||
typeof counters.warning != "undefined" &&
|
||||
counters.warning > 0
|
||||
) {
|
||||
var $warningCounter = $("<div></div>");
|
||||
$warningCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("warning")
|
||||
.addClass("yellow")
|
||||
.html(counters.warning);
|
||||
// Open the parentheses
|
||||
$counters.append(" (");
|
||||
|
||||
_processNodeCounterTitle($warningCounter, type, "warning");
|
||||
$counters.append($totalCounter);
|
||||
|
||||
$counters.append(" : ").append($warningCounter);
|
||||
}
|
||||
if (
|
||||
typeof counters.unknown != "undefined" &&
|
||||
counters.unknown > 0
|
||||
) {
|
||||
var $unknownCounter = $("<div></div>");
|
||||
$unknownCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("unknown")
|
||||
.addClass("grey")
|
||||
.html(counters.unknown);
|
||||
if (
|
||||
typeof counters.alerts != "undefined" &&
|
||||
counters.alerts > 0
|
||||
) {
|
||||
var $firedCounter = $("<div></div>");
|
||||
$firedCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("alerts")
|
||||
.addClass("orange")
|
||||
.html(counters.alerts);
|
||||
|
||||
_processNodeCounterTitle($unknownCounter, type, "unknown");
|
||||
_processNodeCounterTitle($firedCounter, type, "alerts");
|
||||
|
||||
$counters.append(" : ").append($unknownCounter);
|
||||
}
|
||||
if (
|
||||
typeof counters.not_init != "undefined" &&
|
||||
counters.not_init > 0
|
||||
) {
|
||||
var $notInitCounter = $("<div></div>");
|
||||
$notInitCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("not_init")
|
||||
.addClass("blue")
|
||||
.html(counters.not_init);
|
||||
$counters.append(" : ").append($firedCounter);
|
||||
}
|
||||
if (
|
||||
typeof counters.critical != "undefined" &&
|
||||
counters.critical > 0
|
||||
) {
|
||||
var $criticalCounter = $("<div></div>");
|
||||
$criticalCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("critical")
|
||||
.addClass("red")
|
||||
.html(counters.critical);
|
||||
|
||||
_processNodeCounterTitle($notInitCounter, type, "not_init");
|
||||
_processNodeCounterTitle($criticalCounter, type, "critical");
|
||||
|
||||
$counters.append(" : ").append($notInitCounter);
|
||||
}
|
||||
if (typeof counters.ok != "undefined" && counters.ok > 0) {
|
||||
var $okCounter = $("<div></div>");
|
||||
$okCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("ok")
|
||||
.addClass("green")
|
||||
.html(counters.ok);
|
||||
$counters.append(" : ").append($criticalCounter);
|
||||
}
|
||||
if (
|
||||
typeof counters.warning != "undefined" &&
|
||||
counters.warning > 0
|
||||
) {
|
||||
var $warningCounter = $("<div></div>");
|
||||
$warningCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("warning")
|
||||
.addClass("yellow")
|
||||
.html(counters.warning);
|
||||
|
||||
_processNodeCounterTitle($okCounter, type, "ok");
|
||||
_processNodeCounterTitle($warningCounter, type, "warning");
|
||||
|
||||
$counters.append(" : ").append($okCounter);
|
||||
$counters.append(" : ").append($warningCounter);
|
||||
}
|
||||
if (
|
||||
typeof counters.unknown != "undefined" &&
|
||||
counters.unknown > 0
|
||||
) {
|
||||
var $unknownCounter = $("<div></div>");
|
||||
$unknownCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("unknown")
|
||||
.addClass("grey")
|
||||
.html(counters.unknown);
|
||||
|
||||
_processNodeCounterTitle($unknownCounter, type, "unknown");
|
||||
|
||||
$counters.append(" : ").append($unknownCounter);
|
||||
}
|
||||
if (
|
||||
typeof counters.not_init != "undefined" &&
|
||||
counters.not_init > 0
|
||||
) {
|
||||
var $notInitCounter = $("<div></div>");
|
||||
$notInitCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("not_init")
|
||||
.addClass("blue")
|
||||
.html(counters.not_init);
|
||||
|
||||
_processNodeCounterTitle($notInitCounter, type, "not_init");
|
||||
|
||||
$counters.append(" : ").append($notInitCounter);
|
||||
}
|
||||
if (typeof counters.ok != "undefined" && counters.ok > 0) {
|
||||
var $okCounter = $("<div></div>");
|
||||
$okCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("ok")
|
||||
.addClass("green")
|
||||
.html(counters.ok);
|
||||
|
||||
_processNodeCounterTitle($okCounter, type, "ok");
|
||||
|
||||
$counters.append(" : ").append($okCounter);
|
||||
}
|
||||
}
|
||||
|
||||
// Close the parentheses
|
||||
|
@ -436,7 +570,120 @@ var TreeController = {
|
|||
|
||||
$content.append($alertImage);
|
||||
}
|
||||
$content.append(element.alias);
|
||||
|
||||
// Events by agent
|
||||
if (element.showEventsBtn == 1) {
|
||||
if (typeof element.eventAgent != "undefined") {
|
||||
$content.append(
|
||||
'<form method="post" id="hiddenAgentsEventsForm-' +
|
||||
element.eventAgent +
|
||||
'" style="display: none;" action="index.php?sec=eventos&sec2=operation/events/events&refr=0&pure=§ion=list&history=0"><input type="hidden" name="id_agent" value="' +
|
||||
element.eventAgent +
|
||||
'"></form>'
|
||||
);
|
||||
var $eventImage = $(
|
||||
'<img src="' +
|
||||
(controller.baseURL.length > 0
|
||||
? controller.baseURL
|
||||
: "") +
|
||||
'images/tree_events.png" /> '
|
||||
);
|
||||
$eventImage.addClass("agent-alerts-fired");
|
||||
$eventImage
|
||||
.click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
document
|
||||
.getElementById(
|
||||
"hiddenAgentsEventsForm-" + element.eventAgent
|
||||
)
|
||||
.submit();
|
||||
})
|
||||
.css("cursor", "pointer");
|
||||
|
||||
$content.append($eventImage);
|
||||
}
|
||||
}
|
||||
|
||||
$content.append(" " + element.alias);
|
||||
break;
|
||||
case "services":
|
||||
if (
|
||||
typeof element.statusImageHTML != "undefined" &&
|
||||
element.statusImageHTML.length > 0
|
||||
) {
|
||||
var $statusImage = $(element.statusImageHTML);
|
||||
$statusImage.addClass("agent-status");
|
||||
|
||||
$content.append($statusImage);
|
||||
}
|
||||
|
||||
var $serviceDetailImage = $(
|
||||
'<img src="' +
|
||||
(controller.baseURL.length > 0 ? controller.baseURL : "") +
|
||||
'images/tree_service_map.png" /> '
|
||||
);
|
||||
|
||||
if (typeof element.serviceDetail != "undefined") {
|
||||
$serviceDetailImage
|
||||
.click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
window.location.href = element.serviceDetail;
|
||||
})
|
||||
.css("cursor", "pointer");
|
||||
|
||||
$content.append($serviceDetailImage);
|
||||
}
|
||||
|
||||
$content.append(" " + element.name);
|
||||
|
||||
break;
|
||||
case "modules":
|
||||
if (
|
||||
typeof element.statusImageHTML != "undefined" &&
|
||||
element.statusImageHTML.length > 0
|
||||
) {
|
||||
var $statusImage = $(element.statusImageHTML);
|
||||
$statusImage.addClass("agent-status");
|
||||
|
||||
$content.append($statusImage);
|
||||
}
|
||||
|
||||
// Events by module
|
||||
if (element.showEventsBtn == 1) {
|
||||
if (typeof element.eventModule != "undefined") {
|
||||
$content.append(
|
||||
'<form method="post" id="hiddenModulesEventsForm-' +
|
||||
element.eventModule +
|
||||
'" style="display: none;" action="index.php?sec=eventos&sec2=operation/events/events&refr=0&pure=§ion=list&history=0"><input type="hidden" name="module_search_hidden" value="' +
|
||||
element.eventModule +
|
||||
'"></form>'
|
||||
);
|
||||
var $moduleImage = $(
|
||||
'<img src="' +
|
||||
(controller.baseURL.length > 0
|
||||
? controller.baseURL
|
||||
: "") +
|
||||
'images/tree_events.png" /> '
|
||||
);
|
||||
$moduleImage
|
||||
.click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
document
|
||||
.getElementById(
|
||||
"hiddenModulesEventsForm-" + element.eventModule
|
||||
)
|
||||
.submit();
|
||||
})
|
||||
.css("cursor", "pointer");
|
||||
|
||||
$content.append($moduleImage);
|
||||
}
|
||||
}
|
||||
|
||||
$content.append(" " + element.name);
|
||||
break;
|
||||
case "module":
|
||||
// Status image
|
||||
|
@ -617,6 +864,19 @@ var TreeController = {
|
|||
}
|
||||
$content.append(element.name);
|
||||
break;
|
||||
case "services":
|
||||
// Status image
|
||||
if (
|
||||
typeof element.statusImageHTML != "undefined" &&
|
||||
element.statusImageHTML.length > 0
|
||||
) {
|
||||
var $statusImage = $(element.statusImageHTML);
|
||||
$statusImage.addClass("agent-status");
|
||||
|
||||
$content.append($statusImage);
|
||||
}
|
||||
$content.append(element.name);
|
||||
break;
|
||||
default:
|
||||
$content.append(element.name);
|
||||
break;
|
||||
|
@ -820,14 +1080,16 @@ var TreeController = {
|
|||
}
|
||||
|
||||
controller.recipient.empty();
|
||||
controller.recipient.html(
|
||||
"<div> " +
|
||||
controller.foundMessage +
|
||||
": " +
|
||||
controller.tree.length +
|
||||
"</div>" +
|
||||
"<br/>"
|
||||
);
|
||||
if (controller.tree.length !== undefined) {
|
||||
controller.recipient.html(
|
||||
"<div> " +
|
||||
controller.foundMessage +
|
||||
": " +
|
||||
controller.tree.length +
|
||||
"</div>" +
|
||||
"<br/>"
|
||||
);
|
||||
}
|
||||
|
||||
var $children = _processGroup(this.recipient, this.tree, true);
|
||||
$children.show();
|
||||
|
|
|
@ -294,6 +294,8 @@ enterprise_hook('close_meta_frame');
|
|||
|
||||
$(".loading_tree").show();
|
||||
|
||||
|
||||
|
||||
var parameters = {};
|
||||
parameters['page'] = "include/ajax/tree.ajax";
|
||||
parameters['getChildren'] = 1;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.731
|
||||
%define release 190226
|
||||
%define version 7.0NG.732
|
||||
%define release 190304
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.731
|
||||
%define release 190226
|
||||
%define version 7.0NG.732
|
||||
%define release 190304
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.731"
|
||||
PI_VERSION="7.0NG.732"
|
||||
FORCE=0
|
||||
DESTDIR=""
|
||||
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
||||
|
|
|
@ -111,10 +111,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
||||
('custom_report_front_header', ''),
|
||||
('custom_report_front_footer', ''),
|
||||
('MR', 24),
|
||||
('MR', 25),
|
||||
('identification_reminder', 1),
|
||||
('identification_reminder_timestamp', 0),
|
||||
('current_package_enterprise', '731'),
|
||||
('current_package_enterprise', '732'),
|
||||
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'),
|
||||
('custom_docs_logo', 'default_docs.png'),
|
||||
('custom_support_logo', 'default_support.png'),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.731-190226
|
||||
Version: 7.0NG.732-190304
|
||||
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.731-190226"
|
||||
pandora_version="7.0NG.732-190304"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#############################################################################
|
||||
# Pandora FMS Server Parameters
|
||||
# Pandora FMS, the Flexible Monitoring System.
|
||||
# Version 7.0NG.731
|
||||
# Version 7.0NG.732
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2017 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -44,8 +44,8 @@ our @EXPORT = qw(
|
|||
);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.731";
|
||||
my $pandora_build = "190226";
|
||||
my $pandora_version = "7.0NG.732";
|
||||
my $pandora_build = "190304";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -31,8 +31,8 @@ use base 'Exporter';
|
|||
our @ISA = qw(Exporter);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.731";
|
||||
my $pandora_build = "190226";
|
||||
my $pandora_version = "7.0NG.732";
|
||||
my $pandora_build = "190304";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -216,7 +216,7 @@ sub new {
|
|||
$self->{'snmp_security_level'} = '';
|
||||
|
||||
# Disable SNMP scans if no community was given.
|
||||
if (scalar(@{$self->{'communities'}}) == 0) {
|
||||
if (ref($self->{'communities'}) ne "ARRAY" || scalar(@{$self->{'communities'}}) == 0) {
|
||||
$self->{'snmp_enabled'} = 0;
|
||||
$self->call('message', "There is not any SNMP community configured.", 5);
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Server
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.731
|
||||
%define release 190226
|
||||
%define version 7.0NG.732
|
||||
%define release 190304
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Server
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.731
|
||||
%define release 190226
|
||||
%define version 7.0NG.732
|
||||
%define release 190304
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.731"
|
||||
PI_BUILD="190226"
|
||||
PI_VERSION="7.0NG.732"
|
||||
PI_BUILD="190304"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -34,7 +34,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.731 PS190226";
|
||||
my $version = "7.0NG.732 PS190304";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.731 PS190226";
|
||||
my $version = "7.0NG.732 PS190304";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
@ -200,7 +200,7 @@ sub help_screen{
|
|||
print "\nINCIDENTS:\n\n" unless $param ne '';
|
||||
help_screen_line('--create_incident', "<title> <description> <origin> <status> <priority 0 for Informative, \n\t 1 for Low, 2 for Medium, 3 for Serious, 4 for Very serious or 5 for Maintenance>\n\t <group> [<owner>]", 'Create incidents');
|
||||
print "\nPOLICIES:\n\n" unless $param ne '';
|
||||
help_screen_line('--apply_policy', '<policy_name>', 'Force apply a policy');
|
||||
help_screen_line('--apply_policy', '<id_policy> [<id_agent> <name(boolean)> <id_server>]', 'Force apply a policy in an agent');
|
||||
help_screen_line('--apply_all_policies', '', 'Force apply to all the policies');
|
||||
help_screen_line('--add_agent_to_policy', '<agent_name> <policy_name>', 'Add an agent to a policy');
|
||||
help_screen_line('--remove_agent_from_policy', '<policy_id> <agent_id>', 'Delete an agent to a policy');
|
||||
|
@ -3606,19 +3606,11 @@ sub cli_delete_data($) {
|
|||
##############################################################################
|
||||
|
||||
sub cli_apply_policy() {
|
||||
my $policy_name = @ARGV[2];
|
||||
|
||||
my $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]);
|
||||
exist_check($policy_id,'policy',$policy_name);
|
||||
|
||||
my $ret = enterprise_hook('pandora_add_policy_queue', [$dbh, $conf, $policy_id, 'apply', 0, 1]);
|
||||
|
||||
if($ret == -1) {
|
||||
print_log "[ERROR] Operation 'apply' cannot be added to policy '$policy_name' because is duplicated in queue or incompatible with others operations\n\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
print_log "[INFO] Added operation 'apply' to policy '$policy_name'\n\n";
|
||||
my ($id_policy, $id_agent, $name, $id_server) = @ARGV[2..5];
|
||||
|
||||
# Call the API.
|
||||
my $result = api_call(\%conf, 'set', 'apply_policy', $id_policy, $id_agent, "$name|$id_server");
|
||||
print "\n$result\n";
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
@ -6031,7 +6023,7 @@ sub pandora_manage_main ($$$) {
|
|||
cli_delete_data($ltotal);
|
||||
}
|
||||
elsif ($param eq '--apply_policy') {
|
||||
param_check($ltotal, 1);
|
||||
param_check($ltotal, 4, 3);
|
||||
cli_apply_policy();
|
||||
}
|
||||
elsif ($param eq '--disable_policy_alerts') {
|
||||
|
|
Loading…
Reference in New Issue