Merge branch 'ent-3595-discovery-fase-2' into 'develop'
Ent 3595 discovery fase 2 See merge request artica/pandorafms!2230 Former-commit-id: 2d5e2e4ff57612c727f20357bfb9de5b8c29ae72
|
@ -1,8 +1,14 @@
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE `treport_content` ADD COLUMN `show_extended_events` tinyint(1) default '0';
|
||||||
|
|
||||||
-- ----------------------------------------------------------------------
|
-- ----------------------------------------------------------------------
|
||||||
-- Add column in table `tagent_custom_fields`
|
-- Add column in table `tagent_custom_fields`
|
||||||
-- ----------------------------------------------------------------------
|
-- ----------------------------------------------------------------------
|
||||||
ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT '';
|
ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT '';
|
||||||
|
|
||||||
|
ALTER TABLE `treport_content` ADD COLUMN `show_extended_events` tinyint(1) default '0';
|
||||||
|
|
||||||
|
ALTER TABLE `trecon_task` ADD COLUMN `summary` text;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
|
@ -1376,6 +1376,7 @@ ALTER TABLE treport_content ADD COLUMN `lapse` int(11) default '300';
|
||||||
ALTER TABLE treport_content ADD COLUMN `visual_format` tinyint(1) default '0';
|
ALTER TABLE treport_content ADD COLUMN `visual_format` tinyint(1) default '0';
|
||||||
ALTER TABLE treport_content ADD COLUMN `hide_no_data` tinyint(1) default '0';
|
ALTER TABLE treport_content ADD COLUMN `hide_no_data` tinyint(1) default '0';
|
||||||
ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL;
|
ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL;
|
||||||
|
ALTER TABLE treport_content ADD COLUMN `show_extended_events` tinyint(1) default '0';
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `tmodule_relationship`
|
-- Table `tmodule_relationship`
|
||||||
|
@ -1410,6 +1411,7 @@ ALTER TABLE trecon_task ADD `vlan_enabled` int(2) unsigned default '0';
|
||||||
ALTER TABLE trecon_task ADD `wmi_enabled` tinyint(1) unsigned DEFAULT '0';
|
ALTER TABLE trecon_task ADD `wmi_enabled` tinyint(1) unsigned DEFAULT '0';
|
||||||
ALTER TABLE trecon_task ADD `auth_strings` text;
|
ALTER TABLE trecon_task ADD `auth_strings` text;
|
||||||
ALTER TABLE trecon_task ADD `autoconfiguration_enabled` tinyint(1) unsigned default '0';
|
ALTER TABLE trecon_task ADD `autoconfiguration_enabled` tinyint(1) unsigned default '0';
|
||||||
|
ALTER TABLE trecon_task ADD `summary` text;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `twidget` AND Table `twidget_dashboard`
|
-- Table `twidget` AND Table `twidget_dashboard`
|
||||||
|
|
|
@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
|
||||||
<?php echo html_print_image('images/icono_grande_reconserver.png', true, ['title' => __('Collections')]); ?>
|
<?php echo html_print_image('images/icono_grande_reconserver.png', true, ['title' => __('Collections')]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="text_task">
|
<div class="text_task">
|
||||||
<h3> <?php echo __('Create Collections'); ?> <p id="description_task">
|
<h3> <?php echo __('Create Collections'); ?></h3><p id="description_task">
|
||||||
<?php
|
<?php
|
||||||
echo __(
|
echo __(
|
||||||
"A file collection is a group of files (e.g. scripts or executables) which are
|
"A file collection is a group of files (e.g. scripts or executables) which are
|
||||||
|
|
|
@ -24,7 +24,7 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom
|
||||||
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Custom Fields')]); ?>
|
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Custom Fields')]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="text_task">
|
<div class="text_task">
|
||||||
<h3> <?php echo __('Create Custom Fields'); ?> <p id="description_task">
|
<h3> <?php echo __('Create Custom Fields'); ?></h3><p id="description_task">
|
||||||
<?php
|
<?php
|
||||||
echo __(
|
echo __(
|
||||||
"Custom fields are an easy way to personalized agent's information.
|
"Custom fields are an easy way to personalized agent's information.
|
||||||
|
|
|
@ -24,7 +24,7 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom
|
||||||
<?php echo html_print_image('images/firts_task/icono_grande_custom_reporting.png', true, ['title' => __('Custom Graphs')]); ?>
|
<?php echo html_print_image('images/firts_task/icono_grande_custom_reporting.png', true, ['title' => __('Custom Graphs')]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="text_task">
|
<div class="text_task">
|
||||||
<h3> <?php echo __('Create Custom Graph'); ?> <p id="description_task">
|
<h3> <?php echo __('Create Custom Graph'); ?></h3><p id="description_task">
|
||||||
<?php
|
<?php
|
||||||
echo __(
|
echo __(
|
||||||
"Graphs are designed to show the data collected by %s in a temporary scale defined by the user.
|
"Graphs are designed to show the data collected by %s in a temporary scale defined by the user.
|
||||||
|
|
|
@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
|
||||||
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Fields Manager')]); ?>
|
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Fields Manager')]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="text_task">
|
<div class="text_task">
|
||||||
<h3> <?php echo __('Create Fields Manager'); ?> <p id="description_task">
|
<h3> <?php echo __('Create Fields Manager'); ?></h3><p id="description_task">
|
||||||
<?php
|
<?php
|
||||||
echo __(
|
echo __(
|
||||||
"Custom fields are an easy way to personalized agent's information.
|
"Custom fields are an easy way to personalized agent's information.
|
||||||
|
|
|
@ -28,7 +28,7 @@ if ($incident_w || $incident_m) {
|
||||||
<?php echo html_print_image('images/firts_task/icono_grande_incidencia.png', true, ['title' => __('Incidents')]); ?>
|
<?php echo html_print_image('images/firts_task/icono_grande_incidencia.png', true, ['title' => __('Incidents')]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="text_task">
|
<div class="text_task">
|
||||||
<h3> <?php echo __('Create Incidents'); ?> <p id="description_task">
|
<h3> <?php echo __('Create Incidents'); ?></h3><p id="description_task">
|
||||||
<?php
|
<?php
|
||||||
echo __(
|
echo __(
|
||||||
"Besides receiving and processing data to monitor systems or applications,
|
"Besides receiving and processing data to monitor systems or applications,
|
||||||
|
|
|
@ -31,7 +31,7 @@ if ($vconsoles_write || $vconsoles_manage) {
|
||||||
<?php echo html_print_image('images/firts_task/icono_grande_visualconsole.png', true, ['title' => __('Visual Console')]); ?>
|
<?php echo html_print_image('images/firts_task/icono_grande_visualconsole.png', true, ['title' => __('Visual Console')]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="text_task">
|
<div class="text_task">
|
||||||
<h3> <?php echo __('Create Visual Console'); ?> <p id="description_task">
|
<h3> <?php echo __('Create Visual Console'); ?></h3><p id="description_task">
|
||||||
<?php
|
<?php
|
||||||
echo __(
|
echo __(
|
||||||
'%s allows users to create visual maps on which each user is able to create his or her '.'own monitoring map. The new visual console editor is much more practical, although the prior '."visual console editor had its advantages. On the new visual console, we've been successful in "."imitating the sensation and touch of a drawing application like GIMP. We've also simplified the "."editor by dividing it into several subject-divided tabs named 'Data', 'Preview', 'Wizard', 'List of "."Elements' and 'Editor'. The items the %s Visual Map was designed to handle are "."'static images', 'percentage bars', 'module graphs' and 'simple values'.",
|
'%s allows users to create visual maps on which each user is able to create his or her '.'own monitoring map. The new visual console editor is much more practical, although the prior '."visual console editor had its advantages. On the new visual console, we've been successful in "."imitating the sensation and touch of a drawing application like GIMP. We've also simplified the "."editor by dividing it into several subject-divided tabs named 'Data', 'Preview', 'Wizard', 'List of "."Elements' and 'Editor'. The items the %s Visual Map was designed to handle are "."'static images', 'percentage bars', 'module graphs' and 'simple values'.",
|
||||||
|
|
|
@ -26,7 +26,7 @@ $networkmap_types = networkmap_get_types($strict_user);
|
||||||
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Network Map')]); ?>
|
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Network Map')]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="text_task">
|
<div class="text_task">
|
||||||
<h3> <?php echo __('Create Network Map'); ?> <p id="description_task">
|
<h3> <?php echo __('Create Network Map'); ?></h3><p id="description_task">
|
||||||
<?php
|
<?php
|
||||||
echo __(
|
echo __(
|
||||||
'There is also an open-source version of the network map.
|
'There is also an open-source version of the network map.
|
||||||
|
|
|
@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
|
||||||
<?php echo html_print_image('images/firts_task/icono_grande_visualconsole.png', true, ['title' => __('Planned Downtime')]); ?>
|
<?php echo html_print_image('images/firts_task/icono_grande_visualconsole.png', true, ['title' => __('Planned Downtime')]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="text_task">
|
<div class="text_task">
|
||||||
<h3> <?php echo __('Create Planned Downtime'); ?> <p id="description_task">
|
<h3> <?php echo __('Create Planned Downtime'); ?></h3><p id="description_task">
|
||||||
<?php
|
<?php
|
||||||
echo __(
|
echo __(
|
||||||
"%s contains a scheduled downtime management system.
|
"%s contains a scheduled downtime management system.
|
||||||
|
|
|
@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
|
||||||
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Discovery server')]); ?>
|
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Discovery server')]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="text_task">
|
<div class="text_task">
|
||||||
<h3> <?php echo __('Create Discovery Task'); ?><p id="description_task">
|
<h3> <?php echo __('Create Discovery Task'); ?></h3><p id="description_task">
|
||||||
<?php
|
<?php
|
||||||
echo __(
|
echo __(
|
||||||
'Discovery Task are used to find new elements in the network.
|
'Discovery Task are used to find new elements in the network.
|
||||||
|
|
|
@ -25,7 +25,7 @@ ui_require_css_file('firts_task');
|
||||||
<?php echo html_print_image('images/firts_task/icono_grande_servicios.png', true, ['title' => __('Services')]); ?>
|
<?php echo html_print_image('images/firts_task/icono_grande_servicios.png', true, ['title' => __('Services')]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="text_task">
|
<div class="text_task">
|
||||||
<h3> <?php echo __('Create Services'); ?> <p id="description_task">
|
<h3> <?php echo __('Create Services'); ?></h3><p id="description_task">
|
||||||
<?php
|
<?php
|
||||||
echo __(
|
echo __(
|
||||||
"A service is a way to group your IT resources based on their functionalities.
|
"A service is a way to group your IT resources based on their functionalities.
|
||||||
|
|
|
@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
|
||||||
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('SNMP Filter')]); ?>
|
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('SNMP Filter')]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="text_task">
|
<div class="text_task">
|
||||||
<h3> <?php echo __('Create SNMP Filter'); ?> <p id="description_task">
|
<h3> <?php echo __('Create SNMP Filter'); ?></h3><p id="description_task">
|
||||||
<?php
|
<?php
|
||||||
echo __(
|
echo __(
|
||||||
"Some systems receive a high number of traps.
|
"Some systems receive a high number of traps.
|
||||||
|
|
|
@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
|
||||||
<?php echo html_print_image('images/firts_task/icono_grande_gestiondetags.png', true, ['title' => __('Tags')]); ?>
|
<?php echo html_print_image('images/firts_task/icono_grande_gestiondetags.png', true, ['title' => __('Tags')]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="text_task">
|
<div class="text_task">
|
||||||
<h3> <?php echo __('Create Tags'); ?> <p id="description_task">
|
<h3> <?php echo __('Create Tags'); ?></h3><p id="description_task">
|
||||||
<?php
|
<?php
|
||||||
echo __(
|
echo __(
|
||||||
"Access to modules can be configured by a tagging system.
|
"Access to modules can be configured by a tagging system.
|
||||||
|
|
|
@ -28,7 +28,7 @@ if ($networkmaps_write || $networkmaps_manage) {
|
||||||
<?php echo html_print_image('images/firts_task/icono_grande_topology.png', true, ['title' => __('Transactions')]); ?>
|
<?php echo html_print_image('images/firts_task/icono_grande_topology.png', true, ['title' => __('Transactions')]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="text_task">
|
<div class="text_task">
|
||||||
<h3> <?php echo __('Create Transactions'); ?> <p id="description_task">
|
<h3> <?php echo __('Create Transactions'); ?></h3><p id="description_task">
|
||||||
<?php
|
<?php
|
||||||
echo __(
|
echo __(
|
||||||
'The new transactional server allows you to execute tasks dependent on the others following a user-defined design. This means that it is possible to coordinate several executions to check a target at a given time.
|
'The new transactional server allows you to execute tasks dependent on the others following a user-defined design. This means that it is possible to coordinate several executions to check a target at a given time.
|
||||||
|
|
|
@ -305,12 +305,12 @@ if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||||
echo '<div class ="img_banner_login">';
|
echo '<div class ="img_banner_login">';
|
||||||
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||||
if (isset($config['custom_splash_login'])) {
|
if (isset($config['custom_splash_login'])) {
|
||||||
html_print_image('enterprise/images/custom_splash_login/'.$config['custom_splash_login'], false, [ 'alt' => 'splash', 'border' => 0, 'title' => $splash_title], false, true);
|
html_print_image('enterprise/images/custom_splash_login/'.$config['custom_splash_login'], false, [ 'alt' => 'splash', 'border' => 0], false, true);
|
||||||
} else {
|
} else {
|
||||||
html_print_image('enterprise/images/custom_splash_login/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0, 'title' => $splash_title], false, true);
|
html_print_image('enterprise/images/custom_splash_login/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0], false, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
html_print_image('images/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0, 'title' => $splash_title], false, true);
|
html_print_image('images/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0], false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
|
@ -1,26 +1,39 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Extension to self monitor Pandora FMS Console
|
||||||
|
*
|
||||||
|
* @category Main page
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Introduction
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
// Config functions.
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; version 2
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
require_once 'include/config.php';
|
require_once 'include/config.php';
|
||||||
|
|
||||||
// This solves problems in enterprise load
|
// This solves problems in enterprise load.
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
/*
|
|
||||||
Call all extensions login function */
|
|
||||||
// extensions_call_login_function ();
|
|
||||||
require_once 'include/functions_reporting.php';
|
require_once 'include/functions_reporting.php';
|
||||||
require_once 'include/functions_tactical.php';
|
require_once 'include/functions_tactical.php';
|
||||||
require_once $config['homedir'].'/include/functions_graph.php';
|
require_once $config['homedir'].'/include/functions_graph.php';
|
||||||
|
@ -29,8 +42,18 @@ if (tags_has_user_acl_tags()) {
|
||||||
ui_print_tags_warning();
|
ui_print_tags_warning();
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_strict = (bool) db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
|
$user_strict = (bool) db_get_value(
|
||||||
$all_data = tactical_status_modules_agents($config['id_user'], $user_strict, 'AR', $user_strict);
|
'strict_acl',
|
||||||
|
'tusuario',
|
||||||
|
'id_user',
|
||||||
|
$config['id_user']
|
||||||
|
);
|
||||||
|
$all_data = tactical_status_modules_agents(
|
||||||
|
$config['id_user'],
|
||||||
|
$user_strict,
|
||||||
|
'AR',
|
||||||
|
$user_strict
|
||||||
|
);
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
$data['monitor_not_init'] = (int) $all_data['_monitors_not_init_'];
|
$data['monitor_not_init'] = (int) $all_data['_monitors_not_init_'];
|
||||||
|
@ -79,6 +102,8 @@ if (!empty($all_data)) {
|
||||||
|
|
||||||
$data['server_sanity'] = format_numeric((100 - $data['module_sanity']), 1);
|
$data['server_sanity'] = format_numeric((100 - $data['module_sanity']), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<table border="0" width="100%" cellspacing="0" cellpadding="0">
|
<table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -88,7 +113,7 @@ if (!empty($all_data)) {
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
//
|
//
|
||||||
// Overview Table
|
// Overview Table.
|
||||||
//
|
//
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->class = 'databox';
|
$table->class = 'databox';
|
||||||
|
@ -101,12 +126,12 @@ if (!empty($all_data)) {
|
||||||
$table->head[0] = '<span>'.__('%s Overview', get_product_name()).'</span>';
|
$table->head[0] = '<span>'.__('%s Overview', get_product_name()).'</span>';
|
||||||
$table->head_colspan[0] = 4;
|
$table->head_colspan[0] = 4;
|
||||||
|
|
||||||
// Indicators
|
// Indicators.
|
||||||
$tdata = [];
|
$tdata = [];
|
||||||
$stats = reporting_get_stats_indicators($data, 120, 10, false);
|
$stats = reporting_get_stats_indicators($data, 120, 10, false);
|
||||||
$status = '<table class="status_tactical">';
|
$status = '<table class="status_tactical">';
|
||||||
foreach ($stats as $stat) {
|
foreach ($stats as $stat) {
|
||||||
$status .= '<tr><td><b>'.$stat['title'].'</b>'.'</td><td>'.$stat['graph'].'</td></tr>';
|
$status .= '<tr><td><b>'.$stat['title'].'</b></td><td>'.$stat['graph'].'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$status .= '</table>';
|
$status .= '</table>';
|
||||||
|
@ -115,25 +140,25 @@ if (!empty($all_data)) {
|
||||||
|
|
||||||
$table->data[] = $tdata;
|
$table->data[] = $tdata;
|
||||||
|
|
||||||
// Alerts
|
// Alerts.
|
||||||
$tdata = [];
|
$tdata = [];
|
||||||
$tdata[0] = reporting_get_stats_alerts($data);
|
$tdata[0] = reporting_get_stats_alerts($data);
|
||||||
$table->rowclass[] = '';
|
$table->rowclass[] = '';
|
||||||
$table->data[] = $tdata;
|
$table->data[] = $tdata;
|
||||||
|
|
||||||
// Modules by status
|
// Modules by status.
|
||||||
$tdata = [];
|
$tdata = [];
|
||||||
$tdata[0] = reporting_get_stats_modules_status($data, 180, 100);
|
$tdata[0] = reporting_get_stats_modules_status($data, 180, 100);
|
||||||
$table->rowclass[] = '';
|
$table->rowclass[] = '';
|
||||||
$table->data[] = $tdata;
|
$table->data[] = $tdata;
|
||||||
|
|
||||||
// Total agents and modules
|
// Total agents and modules.
|
||||||
$tdata = [];
|
$tdata = [];
|
||||||
$tdata[0] = reporting_get_stats_agents_monitors($data);
|
$tdata[0] = reporting_get_stats_agents_monitors($data);
|
||||||
$table->rowclass[] = '';
|
$table->rowclass[] = '';
|
||||||
$table->data[] = $tdata;
|
$table->data[] = $tdata;
|
||||||
|
|
||||||
// Users
|
// Users.
|
||||||
if (users_is_admin()) {
|
if (users_is_admin()) {
|
||||||
$tdata = [];
|
$tdata = [];
|
||||||
$tdata[0] = reporting_get_stats_users($data);
|
$tdata[0] = reporting_get_stats_users($data);
|
||||||
|
@ -160,7 +185,7 @@ if (!empty($all_data)) {
|
||||||
|
|
||||||
|
|
||||||
if (!empty($news)) {
|
if (!empty($news)) {
|
||||||
// NEWS BOARD/////////////////////////////
|
// NEWS BOARD.
|
||||||
echo '<div id="news_board">';
|
echo '<div id="news_board">';
|
||||||
|
|
||||||
echo '<table cellpadding="0" width=100% cellspacing="0" class="databox filters">';
|
echo '<table cellpadding="0" width=100% cellspacing="0" class="databox filters">';
|
||||||
|
@ -184,20 +209,72 @@ if (!empty($all_data)) {
|
||||||
|
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
// News board
|
// News board.
|
||||||
echo '<br><br>';
|
echo '<br><br>';
|
||||||
|
|
||||||
// END OF NEWS BOARD/////////////////////////////
|
// END OF NEWS BOARD.
|
||||||
}
|
}
|
||||||
|
|
||||||
// LAST ACTIVITY/////////////////////////////
|
$nots = messages_get_overview('utimestamp', 'DESC', false);
|
||||||
// Show last activity from this user
|
if (!empty($nots)) {
|
||||||
|
// Notifications board.
|
||||||
|
echo '<div id="notifications_board">';
|
||||||
|
|
||||||
|
echo '<table cellpadding="0" width=100% cellspacing="0" class="databox filters">';
|
||||||
|
echo '<tr><th style="text-align:center;"><span >'.__('Pending notifications').'</span></th></tr>';
|
||||||
|
if ($config['prominent_time'] == 'timestamp') {
|
||||||
|
$comparation_suffix = '';
|
||||||
|
} else {
|
||||||
|
$comparation_suffix = __('ago');
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($nots as $msg) {
|
||||||
|
$conversation = io_safe_output(
|
||||||
|
messages_get_conversation($msg)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (is_array($conversation)) {
|
||||||
|
$text = array_pop($conversation)['message'];
|
||||||
|
} else {
|
||||||
|
// Skip empty message.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = ui_get_full_url(
|
||||||
|
'index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&id_message='.$msg['id_mensaje']
|
||||||
|
);
|
||||||
|
if ($msg['url'] != '') {
|
||||||
|
$url = $msg['url'];
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<tr><th class="green_title">'.$msg['subject'].'</th></tr>';
|
||||||
|
echo '<tr><td><a href="'.$url.'">';
|
||||||
|
if ($msg['id_usuario_origen'] != '') {
|
||||||
|
echo '<b>'.get_user_fullname($msg['id_usuario_origen']).'</b> ';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<i>'.ui_print_timestamp($msg['timestamp'], true).'</i> '.$comparation_suffix.'</a></td></tr>';
|
||||||
|
echo '<tr><td class="datos">';
|
||||||
|
echo nl2br($text);
|
||||||
|
echo '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</table>';
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
// EO Notifications board.
|
||||||
|
}
|
||||||
|
|
||||||
|
// LAST ACTIVITY.
|
||||||
|
// Show last activity from this user.
|
||||||
echo '<div id="activity">';
|
echo '<div id="activity">';
|
||||||
|
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->class = 'databox data';
|
$table->class = 'databox data';
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
// Don't specify px
|
// Don't specify px.
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
$table->size = [];
|
$table->size = [];
|
||||||
$table->size[0] = '5%';
|
$table->size[0] = '5%';
|
||||||
|
@ -212,38 +289,14 @@ if (!empty($all_data)) {
|
||||||
$table->head[3] = __('Source IP');
|
$table->head[3] = __('Source IP');
|
||||||
$table->head[4] = __('Comments');
|
$table->head[4] = __('Comments');
|
||||||
$table->title = '<span>'.__('This is your last activity performed on the %s console', get_product_name()).'</span>';
|
$table->title = '<span>'.__('This is your last activity performed on the %s console', get_product_name()).'</span>';
|
||||||
|
$sql = sprintf(
|
||||||
switch ($config['dbtype']) {
|
'SELECT id_usuario,accion, ip_origen,descripcion,utimestamp
|
||||||
case 'mysql':
|
|
||||||
$sql = sprintf(
|
|
||||||
'SELECT id_usuario,accion, ip_origen,descripcion,utimestamp
|
|
||||||
FROM tsesion
|
FROM tsesion
|
||||||
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - '.SECONDS_1WEEK.")
|
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - '.SECONDS_1WEEK.")
|
||||||
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10",
|
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10",
|
||||||
$config['id_user']
|
$config['id_user']
|
||||||
);
|
);
|
||||||
break;
|
|
||||||
|
|
||||||
case 'postgresql':
|
|
||||||
$sql = sprintf(
|
|
||||||
"SELECT \"id_usuario\", accion, \"ip_origen\", descripcion, utimestamp
|
|
||||||
FROM tsesion
|
|
||||||
WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_1WEEK.")
|
|
||||||
AND \"id_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 10",
|
|
||||||
$config['id_user']
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'oracle':
|
|
||||||
$sql = sprintf(
|
|
||||||
"SELECT id_usuario, accion, ip_origen, descripcion, utimestamp
|
|
||||||
FROM tsesion
|
|
||||||
WHERE ((utimestamp > ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_1WEEK.")
|
|
||||||
AND id_usuario = '%s') AND rownum <= 10 ORDER BY utimestamp DESC",
|
|
||||||
$config['id_user']
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sessions = db_get_all_rows_sql($sql);
|
$sessions = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
|
@ -253,24 +306,17 @@ if (!empty($all_data)) {
|
||||||
|
|
||||||
foreach ($sessions as $session) {
|
foreach ($sessions as $session) {
|
||||||
$data = [];
|
$data = [];
|
||||||
|
$session_id_usuario = $session['id_usuario'];
|
||||||
|
$session_ip_origen = $session['ip_origen'];
|
||||||
|
|
||||||
switch ($config['dbtype']) {
|
|
||||||
case 'mysql':
|
|
||||||
case 'oracle':
|
|
||||||
$session_id_usuario = $session['id_usuario'];
|
|
||||||
$session_ip_origen = $session['ip_origen'];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'postgresql':
|
|
||||||
$session_id_usuario = $session['id_usuario'];
|
|
||||||
$session_ip_origen = $session['ip_origen'];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$data[0] = '<strong>'.$session_id_usuario.'</strong>';
|
$data[0] = '<strong>'.$session_id_usuario.'</strong>';
|
||||||
$data[1] = ui_print_session_action_icon($session['accion'], true).' '.$session['accion'];
|
$data[1] = ui_print_session_action_icon($session['accion'], true).' '.$session['accion'];
|
||||||
$data[2] = ui_print_help_tip(date($config['date_format'], $session['utimestamp']), true).human_time_comparation($session['utimestamp'], 'tiny');
|
$data[2] = ui_print_help_tip(
|
||||||
|
date($config['date_format'], $session['utimestamp']),
|
||||||
|
true
|
||||||
|
).human_time_comparation($session['utimestamp'], 'tiny');
|
||||||
$data[3] = $session_ip_origen;
|
$data[3] = $session_ip_origen;
|
||||||
$description = str_replace([',', ', '], ', ', $session['descripcion']);
|
$description = str_replace([',', ', '], ', ', $session['descripcion']);
|
||||||
if (strlen($description) > 100) {
|
if (strlen($description) > 100) {
|
||||||
|
@ -287,8 +333,7 @@ if (!empty($all_data)) {
|
||||||
unset($table);
|
unset($table);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
// activity
|
// END OF LAST ACTIVIYY.
|
||||||
// END OF LAST ACTIVIYY/////////////////////////////
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -375,12 +375,12 @@ if ($create_modules) {
|
||||||
$new_module_configuration_data .= "\nmodule_secname ".$snmp3_auth_user;
|
$new_module_configuration_data .= "\nmodule_secname ".$snmp3_auth_user;
|
||||||
$new_module_configuration_data .= "\nmodule_seclevel ".$snmp3_security_level;
|
$new_module_configuration_data .= "\nmodule_seclevel ".$snmp3_security_level;
|
||||||
|
|
||||||
if ($snmp3_security_level=='authNoPriv' || $snmp3_security_level=='authPriv') {
|
if ($snmp3_security_level == 'authNoPriv' || $snmp3_security_level == 'authPriv') {
|
||||||
$new_module_configuration_data .= "\nmodule_authpass ".$snmp3_auth_pass;
|
$new_module_configuration_data .= "\nmodule_authpass ".$snmp3_auth_pass;
|
||||||
$new_module_configuration_data .= "\nmodule_authproto ".$snmp3_auth_method;
|
$new_module_configuration_data .= "\nmodule_authproto ".$snmp3_auth_method;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($snmp3_security_level=='authPriv') {
|
if ($snmp3_security_level == 'authPriv') {
|
||||||
$new_module_configuration_data .= "\nmodule_privproto ".$snmp3_privacy_method;
|
$new_module_configuration_data .= "\nmodule_privproto ".$snmp3_privacy_method;
|
||||||
$new_module_configuration_data .= "\nmodule_privpass ".$snmp3_privacy_pass;
|
$new_module_configuration_data .= "\nmodule_privpass ".$snmp3_privacy_pass;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,15 +24,15 @@ $menu_godmode['class'] = 'godmode';
|
||||||
|
|
||||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||||
$sub = [];
|
$sub = [];
|
||||||
$sub['godmode/servers/discovery']['text'] = __('Discover');
|
$sub['godmode/servers/discovery']['text'] = __('Discovery');
|
||||||
$sub['godmode/servers/discovery']['id'] = 'Discover';
|
$sub['godmode/servers/discovery']['id'] = 'Discovery';
|
||||||
$sub['godmode/servers/discovery']['subsecs'] = ['godmode/servers/discovery'];
|
$sub['godmode/servers/discovery']['subsecs'] = ['godmode/servers/discovery'];
|
||||||
|
|
||||||
// Add to menu.
|
// Add to menu.
|
||||||
$menu_godmode['discover']['text'] = __('Discovery');
|
$menu_godmode['discovery']['text'] = __('Discovery');
|
||||||
$menu_godmode['discover']['sec2'] = 'godmode/servers/discovery';
|
$menu_godmode['discovery']['sec2'] = 'godmode/servers/discovery';
|
||||||
$menu_godmode['discover']['id'] = 'god-discovery';
|
$menu_godmode['discovery']['id'] = 'god-discovery';
|
||||||
$menu_godmode['discover']['sub'] = $sub;
|
$menu_godmode['discovery']['sub'] = $sub;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -225,15 +225,9 @@ if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, '
|
||||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||||
enterprise_hook('ha_cluster');
|
enterprise_hook('ha_cluster');
|
||||||
|
|
||||||
$sub['godmode/servers/manage_recontask']['text'] = __('Recon task');
|
|
||||||
$sub['godmode/servers/manage_recontask']['id'] = 'Recon task';
|
|
||||||
|
|
||||||
$sub['godmode/servers/plugin']['text'] = __('Plugins');
|
$sub['godmode/servers/plugin']['text'] = __('Plugins');
|
||||||
$sub['godmode/servers/plugin']['id'] = 'Plugins';
|
$sub['godmode/servers/plugin']['id'] = 'Plugins';
|
||||||
|
|
||||||
$sub['godmode/servers/recon_script']['text'] = __('Recon script');
|
|
||||||
$sub['godmode/servers/recon_script']['id'] = 'Recon script';
|
|
||||||
|
|
||||||
enterprise_hook('export_target_submenu');
|
enterprise_hook('export_target_submenu');
|
||||||
|
|
||||||
enterprise_hook('manage_satellite_submenu');
|
enterprise_hook('manage_satellite_submenu');
|
||||||
|
|
|
@ -450,6 +450,7 @@ switch ($action) {
|
||||||
case 'event_report_agent':
|
case 'event_report_agent':
|
||||||
case 'event_report_group':
|
case 'event_report_group':
|
||||||
$recursion = $item['recursion'];
|
$recursion = $item['recursion'];
|
||||||
|
$include_extended_events = $item['show_extended_events'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'event_report_module':
|
case 'event_report_module':
|
||||||
|
@ -471,6 +472,8 @@ switch ($action) {
|
||||||
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
|
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
|
||||||
|
|
||||||
$filter_search = $style['event_filter_search'];
|
$filter_search = $style['event_filter_search'];
|
||||||
|
|
||||||
|
$include_extended_events = $item['show_extended_events'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'general':
|
case 'general':
|
||||||
|
@ -1729,6 +1732,15 @@ $class = 'databox filters';
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr id="row_extended_events" style="" class="datos">
|
||||||
|
<td style="font-weight:bold;"><?php echo __('Include extended events'); ?></td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
html_print_checkbox('include_extended_events', true, $include_extended_events);
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr id="row_event_graphs" style="" class="datos">
|
<tr id="row_event_graphs" style="" class="datos">
|
||||||
<td style="font-weight:bold;"><?php echo __('Event graphs'); ?></td>
|
<td style="font-weight:bold;"><?php echo __('Event graphs'); ?></td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -3101,6 +3113,7 @@ function chooseType() {
|
||||||
$("#row_event_graph_by_user").hide();
|
$("#row_event_graph_by_user").hide();
|
||||||
$("#row_event_graph_by_criticity").hide();
|
$("#row_event_graph_by_criticity").hide();
|
||||||
$("#row_event_graph_by_validated").hide();
|
$("#row_event_graph_by_validated").hide();
|
||||||
|
$("#row_extended_events").hide();
|
||||||
$("#row_netflow_filter").hide();
|
$("#row_netflow_filter").hide();
|
||||||
$("#row_max_values").hide();
|
$("#row_max_values").hide();
|
||||||
$("#row_resolution").hide();
|
$("#row_resolution").hide();
|
||||||
|
@ -3144,6 +3157,7 @@ function chooseType() {
|
||||||
$("#row_event_graph_by_user").show();
|
$("#row_event_graph_by_user").show();
|
||||||
$("#row_event_graph_by_criticity").show();
|
$("#row_event_graph_by_criticity").show();
|
||||||
$("#row_event_graph_by_validated").show();
|
$("#row_event_graph_by_validated").show();
|
||||||
|
$("#row_extended_events").show();
|
||||||
|
|
||||||
$("#row_filter_search").show();
|
$("#row_filter_search").show();
|
||||||
$("#row_historical_db_check").hide();
|
$("#row_historical_db_check").hide();
|
||||||
|
@ -3444,6 +3458,7 @@ function chooseType() {
|
||||||
$("#row_event_graph_by_criticity").show();
|
$("#row_event_graph_by_criticity").show();
|
||||||
$("#row_event_graph_by_validated").show();
|
$("#row_event_graph_by_validated").show();
|
||||||
$("#row_event_type").show();
|
$("#row_event_type").show();
|
||||||
|
$("#row_extended_events").show();
|
||||||
|
|
||||||
$("#row_filter_search").show();
|
$("#row_filter_search").show();
|
||||||
$("#row_historical_db_check").hide();
|
$("#row_historical_db_check").hide();
|
||||||
|
@ -3459,7 +3474,8 @@ function chooseType() {
|
||||||
$("#row_show_summary_group").show();
|
$("#row_show_summary_group").show();
|
||||||
$("#row_event_graphs").show();
|
$("#row_event_graphs").show();
|
||||||
$("#row_event_type").show();
|
$("#row_event_type").show();
|
||||||
|
$("#row_extended_events").show();
|
||||||
|
$("#row_extended_events").show();
|
||||||
|
|
||||||
$("#row_event_graph_by_user").show();
|
$("#row_event_graph_by_user").show();
|
||||||
$("#row_event_graph_by_criticity").show();
|
$("#row_event_graph_by_criticity").show();
|
||||||
|
@ -3482,6 +3498,7 @@ function chooseType() {
|
||||||
$("#row_show_summary_group").show();
|
$("#row_show_summary_group").show();
|
||||||
$("#row_event_graphs").show();
|
$("#row_event_graphs").show();
|
||||||
$("#row_event_type").show();
|
$("#row_event_type").show();
|
||||||
|
$("#row_extended_events").show();
|
||||||
|
|
||||||
$("#row_event_graph_by_user").show();
|
$("#row_event_graph_by_user").show();
|
||||||
$("#row_event_graph_by_criticity").show();
|
$("#row_event_graph_by_criticity").show();
|
||||||
|
|
|
@ -1298,6 +1298,7 @@ switch ($action) {
|
||||||
$values['exception_condition_value'] = get_parameter('exception_condition_value');
|
$values['exception_condition_value'] = get_parameter('exception_condition_value');
|
||||||
$values['id_module_group'] = get_parameter('combo_modulegroup');
|
$values['id_module_group'] = get_parameter('combo_modulegroup');
|
||||||
$values['id_group'] = get_parameter('combo_group');
|
$values['id_group'] = get_parameter('combo_group');
|
||||||
|
$values['show_extended_events'] = get_parameter('include_extended_events');
|
||||||
$values['server_name'] = get_parameter('server_name');
|
$values['server_name'] = get_parameter('server_name');
|
||||||
$server_id = (int) get_parameter('server_id');
|
$server_id = (int) get_parameter('server_id');
|
||||||
if ($server_id != 0) {
|
if ($server_id != 0) {
|
||||||
|
@ -1689,6 +1690,7 @@ switch ($action) {
|
||||||
$values['exception_condition_value'] = get_parameter('exception_condition_value');
|
$values['exception_condition_value'] = get_parameter('exception_condition_value');
|
||||||
$values['id_module_group'] = get_parameter('combo_modulegroup');
|
$values['id_module_group'] = get_parameter('combo_modulegroup');
|
||||||
$values['id_group'] = get_parameter('combo_group');
|
$values['id_group'] = get_parameter('combo_group');
|
||||||
|
$values['show_extended_events'] = get_parameter('include_extended_events');
|
||||||
|
|
||||||
|
|
||||||
if ((($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) && ($values['id_gs'] == 0 || $values['id_gs'] == '')) {
|
if ((($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) && ($values['id_gs'] == 0 || $values['id_gs'] == '')) {
|
||||||
|
|
|
@ -15,9 +15,6 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
|
|
||||||
ui_require_css_file('discovery');
|
ui_require_css_file('discovery');
|
||||||
|
|
||||||
ui_print_page_header(__('Discover'), '', false, '', true);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mask class names.
|
* Mask class names.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Extension to manage a list of gateways and the node address where they should
|
* Deprectated.
|
||||||
* point to.
|
|
||||||
*
|
*
|
||||||
* @category Extensions
|
* @category Deprectated
|
||||||
* @package Pandora FMS
|
* @package Pandora FMS
|
||||||
* @subpackage Community
|
* @subpackage Recion task script
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @license See below
|
* @license See below
|
||||||
*
|
*
|
||||||
|
@ -26,481 +25,3 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
check_login();
|
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
|
||||||
db_pandora_audit(
|
|
||||||
'ACL Violation',
|
|
||||||
'Trying to access Recon Task Management'
|
|
||||||
);
|
|
||||||
include 'general/noaccess.php';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once $config['homedir'].'/include/functions_network_profiles.php';
|
|
||||||
|
|
||||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
|
||||||
$options[]['text'] = "<a href='index.php?sec=estado&sec2=operation/servers/recon_view'>".html_print_image('images/operation.png', true, ['title' => __('View')]).'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$user_groups_w = users_get_groups(false, 'PM', true, false, null, 'id_grupo');
|
|
||||||
$user_groups_w = array_keys($user_groups_w);
|
|
||||||
|
|
||||||
$user_groups_r = users_get_groups(false, 'AW', true, false, null, 'id_grupo');
|
|
||||||
$user_groups_r = array_keys($user_groups_r);
|
|
||||||
|
|
||||||
// Headers.
|
|
||||||
ui_print_page_header(
|
|
||||||
__('Manage recontask'),
|
|
||||||
'images/gm_servers.png',
|
|
||||||
false,
|
|
||||||
'',
|
|
||||||
true,
|
|
||||||
$options
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------
|
|
||||||
// DELETE A RECON TASKs.
|
|
||||||
// --------------------------------
|
|
||||||
if (isset($_GET['delete'])) {
|
|
||||||
$id = get_parameter_get('delete');
|
|
||||||
|
|
||||||
$result = db_process_sql_delete('trecon_task', ['id_rt' => $id]);
|
|
||||||
|
|
||||||
if ($result !== false) {
|
|
||||||
ui_print_success_message(__('Successfully deleted recon task'));
|
|
||||||
} else {
|
|
||||||
ui_print_error_message(__('Error deleting recon task'));
|
|
||||||
}
|
|
||||||
} else if (isset($_GET['disabled'])) {
|
|
||||||
$id = get_parameter_get('id');
|
|
||||||
$disabled = get_parameter_get('disabled');
|
|
||||||
|
|
||||||
$result = db_process_sql_update(
|
|
||||||
'trecon_task',
|
|
||||||
['disabled' => $disabled],
|
|
||||||
['id_rt' => $id]
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($result !== false) {
|
|
||||||
ui_print_success_message(__('Successfully updated recon task'));
|
|
||||||
// If the action is enabled, we force recon_task to be queued asap.
|
|
||||||
if ($disabled == 0) {
|
|
||||||
servers_force_recon_task($id);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ui_print_error_message(__('Error updating recon task'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------
|
|
||||||
// GET PARAMETERS IF UPDATE OR CREATE.
|
|
||||||
// --------------------------------
|
|
||||||
if ((isset($_GET['update'])) || ((isset($_GET['create'])))) {
|
|
||||||
$name = get_parameter_post('name');
|
|
||||||
$network = get_parameter_post('network');
|
|
||||||
$description = get_parameter_post('description');
|
|
||||||
$id_recon_server = get_parameter_post('id_recon_server');
|
|
||||||
$interval = get_parameter_post('interval');
|
|
||||||
$id_group = get_parameter_post('id_group');
|
|
||||||
$create_incident = get_parameter_post('create_incident');
|
|
||||||
$id_network_profile = get_parameter_post('id_network_profile');
|
|
||||||
$recon_ports = get_parameter_post('recon_ports', '');
|
|
||||||
$id_os = get_parameter_post('id_os', 10);
|
|
||||||
$snmp_community = get_parameter_post('snmp_community', 'public');
|
|
||||||
$id_recon_script = get_parameter('id_recon_script', 0);
|
|
||||||
$mode = get_parameter('mode', '');
|
|
||||||
$field1 = get_parameter('_field1_', '');
|
|
||||||
$field2 = get_parameter('_field2_', '');
|
|
||||||
$field3 = get_parameter('_field3_', '');
|
|
||||||
$field4 = get_parameter('_field4_', '');
|
|
||||||
$snmp_version = get_parameter_post('snmp_version');
|
|
||||||
$snmp3_auth_user = get_parameter_post('snmp_auth_user');
|
|
||||||
$snmp3_auth_pass = get_parameter_post('snmp_auth_pass');
|
|
||||||
$snmp3_privacy_method = get_parameter_post('snmp_privacy_method');
|
|
||||||
$snmp3_privacy_pass = get_parameter_post('snmp_privacy_pass');
|
|
||||||
$snmp3_auth_method = get_parameter_post('snmp_auth_method');
|
|
||||||
$snmp3_security_level = get_parameter_post('snmp_security_level');
|
|
||||||
|
|
||||||
|
|
||||||
if ($mode == 'network_sweep') {
|
|
||||||
$id_recon_script = 0;
|
|
||||||
} else {
|
|
||||||
$id_network_profile = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$os_detect = (int) get_parameter('os_detect', 0);
|
|
||||||
$resolve_names = (int) get_parameter('resolve_names', 0);
|
|
||||||
$parent_detection = (int) get_parameter('parent_detection', 0);
|
|
||||||
$parent_recursion = (int) get_parameter('parent_recursion', 1);
|
|
||||||
$alias_as_name = (int) get_parameter('alias_as_name', 0);
|
|
||||||
$snmp_enabled = (int) get_parameter('snmp_enabled', 0);
|
|
||||||
$vlan_enabled = (int) get_parameter('vlan_enabled', 0);
|
|
||||||
// Get macros.
|
|
||||||
$macros = (string) get_parameter('macros');
|
|
||||||
|
|
||||||
if (!empty($macros)) {
|
|
||||||
$macros = json_decode(base64_decode($macros), true);
|
|
||||||
|
|
||||||
if (isset($macros) === true && is_array($macros) === true) {
|
|
||||||
foreach ($macros as $k => $m) {
|
|
||||||
$macros[$k]['value'] = get_parameter($m['macro'], '');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$macros = io_json_mb_encode($macros);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------
|
|
||||||
// UPDATE A RECON TASK.
|
|
||||||
// --------------------------------
|
|
||||||
if (isset($_GET['update'])) {
|
|
||||||
$id = get_parameter_get('update');
|
|
||||||
|
|
||||||
$values = [
|
|
||||||
'snmp_community' => $snmp_community,
|
|
||||||
'id_os' => $id_os,
|
|
||||||
'name' => $name,
|
|
||||||
'subnet' => $network,
|
|
||||||
'description' => $description,
|
|
||||||
'id_recon_server' => $id_recon_server,
|
|
||||||
'create_incident' => $create_incident,
|
|
||||||
'id_group' => $id_group,
|
|
||||||
'interval_sweep' => $interval,
|
|
||||||
'id_network_profile' => $id_network_profile,
|
|
||||||
'recon_ports' => $recon_ports,
|
|
||||||
'id_recon_script' => $id_recon_script,
|
|
||||||
'field1' => $field1,
|
|
||||||
'field2' => $field2,
|
|
||||||
'field3' => $field3,
|
|
||||||
'field4' => $field4,
|
|
||||||
'os_detect' => $os_detect,
|
|
||||||
'resolve_names' => $resolve_names,
|
|
||||||
'parent_detection' => $parent_detection,
|
|
||||||
'parent_recursion' => $parent_recursion,
|
|
||||||
'macros' => $macros,
|
|
||||||
'alias_as_name' => $alias_as_name,
|
|
||||||
'snmp_enabled' => $snmp_enabled,
|
|
||||||
'vlan_enabled' => $vlan_enabled,
|
|
||||||
'snmp_version' => $snmp_version,
|
|
||||||
];
|
|
||||||
|
|
||||||
$values_v3 = [
|
|
||||||
'snmp_auth_user' => $snmp3_auth_user,
|
|
||||||
'snmp_auth_pass' => $snmp3_auth_pass,
|
|
||||||
'snmp_privacy_method' => $snmp3_privacy_method,
|
|
||||||
'snmp_privacy_pass' => $snmp3_privacy_pass,
|
|
||||||
'snmp_auth_method' => $snmp3_auth_method,
|
|
||||||
'snmp_security_level' => $snmp3_security_level,
|
|
||||||
];
|
|
||||||
if ($values['snmp_version'] == '1' || $values['snmp_version'] == '2' || $values['snmp_version'] == '2c') {
|
|
||||||
$values_v3 = [
|
|
||||||
'snmp_auth_user' => '',
|
|
||||||
'snmp_auth_pass' => '',
|
|
||||||
'snmp_privacy_method' => '',
|
|
||||||
'snmp_privacy_pass' => '',
|
|
||||||
'snmp_auth_method' => '',
|
|
||||||
'snmp_security_level' => '',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$values = array_merge($values, $values_v3);
|
|
||||||
|
|
||||||
$where = ['id_rt' => $id];
|
|
||||||
|
|
||||||
$reason = '';
|
|
||||||
if ($name != '') {
|
|
||||||
if (empty($id_recon_script)) {
|
|
||||||
if (!preg_match('/[0-9]+.+[0-9]+.+[0-9]+.+[0-9]+\/+[0-9]/', $network)) {
|
|
||||||
$reason = __('Wrong format in Subnet field');
|
|
||||||
$result = false;
|
|
||||||
} else {
|
|
||||||
$result = db_process_sql_update(
|
|
||||||
'trecon_task',
|
|
||||||
$values,
|
|
||||||
$where
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result = db_process_sql_update(
|
|
||||||
'trecon_task',
|
|
||||||
$values,
|
|
||||||
$where
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result !== false) {
|
|
||||||
ui_print_success_message(__('Successfully updated recon task'));
|
|
||||||
} else {
|
|
||||||
ui_print_error_message(__('Error updating recon task'));
|
|
||||||
echo $reason;
|
|
||||||
include 'manage_recontask_form.php';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------
|
|
||||||
// CREATE A RECON TASK
|
|
||||||
// --------------------------------
|
|
||||||
if (isset($_GET['create'])) {
|
|
||||||
$values = [
|
|
||||||
'name' => $name,
|
|
||||||
'subnet' => $network,
|
|
||||||
'description' => $description,
|
|
||||||
'id_recon_server' => $id_recon_server,
|
|
||||||
'create_incident' => $create_incident,
|
|
||||||
'id_group' => $id_group,
|
|
||||||
'id_network_profile' => $id_network_profile,
|
|
||||||
'interval_sweep' => $interval,
|
|
||||||
'id_os' => $id_os,
|
|
||||||
'recon_ports' => $recon_ports,
|
|
||||||
'snmp_community' => $snmp_community,
|
|
||||||
'id_recon_script' => $id_recon_script,
|
|
||||||
'field1' => $field1,
|
|
||||||
'field2' => $field2,
|
|
||||||
'field3' => $field3,
|
|
||||||
'field4' => $field4,
|
|
||||||
'os_detect' => $os_detect,
|
|
||||||
'resolve_names' => $resolve_names,
|
|
||||||
'parent_detection' => $parent_detection,
|
|
||||||
'parent_recursion' => $parent_recursion,
|
|
||||||
'macros' => $macros,
|
|
||||||
'alias_as_name' => $alias_as_name,
|
|
||||||
'snmp_enabled' => $snmp_enabled,
|
|
||||||
'vlan_enabled' => $vlan_enabled,
|
|
||||||
'snmp_version' => $snmp_version,
|
|
||||||
];
|
|
||||||
|
|
||||||
$values_v3 = [
|
|
||||||
'snmp_auth_user' => $snmp3_auth_user,
|
|
||||||
'snmp_auth_pass' => $snmp3_auth_pass,
|
|
||||||
'snmp_privacy_method' => $snmp3_privacy_method,
|
|
||||||
'snmp_privacy_pass' => $snmp3_privacy_pass,
|
|
||||||
'snmp_auth_method' => $snmp3_auth_method,
|
|
||||||
'snmp_security_level' => $snmp3_security_level,
|
|
||||||
];
|
|
||||||
if ($values['snmp_version'] == '1' || $values['snmp_version'] == '2' || $values['snmp_version'] == '2c') {
|
|
||||||
$values_v3 = [
|
|
||||||
'snmp_auth_user' => '',
|
|
||||||
'snmp_auth_pass' => '',
|
|
||||||
'snmp_privacy_method' => '',
|
|
||||||
'snmp_privacy_pass' => '',
|
|
||||||
'snmp_auth_method' => '',
|
|
||||||
'snmp_security_level' => '',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($values['snmp_version'] == '3') {
|
|
||||||
$values['vlan_enabled'] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$values = array_merge($values, $values_v3);
|
|
||||||
|
|
||||||
$name = io_safe_output($name);
|
|
||||||
$name = trim($name, ' ');
|
|
||||||
$name = io_safe_input($name);
|
|
||||||
$reason = '';
|
|
||||||
|
|
||||||
if ($name != '') {
|
|
||||||
$name_exists = (bool) db_get_value('name', 'trecon_task', 'name', $name);
|
|
||||||
|
|
||||||
if (empty($id_recon_script)) {
|
|
||||||
if ($name_exists && (!preg_match('/[0-9]+.+[0-9]+.+[0-9]+.+[0-9]+\/+[0-9]/', $network))) {
|
|
||||||
$reason = __('Recon-task name already exists and incorrect format in Subnet field');
|
|
||||||
$result = false;
|
|
||||||
} else if (!preg_match('/[0-9]+.+[0-9]+.+[0-9]+.+[0-9]+\/+[0-9]/', $network)) {
|
|
||||||
$reason = __('Wrong format in Subnet field');
|
|
||||||
$result = false;
|
|
||||||
} else if ($name_exists) {
|
|
||||||
$reason = __('Recon-task name already exists');
|
|
||||||
$result = false;
|
|
||||||
} else {
|
|
||||||
$result = db_process_sql_insert('trecon_task', $values);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ($name_exists) {
|
|
||||||
$reason = __('Recon-task name already exists');
|
|
||||||
$result = false;
|
|
||||||
} else {
|
|
||||||
$result = db_process_sql_insert('trecon_task', $values);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$reason = 'The field "Task name" is empty';
|
|
||||||
$result = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result !== false) {
|
|
||||||
ui_print_success_message(__('Successfully created recon task'));
|
|
||||||
} else {
|
|
||||||
ui_print_error_message(__('Error creating recon task'));
|
|
||||||
echo $reason;
|
|
||||||
include 'manage_recontask_form.php';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------
|
|
||||||
// SHOW TABLE WITH ALL RECON TASKs.
|
|
||||||
// --------------------------------
|
|
||||||
// Pandora Admin must see all columns.
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
|
||||||
$sql = sprintf(
|
|
||||||
'SELECT *
|
|
||||||
FROM trecon_task RT, tusuario_perfil UP
|
|
||||||
WHERE
|
|
||||||
UP.id_usuario = "%s" AND UP.id_grupo = RT.id_group',
|
|
||||||
$config['id_user']
|
|
||||||
);
|
|
||||||
|
|
||||||
$result = db_get_all_rows_sql($sql);
|
|
||||||
} else {
|
|
||||||
$result = db_get_all_rows_in_table('trecon_task');
|
|
||||||
}
|
|
||||||
|
|
||||||
$color = 1;
|
|
||||||
if ($result !== false) {
|
|
||||||
$table = new StdClass();
|
|
||||||
$table->head = [
|
|
||||||
__('Name'),
|
|
||||||
__('Network'),
|
|
||||||
__('Mode'),
|
|
||||||
__('Group'),
|
|
||||||
__('SNMP Version'),
|
|
||||||
__('Incident'),
|
|
||||||
__('OS'),
|
|
||||||
__('Interval'),
|
|
||||||
__('Ports'),
|
|
||||||
__('Action'),
|
|
||||||
];
|
|
||||||
$table->align = [
|
|
||||||
'left',
|
|
||||||
'left',
|
|
||||||
'left',
|
|
||||||
'left',
|
|
||||||
'left',
|
|
||||||
'left',
|
|
||||||
'left',
|
|
||||||
'left',
|
|
||||||
];
|
|
||||||
$table->width = '100%';
|
|
||||||
$table->cellpadding = 4;
|
|
||||||
$table->cellspacing = 4;
|
|
||||||
$table->class = 'databox data';
|
|
||||||
$table->data = [];
|
|
||||||
|
|
||||||
$table->style[8] = 'text-align: left;';
|
|
||||||
$table->size[8] = '15%';
|
|
||||||
|
|
||||||
foreach ($result as $row) {
|
|
||||||
if (in_array($row['id_group'], $user_groups_r)) {
|
|
||||||
$data = [];
|
|
||||||
$data[0] = $row['name'];
|
|
||||||
if ($row['id_recon_script'] == 0) {
|
|
||||||
$data[1] = $row['subnet'];
|
|
||||||
} else {
|
|
||||||
$data[1] = '-';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ($row['id_recon_script'] == 0) {
|
|
||||||
// Network recon task.
|
|
||||||
$data[2] = html_print_image('images/network.png', true, ['title' => __('Network recon task')]).' ';
|
|
||||||
$data[2] .= network_profiles_get_name($row['id_network_profile']);
|
|
||||||
$mode_name = '';
|
|
||||||
} else {
|
|
||||||
// APP recon task.
|
|
||||||
$data[2] = html_print_image('images/plugin.png', true).' ';
|
|
||||||
$mode_name = db_get_sql(sprintf('SELECT name FROM trecon_script WHERE id_recon_script = %d', $row['id_recon_script']));
|
|
||||||
$data[2] .= $mode_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// GROUP.
|
|
||||||
if ($row['id_recon_script'] == 0) {
|
|
||||||
$data[3] = ui_print_group_icon($row['id_group'], true);
|
|
||||||
} else {
|
|
||||||
$data[3] = '-';
|
|
||||||
}
|
|
||||||
|
|
||||||
// SNMP VERSION.
|
|
||||||
if ($row['snmp_version'] == '1') {
|
|
||||||
$data[4] = 'v. 1';
|
|
||||||
} else if ($row['snmp_version'] == '2') {
|
|
||||||
$data[4] = 'v. 2';
|
|
||||||
} else if ($row['snmp_version'] == '2c') {
|
|
||||||
$data[4] = 'v. 2c';
|
|
||||||
} else if ($row['snmp_version'] == '3') {
|
|
||||||
$data[4] = 'v. 3';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// INCIDENT.
|
|
||||||
$data[5] = (($row['create_incident'] == 1) ? __('Yes') : __('No'));
|
|
||||||
|
|
||||||
// OS.
|
|
||||||
if ($row['id_recon_script'] == 0) {
|
|
||||||
$data[6] = (($row['id_os'] > 0) ? ui_print_os_icon($row['id_os'], false, true) : __('Any'));
|
|
||||||
} else {
|
|
||||||
$data[6] = '-';
|
|
||||||
}
|
|
||||||
|
|
||||||
// INTERVAL.
|
|
||||||
if ($row['interval_sweep'] == 0) {
|
|
||||||
$data[7] = __('Manual');
|
|
||||||
} else {
|
|
||||||
$data[7] = human_time_description_raw($row['interval_sweep']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// PORTS.
|
|
||||||
if ($row['id_recon_script'] == 0) {
|
|
||||||
$data[8] = substr($row['recon_ports'], 0, 15);
|
|
||||||
} else {
|
|
||||||
$data[8] = '-';
|
|
||||||
}
|
|
||||||
|
|
||||||
// ACTION.
|
|
||||||
$task_group = $row['id_group'];
|
|
||||||
|
|
||||||
if (in_array($task_group, $user_groups_w)) {
|
|
||||||
$data[9] = '<a href="index.php?sec=estado&sec2=operation/servers/recon_view">'.html_print_image('images/eye.png', true).'</a>';
|
|
||||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&delete='.$row['id_rt'].'">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
|
|
||||||
if ($mode_name != 'IPAM Recon') {
|
|
||||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update='.$row['id_rt'].'">'.html_print_image('images/config.png', true).'</a>';
|
|
||||||
} else {
|
|
||||||
$sql_ipam = 'select id from tipam_network where id_recon_task ='.$row['id_rt'];
|
|
||||||
$id_recon_ipam = db_get_sql($sql_ipam);
|
|
||||||
$data[9] .= '<a href="index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id='.$id_recon_ipam.'">'.html_print_image('images/config.png', true).'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($row['disabled'] == 0) {
|
|
||||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row['id_rt'].'&disabled=1">'.html_print_image('images/lightbulb.png', true).'</a>';
|
|
||||||
} else {
|
|
||||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row['id_rt'].'&disabled=0">'.html_print_image('images/lightbulb_off.png', true).'</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->data[] = $data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
html_print_table($table);
|
|
||||||
unset($table);
|
|
||||||
} else {
|
|
||||||
echo '<div class="nf">'.__('There are no recon task configured').'</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: 99%;">';
|
|
||||||
echo '<form method="post" action="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&create">';
|
|
||||||
echo html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"', true);
|
|
||||||
echo '</form>';
|
|
||||||
echo '</div>';
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Extension to manage a list of gateways and the node address where they should
|
* Deprectated.
|
||||||
* point to.
|
|
||||||
*
|
*
|
||||||
* @category Extensions
|
* @category deprecated
|
||||||
* @package Pandora FMS
|
* @package Pandora FMS
|
||||||
* @subpackage Community
|
* @subpackage recon task
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @license See below
|
* @license See below
|
||||||
*
|
*
|
||||||
|
@ -26,910 +25,3 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
check_login();
|
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
|
||||||
db_pandora_audit(
|
|
||||||
'ACL Violation',
|
|
||||||
'Trying to access Agent Management'
|
|
||||||
);
|
|
||||||
include 'general/noaccess.php';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once $config['homedir'].'/include/functions_users.php';
|
|
||||||
|
|
||||||
$user_groups = users_get_groups(false, 'AW', true, false, null, 'id_grupo');
|
|
||||||
$user_groups = array_keys($user_groups);
|
|
||||||
|
|
||||||
if (is_ajax()) {
|
|
||||||
$get_explanation = (bool) get_parameter('get_explanation', 0);
|
|
||||||
|
|
||||||
if ($get_explanation) {
|
|
||||||
$id = (int) get_parameter('id', 0);
|
|
||||||
|
|
||||||
$explanation = db_get_value(
|
|
||||||
'description',
|
|
||||||
'trecon_script',
|
|
||||||
'id_recon_script',
|
|
||||||
$id
|
|
||||||
);
|
|
||||||
|
|
||||||
echo io_safe_output($explanation);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$get_recon_script_macros = get_parameter('get_recon_script_macros');
|
|
||||||
if ($get_recon_script_macros) {
|
|
||||||
$id_recon_script = (int) get_parameter('id');
|
|
||||||
$id_recon_task = (int) get_parameter('id_rt');
|
|
||||||
|
|
||||||
if (!empty($id_recon_task) && empty($id_recon_script)) {
|
|
||||||
$recon_script_macros = db_get_value(
|
|
||||||
'macros',
|
|
||||||
'trecon_task',
|
|
||||||
'id_rt',
|
|
||||||
$id_recon_task
|
|
||||||
);
|
|
||||||
} else if (!empty($id_recon_task)) {
|
|
||||||
$recon_task_id_rs = (int) db_get_value(
|
|
||||||
'id_recon_script',
|
|
||||||
'trecon_task',
|
|
||||||
'id_rt',
|
|
||||||
$id_recon_task
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($id_recon_script == $recon_task_id_rs) {
|
|
||||||
$recon_script_macros = db_get_value(
|
|
||||||
'macros',
|
|
||||||
'trecon_task',
|
|
||||||
'id_rt',
|
|
||||||
$id_recon_task
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$recon_script_macros = db_get_value(
|
|
||||||
'macros',
|
|
||||||
'trecon_script',
|
|
||||||
'id_recon_script',
|
|
||||||
$id_recon_script
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else if (!empty($id_recon_script)) {
|
|
||||||
$recon_script_macros = db_get_value(
|
|
||||||
'macros',
|
|
||||||
'trecon_script',
|
|
||||||
'id_recon_script',
|
|
||||||
$id_recon_script
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$recon_script_macros = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$macros = [];
|
|
||||||
$macros['base64'] = base64_encode($recon_script_macros);
|
|
||||||
$macros['array'] = json_decode($recon_script_macros, true);
|
|
||||||
|
|
||||||
echo io_json_mb_encode($macros);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Edit mode.
|
|
||||||
if (isset($_GET['update']) || (isset($_GET['upd']))) {
|
|
||||||
$update_recon = true;
|
|
||||||
if (isset($_GET['upd'])) {
|
|
||||||
if ($_GET['upd'] != 'update') {
|
|
||||||
$update_recon = false;
|
|
||||||
} else {
|
|
||||||
$id_rt = get_parameter('upd');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($update_recon) {
|
|
||||||
if (!isset($id_rt)) {
|
|
||||||
$id_rt = (int) get_parameter_get('update');
|
|
||||||
}
|
|
||||||
|
|
||||||
$row = db_get_row('trecon_task', 'id_rt', $id_rt);
|
|
||||||
$name = $row['name'];
|
|
||||||
$network = $row['subnet'];
|
|
||||||
$id_recon_server = $row['id_recon_server'];
|
|
||||||
$description = $row['description'];
|
|
||||||
$interval = $row['interval_sweep'];
|
|
||||||
$id_group = $row['id_group'];
|
|
||||||
$create_incident = $row['create_incident'];
|
|
||||||
$id_network_profile = $row['id_network_profile'];
|
|
||||||
$id_os = $row['id_os'];
|
|
||||||
$recon_ports = $row['recon_ports'];
|
|
||||||
$snmp_community = $row['snmp_community'];
|
|
||||||
$snmp_version = $row['snmp_version'];
|
|
||||||
$snmp3_auth_user = $row['snmp_auth_user'];
|
|
||||||
$snmp3_auth_pass = $row['snmp_auth_pass'];
|
|
||||||
$snmp3_privacy_method = $row['snmp_privacy_method'];
|
|
||||||
$snmp3_privacy_pass = $row['snmp_privacy_pass'];
|
|
||||||
$snmp3_auth_method = $row['snmp_auth_method'];
|
|
||||||
$snmp3_security_level = $row['snmp_security_level'];
|
|
||||||
$id_recon_script = $row['id_recon_script'];
|
|
||||||
$field1 = $row['field1'];
|
|
||||||
$field2 = $row['field2'];
|
|
||||||
$field3 = $row['field3'];
|
|
||||||
$field4 = $row['field4'];
|
|
||||||
if ($id_recon_script == 0) {
|
|
||||||
$mode = 'network_sweep';
|
|
||||||
} else {
|
|
||||||
$mode = 'recon_script';
|
|
||||||
}
|
|
||||||
|
|
||||||
$os_detect = $row['os_detect'];
|
|
||||||
$resolve_names = $row['resolve_names'];
|
|
||||||
$os_detect = $row['os_detect'];
|
|
||||||
$parent_detection = $row['parent_detection'];
|
|
||||||
$parent_recursion = $row['parent_recursion'];
|
|
||||||
$macros = $row['macros'];
|
|
||||||
$alias_as_name = $row['alias_as_name'];
|
|
||||||
$snmp_enabled = $row['snmp_enabled'];
|
|
||||||
$vlan_enabled = $row['vlan_enabled'];
|
|
||||||
|
|
||||||
$name_script = db_get_value(
|
|
||||||
'name',
|
|
||||||
'trecon_script',
|
|
||||||
'id_recon_script',
|
|
||||||
$id_recon_script
|
|
||||||
);
|
|
||||||
|
|
||||||
if (! in_array($id_group, $user_groups)) {
|
|
||||||
db_pandora_audit(
|
|
||||||
'ACL Violation',
|
|
||||||
'Trying to access Recon Task Management'
|
|
||||||
);
|
|
||||||
include 'general/noaccess.php';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (isset($_GET['create']) || isset($_GET['crt'])) {
|
|
||||||
$create_recon = true;
|
|
||||||
if (isset($_GET['crt'])) {
|
|
||||||
if ($_GET['crt'] != 'Create') {
|
|
||||||
$create_recon = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($create_recon) {
|
|
||||||
$id_rt = -1;
|
|
||||||
$name = get_parameter('name');
|
|
||||||
$network = get_parameter('network');
|
|
||||||
$description = get_parameter('description');
|
|
||||||
$id_recon_server = 0;
|
|
||||||
$interval = 0;
|
|
||||||
$id_group = 0;
|
|
||||||
$create_incident = 1;
|
|
||||||
$snmp_community = 'public';
|
|
||||||
$snmp3_auth_user = '';
|
|
||||||
$snmp3_auth_pass = '';
|
|
||||||
$snmp_version = 1;
|
|
||||||
$snmp3_privacy_method = '';
|
|
||||||
$snmp3_privacy_pass = '';
|
|
||||||
$snmp3_auth_method = '';
|
|
||||||
$snmp3_security_level = '';
|
|
||||||
$id_network_profile = 0;
|
|
||||||
$id_os = -1;
|
|
||||||
$recon_ports = '';
|
|
||||||
$field1 = '';
|
|
||||||
$field2 = '';
|
|
||||||
$field3 = '';
|
|
||||||
$field4 = '';
|
|
||||||
$id_recon_script = 0;
|
|
||||||
$mode = 'network_sweep';
|
|
||||||
$os_detect = 0;
|
|
||||||
$resolve_names = 0;
|
|
||||||
$parent_detection = 1;
|
|
||||||
$parent_recursion = 5;
|
|
||||||
$macros = '';
|
|
||||||
$alias_as_name = 0;
|
|
||||||
$snmp_enabled = 0;
|
|
||||||
$vlan_enabled = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$modify = false;
|
|
||||||
if (($name != '') || ($network != '')) {
|
|
||||||
$modify = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$modify) {
|
|
||||||
// Headers.
|
|
||||||
ui_print_page_header(__('Manage recontask'), '', false, 'recontask', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
|
|
||||||
if ($is_windows) {
|
|
||||||
echo '<div class="notify">';
|
|
||||||
echo __('Warning').': '.__('By default, in Windows, %s only support Standard network sweep, not custom scripts', get_product_name());
|
|
||||||
echo '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$table = new stdClass();
|
|
||||||
$table->id = 'table_recon';
|
|
||||||
$table->width = '100%';
|
|
||||||
$table->cellspacing = 4;
|
|
||||||
$table->cellpadding = 4;
|
|
||||||
$table->class = 'databox filters';
|
|
||||||
|
|
||||||
$table->rowclass[3] = 'network_sweep';
|
|
||||||
$table->rowclass[5] = 'network_sweep';
|
|
||||||
$table->rowclass[7] = 'network_sweep';
|
|
||||||
$table->rowclass[8] = 'network_sweep';
|
|
||||||
$table->rowclass[11] = 'network_sweep';
|
|
||||||
$table->rowclass[12] = 'network_sweep';
|
|
||||||
$table->rowclass[18] = 'network_sweep';
|
|
||||||
$table->rowclass[19] = 'network_sweep';
|
|
||||||
$table->rowclass[20] = 'network_sweep';
|
|
||||||
$table->rowclass[21] = 'network_sweep';
|
|
||||||
$table->rowclass[22] = 'network_sweep';
|
|
||||||
$table->rowclass[23] = 'network_sweep';
|
|
||||||
$table->rowclass[24] = 'network_sweep';
|
|
||||||
$table->rowclass[25] = 'network_sweep recon_v3';
|
|
||||||
$table->rowclass[26] = 'network_sweep recon_v3';
|
|
||||||
$table->rowclass[27] = 'network_sweep recon_v3';
|
|
||||||
$table->rowclass[28] = 'network_sweep recon_v3';
|
|
||||||
$table->rowclass[29] = 'network_sweep recon_v3';
|
|
||||||
$table->rowclass[30] = 'network_sweep recon_v3';
|
|
||||||
|
|
||||||
$table->rowclass[6] = 'recon_script';
|
|
||||||
$table->rowclass[13] = 'recon_script';
|
|
||||||
$table->rowclass[14] = 'recon_script';
|
|
||||||
$table->rowclass[15] = 'recon_script';
|
|
||||||
$table->rowclass[16] = 'recon_script';
|
|
||||||
$table->rowclass[17] = 'recon_script';
|
|
||||||
// Name.
|
|
||||||
$table->data[0][0] = '<b>'.__('Task name').'</b>';
|
|
||||||
$table->data[0][1] = html_print_input_text('name', $name, '', 25, 0, true);
|
|
||||||
|
|
||||||
// Discovery server.
|
|
||||||
$table->data[1][0] = '<b>'.__('Discovery server').ui_print_help_tip(
|
|
||||||
__('You must select a Discovery Server to run the Task, otherwise the Recon Task will never run'),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
$sql = 'SELECT id_server, name
|
|
||||||
FROM tserver
|
|
||||||
WHERE server_type = 3
|
|
||||||
ORDER BY name';
|
|
||||||
$table->data[1][1] = html_print_select_from_sql(
|
|
||||||
$sql,
|
|
||||||
'id_recon_server',
|
|
||||||
$id_recon_server,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
$fields['network_sweep'] = __('Network sweep');
|
|
||||||
if (!$is_windows) {
|
|
||||||
$fields['recon_script'] = __('Custom script');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$table->data[2][0] = '<b>'.__('Mode').'</b>';
|
|
||||||
$table->data[2][1] = html_print_select(
|
|
||||||
$fields,
|
|
||||||
'mode',
|
|
||||||
$mode,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
0,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Network.
|
|
||||||
$table->data[3][0] = '<b>'.__('Network').'</b>';
|
|
||||||
$table->data[3][0] .= ui_print_help_tip(
|
|
||||||
__('You can specify several networks, separated by commas, for example: 192.168.50.0/24,192.168.60.0/24'),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
$table->data[3][1] = html_print_input_text(
|
|
||||||
'network',
|
|
||||||
$network,
|
|
||||||
'',
|
|
||||||
25,
|
|
||||||
0,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// Interval.
|
|
||||||
$interv_manual = 0;
|
|
||||||
if ((int) $interval == 0) {
|
|
||||||
$interv_manual = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->data[4][0] = '<b>'.__('Interval');
|
|
||||||
$table->data[4][0] .= ui_print_help_tip(
|
|
||||||
__('Manual interval means that it will be executed only On-demand'),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
$values = [
|
|
||||||
0 => __('Defined'),
|
|
||||||
1 => __('Manual'),
|
|
||||||
];
|
|
||||||
$table->data[4][1] = html_print_select(
|
|
||||||
$values,
|
|
||||||
'interval_manual_defined',
|
|
||||||
$interv_manual,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
$table->data[4][1] .= '<span id="interval_manual_container">';
|
|
||||||
$table->data[4][1] .= html_print_extended_select_for_time(
|
|
||||||
'interval',
|
|
||||||
$interval,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
'0',
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
$table->data[4][1] .= ui_print_help_tip(
|
|
||||||
__('The minimum recomended interval for Recon Task is 5 minutes'),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
$table->data[4][1] .= '</span>';
|
|
||||||
|
|
||||||
|
|
||||||
// Module template.
|
|
||||||
$table->data[5][0] = '<b>'.__('Module template').'</b>';
|
|
||||||
|
|
||||||
$sql = 'SELECT id_np, name
|
|
||||||
FROM tnetwork_profile
|
|
||||||
ORDER BY name';
|
|
||||||
$table->data[5][1] = html_print_select_from_sql(
|
|
||||||
$sql,
|
|
||||||
'id_network_profile',
|
|
||||||
$id_network_profile,
|
|
||||||
'',
|
|
||||||
__('None'),
|
|
||||||
0,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// Recon script.
|
|
||||||
$data[1] = '';
|
|
||||||
$table->data[6][0] = '<b>'.__('Recon script').'</b>';
|
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT id_recon_script, name
|
|
||||||
FROM trecon_script
|
|
||||||
WHERE name <> 'IPAM Recon'
|
|
||||||
ORDER BY name";
|
|
||||||
if ($name_script != 'IPAM Recon') {
|
|
||||||
$table->data[6][1] = html_print_select_from_sql(
|
|
||||||
$sql,
|
|
||||||
'id_recon_script',
|
|
||||||
$id_recon_script,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
true
|
|
||||||
);
|
|
||||||
$table->data[6][1] .= "<span id='spinner_recon_script' style='display: none;'>".html_print_image('images/spinner.gif', true).'</span>';
|
|
||||||
$table->data[6][1] .= $data[1] .= html_print_input_hidden(
|
|
||||||
'macros',
|
|
||||||
base64_encode($macros),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$table->data[6][1] = 'IPAM Recon';
|
|
||||||
}
|
|
||||||
|
|
||||||
// OS.
|
|
||||||
$table->data[7][0] = '<b>'.__('OS').'</b>';
|
|
||||||
|
|
||||||
$sql = 'SELECT id_os, name
|
|
||||||
FROM tconfig_os
|
|
||||||
ORDER BY name';
|
|
||||||
$table->data[7][1] = html_print_select_from_sql(
|
|
||||||
$sql,
|
|
||||||
'id_os',
|
|
||||||
$id_os,
|
|
||||||
'',
|
|
||||||
__('Any'),
|
|
||||||
-1,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// Recon ports.
|
|
||||||
$table->data[8][0] = '<b>'.__('Ports').'</b>';
|
|
||||||
$table->data[8][1] = html_print_input_text(
|
|
||||||
'recon_ports',
|
|
||||||
$recon_ports,
|
|
||||||
'',
|
|
||||||
25,
|
|
||||||
0,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
$table->data[8][1] .= ui_print_help_tip(
|
|
||||||
__('Ports defined like: 80 or 80,443,512 or even 0-1024 (Like Nmap command line format). If dont want to do a sweep using portscan, left it in blank'),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// Group.
|
|
||||||
$table->data[9][0] = '<b>'.__('Group');
|
|
||||||
$groups = users_get_groups(false, 'PM', false);
|
|
||||||
$table->data[9][1] = html_print_select_groups(
|
|
||||||
false,
|
|
||||||
'PM',
|
|
||||||
false,
|
|
||||||
'id_group',
|
|
||||||
$id_group,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
0,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// Incident.
|
|
||||||
$values = [
|
|
||||||
0 => __('No'),
|
|
||||||
1 => __('Yes'),
|
|
||||||
];
|
|
||||||
$table->data[10][0] = '<b>'.__('Incident');
|
|
||||||
$table->data[10][1] = html_print_select(
|
|
||||||
$values,
|
|
||||||
'create_incident',
|
|
||||||
$create_incident,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
true
|
|
||||||
).' '.ui_print_help_tip(
|
|
||||||
__('Choose if the discovery of a new system creates an incident or not.'),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// Snmp_enabled.
|
|
||||||
$table->data[11][0] = '<b>'.__('SNMP enabled');
|
|
||||||
$table->data[11][1] = html_print_checkbox(
|
|
||||||
'snmp_enabled',
|
|
||||||
1,
|
|
||||||
$snmp_enabled,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// SNMP default community.
|
|
||||||
$table->data[12][0] = '<b>'.__('SNMP Default community');
|
|
||||||
$table->data[12][0] .= ui_print_help_tip(
|
|
||||||
__('You can specify several values, separated by commas, for example: public,mysecret,1234'),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
$table->data[12][1] = html_print_input_text(
|
|
||||||
'snmp_community',
|
|
||||||
$snmp_community,
|
|
||||||
'',
|
|
||||||
35,
|
|
||||||
0,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// SNMP version.
|
|
||||||
$snmp_versions['1'] = 'v. 1';
|
|
||||||
$snmp_versions['2'] = 'v. 2';
|
|
||||||
$snmp_versions['2c'] = 'v. 2c';
|
|
||||||
$snmp_versions['3'] = 'v. 3';
|
|
||||||
$table->data[24][0] = '<b>'._('SNMP version');
|
|
||||||
$table->data[24][1] = html_print_select(
|
|
||||||
$snmp_versions,
|
|
||||||
'snmp_version',
|
|
||||||
$snmp_version,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
0,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
$table->data[25][0] = '<b>'.__('Auth user');
|
|
||||||
$table->data[25][1] = html_print_input_text(
|
|
||||||
'snmp_auth_user',
|
|
||||||
$snmp3_auth_user,
|
|
||||||
'',
|
|
||||||
15,
|
|
||||||
60,
|
|
||||||
true,
|
|
||||||
'',
|
|
||||||
false,
|
|
||||||
'',
|
|
||||||
''
|
|
||||||
);
|
|
||||||
$table->data[26][0] = '<b>'.__('Auth password').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
|
||||||
$table->data[26][1] = html_print_input_password(
|
|
||||||
'snmp_auth_pass',
|
|
||||||
$snmp3_auth_pass,
|
|
||||||
'',
|
|
||||||
15,
|
|
||||||
60,
|
|
||||||
true,
|
|
||||||
'',
|
|
||||||
false,
|
|
||||||
''
|
|
||||||
);
|
|
||||||
$table->data[26][1] .= html_print_input_hidden_extended(
|
|
||||||
'active_snmp_v3',
|
|
||||||
0,
|
|
||||||
'active_snmp_v3_mmen',
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
$table->data[27][0] = '<b>'.__('Privacy method');
|
|
||||||
$table->data[27][1] = html_print_select(
|
|
||||||
[
|
|
||||||
'DES' => __('DES'),
|
|
||||||
'AES' => __('AES'),
|
|
||||||
],
|
|
||||||
'snmp_privacy_method',
|
|
||||||
$snmp3_privacy_method,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
'',
|
|
||||||
''
|
|
||||||
);
|
|
||||||
$table->data[28][0] = '<b>'.__('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
|
||||||
$table->data[28][1] = html_print_input_password(
|
|
||||||
'snmp_privacy_pass',
|
|
||||||
$snmp3_privacy_pass,
|
|
||||||
'',
|
|
||||||
15,
|
|
||||||
60,
|
|
||||||
true,
|
|
||||||
'',
|
|
||||||
false,
|
|
||||||
''
|
|
||||||
);
|
|
||||||
$table->data[29][0] = '<b>'.__('Auth method');
|
|
||||||
$table->data[29][1] = html_print_select(
|
|
||||||
[
|
|
||||||
'MD5' => __('MD5'),
|
|
||||||
'SHA' => __('SHA'),
|
|
||||||
],
|
|
||||||
'snmp_auth_method',
|
|
||||||
$snmp3_auth_method,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
'',
|
|
||||||
''
|
|
||||||
);
|
|
||||||
$table->data[30][0] = '<b>'.__('Security level');
|
|
||||||
$table->data[30][1] = html_print_select(
|
|
||||||
[
|
|
||||||
'noAuthNoPriv' => __('Not auth and not privacy method'),
|
|
||||||
'authNoPriv' => __('Auth and not privacy method'),
|
|
||||||
'authPriv' => __('Auth and privacy method'),
|
|
||||||
],
|
|
||||||
'snmp_security_level',
|
|
||||||
$snmp3_security_level,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
'',
|
|
||||||
''
|
|
||||||
);
|
|
||||||
|
|
||||||
// Explanation.
|
|
||||||
$explanation = db_get_value(
|
|
||||||
'description',
|
|
||||||
'trecon_script',
|
|
||||||
'id_recon_script',
|
|
||||||
$id_recon_script
|
|
||||||
);
|
|
||||||
|
|
||||||
$table->data[13][0] = '<b>'.__('Explanation').'</b>';
|
|
||||||
$table->data[13][1] = "<span id='spinner_layout' style='display: none;'>".html_print_image('images/spinner.gif', true).'</span>'.html_print_textarea('explanation', 4, 60, $explanation, 'style="width: 388px;"', true);
|
|
||||||
|
|
||||||
// A hidden "model row" to clone it from javascript to add fields dynamicaly.
|
|
||||||
$data = [];
|
|
||||||
$data[0] = 'macro_desc';
|
|
||||||
$data[0] .= ui_print_help_tip('macro_help', true);
|
|
||||||
$data[1] = html_print_input_text(
|
|
||||||
'macro_name',
|
|
||||||
'macro_value',
|
|
||||||
'',
|
|
||||||
100,
|
|
||||||
255,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
$table->colspan['macro_field'][1] = 3;
|
|
||||||
$table->rowstyle['macro_field'] = 'display:none';
|
|
||||||
$table->data['macro_field'] = $data;
|
|
||||||
|
|
||||||
// If there are $macros, we create the form fields.
|
|
||||||
if (!empty($macros)) {
|
|
||||||
$macros = json_decode($macros, true);
|
|
||||||
|
|
||||||
if (isset($macros) === true
|
|
||||||
&& is_array($macros) === true
|
|
||||||
) {
|
|
||||||
foreach ($macros as $k => $m) {
|
|
||||||
$data = [];
|
|
||||||
$data[0] = '<b>'.$m['desc'].'</b>';
|
|
||||||
if (!empty($m['help'])) {
|
|
||||||
$data[0] .= ui_print_help_tip($m['help'], true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($m['hide']) {
|
|
||||||
$data[1] = html_print_input_password(
|
|
||||||
$m['macro'],
|
|
||||||
$m['value'],
|
|
||||||
'',
|
|
||||||
100,
|
|
||||||
255,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$data[1] = html_print_input_text(
|
|
||||||
$m['macro'],
|
|
||||||
$m['value'],
|
|
||||||
'',
|
|
||||||
100,
|
|
||||||
255,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->colspan['macro'.$m['macro']][1] = 3;
|
|
||||||
$table->rowclass['macro'.$m['macro']] = 'macro_field';
|
|
||||||
|
|
||||||
$table->data['macro'.$m['macro']] = $data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Comments.
|
|
||||||
$table->data[18][0] = '<b>'.__('Comments');
|
|
||||||
$table->data[18][1] = html_print_input_text(
|
|
||||||
'description',
|
|
||||||
$description,
|
|
||||||
'',
|
|
||||||
45,
|
|
||||||
0,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// OS detection.
|
|
||||||
$table->data[19][0] = '<b>'.__('OS detection');
|
|
||||||
$table->data[19][1] = html_print_checkbox(
|
|
||||||
'os_detect',
|
|
||||||
1,
|
|
||||||
$os_detect,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// Name resolution.
|
|
||||||
$table->data[20][0] = '<b>'.__('Name resolution');
|
|
||||||
$table->data[20][1] = html_print_checkbox(
|
|
||||||
'resolve_names',
|
|
||||||
1,
|
|
||||||
$resolve_names,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// Parent detection.
|
|
||||||
$table->data[21][0] = '<b>'.__('Parent detection');
|
|
||||||
$table->data[21][1] = html_print_checkbox(
|
|
||||||
'parent_detection',
|
|
||||||
1,
|
|
||||||
$parent_detection,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// Parent recursion.
|
|
||||||
$table->data[22][0] = '<b>'.__('Parent recursion');
|
|
||||||
$table->data[22][1] = html_print_input_text(
|
|
||||||
'parent_recursion',
|
|
||||||
$parent_recursion,
|
|
||||||
'',
|
|
||||||
5,
|
|
||||||
0,
|
|
||||||
true
|
|
||||||
).ui_print_help_tip(
|
|
||||||
__('Maximum number of parent hosts that will be created if parent detection is enabled.'),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// Vlan_enabled.
|
|
||||||
$table->data[23][0] = '<b>'.__('Vlan enabled');
|
|
||||||
$table->data[23][1] = html_print_checkbox(
|
|
||||||
'vlan_enabled',
|
|
||||||
1,
|
|
||||||
$vlan_enabled,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// NOTE: The 7.0NG Recon Server will not generate random names, since IP
|
|
||||||
// address collisions could have other consequences.
|
|
||||||
// Different Form url if it's a create or if it's a update form.
|
|
||||||
echo '<form name="modulo" method="post" action="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&'.(($id_rt != -1) ? 'update='.$id_rt : 'create=1').'">';
|
|
||||||
html_print_table($table);
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
|
||||||
|
|
||||||
if ($id_rt != -1) {
|
|
||||||
if ($name_script != 'IPAM Recon') {
|
|
||||||
html_print_submit_button(__('Update'), 'crt', false, 'class="sub upd"');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
html_print_submit_button(__('Add'), 'crt', false, 'class="sub wand"');
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
echo '</form>';
|
|
||||||
|
|
||||||
ui_require_javascript_file('pandora_modules');
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
/* <![CDATA[ */
|
|
||||||
$(document).ready (function () {
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
var xhrManager = function () {
|
|
||||||
var manager = {};
|
|
||||||
|
|
||||||
manager.tasks = [];
|
|
||||||
|
|
||||||
manager.addTask = function (xhr) {
|
|
||||||
manager.tasks.push(xhr);
|
|
||||||
}
|
|
||||||
|
|
||||||
manager.stopTasks = function () {
|
|
||||||
while (manager.tasks.length > 0)
|
|
||||||
manager.tasks.pop().abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
return manager;
|
|
||||||
};
|
|
||||||
|
|
||||||
var taskManager = new xhrManager();
|
|
||||||
|
|
||||||
$('select#interval_manual_defined').change(function() {
|
|
||||||
if ($("#interval_manual_defined").val() == 1) {
|
|
||||||
$('#interval_manual_container').hide();
|
|
||||||
$('#text-interval_text').val(0);
|
|
||||||
$('#hidden-interval').val(0);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$('#interval_manual_container').show();
|
|
||||||
$('#text-interval_text').val(10);
|
|
||||||
$('#hidden-interval').val(600);
|
|
||||||
$('#interval_units').val(60);
|
|
||||||
}
|
|
||||||
}).change();
|
|
||||||
|
|
||||||
$('select#id_recon_script').change(function() {
|
|
||||||
if ($('select#mode').val() == 'recon_script')
|
|
||||||
get_explanation_recon_script($(this).val());
|
|
||||||
});
|
|
||||||
|
|
||||||
$('select#snmp_version').change(function () {
|
|
||||||
if (this.value == "3") {
|
|
||||||
$(".recon_v3").show();
|
|
||||||
$("input[name=active_snmp_v3]").val(1);
|
|
||||||
$("input[name=snmp_community]").attr("disabled", true);
|
|
||||||
$("input[name=vlan_enabled]").removeAttr("checked");
|
|
||||||
$("input[name=vlan_enabled]").attr("disabled", true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$(".recon_v3").hide();
|
|
||||||
$("input[name=active_snmp_v3]").val(0);
|
|
||||||
$("input[name=snmp_community]").removeAttr('disabled');
|
|
||||||
$("input[name=vlan_enabled]").removeAttr('disabled');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('select#mode').change(function() {
|
|
||||||
var type = $(this).val();
|
|
||||||
if (type == 'recon_script') {
|
|
||||||
$(".recon_script").show();
|
|
||||||
$(".network_sweep").hide();
|
|
||||||
|
|
||||||
get_explanation_recon_script($("#id_recon_script").val());
|
|
||||||
}
|
|
||||||
else if (type == 'network_sweep') {
|
|
||||||
$(".recon_script").hide();
|
|
||||||
$(".network_sweep").show();
|
|
||||||
$('.macro_field').remove();
|
|
||||||
$('select#snmp_version').trigger('change');
|
|
||||||
}
|
|
||||||
}).change();
|
|
||||||
|
|
||||||
function get_explanation_recon_script (id) {
|
|
||||||
// Stop old ajax tasks.
|
|
||||||
taskManager.stopTasks();
|
|
||||||
|
|
||||||
// Show the spinners.
|
|
||||||
$("#textarea_explanation").hide();
|
|
||||||
$("#spinner_layout").show();
|
|
||||||
|
|
||||||
var xhr = jQuery.ajax ({
|
|
||||||
data: {
|
|
||||||
'page': 'godmode/servers/manage_recontask_form',
|
|
||||||
'get_explanation': 1,
|
|
||||||
'id': id,
|
|
||||||
'id_rt': <?php echo json_encode((int) $id_rt); ?>
|
|
||||||
},
|
|
||||||
url: "<?php echo $config['homeurl']; ?>ajax.php",
|
|
||||||
type: 'POST',
|
|
||||||
dataType: 'text',
|
|
||||||
complete: function (xhr, textStatus) {
|
|
||||||
$("#spinner_layout").hide();
|
|
||||||
},
|
|
||||||
success: function (data, textStatus, xhr) {
|
|
||||||
$("#textarea_explanation").val(data);
|
|
||||||
$("#textarea_explanation").show();
|
|
||||||
},
|
|
||||||
error: function (xhr, textStatus, errorThrown) {
|
|
||||||
console.log(errorThrown);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
taskManager.addTask(xhr);
|
|
||||||
|
|
||||||
// Delete all the macro fields.
|
|
||||||
$('.macro_field').remove();
|
|
||||||
$("#spinner_recon_script").show();
|
|
||||||
|
|
||||||
var xhr = jQuery.ajax ({
|
|
||||||
data: {
|
|
||||||
'page': 'godmode/servers/manage_recontask_form',
|
|
||||||
'get_recon_script_macros': 1,
|
|
||||||
'id': id,
|
|
||||||
'id_rt': <?php echo json_encode((int) $id_rt); ?>
|
|
||||||
},
|
|
||||||
url: "<?php echo $config['homeurl']; ?>ajax.php",
|
|
||||||
type: 'POST',
|
|
||||||
dataType: 'json',
|
|
||||||
complete: function (xhr, textStatus) {
|
|
||||||
$("#spinner_recon_script").hide();
|
|
||||||
forced_title_callback();
|
|
||||||
},
|
|
||||||
success: function (data, textStatus, xhr) {
|
|
||||||
if (data.array !== null) {
|
|
||||||
$('#hidden-macros').val(data.base64);
|
|
||||||
|
|
||||||
jQuery.each (data.array, function (i, macro) {
|
|
||||||
if (macro.desc != '') {
|
|
||||||
add_macro_field(macro, 'table_recon-macro');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (xhr, textStatus, errorThrown) {
|
|
||||||
console.log(errorThrown);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
taskManager.addTask(xhr);
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
|
@ -1,401 +1,27 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
// Pandora FMS - http://pandorafms.com
|
* Deprectated.
|
||||||
// ==================================================
|
*
|
||||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
* @category Deprectated
|
||||||
// Please see http://pandorafms.org for full contribution list
|
* @package Pandora FMS
|
||||||
// This program is free software; you can redistribute it and/or
|
* @subpackage recon script
|
||||||
// modify it under the terms of the GNU General Public License
|
* @version 1.0.0
|
||||||
// as published by the Free Software Foundation for version 2.
|
* @license See below
|
||||||
// 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.
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
if (is_ajax()) {
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
$get_reconscript_description = get_parameter('get_reconscript_description');
|
*
|
||||||
$id_reconscript = get_parameter('id_reconscript');
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
$description = db_get_value_filter(
|
* Please see http://pandorafms.org for full contribution list
|
||||||
'description',
|
* This program is free software; you can redistribute it and/or
|
||||||
'trecon_script',
|
* modify it under the terms of the GNU General Public License
|
||||||
['id_recon_script' => $id_reconscript]
|
* 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
|
||||||
echo htmlentities(io_safe_output($description), ENT_QUOTES, 'UTF-8', true);
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
return;
|
* GNU General Public License for more details.
|
||||||
}
|
* ============================================================================
|
||||||
|
|
||||||
// Load global vars
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
check_login();
|
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'LM')) {
|
|
||||||
db_pandora_audit(
|
|
||||||
'ACL Violation',
|
|
||||||
'Trying to access recon script Management'
|
|
||||||
);
|
|
||||||
include 'general/noaccess.php';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Disabled at the moment.
|
|
||||||
if (!check_referer()) {
|
|
||||||
require ("general/noaccess.php");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$view = get_parameter('view', '');
|
|
||||||
$create = get_parameter('create', '');
|
|
||||||
|
|
||||||
if ($view != '') {
|
|
||||||
$form_id = $view;
|
|
||||||
$reconscript = db_get_row('trecon_script', 'id_recon_script', $form_id);
|
|
||||||
$form_name = $reconscript['name'];
|
|
||||||
$form_description = $reconscript['description'];
|
|
||||||
$form_script = $reconscript['script'];
|
|
||||||
$macros = $reconscript['macros'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($create != '') {
|
|
||||||
$form_name = '';
|
|
||||||
$form_description = '';
|
|
||||||
$form_script = '';
|
|
||||||
$macros = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// SHOW THE FORM
|
|
||||||
// =================================================================
|
|
||||||
if (($create != '') or ($view != '')) {
|
|
||||||
if ($create != '') {
|
|
||||||
ui_print_page_header(__('Recon script creation'), 'images/gm_servers.png', false, 'reconscript_definition', true);
|
|
||||||
} else {
|
|
||||||
ui_print_page_header(__('Recon script update'), 'images/gm_servers.png', false, 'reconscript_definition', true);
|
|
||||||
$id_recon_script = get_parameter('view', '');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ($create == '') {
|
|
||||||
echo "<form name=reconscript method='post' action='index.php?sec=gservers&sec2=godmode/servers/recon_script&update_reconscript=$id_recon_script'>";
|
|
||||||
} else {
|
|
||||||
echo "<form name=reconscript method='post' action='index.php?sec=gservers&sec2=godmode/servers/recon_script&create_reconscript=1'>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$table = new stdClass();
|
|
||||||
$table->width = '100%';
|
|
||||||
$table->id = 'table-form';
|
|
||||||
$table->class = 'databox filters';
|
|
||||||
$table->style = [];
|
|
||||||
$table->style[0] = 'font-weight: bold';
|
|
||||||
$table->style[2] = 'font-weight: bold';
|
|
||||||
$table->data = [];
|
|
||||||
|
|
||||||
$data = [];
|
|
||||||
$data[0] = __('Name');
|
|
||||||
$data[1] = '<input type="text" name="form_name" size=30 value="'.$form_name.'">';
|
|
||||||
$table->data['recon_name'] = $data;
|
|
||||||
$table->colspan['recon_name'][1] = 3;
|
|
||||||
|
|
||||||
$data = [];
|
|
||||||
$data[0] = __('Script fullpath');
|
|
||||||
$data[1] = '<input type="text" name="form_script" size=70 value="'.$form_script.'">';
|
|
||||||
$table->data['recon_fullpath'] = $data;
|
|
||||||
$table->colspan['recon_fullpath'][1] = 3;
|
|
||||||
|
|
||||||
$data = [];
|
|
||||||
$data[0] = __('Description');
|
|
||||||
$data[1] = '<textarea name="form_description" cols="50" rows="4">';
|
|
||||||
$data[1] .= $form_description;
|
|
||||||
$data[1] .= '</textarea>';
|
|
||||||
$table->data['recon_description'] = $data;
|
|
||||||
$table->colspan['recon_description'][1] = 3;
|
|
||||||
|
|
||||||
$macros = json_decode($macros, true);
|
|
||||||
|
|
||||||
// This code is ready to add locked feature as plugins
|
|
||||||
$locked = false;
|
|
||||||
|
|
||||||
// The next row number is recon_3
|
|
||||||
$next_name_number = 3;
|
|
||||||
$i = 1;
|
|
||||||
while (1) {
|
|
||||||
// Always print at least one macro
|
|
||||||
if ((!isset($macros[$i]) || $macros[$i]['desc'] == '') && $i > 1) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$macro_desc_name = 'field'.$i.'_desc';
|
|
||||||
$macro_desc_value = '';
|
|
||||||
$macro_help_name = 'field'.$i.'_help';
|
|
||||||
$macro_help_value = '';
|
|
||||||
$macro_value_name = 'field'.$i.'_value';
|
|
||||||
$macro_value_value = '';
|
|
||||||
$macro_name_name = 'field'.$i.'_macro';
|
|
||||||
$macro_name = '_field'.$i.'_';
|
|
||||||
$macro_hide_value_name = 'field'.$i.'_hide';
|
|
||||||
$macro_hide_value_value = 0;
|
|
||||||
|
|
||||||
if (isset($macros[$i]['desc'])) {
|
|
||||||
$macro_desc_value = $macros[$i]['desc'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($macros[$i]['help'])) {
|
|
||||||
$macro_help_value = $macros[$i]['help'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($macros[$i]['value'])) {
|
|
||||||
$macro_value_value = $macros[$i]['value'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($macros[$i]['hide'])) {
|
|
||||||
$macro_hide_value_value = $macros[$i]['hide'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$datam = [];
|
|
||||||
$datam[0] = __('Description')."<span style='font-weight: normal'> ($macro_name)</span>";
|
|
||||||
$datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true);
|
|
||||||
$datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_advanced_conf'", true);
|
|
||||||
if ($locked) {
|
|
||||||
$datam[1] .= html_print_image('images/lock.png', true, ['class' => 'command_advanced_conf']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$datam[2] = __('Default value')."<span style='font-weight: normal'> ($macro_name)</span>";
|
|
||||||
$datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_advanced_conf'", true);
|
|
||||||
if ($locked) {
|
|
||||||
$datam[3] .= html_print_image('images/lock.png', true, ['class' => 'command_advanced_conf']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->data['recon_'.$next_name_number] = $datam;
|
|
||||||
|
|
||||||
$next_name_number++;
|
|
||||||
|
|
||||||
$table->colspan['recon_'.$next_name_number][1] = 3;
|
|
||||||
|
|
||||||
$datam = [];
|
|
||||||
$datam[0] = __('Hide value').ui_print_help_tip(__('This field will show up as dots like a password'), true);
|
|
||||||
$datam[1] = html_print_checkbox_extended($macro_hide_value_name, 1, $macro_hide_value_value, 0, '', ['class' => 'command_advanced_conf'], true, 'checkbox-'.$macro_hide_value_name);
|
|
||||||
|
|
||||||
$table->data['recon_'.$next_name_number] = $datam;
|
|
||||||
$next_name_number++;
|
|
||||||
|
|
||||||
$table->colspan['recon_'.$next_name_number][1] = 3;
|
|
||||||
|
|
||||||
$datam = [];
|
|
||||||
$datam[0] = __('Help')."<span style='font-weight: normal'> ($macro_name)</span><br><br><br>";
|
|
||||||
$tadisabled = $locked === true ? ' disabled' : '';
|
|
||||||
$datam[1] = html_print_textarea($macro_help_name, 6, 100, $macro_help_value, 'class="command_advanced_conf" style="width: 97%;"'.$tadisabled, true);
|
|
||||||
|
|
||||||
if ($locked) {
|
|
||||||
$datam[1] .= html_print_image('images/lock.png', true, ['class' => 'command_advanced_conf']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$datam[1] .= '<br><br><br>';
|
|
||||||
|
|
||||||
$table->data['recon_'.$next_name_number] = $datam;
|
|
||||||
$next_name_number++;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$locked) {
|
|
||||||
$datam = [];
|
|
||||||
$datam[0] = '<span style="font-weight: bold">'.__('Add macro').'</span> <a href="javascript:new_macro(\'table-form-recon_\');update_preview();">'.html_print_image('images/add.png', true).'</a>';
|
|
||||||
$datam[0] .= '<div id="next_macro" style="display:none">'.$i.'</div>';
|
|
||||||
$datam[0] .= '<div id="next_row" style="display:none">'.$next_name_number.'</div>';
|
|
||||||
$delete_macro_style = '';
|
|
||||||
if ($i <= 2) {
|
|
||||||
$delete_macro_style = 'display:none;';
|
|
||||||
}
|
|
||||||
|
|
||||||
$datam[2] = '<div id="delete_macro_button" style="'.$delete_macro_style.'">'.__('Delete macro').' <a href="javascript:delete_macro_form(\'table-form-recon_\');update_preview();">'.html_print_image('images/delete.png', true).'</a></div>';
|
|
||||||
|
|
||||||
$table->colspan['recon_action'][0] = 2;
|
|
||||||
$table->rowstyle['recon_action'] = 'text-align:center';
|
|
||||||
$table->colspan['recon_action'][2] = 2;
|
|
||||||
$table->data['recon_action'] = $datam;
|
|
||||||
}
|
|
||||||
|
|
||||||
html_print_table($table);
|
|
||||||
|
|
||||||
echo '<table width=100%>';
|
|
||||||
echo '<tr><td align="right">';
|
|
||||||
|
|
||||||
if ($create != '') {
|
|
||||||
echo "<input name='crtbutton' type='submit' class='sub wand' value='".__('Create')."'>";
|
|
||||||
} else {
|
|
||||||
echo "<input name='uptbutton' type='submit' class='sub upd' value='".__('Update')."'>";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</form></table>';
|
|
||||||
} else {
|
|
||||||
ui_print_page_header(__('Recon scripts registered on %s', get_product_name()), 'images/gm_servers.png', false, '', true);
|
|
||||||
|
|
||||||
// Update reconscript
|
|
||||||
if (isset($_GET['update_reconscript'])) {
|
|
||||||
// if modified any parameter
|
|
||||||
$id_recon_script = get_parameter('update_reconscript', 0);
|
|
||||||
$reconscript_name = get_parameter('form_name', '');
|
|
||||||
$reconscript_description = get_parameter('form_description', '');
|
|
||||||
$reconscript_script = get_parameter('form_script', '');
|
|
||||||
|
|
||||||
// Get macros
|
|
||||||
$i = 1;
|
|
||||||
$macros = [];
|
|
||||||
while (1) {
|
|
||||||
$macro = (string) get_parameter('field'.$i.'_macro');
|
|
||||||
if ($macro == '') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$desc = (string) get_parameter('field'.$i.'_desc');
|
|
||||||
$help = (string) get_parameter('field'.$i.'_help');
|
|
||||||
$value = (string) get_parameter('field'.$i.'_value');
|
|
||||||
$hide = get_parameter('field'.$i.'_hide');
|
|
||||||
|
|
||||||
$macros[$i]['macro'] = $macro;
|
|
||||||
$macros[$i]['desc'] = $desc;
|
|
||||||
$macros[$i]['help'] = $help;
|
|
||||||
$macros[$i]['value'] = $value;
|
|
||||||
$macros[$i]['hide'] = $hide;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$macros = io_json_mb_encode($macros);
|
|
||||||
|
|
||||||
$sql_update = "UPDATE trecon_script SET
|
|
||||||
name = '$reconscript_name',
|
|
||||||
description = '$reconscript_description',
|
|
||||||
script = '$reconscript_script',
|
|
||||||
macros = '$macros'
|
|
||||||
WHERE id_recon_script = $id_recon_script";
|
|
||||||
$result = false;
|
|
||||||
if ($reconscript_name != '' && $reconscript_script != '') {
|
|
||||||
$result = db_process_sql($sql_update);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $result) {
|
|
||||||
ui_print_error_message(__('Problem updating'));
|
|
||||||
} else {
|
|
||||||
ui_print_success_message(__('Updated successfully'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create reconscript
|
|
||||||
if (isset($_GET['create_reconscript'])) {
|
|
||||||
$reconscript_name = get_parameter('form_name', '');
|
|
||||||
$reconscript_description = get_parameter('form_description', '');
|
|
||||||
$reconscript_script = get_parameter('form_script', '');
|
|
||||||
|
|
||||||
// Get macros
|
|
||||||
$i = 1;
|
|
||||||
$macros = [];
|
|
||||||
while (1) {
|
|
||||||
$macro = (string) get_parameter('field'.$i.'_macro');
|
|
||||||
if ($macro == '') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$desc = (string) get_parameter('field'.$i.'_desc');
|
|
||||||
$help = (string) get_parameter('field'.$i.'_help');
|
|
||||||
$value = (string) get_parameter('field'.$i.'_value');
|
|
||||||
$hide = get_parameter('field'.$i.'_hide');
|
|
||||||
|
|
||||||
$macros[$i]['macro'] = $macro;
|
|
||||||
$macros[$i]['desc'] = $desc;
|
|
||||||
$macros[$i]['help'] = $help;
|
|
||||||
$macros[$i]['value'] = $value;
|
|
||||||
$macros[$i]['hide'] = $hide;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$macros = io_json_mb_encode($macros);
|
|
||||||
|
|
||||||
$values = [
|
|
||||||
'name' => $reconscript_name,
|
|
||||||
'description' => $reconscript_description,
|
|
||||||
'script' => $reconscript_script,
|
|
||||||
'macros' => $macros,
|
|
||||||
];
|
|
||||||
$result = false;
|
|
||||||
if ($values['name'] != '' && $values['script'] != '') {
|
|
||||||
$result = db_process_sql_insert('trecon_script', $values);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $result) {
|
|
||||||
ui_print_error_message(__('Problem creating'));
|
|
||||||
} else {
|
|
||||||
ui_print_success_message(__('Created successfully'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_GET['kill_reconscript'])) {
|
|
||||||
// if delete alert
|
|
||||||
$reconscript_id = get_parameter('kill_reconscript', 0);
|
|
||||||
|
|
||||||
$result = db_process_sql_delete(
|
|
||||||
'trecon_script',
|
|
||||||
['id_recon_script' => $reconscript_id]
|
|
||||||
);
|
|
||||||
|
|
||||||
if (! $result) {
|
|
||||||
ui_print_error_message(__('Problem deleting reconscript'));
|
|
||||||
} else {
|
|
||||||
ui_print_success_message(__('reconscript deleted successfully'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($reconscript_id != 0) {
|
|
||||||
$result = db_process_sql_delete(
|
|
||||||
'trecon_task',
|
|
||||||
['id_recon_script' => $reconscript_id]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If not edition or insert, then list available reconscripts
|
|
||||||
$rows = db_get_all_rows_in_table('trecon_script');
|
|
||||||
|
|
||||||
if ($rows !== false) {
|
|
||||||
echo '<table width="100%" cellspacing="4" cellpadding="4" class="databox data">';
|
|
||||||
echo '<th>'.__('Name').'</th>';
|
|
||||||
echo '<th>'.__('Description').'</th>';
|
|
||||||
echo '<th>'.__('Delete').'</th>';
|
|
||||||
$color = 0;
|
|
||||||
foreach ($rows as $row) {
|
|
||||||
if ($color == 1) {
|
|
||||||
$tdcolor = 'datos';
|
|
||||||
$color = 0;
|
|
||||||
} else {
|
|
||||||
$tdcolor = 'datos2';
|
|
||||||
$color = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<tr>';
|
|
||||||
echo "<td class='$tdcolor' style='min-width: 100px;'>";
|
|
||||||
echo "<b><a href='index.php?sec=gservers&sec2=godmode/servers/recon_script&view=".$row['id_recon_script']."'>";
|
|
||||||
echo $row['name'];
|
|
||||||
echo '</a></b></td>';
|
|
||||||
echo "</td><td class='$tdcolor'>";
|
|
||||||
$desc = io_safe_output($row['description']);
|
|
||||||
$desc = str_replace("\n", '<br>', $desc);
|
|
||||||
echo $desc.'<br><br>';
|
|
||||||
echo '<b>'.__('Command').': </b><i>'.$row['script'].'</i>';
|
|
||||||
echo "</td><td align='center' class='$tdcolor'>";
|
|
||||||
echo "<a href='index.php?sec=gservers&sec2=godmode/servers/recon_script&kill_reconscript=".$row['id_recon_script']."'>".html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
|
|
||||||
echo '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</table>';
|
|
||||||
} else {
|
|
||||||
ui_print_info_message(['no_close' => true, 'message' => __('There are no recon scripts in the system') ]);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<table width=100%>';
|
|
||||||
echo '<tr><td align=right>';
|
|
||||||
echo "<form name=reconscript method='post' action='index.php?sec=gservers&sec2=godmode/servers/recon_script&create=1'>";
|
|
||||||
echo "<input name='crtbutton' type='submit' class='sub next' value='".__('Add')."'>";
|
|
||||||
echo '</td></tr></table>';
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_require_javascript_file('pandora_modules');
|
|
||||||
|
|
|
@ -30,7 +30,10 @@ require_once __DIR__.'/Wizard.main.php';
|
||||||
require_once $config['homedir'].'/include/functions_users.php';
|
require_once $config['homedir'].'/include/functions_users.php';
|
||||||
require_once $config['homedir'].'/include/functions_reports.php';
|
require_once $config['homedir'].'/include/functions_reports.php';
|
||||||
require_once $config['homedir'].'/include/functions_cron.php';
|
require_once $config['homedir'].'/include/functions_cron.php';
|
||||||
enterprise_include('include/functions_tasklist.php');
|
enterprise_include_once('include/functions_tasklist.php');
|
||||||
|
enterprise_include_once('include/functions_cron.php');
|
||||||
|
|
||||||
|
ui_require_css_file('task_list');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defined as wizard to guide user to explore running tasks.
|
* Defined as wizard to guide user to explore running tasks.
|
||||||
|
@ -93,7 +96,8 @@ class DiscoveryTaskList extends Wizard
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->printHeader();
|
// Header
|
||||||
|
ui_print_page_header(__('Task list'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
|
||||||
|
|
||||||
// Show redirected messages from discovery.php.
|
// Show redirected messages from discovery.php.
|
||||||
if ($status === 0) {
|
if ($status === 0) {
|
||||||
|
@ -237,7 +241,7 @@ class DiscoveryTaskList extends Wizard
|
||||||
$id_console_task = (int) get_parameter('id_console_task');
|
$id_console_task = (int) get_parameter('id_console_task');
|
||||||
|
|
||||||
if ($id_console_task !== null) {
|
if ($id_console_task !== null) {
|
||||||
enterprise_include('cron_task_run', $id_console_task, true);
|
enterprise_hook('cron_task_run', [$id_console_task, true]);
|
||||||
// Trick to avoid double execution.
|
// Trick to avoid double execution.
|
||||||
header('Location: '.$this->url);
|
header('Location: '.$this->url);
|
||||||
}
|
}
|
||||||
|
@ -345,6 +349,8 @@ class DiscoveryTaskList extends Wizard
|
||||||
$recon_tasks = [];
|
$recon_tasks = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$url_ajax = $config['homeurl'].'ajax.php';
|
||||||
|
|
||||||
$table = new StdClass();
|
$table = new StdClass();
|
||||||
$table->cellpadding = 4;
|
$table->cellpadding = 4;
|
||||||
$table->cellspacing = 4;
|
$table->cellspacing = 4;
|
||||||
|
@ -424,7 +430,16 @@ class DiscoveryTaskList extends Wizard
|
||||||
$data[0] = '';
|
$data[0] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$data[1] = '<b>'.$task['name'].'</b>';
|
// Name task.
|
||||||
|
$data[1] = '';
|
||||||
|
if ($task['disabled'] != 2) {
|
||||||
|
$data[1] .= '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||||
|
}
|
||||||
|
|
||||||
|
$data[1] .= '<b>'.$task['name'].'</b>';
|
||||||
|
if ($task['disabled'] != 2) {
|
||||||
|
$data[1] .= '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
$data[2] = $server_name;
|
$data[2] = $server_name;
|
||||||
|
|
||||||
|
@ -488,6 +503,24 @@ class DiscoveryTaskList extends Wizard
|
||||||
$data[8] = __('Not executed yet');
|
$data[8] = __('Not executed yet');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($task['disabled'] != 2) {
|
||||||
|
$data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||||
|
$data[9] .= html_print_image(
|
||||||
|
'images/eye.png',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$data[9] .= '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($task['disabled'] != 2 && $task['utimestamp'] > 0) {
|
||||||
|
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||||
|
$data[9] .= html_print_image(
|
||||||
|
'images/dynamic_network_icon.png',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$data[9] .= '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
if (check_acl(
|
if (check_acl(
|
||||||
$config['id_user'],
|
$config['id_user'],
|
||||||
$task['id_group'],
|
$task['id_group'],
|
||||||
|
@ -495,7 +528,7 @@ class DiscoveryTaskList extends Wizard
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
if ($ipam === true) {
|
if ($ipam === true) {
|
||||||
$data[9] = '<a href="'.ui_get_full_url(
|
$data[9] .= '<a href="'.ui_get_full_url(
|
||||||
sprintf(
|
sprintf(
|
||||||
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=%d',
|
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=%d',
|
||||||
$tipam_task_id
|
$tipam_task_id
|
||||||
|
@ -512,7 +545,7 @@ class DiscoveryTaskList extends Wizard
|
||||||
).'</a>';
|
).'</a>';
|
||||||
} else {
|
} else {
|
||||||
// Check if is a H&D, Cloud or Application or IPAM.
|
// Check if is a H&D, Cloud or Application or IPAM.
|
||||||
$data[9] = '<a href="'.ui_get_full_url(
|
$data[9] .= '<a href="'.ui_get_full_url(
|
||||||
sprintf(
|
sprintf(
|
||||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
|
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
|
||||||
$this->getTargetWiz($task),
|
$this->getTargetWiz($task),
|
||||||
|
@ -533,6 +566,9 @@ class DiscoveryTaskList extends Wizard
|
||||||
$data[9] = '';
|
$data[9] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Div neccesary for modal progress task.
|
||||||
|
echo '<div id="progress_task_'.$task['id_rt'].'" style="display:none"></div>';
|
||||||
|
|
||||||
array_push($table->data, $data);
|
array_push($table->data, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,7 +580,12 @@ class DiscoveryTaskList extends Wizard
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($table);
|
// Div neccesary for modal map task.
|
||||||
|
echo '<div id="map_task" style="display:none"></div>';
|
||||||
|
|
||||||
|
unset($table);
|
||||||
|
|
||||||
|
ui_require_javascript_file('pandora_taskList');
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -583,7 +624,12 @@ class DiscoveryTaskList extends Wizard
|
||||||
return 'wiz=ctask';
|
return 'wiz=ctask';
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 'wiz=hd&mode=netscan';
|
if ($task['id_recon_script'] === null) {
|
||||||
|
return 'wiz=hd&mode=netscan';
|
||||||
|
} else {
|
||||||
|
return 'wiz=hd&mode=customnetscan';
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,10 @@
|
||||||
|
|
||||||
require_once __DIR__.'/Wizard.main.php';
|
require_once __DIR__.'/Wizard.main.php';
|
||||||
require_once $config['homedir'].'/include/functions_users.php';
|
require_once $config['homedir'].'/include/functions_users.php';
|
||||||
enterprise_include('include/class/CSVImportAgents.class.php');
|
require_once $config['homedir'].'/include/class/CustomNetScan.class.php';
|
||||||
|
require_once $config['homedir'].'/include/class/ManageNetScanScripts.class.php';
|
||||||
|
|
||||||
|
enterprise_include_once('include/class/CSVImportAgents.class.php');
|
||||||
enterprise_include_once('include/functions_hostdevices.php');
|
enterprise_include_once('include/functions_hostdevices.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,6 +120,7 @@ class HostDevices extends Wizard
|
||||||
'icon' => 'images/wizard/netscan.png',
|
'icon' => 'images/wizard/netscan.png',
|
||||||
'label' => __('Net Scan'),
|
'label' => __('Net Scan'),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
$buttons[] = [
|
$buttons[] = [
|
||||||
'url' => $this->url.'&mode=importcsv',
|
'url' => $this->url.'&mode=importcsv',
|
||||||
|
@ -125,6 +129,18 @@ class HostDevices extends Wizard
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$buttons[] = [
|
||||||
|
'url' => $this->url.'&mode=customnetscan',
|
||||||
|
'icon' => '/images/wizard/customnetscan.png',
|
||||||
|
'label' => __('Custom NetScan'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$buttons[] = [
|
||||||
|
'url' => $this->url.'&mode=managenetscanscripts',
|
||||||
|
'icon' => '/images/wizard/managenetscanscripts.png',
|
||||||
|
'label' => __('Manage NetScan scripts'),
|
||||||
|
];
|
||||||
|
|
||||||
$this->prepareBreadcrum(
|
$this->prepareBreadcrum(
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
@ -136,19 +152,38 @@ class HostDevices extends Wizard
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->printHeader();
|
ui_print_page_header(__('Host & devices'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
|
||||||
|
|
||||||
$this->printBigButtonsList($buttons);
|
$this->printBigButtonsList($buttons);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
if ($mode == 'importcsv') {
|
if ($mode === 'importcsv') {
|
||||||
$csv_importer = new CSVImportAgents($this->page, $this->breadcrum);
|
$csv_importer = new CSVImportAgents(
|
||||||
|
$this->page,
|
||||||
|
$this->breadcrum
|
||||||
|
);
|
||||||
return $csv_importer->runCSV();
|
return $csv_importer->runCSV();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($mode === 'customnetscan') {
|
||||||
|
$customnetscan_importer = new CustomNetScan(
|
||||||
|
$this->page,
|
||||||
|
$this->breadcrum
|
||||||
|
);
|
||||||
|
return $customnetscan_importer->runCustomNetScan();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode === 'managenetscanscripts') {
|
||||||
|
$managenetscanscript_importer = new ManageNetScanScripts(
|
||||||
|
$this->page,
|
||||||
|
$this->breadcrum
|
||||||
|
);
|
||||||
|
return $managenetscanscript_importer->runManageNetScanScript();
|
||||||
|
}
|
||||||
|
|
||||||
if ($mode == 'netscan') {
|
if ($mode == 'netscan') {
|
||||||
return $this->runNetScan();
|
return $this->runNetScan();
|
||||||
}
|
}
|
||||||
|
@ -477,9 +512,15 @@ class HostDevices extends Wizard
|
||||||
$task_url = '&task='.$this->task['id_rt'];
|
$task_url = '&task='.$this->task['id_rt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$breadcrum[] = [
|
$breadcrum = [
|
||||||
'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd',
|
[
|
||||||
'label' => __($this->label),
|
'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery',
|
||||||
|
'label' => 'Discovery',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd',
|
||||||
|
'label' => __($this->label),
|
||||||
|
],
|
||||||
];
|
];
|
||||||
for ($i = 0; $i < $this->maxPagesNetScan; $i++) {
|
for ($i = 0; $i < $this->maxPagesNetScan; $i++) {
|
||||||
$breadcrum[] = [
|
$breadcrum[] = [
|
||||||
|
@ -492,7 +533,7 @@ class HostDevices extends Wizard
|
||||||
if ($this->page < $this->maxPagesNetScan) {
|
if ($this->page < $this->maxPagesNetScan) {
|
||||||
// Avoid to print header out of wizard.
|
// Avoid to print header out of wizard.
|
||||||
$this->prepareBreadcrum($breadcrum);
|
$this->prepareBreadcrum($breadcrum);
|
||||||
$this->printHeader();
|
ui_print_page_header(__('NetScan'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->page) === true
|
if (isset($this->page) === true
|
||||||
|
|
|
@ -26,14 +26,15 @@
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2');
|
// Begin.
|
||||||
|
|
||||||
/**
|
|
||||||
* Global Wizard generic class. Needs to be inherited.
|
/**
|
||||||
*
|
* Global Wizard generic class. Needs to be inherited.
|
||||||
* Used in Hostdevices class, Applications class and others, is the core of
|
*
|
||||||
* Discovery proyect.
|
* Used in Hostdevices class, Applications class and others, is the core of
|
||||||
*/
|
* Discovery proyect.
|
||||||
|
*/
|
||||||
class Wizard
|
class Wizard
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -195,20 +196,34 @@ class Wizard
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function prepareBreadcrum(array $urls, bool $add=false)
|
public function prepareBreadcrum(array $urls, bool $add=false, bool $separator_beginning=false)
|
||||||
{
|
{
|
||||||
$bc = [];
|
$bc = [];
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
$count = 0;
|
||||||
|
$array_size = count($urls);
|
||||||
|
|
||||||
foreach ($urls as $url) {
|
foreach ($urls as $url) {
|
||||||
|
$count++;
|
||||||
|
|
||||||
if ($url['selected'] == 1) {
|
if ($url['selected'] == 1) {
|
||||||
$class = 'selected';
|
$class = 'selected';
|
||||||
} else {
|
} else {
|
||||||
$class = '';
|
$class = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$bc[$i] = '<a href="'.$url['link'].'" class="text_color">';
|
$bc[$i] = '';
|
||||||
$bc[$i] .= '<div class="arrow_box '.$class.'">'.$url['label'];
|
|
||||||
$bc[$i++] .= '</div></a>';
|
if ($separator_beginning === true) $bc[$i] .= '<span class="breadcrumb_link"> / </span>';
|
||||||
|
|
||||||
|
$bc[$i] .= '<span><a class="breadcrumb_link '.$class.'" href="'.$url['link'].'">';
|
||||||
|
$bc[$i] .= $url['label'];
|
||||||
|
$bc[$i] .= '</a>';
|
||||||
|
if ($count < $array_size) $bc[$i] .= '<span class="breadcrumb_link"> / </span>';
|
||||||
|
|
||||||
|
$bc[$i] .= '</span>';
|
||||||
|
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($add === true) {
|
if ($add === true) {
|
||||||
|
@ -256,7 +271,7 @@ class Wizard
|
||||||
*/
|
*/
|
||||||
public function printBreadcrum()
|
public function printBreadcrum()
|
||||||
{
|
{
|
||||||
return '<h1 class="wizard">'.implode('', $this->breadcrum).'</h1>';
|
return implode('', $this->breadcrum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -572,14 +587,18 @@ class Wizard
|
||||||
{
|
{
|
||||||
$output = '';
|
$output = '';
|
||||||
if ($input['hidden'] == 1) {
|
if ($input['hidden'] == 1) {
|
||||||
$class = ' class="hidden"';
|
$class = ' hidden';
|
||||||
} else {
|
} else {
|
||||||
$class = '';
|
$class = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($input['class']) === true) {
|
||||||
|
$class = $input['class'].$class;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_array($input['block_content']) === true) {
|
if (is_array($input['block_content']) === true) {
|
||||||
// Print independent block of inputs.
|
// Print independent block of inputs.
|
||||||
$output .= '<li id="'.$input['block_id'].'" '.$class.'>';
|
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
|
||||||
$output .= '<ul class="wizard">';
|
$output .= '<ul class="wizard">';
|
||||||
foreach ($input['block_content'] as $input) {
|
foreach ($input['block_content'] as $input) {
|
||||||
$output .= $this->printBlock($input, $return);
|
$output .= $this->printBlock($input, $return);
|
||||||
|
@ -588,7 +607,7 @@ class Wizard
|
||||||
$output .= '</ul></li>';
|
$output .= '</ul></li>';
|
||||||
} else {
|
} else {
|
||||||
if ($input['arguments']['type'] != 'hidden') {
|
if ($input['arguments']['type'] != 'hidden') {
|
||||||
$output .= '<li id="'.$input['id'].'" '.$class.'>';
|
$output .= '<li id="'.$input['id'].'" class="'.$class.'">';
|
||||||
$output .= '<label>'.$input['label'].'</label>';
|
$output .= '<label>'.$input['label'].'</label>';
|
||||||
$output .= $this->printInput($input['arguments']);
|
$output .= $this->printInput($input['arguments']);
|
||||||
// Allow dynamic content.
|
// Allow dynamic content.
|
||||||
|
|
After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 339 B |
Before Width: | Height: | Size: 272 B After Width: | Height: | Size: 263 B |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.1 KiB |
|
@ -0,0 +1,173 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Extension to schedule tasks on Pandora FMS Console
|
||||||
|
*
|
||||||
|
* @category Ajax
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Host&Devices
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once $config['homedir'].'/include/graphs/functions_d3.php';
|
||||||
|
|
||||||
|
$progress_task_discovery = (bool) get_parameter('progress_task_discovery', 0);
|
||||||
|
$showmap = (bool) get_parameter('showmap', 0);
|
||||||
|
|
||||||
|
if ($progress_task_discovery) {
|
||||||
|
$id_task = get_parameter('id', 0);
|
||||||
|
|
||||||
|
if ($id_task <= 0) {
|
||||||
|
echo json_encode(['error' => true]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$task = db_get_row('trecon_task', 'id_rt', $id_task);
|
||||||
|
$global_progress = $task['status'];
|
||||||
|
$summary = json_decode($task['summary'], true);
|
||||||
|
|
||||||
|
$result = '<div id = progress_task_'.$id_task.'>';
|
||||||
|
if ($task['utimestamp']) {
|
||||||
|
$result .= '<ul class="progress_task_discovery">';
|
||||||
|
$result .= '<li><h1>'._('Overall Progress').'</h1></li>';
|
||||||
|
$result .= '<li>';
|
||||||
|
$result .= d3_progress_bar(
|
||||||
|
$id_task,
|
||||||
|
($global_progress < 0) ? 100 : $global_progress,
|
||||||
|
460,
|
||||||
|
30,
|
||||||
|
'#EA5434',
|
||||||
|
'%',
|
||||||
|
'',
|
||||||
|
'#FFFFFF',
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($global_progress > 0) {
|
||||||
|
switch ($summary['step']) {
|
||||||
|
case STEP_SCANNING:
|
||||||
|
$str = __('Scanning network');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case STEP_AFT:
|
||||||
|
$str = __('Finding AFT connectivity');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case STEP_TRACEROUTE:
|
||||||
|
$str = __('Finding traceroute connectivity');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case STEP_GATEWAY:
|
||||||
|
$str = __('Finding gateway connectivity');
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$str = __('Searching for devices...');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result .= '</li>';
|
||||||
|
$result .= '<li><h1>'.$str.' ';
|
||||||
|
$result .= $summary['c_network_name'];
|
||||||
|
$result .= '</h1></li>';
|
||||||
|
$result .= '<li>';
|
||||||
|
$result .= d3_progress_bar(
|
||||||
|
$id_task.'_detail',
|
||||||
|
$summary['c_network_percent'],
|
||||||
|
460,
|
||||||
|
30,
|
||||||
|
'#2751E1',
|
||||||
|
'%',
|
||||||
|
'',
|
||||||
|
'#FFFFFF',
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
$result .= '</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$result .= '</ul>';
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
$table = new StdClasS();
|
||||||
|
$table->class = 'databox data';
|
||||||
|
$table->width = '75%';
|
||||||
|
$table->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;background: white;';
|
||||||
|
$table->rowid = [];
|
||||||
|
$table->data = [];
|
||||||
|
|
||||||
|
// Content.
|
||||||
|
$table->data[$i][0] = '<b>'.__('Hosts discovered').'</b>';
|
||||||
|
$table->data[$i][1] = '<span id="discovered">';
|
||||||
|
$table->data[$i][1] .= $summary['summary']['discovered'];
|
||||||
|
$table->data[$i++][1] .= '</span>';
|
||||||
|
|
||||||
|
$table->data[$i][0] = '<b>'.__('Alive').'</b>';
|
||||||
|
$table->data[$i][1] = '<span id="alive">';
|
||||||
|
$table->data[$i][1] .= $summary['summary']['alive'];
|
||||||
|
$table->data[$i++][1] .= '</span>';
|
||||||
|
|
||||||
|
$table->data[$i][0] = '<b>'.__('Not alive').'</b>';
|
||||||
|
$table->data[$i][1] = '<span id="not_alive">';
|
||||||
|
$table->data[$i][1] .= $summary['summary']['not_alive'];
|
||||||
|
$table->data[$i++][1] .= '</span>';
|
||||||
|
|
||||||
|
$table->data[$i][0] = '<b>'.__('Responding SNMP').'</b>';
|
||||||
|
$table->data[$i][1] = '<span id="SNMP">';
|
||||||
|
$table->data[$i][1] .= $summary['summary']['SNMP'];
|
||||||
|
$table->data[$i++][1] .= '</span>';
|
||||||
|
|
||||||
|
$table->data[$i][0] = '<b>'.__('Responding WMI').'</b>';
|
||||||
|
$table->data[$i][1] = '<span id="WMI">';
|
||||||
|
$table->data[$i][1] .= $summary['summary']['WMI'];
|
||||||
|
$table->data[$i++][1] .= '</span>';
|
||||||
|
|
||||||
|
$result .= html_print_table($table, true).'</div>';
|
||||||
|
} else {
|
||||||
|
$global_progress = -1;
|
||||||
|
$result .= ui_print_error_message(
|
||||||
|
__('No data to show'),
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
).'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$result_array['status'] = $global_progress;
|
||||||
|
$result_array['html'] = $result;
|
||||||
|
|
||||||
|
echo json_encode($result_array);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($showmap) {
|
||||||
|
include_once $config['homedir'].'/include/class/NetworkMap.class.php';
|
||||||
|
$id_task = get_parameter('id', 0);
|
||||||
|
|
||||||
|
$map = new NetworkMap(
|
||||||
|
[
|
||||||
|
'id_task' => $id_task,
|
||||||
|
'pure' => 1,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$map->printMap();
|
||||||
|
}
|
|
@ -36,7 +36,7 @@ require_once $config['homedir'].'/include/functions_servers.php';
|
||||||
// Enterprise includes.
|
// Enterprise includes.
|
||||||
enterprise_include_once('include/functions_metaconsole.php');
|
enterprise_include_once('include/functions_metaconsole.php');
|
||||||
enterprise_include_once('include/functions_license.php');
|
enterprise_include_once('include/functions_license.php');
|
||||||
enterprise_include_once('extensions/cron/functions.php');
|
enterprise_include_once('include/functions_cron.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class to run scheduled tasks in cron extension
|
* Base class to run scheduled tasks in cron extension
|
||||||
|
@ -540,7 +540,8 @@ class ConsoleSupervisor
|
||||||
switch ($data['type']) {
|
switch ($data['type']) {
|
||||||
case 'NOTIF.LICENSE.LIMITED':
|
case 'NOTIF.LICENSE.LIMITED':
|
||||||
$max_age = 0;
|
$max_age = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'NOTIF.LICENSE.EXPIRATION':
|
case 'NOTIF.LICENSE.EXPIRATION':
|
||||||
case 'NOTIF.FILES.ATTACHMENT':
|
case 'NOTIF.FILES.ATTACHMENT':
|
||||||
case 'NOTIF.FILES.DATAIN':
|
case 'NOTIF.FILES.DATAIN':
|
||||||
|
@ -688,7 +689,7 @@ class ConsoleSupervisor
|
||||||
|
|
||||||
$days_to_expiry = ((strtotime($license['expiry_date']) - time()) / (60 * 60 * 24));
|
$days_to_expiry = ((strtotime($license['expiry_date']) - time()) / (60 * 60 * 24));
|
||||||
|
|
||||||
// Limited mode.
|
// Limited mode.
|
||||||
if (isset($config['limited_mode'])) {
|
if (isset($config['limited_mode'])) {
|
||||||
// Warn user if license is going to expire in 15 days or less.
|
// Warn user if license is going to expire in 15 days or less.
|
||||||
$this->notify(
|
$this->notify(
|
||||||
|
@ -703,7 +704,7 @@ class ConsoleSupervisor
|
||||||
$this->cleanNotifications('NOTIF.LICENSE.LIMITED');
|
$this->cleanNotifications('NOTIF.LICENSE.LIMITED');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expiry.
|
// Expiry.
|
||||||
if (($days_to_expiry <= 15) && ($days_to_expiry > 0)) {
|
if (($days_to_expiry <= 15) && ($days_to_expiry > 0)) {
|
||||||
// Warn user if license is going to expire in 15 days or less.
|
// Warn user if license is going to expire in 15 days or less.
|
||||||
$this->notify(
|
$this->notify(
|
||||||
|
@ -711,7 +712,7 @@ class ConsoleSupervisor
|
||||||
'type' => 'NOTIF.LICENSE.EXPIRATION',
|
'type' => 'NOTIF.LICENSE.EXPIRATION',
|
||||||
'title' => __('License is going to expire.'),
|
'title' => __('License is going to expire.'),
|
||||||
'message' => __(
|
'message' => __(
|
||||||
'Your license is going to expire in %d days. Please contact sales.',
|
'Your license will expire in %d days. Please, contact our sales department.',
|
||||||
$days_to_expiry
|
$days_to_expiry
|
||||||
),
|
),
|
||||||
'url' => 'index.php?sec=gsetup&sec2=godmode/setup/license',
|
'url' => 'index.php?sec=gsetup&sec2=godmode/setup/license',
|
||||||
|
@ -722,8 +723,8 @@ class ConsoleSupervisor
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.LICENSE.EXPIRATION',
|
'type' => 'NOTIF.LICENSE.EXPIRATION',
|
||||||
'title' => __('License is expired.'),
|
'title' => __('Expired license'),
|
||||||
'message' => __('Your license has expired. Please contact sales.'),
|
'message' => __('Your license has expired. Please, contact our sales department.'),
|
||||||
'url' => 'index.php?sec=gsetup&sec2=godmode/setup/license',
|
'url' => 'index.php?sec=gsetup&sec2=godmode/setup/license',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -796,9 +797,9 @@ class ConsoleSupervisor
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.WRITABLE.ATTACHMENT',
|
'type' => 'NOTIF.WRITABLE.ATTACHMENT',
|
||||||
'title' => __('Attachment directory is not writable.'),
|
'title' => __('Attachment directory is not writable'),
|
||||||
'message' => __(
|
'message' => __(
|
||||||
'Directory %s is not writable. Please configure proper permissions.',
|
'Directory %s is not writable. Please, configure corresponding permissions.',
|
||||||
$config['attachment_store']
|
$config['attachment_store']
|
||||||
),
|
),
|
||||||
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||||
|
@ -818,9 +819,9 @@ class ConsoleSupervisor
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.FILES.ATTACHMENT',
|
'type' => 'NOTIF.FILES.ATTACHMENT',
|
||||||
'title' => __('There are too much files in attachment directory.'),
|
'title' => __('There are too many files in attachment directory'),
|
||||||
'message' => __(
|
'message' => __(
|
||||||
'There are more than %d files in attachment, you should consider cleaning up your attachment directory manually.',
|
'There are more than %d files in attachment, consider cleaning up attachment directory manually.',
|
||||||
$config['num_files_attachment']
|
$config['num_files_attachment']
|
||||||
),
|
),
|
||||||
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||||
|
@ -850,9 +851,9 @@ class ConsoleSupervisor
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG',
|
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG',
|
||||||
'title' => __('Remote configuration directory is not readable.'),
|
'title' => __('Remote configuration directory is not readable'),
|
||||||
'message' => __(
|
'message' => __(
|
||||||
'Remote configuration directory %s is not readable. Please configure it.',
|
'Remote configuration directory %s is not readable. Please, adjust configuration.',
|
||||||
$config['remote_config']
|
$config['remote_config']
|
||||||
),
|
),
|
||||||
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||||
|
@ -869,9 +870,9 @@ class ConsoleSupervisor
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.CONF',
|
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.CONF',
|
||||||
'title' => __('Remote configuration directory is not writable.'),
|
'title' => __('Remote configuration directory is not writable'),
|
||||||
'message' => __(
|
'message' => __(
|
||||||
'Remote configuration directory %s is not writable. Please configure it.',
|
'Remote configuration directory %s is not writable. Please, adjust configuration.',
|
||||||
$config['remote_config'].'/conf'
|
$config['remote_config'].'/conf'
|
||||||
),
|
),
|
||||||
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||||
|
@ -887,9 +888,9 @@ class ConsoleSupervisor
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.COLLECTIONS',
|
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.COLLECTIONS',
|
||||||
'title' => __('Remote collections directory is not writable.'),
|
'title' => __('Remote collections directory is not writable'),
|
||||||
'message' => __(
|
'message' => __(
|
||||||
'Collections directory %s is not writable. Please configure it.',
|
'Collections directory %s is not writable. Please, adjust configuration.',
|
||||||
$config['remote_config'].'/collections'
|
$config['remote_config'].'/collections'
|
||||||
),
|
),
|
||||||
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||||
|
@ -905,9 +906,9 @@ class ConsoleSupervisor
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.MD5',
|
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.MD5',
|
||||||
'title' => __('Remote md5 directory is not writable.'),
|
'title' => __('Remote md5 directory is not writable'),
|
||||||
'message' => __(
|
'message' => __(
|
||||||
'MD5 directory %s is not writable. Please configure it.',
|
'MD5 directory %s is not writable. Please, adjust configuration.',
|
||||||
$config['remote_config'].'/md5'
|
$config['remote_config'].'/md5'
|
||||||
),
|
),
|
||||||
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||||
|
@ -937,7 +938,7 @@ class ConsoleSupervisor
|
||||||
'type' => 'NOTIF.FILES.DATAIN',
|
'type' => 'NOTIF.FILES.DATAIN',
|
||||||
'title' => __('There are too much files in spool').'.',
|
'title' => __('There are too much files in spool').'.',
|
||||||
'message' => __(
|
'message' => __(
|
||||||
'There are more than %d files in %s, you should consider checking DataServer performance',
|
'There are more than %d files in %s. Consider checking DataServer performance',
|
||||||
$MAX_FILES_DATA_IN,
|
$MAX_FILES_DATA_IN,
|
||||||
$config['remote_config']
|
$config['remote_config']
|
||||||
),
|
),
|
||||||
|
@ -958,9 +959,9 @@ class ConsoleSupervisor
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.FILES.DATAIN.BADXML',
|
'type' => 'NOTIF.FILES.DATAIN.BADXML',
|
||||||
'title' => __('There are too much BADXML files in spool.'),
|
'title' => __('There are too many BADXML files in spool'),
|
||||||
'message' => __(
|
'message' => __(
|
||||||
'There are more than %d files in %s, you should consider checking software agents.',
|
'There are more than %d files in %s. Consider checking software agents.',
|
||||||
$MAX_BADXML_FILES_DATA_IN,
|
$MAX_BADXML_FILES_DATA_IN,
|
||||||
$config['remote_config']
|
$config['remote_config']
|
||||||
),
|
),
|
||||||
|
@ -982,10 +983,12 @@ class ConsoleSupervisor
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
include_once $config['homedir'].'/include/functions_servers.php';
|
||||||
|
|
||||||
$idx_file = $config['attachment_store'].'/.cron.supervisor.servers.idx';
|
$idx_file = $config['attachment_store'].'/.cron.supervisor.servers.idx';
|
||||||
|
|
||||||
$MAX_QUEUE = 1500;
|
$MAX_QUEUE = 1500;
|
||||||
$MAX_GROWN = 50;
|
$total_modules = servers_get_total_modules();
|
||||||
|
|
||||||
$queue_state = [];
|
$queue_state = [];
|
||||||
$previous = [];
|
$previous = [];
|
||||||
|
@ -1008,6 +1011,13 @@ class ConsoleSupervisor
|
||||||
$key = $queue['id_server'];
|
$key = $queue['id_server'];
|
||||||
$type = $queue['server_type'];
|
$type = $queue['server_type'];
|
||||||
$new_data[$key] = $queue['queued_modules'];
|
$new_data[$key] = $queue['queued_modules'];
|
||||||
|
$max_grown = 0;
|
||||||
|
|
||||||
|
if (is_array($total_modules)
|
||||||
|
&& isset($total_modules[$queue['server_type']])
|
||||||
|
) {
|
||||||
|
$max_grown = ($total_modules[$queue['server_type']] * 0.40);
|
||||||
|
}
|
||||||
|
|
||||||
// Compare queue increments in a not over 900 seconds.
|
// Compare queue increments in a not over 900 seconds.
|
||||||
if (empty($previous[$key]['modules'])
|
if (empty($previous[$key]['modules'])
|
||||||
|
@ -1018,9 +1028,9 @@ class ConsoleSupervisor
|
||||||
|
|
||||||
$modules_queued = ($queue['queued_modules'] - $previous[$key]['modules']);
|
$modules_queued = ($queue['queued_modules'] - $previous[$key]['modules']);
|
||||||
|
|
||||||
// 50 Modules queued since last check. Or more than 1500 queued.
|
// 40% Modules queued since last check. If any.
|
||||||
if ($modules_queued > $MAX_GROWN
|
if ($max_grown > 0
|
||||||
|| $queue['queued_modules'] > $MAX_QUEUE
|
&& $modules_queued > $max_grown
|
||||||
) {
|
) {
|
||||||
$msg = 'Queue has grown %d modules. Total %d';
|
$msg = 'Queue has grown %d modules. Total %d';
|
||||||
if ($modules_queued <= 0) {
|
if ($modules_queued <= 0) {
|
||||||
|
@ -1032,7 +1042,7 @@ class ConsoleSupervisor
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.SERVER.QUEUE.'.$key,
|
'type' => 'NOTIF.SERVER.QUEUE.'.$key,
|
||||||
'title' => __(
|
'title' => __(
|
||||||
'%s (%s) performance is being lacked.',
|
'%s (%s) is lacking performance.',
|
||||||
servers_get_server_string_name($type),
|
servers_get_server_string_name($type),
|
||||||
$queue['name']
|
$queue['name']
|
||||||
),
|
),
|
||||||
|
@ -1076,6 +1086,7 @@ class ConsoleSupervisor
|
||||||
id_server,
|
id_server,
|
||||||
name,
|
name,
|
||||||
server_type,
|
server_type,
|
||||||
|
server_keepalive,
|
||||||
status,
|
status,
|
||||||
unix_timestamp() - unix_timestamp(keepalive) as downtime
|
unix_timestamp() - unix_timestamp(keepalive) as downtime
|
||||||
FROM tserver
|
FROM tserver
|
||||||
|
@ -1099,7 +1110,7 @@ class ConsoleSupervisor
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.SERVER.STATUS',
|
'type' => 'NOTIF.SERVER.STATUS',
|
||||||
'title' => __('No servers available.'),
|
'title' => __('No servers available.'),
|
||||||
'message' => __('There are no servers registered in this console, please check installation guide.'),
|
'message' => __('There are no servers registered in this console. Please, check installation guide.'),
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -1111,28 +1122,35 @@ class ConsoleSupervisor
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($servers as $server) {
|
foreach ($servers as $server) {
|
||||||
|
if ($server['server_type'] == SERVER_TYPE_ENTERPRISE_SATELLITE) {
|
||||||
|
if ($server['downtime'] < ($server['server_keepalive'] * 2)) {
|
||||||
|
// Satellite uses different keepalive mode.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($server['status'] == 1) {
|
if ($server['status'] == 1) {
|
||||||
// Fatal error. Component has die.
|
// Fatal error. Component has die.
|
||||||
$msg = __(
|
$msg = __(
|
||||||
'%s (%s) crashed.',
|
'%s (%s) has crashed.',
|
||||||
servers_get_server_string_name($server['server_type']),
|
servers_get_server_string_name($server['server_type']),
|
||||||
$server['name']
|
$server['name']
|
||||||
);
|
);
|
||||||
|
|
||||||
$description = __(
|
$description = __(
|
||||||
'%s (%s) has died, please check log files',
|
'%s (%s) has crashed, please check log files.',
|
||||||
servers_get_server_string_name($server['server_type']),
|
servers_get_server_string_name($server['server_type']),
|
||||||
$server['name']
|
$server['name']
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// Non-fatal error. Controlated exit. Component is not running.
|
// Non-fatal error. Controlated exit. Component is not running.
|
||||||
$msg = __(
|
$msg = __(
|
||||||
'%s (%s) is stopped.',
|
'%s (%s) is not running.',
|
||||||
servers_get_server_string_name($server['server_type']),
|
servers_get_server_string_name($server['server_type']),
|
||||||
$server['name']
|
$server['name']
|
||||||
);
|
);
|
||||||
$description = __(
|
$description = __(
|
||||||
'%s (%s) is stopped, please check configuration file or remove this server from server list.',
|
'%s (%s) is not running. Please, check configuration file or remove this server from server list.',
|
||||||
servers_get_server_string_name($server['server_type']),
|
servers_get_server_string_name($server['server_type']),
|
||||||
$server['name']
|
$server['name']
|
||||||
);
|
);
|
||||||
|
@ -1183,7 +1201,7 @@ class ConsoleSupervisor
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.SERVER.MASTER',
|
'type' => 'NOTIF.SERVER.MASTER',
|
||||||
'title' => __('No master servers found.'),
|
'title' => __('No master servers found.'),
|
||||||
'message' => __('You should define at last one server to run as master, please check documentation.'),
|
'message' => __('At least one server must be defined to run as master. Please, check documentation.'),
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -1224,12 +1242,17 @@ class ConsoleSupervisor
|
||||||
$php_version_array = explode('.', $php_version);
|
$php_version_array = explode('.', $php_version);
|
||||||
|
|
||||||
if ($PHPsafe_mode === '1') {
|
if ($PHPsafe_mode === '1') {
|
||||||
|
$url = 'http://php.net/manual/en/features.safe-mode.php';
|
||||||
|
if ($config['language'] == 'es') {
|
||||||
|
$url = 'http://php.net/manual/es/features.safe-mode.php';
|
||||||
|
}
|
||||||
|
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PHP.SAFE_MODE',
|
'type' => 'NOTIF.PHP.SAFE_MODE',
|
||||||
'title' => __('PHP safe mode is enabled. Some features may not properly work.'),
|
'title' => __('PHP safe mode is enabled. Some features may not work properly'),
|
||||||
'message' => __('To disable, change it on your PHP configuration file (php.ini) and put safe_mode = Off (Dont forget restart apache process after changes)'),
|
'message' => __('To disable it, go to your PHP configuration file (php.ini) and put safe_mode = Off (Do not forget to restart apache process after changes)'),
|
||||||
'url' => 'index.php',
|
'url' => $url,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1237,18 +1260,23 @@ class ConsoleSupervisor
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($PHPmax_input_time !== '-1') {
|
if ($PHPmax_input_time !== '-1') {
|
||||||
|
$url = 'http://php.net/manual/en/info.configuration.php#ini.max-input-time';
|
||||||
|
if ($config['language'] == 'es') {
|
||||||
|
$url = 'http://php.net/manual/es/info.configuration.php#ini.max-input-time';
|
||||||
|
}
|
||||||
|
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PHP.INPUT_TIME',
|
'type' => 'NOTIF.PHP.INPUT_TIME',
|
||||||
'title' => sprintf(
|
'title' => sprintf(
|
||||||
__("Not recommended '%s' value in PHP configuration"),
|
__("'%s' value in PHP configuration is not recommended"),
|
||||||
'max_input_time'
|
'max_input_time'
|
||||||
),
|
),
|
||||||
'message' => sprintf(
|
'message' => sprintf(
|
||||||
__('Recommended value is %s'),
|
__('Recommended value is %s'),
|
||||||
'-1 ('.__('Unlimited').')'
|
'-1 ('.__('Unlimited').')'
|
||||||
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
|
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Do not forget to restart Apache process after)'),
|
||||||
'url' => 'index.php',
|
'url' => $url,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1256,6 +1284,11 @@ class ConsoleSupervisor
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($PHPmax_execution_time !== '0') {
|
if ($PHPmax_execution_time !== '0') {
|
||||||
|
$url = 'http://php.net/manual/en/info.configuration.php#ini.max-execution-time';
|
||||||
|
if ($config['language'] == 'es') {
|
||||||
|
$url = 'http://php.net/manual/es/info.configuration.php#ini.max-execution-time';
|
||||||
|
}
|
||||||
|
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PHP.EXECUTION_TIME',
|
'type' => 'NOTIF.PHP.EXECUTION_TIME',
|
||||||
|
@ -1267,7 +1300,7 @@ class ConsoleSupervisor
|
||||||
__('Recommended value is: %s'),
|
__('Recommended value is: %s'),
|
||||||
'0 ('.__('Unlimited').')'
|
'0 ('.__('Unlimited').')'
|
||||||
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
|
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
|
||||||
'url' => 'index.php',
|
'url' => $url,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1275,6 +1308,11 @@ class ConsoleSupervisor
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($PHPupload_max_filesize < $PHPupload_max_filesize_min) {
|
if ($PHPupload_max_filesize < $PHPupload_max_filesize_min) {
|
||||||
|
$url = 'http://php.net/manual/en/ini.core.php#ini.upload-max-filesize';
|
||||||
|
if ($config['language'] == 'es') {
|
||||||
|
$url = 'http://php.net/manual/es/ini.core.php#ini.upload-max-filesize';
|
||||||
|
}
|
||||||
|
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PHP.UPLOAD_MAX_FILESIZE',
|
'type' => 'NOTIF.PHP.UPLOAD_MAX_FILESIZE',
|
||||||
|
@ -1286,7 +1324,7 @@ class ConsoleSupervisor
|
||||||
__('Recommended value is: %s'),
|
__('Recommended value is: %s'),
|
||||||
sprintf(__('%s or greater'), '800M')
|
sprintf(__('%s or greater'), '800M')
|
||||||
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
|
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
|
||||||
'url' => 'index.php',
|
'url' => $url,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1294,6 +1332,11 @@ class ConsoleSupervisor
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($PHPmemory_limit < $PHPmemory_limit_min && $PHPmemory_limit !== '-1') {
|
if ($PHPmemory_limit < $PHPmemory_limit_min && $PHPmemory_limit !== '-1') {
|
||||||
|
$url = 'http://php.net/manual/en/ini.core.php#ini.memory-limit';
|
||||||
|
if ($config['language'] == 'es') {
|
||||||
|
$url = 'http://php.net/manual/es/ini.core.php#ini.memory-limit';
|
||||||
|
}
|
||||||
|
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PHP.MEMORY_LIMIT',
|
'type' => 'NOTIF.PHP.MEMORY_LIMIT',
|
||||||
|
@ -1305,7 +1348,7 @@ class ConsoleSupervisor
|
||||||
__('Recommended value is: %s'),
|
__('Recommended value is: %s'),
|
||||||
sprintf(__('%s or greater'), '500M')
|
sprintf(__('%s or greater'), '500M')
|
||||||
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator'),
|
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator'),
|
||||||
'url' => 'index.php',
|
'url' => $url,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1313,12 +1356,17 @@ class ConsoleSupervisor
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/system/', $PHPdisable_functions) || preg_match('/exec/', $PHPdisable_functions)) {
|
if (preg_match('/system/', $PHPdisable_functions) || preg_match('/exec/', $PHPdisable_functions)) {
|
||||||
|
$url = 'http://php.net/manual/en/ini.core.php#ini.disable-functions';
|
||||||
|
if ($config['language'] == 'es') {
|
||||||
|
$url = 'http://php.net/manual/es/ini.core.php#ini.disable-functions';
|
||||||
|
}
|
||||||
|
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PHP.DISABLE_FUNCTIONS',
|
'type' => 'NOTIF.PHP.DISABLE_FUNCTIONS',
|
||||||
'title' => __('Problems with disable functions in PHP.INI'),
|
'title' => __('Problems with disable_functions in php.ini'),
|
||||||
'message' => __('Variable disable_functions containts functions system() or exec(), in PHP configuration file (php.ini)').'<br /><br />'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
|
'message' => __('The variable disable_functions contains functions system() or exec() in PHP configuration file (php.ini)').'<br /><br />'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
|
||||||
'url' => 'index.php',
|
'url' => $url,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1334,8 +1382,8 @@ class ConsoleSupervisor
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PHP.PHANTOMJS',
|
'type' => 'NOTIF.PHP.PHANTOMJS',
|
||||||
'title' => __('phantomjs is not installed'),
|
'title' => __('PhantomJS is not installed'),
|
||||||
'message' => __('To be able to create images of the graphs for PDFs, please install the phantom.js extension. For that, it is necessary to follow these steps:'),
|
'message' => __('To be able to create images of the graphs for PDFs, please install the PhantomJS extension. For that, it is necessary to follow these steps:'),
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -1395,7 +1443,7 @@ class ConsoleSupervisor
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.HISTORYDB',
|
'type' => 'NOTIF.HISTORYDB',
|
||||||
'title' => __('Historical database not available'),
|
'title' => __('Historical database not available'),
|
||||||
'message' => __('Historical database is enabled. But not available using given configuration. Please check it.'),
|
'message' => __('Historical database is enabled, though not accessible with the current configuration.'),
|
||||||
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db',
|
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -1438,9 +1486,9 @@ class ConsoleSupervisor
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PANDORADB',
|
'type' => 'NOTIF.PANDORADB',
|
||||||
'title' => __('Database maintance problem'),
|
'title' => __('Database maintenance problem'),
|
||||||
'message' => __(
|
'message' => __(
|
||||||
'Your database is not maintained correctly. It seems that more than 48hrs have passed without proper maintenance. Please review documents of %s on how to perform this maintenance process (DB Tool) and enable it as soon as possible.',
|
'Your database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.',
|
||||||
io_safe_output(get_product_name())
|
io_safe_output(get_product_name())
|
||||||
),
|
),
|
||||||
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||||
|
@ -1500,9 +1548,9 @@ class ConsoleSupervisor
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PANDORADB.HISTORY',
|
'type' => 'NOTIF.PANDORADB.HISTORY',
|
||||||
'title' => __(
|
'title' => __(
|
||||||
'Historical database maintance problem.'
|
'Historical database maintenance problem.'
|
||||||
),
|
),
|
||||||
'message' => __('Your historical database is not being maintained correctly. It seems that more than 48hrs have passed without proper maintenance. Please review documents of %s on how to perform this maintenance process (DB Tool) and enable it as soon as possible.', get_product_name()),
|
'message' => __('Your historical database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.', get_product_name()),
|
||||||
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -1540,8 +1588,8 @@ class ConsoleSupervisor
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.HISTORYDB.MR',
|
'type' => 'NOTIF.HISTORYDB.MR',
|
||||||
'title' => __('Historical database MR missmatch'),
|
'title' => __('Historical database MR mismatch'),
|
||||||
'message' => __('Your historical database is not using the same schema of main DB. This could produce anomalyes while storing historical data.'),
|
'message' => __('Your historical database is not using the same schema as the main DB. This could produce anomalies while storing historical data.'),
|
||||||
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db',
|
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -1583,7 +1631,7 @@ class ConsoleSupervisor
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.EXT.ELASTICSEARCH',
|
'type' => 'NOTIF.EXT.ELASTICSEARCH',
|
||||||
'title' => __('Log collector cannot connect to ElasticSearch'),
|
'title' => __('Log collector cannot connect to ElasticSearch'),
|
||||||
'message' => __('ElasticSearch is not available using current configuration. Please check it.'),
|
'message' => __('ElasticSearch is not available using current configuration.'),
|
||||||
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=log',
|
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=log',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -1653,7 +1701,7 @@ class ConsoleSupervisor
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.METACONSOLE.DB_CONNECTION',
|
'type' => 'NOTIF.METACONSOLE.DB_CONNECTION',
|
||||||
'title' => __('Metaconsole DB is not available.'),
|
'title' => __('Metaconsole DB is not available.'),
|
||||||
'message' => __('Cannot connect with Metaconsole DB using stored configuration. Please check it.'),
|
'message' => __('Cannot connect with Metaconsole DB using current configuration.'),
|
||||||
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=enterprise',
|
'url' => 'index.php?sec=general&sec2=godmode/setup/setup§ion=enterprise',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -1682,7 +1730,7 @@ class ConsoleSupervisor
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.DOWNTIME',
|
'type' => 'NOTIF.DOWNTIME',
|
||||||
'title' => __('Scheduled downtime running.'),
|
'title' => __('Scheduled downtime running.'),
|
||||||
'message' => __('A scheduled downtime is running. Some monitorization data won\'t be available while downtime is taking place.'),
|
'message' => __('A scheduled downtime is running. Some monitoring data won\'t be available while downtime is taking place.'),
|
||||||
'url' => 'index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list',
|
'url' => 'index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -1840,7 +1888,7 @@ class ConsoleSupervisor
|
||||||
'type' => 'NOTIF.DOWNTIME',
|
'type' => 'NOTIF.DOWNTIME',
|
||||||
'title' => __('Downtime scheduled soon.'),
|
'title' => __('Downtime scheduled soon.'),
|
||||||
'message' => __(
|
'message' => __(
|
||||||
'A scheduled downtime is going to be executed from %s to %s. Some monitorization data won\'t be available while downtime is taking place.',
|
'A scheduled downtime is going to be executed from %s to %s. Some monitoring data won\'t be available while downtime is taking place.',
|
||||||
date('M j, G:i:s ', $next_downtime_begin),
|
date('M j, G:i:s ', $next_downtime_begin),
|
||||||
date('M j, G:i:s ', $next_downtime_end)
|
date('M j, G:i:s ', $next_downtime_end)
|
||||||
),
|
),
|
||||||
|
@ -1876,7 +1924,7 @@ class ConsoleSupervisor
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION',
|
'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION',
|
||||||
'title' => __('This instance is not registered in the Update manager'),
|
'title' => __('This instance is not registered in the Update manager section'),
|
||||||
'message' => __('Click <a style="font-weight:bold; text-decoration:underline" href="javascript: force_run_register();"> here</a> to start the registration process'),
|
'message' => __('Click <a style="font-weight:bold; text-decoration:underline" href="javascript: force_run_register();"> here</a> to start the registration process'),
|
||||||
'url' => 'javascript: force_run_register();',
|
'url' => 'javascript: force_run_register();',
|
||||||
]
|
]
|
||||||
|
@ -1915,7 +1963,7 @@ class ConsoleSupervisor
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.NEWSLETTER.SUBSCRIPTION',
|
'type' => 'NOTIF.NEWSLETTER.SUBSCRIPTION',
|
||||||
'title' => __('Not subscribed to the newsletter'),
|
'title' => __('Not subscribed to the newsletter'),
|
||||||
'message' => __('Click <a style="font-weight:bold; text-decoration:underline" href="javascript: force_run_newsletter();"> here</a> to start the newsletter subscription process'),
|
'message' => __('Click <a style="font-weight:bold; text-decoration:underline" href="javascript: force_run_newsletter();"> here</a> to subscribe to the newsletter'),
|
||||||
'url' => 'javascript: force_run_newsletter();',
|
'url' => 'javascript: force_run_newsletter();',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -1947,8 +1995,8 @@ class ConsoleSupervisor
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.SECURITY.DEFAULT_PASSWORD',
|
'type' => 'NOTIF.SECURITY.DEFAULT_PASSWORD',
|
||||||
'title' => __('Default password for "Admin" user has not been changed.'),
|
'title' => __('Default password for "Admin" user has not been changed'),
|
||||||
'message' => __('Please change the default password because is a common vulnerability reported.'),
|
'message' => __('Please, change the default password since it is a commonly reported vulnerability.'),
|
||||||
'url' => 'index.php?sec=gusuarios&sec2=godmode/users/user_list',
|
'url' => 'index.php?sec=gusuarios&sec2=godmode/users/user_list',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -1973,8 +2021,8 @@ class ConsoleSupervisor
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.MISC.FONTPATH',
|
'type' => 'NOTIF.MISC.FONTPATH',
|
||||||
'title' => __('Default font doesnt exist'),
|
'title' => __('Default font doesn\'t exist'),
|
||||||
'message' => __('Your defined font doesnt exist or is not defined. Please check font parameters in your config'),
|
'message' => __('Your defined font doesn\'t exist or is not defined. Please, check font parameters in your config'),
|
||||||
'url' => 'index.php?sec=gsetup&sec2=godmode/setup/setup§ion=vis',
|
'url' => 'index.php?sec=gsetup&sec2=godmode/setup/setup§ion=vis',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -1999,7 +2047,7 @@ class ConsoleSupervisor
|
||||||
'type' => 'NOTIF.MISC.DEVELOPBYPASS',
|
'type' => 'NOTIF.MISC.DEVELOPBYPASS',
|
||||||
'title' => __('Developer mode is enabled'),
|
'title' => __('Developer mode is enabled'),
|
||||||
'message' => __(
|
'message' => __(
|
||||||
'Your %s has the "develop_bypass" mode enabled. This is a developer mode and should be disabled in a production system. This value is written in the main index.php file',
|
'Your %s has the "develop_bypass" mode enabled. This is a developer mode and should be disabled in a production environment. This value is located in the main index.php file',
|
||||||
get_product_name()
|
get_product_name()
|
||||||
),
|
),
|
||||||
'url' => 'index.php',
|
'url' => 'index.php',
|
||||||
|
@ -2023,8 +2071,8 @@ class ConsoleSupervisor
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.MISC.EVENTSTORMPROTECTION',
|
'type' => 'NOTIF.MISC.EVENTSTORMPROTECTION',
|
||||||
'title' => __('Event storm protection is activated.'),
|
'title' => __('Event storm protection is enabled.'),
|
||||||
'message' => __('You need to restart server after altering this configuration setting. No events will be generated during this mode.'),
|
'message' => __('Some events may get lost while this mode is enabled. The server must be restarted after altering this setting.'),
|
||||||
'url' => 'index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general',
|
'url' => 'index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -2050,7 +2098,7 @@ class ConsoleSupervisor
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.UPDATEMANAGER.OPENSETUP',
|
'type' => 'NOTIF.UPDATEMANAGER.OPENSETUP',
|
||||||
'title' => __('Error, first setup "Open update".'),
|
'title' => __('Failed to retrieve updates, please configure utility'),
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
'url' => 'index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general',
|
'url' => 'index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general',
|
||||||
]
|
]
|
||||||
|
@ -2107,10 +2155,10 @@ class ConsoleSupervisor
|
||||||
'type' => 'NOTIF.UPDATEMANAGER.MINOR',
|
'type' => 'NOTIF.UPDATEMANAGER.MINOR',
|
||||||
'title' => __('Minor release/s available'),
|
'title' => __('Minor release/s available'),
|
||||||
'message' => __(
|
'message' => __(
|
||||||
'There are one or more minor releases waiting for update. <a style="font-size:8pt;font-style:italic;" target="blank" href="%s">.About minor release update</a>.',
|
'There is one or more minor releases available. <a style="font-size:8pt;font-style:italic;" target="blank" href="%s">.About minor release update</a>.',
|
||||||
$url
|
$url
|
||||||
),
|
),
|
||||||
'url' => $url,
|
'url' => 'index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2135,7 +2183,7 @@ class ConsoleSupervisor
|
||||||
) {
|
) {
|
||||||
$message_conf_cron = __('DiscoveryConsoleTasks is not running properly');
|
$message_conf_cron = __('DiscoveryConsoleTasks is not running properly');
|
||||||
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
|
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 .= __('Discovery relies on an appropriate cron setup.');
|
||||||
$message_conf_cron .= '. '.__('Please, add the following line to your crontab file:');
|
$message_conf_cron .= '. '.__('Please, add the following line to your crontab file:');
|
||||||
$message_conf_cron .= '<pre>* * * * * <user> wget -q -O - --no-check-certificate ';
|
$message_conf_cron .= '<pre>* * * * * <user> wget -q -O - --no-check-certificate ';
|
||||||
$message_conf_cron .= str_replace(
|
$message_conf_cron .= str_replace(
|
||||||
|
@ -2151,7 +2199,7 @@ class ConsoleSupervisor
|
||||||
if (isset($config['cron_last_run']) === true) {
|
if (isset($config['cron_last_run']) === true) {
|
||||||
$message_conf_cron .= __('Last execution').': ';
|
$message_conf_cron .= __('Last execution').': ';
|
||||||
$message_conf_cron .= date('Y/m/d H:i:s', $config['cron_last_run']);
|
$message_conf_cron .= date('Y/m/d H:i:s', $config['cron_last_run']);
|
||||||
$message_conf_cron .= __('Please check process is no locked.');
|
$message_conf_cron .= __('Please, make sure process is not locked.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->notify(
|
$this->notify(
|
||||||
|
@ -2159,7 +2207,7 @@ class ConsoleSupervisor
|
||||||
'type' => 'NOTIF.CRON.CONFIGURED',
|
'type' => 'NOTIF.CRON.CONFIGURED',
|
||||||
'title' => __('DiscoveryConsoleTasks is not configured.'),
|
'title' => __('DiscoveryConsoleTasks is not configured.'),
|
||||||
'message' => __($message_conf_cron),
|
'message' => __($message_conf_cron),
|
||||||
'url' => 'index.php?extension_in_menu=gservers&sec=extensions&sec2=enterprise/extensions/cron',
|
'url' => 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -0,0 +1,768 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Extension to schedule tasks on Pandora FMS Console
|
||||||
|
*
|
||||||
|
* @category Wizard
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Host&Devices
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CustomNetScan. Host and devices child class.
|
||||||
|
*/
|
||||||
|
class CustomNetScan extends Wizard
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of pages to control breadcrum.
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
public $MAXPAGES = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Labels for breadcrum.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $pageLabels = [
|
||||||
|
'Netscan Custom definition',
|
||||||
|
'Netscan Custom script',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param integer $page Page.
|
||||||
|
* @param array $breadcrum Breadcrum.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(int $page, array $breadcrum)
|
||||||
|
{
|
||||||
|
$this->url = ui_get_full_url(
|
||||||
|
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd'
|
||||||
|
);
|
||||||
|
$this->page = $page;
|
||||||
|
$this->breadcrum = $breadcrum;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves and validates information given by user in NetScan wizard.
|
||||||
|
*
|
||||||
|
* @return boolean Data OK or not.
|
||||||
|
*/
|
||||||
|
public function parseNetScan()
|
||||||
|
{
|
||||||
|
if (isset($this->page) === true && $this->page === 0) {
|
||||||
|
// Check if we're updating a task.
|
||||||
|
$task_id = get_parameter('task', null);
|
||||||
|
|
||||||
|
if (isset($task_id) === true) {
|
||||||
|
// We're updating this task.
|
||||||
|
$task = db_get_row(
|
||||||
|
'trecon_task',
|
||||||
|
'id_rt',
|
||||||
|
$task_id
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($task !== false) {
|
||||||
|
$this->task = $task;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate response from page 0. No, not a bug, we're always 1 page
|
||||||
|
// from 'validation' page.
|
||||||
|
if (isset($this->page) === true && $this->page === 1) {
|
||||||
|
$task_id = get_parameter('task', null);
|
||||||
|
$taskname = get_parameter('taskname', '');
|
||||||
|
$comment = get_parameter('comment', '');
|
||||||
|
$server_id = get_parameter('id_recon_server', '');
|
||||||
|
$id_group = get_parameter('id_group', '');
|
||||||
|
$interval = get_parameter('interval', 0);
|
||||||
|
|
||||||
|
if (isset($task_id) === true) {
|
||||||
|
// We're updating this task.
|
||||||
|
$task = db_get_row(
|
||||||
|
'trecon_task',
|
||||||
|
'id_rt',
|
||||||
|
$task_id
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($task !== false) {
|
||||||
|
$this->task = $task;
|
||||||
|
}
|
||||||
|
} else if (isset($taskname) === true) {
|
||||||
|
// Avoid double creation.
|
||||||
|
$task = db_get_row_filter(
|
||||||
|
'trecon_task',
|
||||||
|
['name' => $taskname]
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($task !== false) {
|
||||||
|
$this->task = $task;
|
||||||
|
$this->msg = __('This task has been already defined. Please edit it or create a new one.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($task_id !== null
|
||||||
|
&& $taskname == null
|
||||||
|
&& $server_id == null
|
||||||
|
&& $id_group == null
|
||||||
|
&& $server == null
|
||||||
|
&& $datacenter == ''
|
||||||
|
&& $user == ''
|
||||||
|
&& $pass == ''
|
||||||
|
&& $encrypt == null
|
||||||
|
&& $interval == 0
|
||||||
|
) {
|
||||||
|
// Default values, no data received.
|
||||||
|
// User is accesing directly to this page.
|
||||||
|
if (users_is_admin() !== true && check_acl(
|
||||||
|
$config['id_usuario'],
|
||||||
|
$this->task['id_group'],
|
||||||
|
'PM'
|
||||||
|
) !== true
|
||||||
|
) {
|
||||||
|
$this->msg = __('You have no access to edit this task.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isset($this->task['id_rt']) === false) {
|
||||||
|
// Disabled 2 Implies wizard non finished.
|
||||||
|
$this->task['disabled'] = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($taskname == '') {
|
||||||
|
$this->msg = __('You must provide a task name.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($server_id == '') {
|
||||||
|
$this->msg = __('You must select a Discovery Server.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id_group == '') {
|
||||||
|
$this->msg = __('You must select a valid group.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assign fields.
|
||||||
|
$this->task['name'] = $taskname;
|
||||||
|
$this->task['description'] = $comment;
|
||||||
|
$this->task['id_recon_server'] = $server_id;
|
||||||
|
$this->task['id_group'] = $id_group;
|
||||||
|
$this->task['interval_sweep'] = $interval;
|
||||||
|
|
||||||
|
if (isset($this->task['id_rt']) === false) {
|
||||||
|
// Create.
|
||||||
|
$this->task['id_rt'] = db_process_sql_insert(
|
||||||
|
'trecon_task',
|
||||||
|
$this->task
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Update.
|
||||||
|
db_process_sql_update(
|
||||||
|
'trecon_task',
|
||||||
|
$this->task,
|
||||||
|
['id_rt' => $this->task['id_rt']]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate response from page 1.
|
||||||
|
if ($this->page == 2) {
|
||||||
|
$id_rt = get_parameter('task', -1);
|
||||||
|
|
||||||
|
$task = db_get_row(
|
||||||
|
'trecon_task',
|
||||||
|
'id_rt',
|
||||||
|
$id_rt
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($task !== false) {
|
||||||
|
$this->task = $task;
|
||||||
|
} else {
|
||||||
|
$this->msg = __('Failed to find network scan task.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$id_recon_script = get_parameter('id_recon_script', null);
|
||||||
|
$field1 = get_parameter('_field1_', '');
|
||||||
|
$field2 = get_parameter('_field2_', '');
|
||||||
|
$field3 = get_parameter('_field3_', '');
|
||||||
|
$field4 = get_parameter('_field4_', '');
|
||||||
|
|
||||||
|
// Get macros.
|
||||||
|
$macros = get_parameter('macros', null);
|
||||||
|
|
||||||
|
if (empty($macros) === false) {
|
||||||
|
$macros = json_decode(
|
||||||
|
base64_decode($macros),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($macros as $k => $m) {
|
||||||
|
$macros[$k]['value'] = get_parameter($m['macro'], '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->task['id_recon_script'] = $id_recon_script;
|
||||||
|
$this->task['macros'] = io_json_mb_encode($macros);
|
||||||
|
$this->task['field1'] = $field1;
|
||||||
|
$this->task['field2'] = $field2;
|
||||||
|
$this->task['field3'] = $field3;
|
||||||
|
$this->task['field4'] = $field4;
|
||||||
|
|
||||||
|
if ($this->task['disabled'] == 2) {
|
||||||
|
// Wizard finished.
|
||||||
|
$this->task['disabled'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update.
|
||||||
|
$res = db_process_sql_update(
|
||||||
|
'trecon_task',
|
||||||
|
$this->task,
|
||||||
|
['id_rt' => $this->task['id_rt']]
|
||||||
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run function. It will be call into HostsDevices class.
|
||||||
|
* Page 0: Upload form.
|
||||||
|
* Page 1: Task resume.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function runCustomNetScan()
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if (!check_acl($config['id_user'], 0, 'PM')) {
|
||||||
|
db_pandora_audit(
|
||||||
|
'ACL Violation',
|
||||||
|
'Trying to access Custom Net Scan.'
|
||||||
|
);
|
||||||
|
include 'general/noaccess.php';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->parseNetScan() === false) {
|
||||||
|
// Error.
|
||||||
|
ui_print_error_message(
|
||||||
|
$this->msg
|
||||||
|
);
|
||||||
|
|
||||||
|
$form = [
|
||||||
|
'form' => [
|
||||||
|
'method' => 'POST',
|
||||||
|
'action' => $this->url.'&mode=customnetscan&page='.($this->page - 1).'&task='.$this->task['id_rt'],
|
||||||
|
],
|
||||||
|
'inputs' => [
|
||||||
|
[
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'hidden',
|
||||||
|
'name' => 'task',
|
||||||
|
'value' => $this->task['id_rt'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'submit',
|
||||||
|
'label' => __('Go back'),
|
||||||
|
'type' => 'submit',
|
||||||
|
'attributes' => 'class="sub cancel"',
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Check ACL. If user is not able to manage target task,
|
||||||
|
// redirect him to main page.
|
||||||
|
if (users_is_admin() !== true && check_acl(
|
||||||
|
$config['id_usuario'],
|
||||||
|
$this->task['id_group'],
|
||||||
|
'PM'
|
||||||
|
) !== true
|
||||||
|
) {
|
||||||
|
$form['form']['action'] = $this->url.'&mode=customnetscan&page='.($this->page - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->printForm($form);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$run_url = 'index.php?sec=gservers&sec2=godmode/servers/discovery';
|
||||||
|
|
||||||
|
$task_url = '';
|
||||||
|
if (isset($this->task['id_rt']) === true) {
|
||||||
|
$task_url = '&task='.$this->task['id_rt'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$breadcrum = [
|
||||||
|
[
|
||||||
|
'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery',
|
||||||
|
'label' => 'Discovery',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => $run_url.'&wiz=hd',
|
||||||
|
'label' => __('Host & Devices'),
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
for ($i = 0; $i < $this->MAXPAGES; $i++) {
|
||||||
|
$breadcrum[] = [
|
||||||
|
'link' => $run_url.'&wiz=hd&mode=customnetscan&page='.$i.$task_url,
|
||||||
|
'label' => __($this->pageLabels[$i]),
|
||||||
|
'selected' => (($i == $this->page) ? 1 : 0),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->page < $this->MAXPAGES) {
|
||||||
|
// Avoid to print header out of wizard.
|
||||||
|
$this->prepareBreadcrum($breadcrum);
|
||||||
|
|
||||||
|
// Header
|
||||||
|
ui_print_page_header(__('NetScan Custom'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
$task_url = '';
|
||||||
|
if (isset($this->task['id_rt'])) {
|
||||||
|
$task_url = '&task='.$this->task['id_rt'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$breadcrum[] = [
|
||||||
|
'link' => $run_url.'&wiz=hd',
|
||||||
|
'label' => __($this->label),
|
||||||
|
];
|
||||||
|
for ($i = 0; $i < $this->maxPagesNetScan; $i++) {
|
||||||
|
$breadcrum[] = [
|
||||||
|
'link' => $run_url.'&wiz=hd&mode=customnetscan&page='.$i.$task_url,
|
||||||
|
'label' => $this->pageLabelsNetScan[$i],
|
||||||
|
'selected' => (($i == $this->page) ? 1 : 0),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->page < $this->maxPagesNetScan) {
|
||||||
|
// Avoid to print header out of wizard.
|
||||||
|
$this->prepareBreadcrum($breadcrum);
|
||||||
|
|
||||||
|
// Header
|
||||||
|
ui_print_page_header(__('NetScan Custom'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->page) === true
|
||||||
|
&& $this->page !== 0
|
||||||
|
&& isset($this->task['id_rt']) === false
|
||||||
|
) {
|
||||||
|
// Error.
|
||||||
|
ui_print_error_message(
|
||||||
|
__('Internal error, please re-run this wizard.')
|
||||||
|
);
|
||||||
|
|
||||||
|
$form = [
|
||||||
|
'form' => [
|
||||||
|
'method' => 'POST',
|
||||||
|
'action' => $this->url.'&mode=customnetscan&page=0',
|
||||||
|
],
|
||||||
|
'inputs' => [
|
||||||
|
[
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'hidden',
|
||||||
|
'name' => 'page',
|
||||||
|
'value' => 0,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'submit',
|
||||||
|
'label' => __('Go back'),
|
||||||
|
'type' => 'submit',
|
||||||
|
'attributes' => 'class="sub cancel"',
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->printForm($form);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------.
|
||||||
|
// Page 0. wizard starts HERE.
|
||||||
|
// -------------------------------.
|
||||||
|
if (isset($this->page) === true || $this->page == 0) {
|
||||||
|
if (isset($this->page) === false
|
||||||
|
|| $this->page == 0
|
||||||
|
) {
|
||||||
|
$form = [];
|
||||||
|
|
||||||
|
// Input task name.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'label' => '<b>'.__('Task name').'</b>',
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'taskname',
|
||||||
|
'value' => $this->task['name'],
|
||||||
|
'type' => 'text',
|
||||||
|
'size' => 25,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
if (isset($this->task['id_rt']) === true) {
|
||||||
|
// Propagate id.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'task',
|
||||||
|
'value' => $this->task['id_rt'],
|
||||||
|
'type' => 'hidden',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Input task description.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'label' => '<b>'.__('Comment').'</b>',
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'comment',
|
||||||
|
'value' => $this->task['description'],
|
||||||
|
'type' => 'text',
|
||||||
|
'size' => 25,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Input Discovery Server.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'label' => '<b>'.__('Discovery server').'</b>'.ui_print_help_tip(
|
||||||
|
__('You must select a Discovery Server to run the Task, otherwise the Recon Task will never run'),
|
||||||
|
true
|
||||||
|
),
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'select_from_sql',
|
||||||
|
'sql' => sprintf(
|
||||||
|
'SELECT id_server, name
|
||||||
|
FROM tserver
|
||||||
|
WHERE server_type = %d
|
||||||
|
ORDER BY name',
|
||||||
|
SERVER_TYPE_DISCOVERY
|
||||||
|
),
|
||||||
|
'name' => 'id_recon_server',
|
||||||
|
'selected' => $this->task['id_recon_server'],
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Input Group.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'label' => '<b>'.__('Group').'</b>',
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'id_group',
|
||||||
|
'returnAllGroup' => false,
|
||||||
|
'privilege' => 'PM',
|
||||||
|
'type' => 'select_groups',
|
||||||
|
'selected' => $this->task['id_group'],
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Interval and schedules.
|
||||||
|
$interv_manual = 0;
|
||||||
|
if ((int) $this->task['interval_sweep'] == 0) {
|
||||||
|
$interv_manual = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Schedule.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'label' => '<b>'.__('Interval').'</b>'.ui_print_help_tip(
|
||||||
|
__('Manual interval means that it will be executed only On-demand'),
|
||||||
|
true
|
||||||
|
),
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'select',
|
||||||
|
'selected' => $interv_manual,
|
||||||
|
'fields' => [
|
||||||
|
0 => __('Defined'),
|
||||||
|
1 => __('Manual'),
|
||||||
|
],
|
||||||
|
'name' => 'interval_manual_defined',
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
'extra' => '<span id="interval_manual_container">'.html_print_extended_select_for_time(
|
||||||
|
'interval',
|
||||||
|
$this->task['interval_sweep'],
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'0',
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
).ui_print_help_tip(
|
||||||
|
__('The minimum recomended interval for Recon Task is 5 minutes'),
|
||||||
|
true
|
||||||
|
).'</span>',
|
||||||
|
];
|
||||||
|
|
||||||
|
$str = __('Next');
|
||||||
|
|
||||||
|
if (isset($this->task['id_rt']) === true) {
|
||||||
|
$str = __('Update and continue');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Submit button.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'submit',
|
||||||
|
'label' => $str,
|
||||||
|
'type' => 'submit',
|
||||||
|
'attributes' => 'class="sub next"',
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$task_url = '';
|
||||||
|
if (isset($this->task['id_rt'])) {
|
||||||
|
$task_url = '&task='.$this->task['id_rt'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$form['form'] = [
|
||||||
|
'method' => 'POST',
|
||||||
|
'action' => $this->url.'&mode=customnetscan&page='.($this->page + 1).$task_url,
|
||||||
|
];
|
||||||
|
|
||||||
|
// Default.
|
||||||
|
$interval = 600;
|
||||||
|
$unit = 60;
|
||||||
|
if (isset($this->task['interval_sweep']) === true) {
|
||||||
|
$interval = $this->task['interval_sweep'];
|
||||||
|
$unit = $this->getTimeUnit($interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
$form['js'] = '
|
||||||
|
$("select#interval_manual_defined").change(function() {
|
||||||
|
if ($("#interval_manual_defined").val() == 1) {
|
||||||
|
$("#interval_manual_container").hide();
|
||||||
|
$("#text-interval_text").val(0);
|
||||||
|
$("#hidden-interval").val(0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$("#interval_manual_container").show();
|
||||||
|
$("#text-interval_text").val(10);
|
||||||
|
$("#hidden-interval").val('.$interval.');
|
||||||
|
$("#interval_units").val('.$unit.');
|
||||||
|
}
|
||||||
|
}).change();
|
||||||
|
';
|
||||||
|
|
||||||
|
// XXX: Could be improved validating inputs before continue (JS)
|
||||||
|
// Print NetScan page 0.
|
||||||
|
$this->printForm($form);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->page) === true && $this->page === 1) {
|
||||||
|
$name_ipam = 'IPAM Recon';
|
||||||
|
// Recon script.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'label' => '<b>'.__('Recon script').'</b>',
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'select_from_sql',
|
||||||
|
'sql' => sprintf(
|
||||||
|
'SELECT id_recon_script, name FROM trecon_script WHERE name <> "%s" ORDER BY name',
|
||||||
|
$name_ipam
|
||||||
|
),
|
||||||
|
'name' => 'id_recon_script',
|
||||||
|
'selected' => $this->task['id_recon_script'],
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'hidden' => 1,
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'hidden',
|
||||||
|
'name' => 'task',
|
||||||
|
'value' => $this->task['id_rt'],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'hidden' => 1,
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'hidden_extended',
|
||||||
|
'name' => 'macros',
|
||||||
|
'value' => base64_encode($this->task['macros']),
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Explanation.
|
||||||
|
$explanation = db_get_value(
|
||||||
|
'description',
|
||||||
|
'trecon_script',
|
||||||
|
'id_recon_script',
|
||||||
|
$this->task['id_recon_script']
|
||||||
|
);
|
||||||
|
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'label' => '<b>'.__('Explanation').'</b><span id="spinner_recon_script" style="display: none;">'.html_print_image('images/spinner.gif', true).'</span>',
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'textarea',
|
||||||
|
'rows' => 4,
|
||||||
|
'columns' => 60,
|
||||||
|
'name' => 'explanation',
|
||||||
|
'value' => $explanation,
|
||||||
|
'return' => true,
|
||||||
|
'attributes' => 'style="width: 388px;"',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'hidden' => 1,
|
||||||
|
'id' => 'table_recon-macro_field',
|
||||||
|
'label' => '<b>'.__('macro_desc').'</b>'.ui_print_help_tip('macro_help', true),
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'macro_name',
|
||||||
|
'value' => 'macro_value',
|
||||||
|
'type' => 'text',
|
||||||
|
'size' => 100,
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
if (empty($this->task['macros']) === false) {
|
||||||
|
$macros = json_decode($this->task['macros'], true);
|
||||||
|
foreach ($macros as $k => $m) {
|
||||||
|
$label_macro = '';
|
||||||
|
$label_macro .= '<b>'.$m['desc'].'</b>';
|
||||||
|
if (!empty($m['help'])) {
|
||||||
|
$label_macro .= ui_print_help_tip(
|
||||||
|
$m['help'],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($m['hide']) {
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'label' => $label_macro,
|
||||||
|
'id' => 'table_recon-macro'.$m['macro'],
|
||||||
|
'class' => 'macro_field',
|
||||||
|
'arguments' => [
|
||||||
|
'name' => $m['macro'],
|
||||||
|
'value' => $m['value'],
|
||||||
|
'type' => 'password',
|
||||||
|
'size' => 100,
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'label' => $label_macro,
|
||||||
|
'id' => 'table_recon-macro'.$m['macro'],
|
||||||
|
'class' => 'macro_field',
|
||||||
|
'arguments' => [
|
||||||
|
'name' => $m['macro'],
|
||||||
|
'value' => $m['value'],
|
||||||
|
'type' => 'text',
|
||||||
|
'size' => 100,
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Submit button.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'submit',
|
||||||
|
'label' => __('Finish'),
|
||||||
|
'type' => 'submit',
|
||||||
|
'attributes' => 'class="sub next"',
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$form['form'] = [
|
||||||
|
'method' => 'POST',
|
||||||
|
'action' => $this->url.'&mode=customnetscan&page='.($this->page + 1).'&task='.$this->task['id_rt'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$id_task = (isset($this->task['id_rt']) === true) ? $this->task['id_rt'] : 0;
|
||||||
|
|
||||||
|
$url_ajax = $config['homeurl'].'ajax.php';
|
||||||
|
|
||||||
|
$change = '';
|
||||||
|
if (empty($this->task['macros']) !== false) {
|
||||||
|
$change = '.change();';
|
||||||
|
}
|
||||||
|
|
||||||
|
$form['js'] = '
|
||||||
|
$("select#id_recon_script").change(function() {
|
||||||
|
get_explanation_recon_script($(this).val(), "'.$id_task.'", "'.$url_ajax.'");
|
||||||
|
})'.$change;
|
||||||
|
|
||||||
|
$this->printForm($form);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->page) === true && $this->page === 2) {
|
||||||
|
if ($this->task['id_rt']) {
|
||||||
|
// 0 - Is OK.
|
||||||
|
$this->result = 0;
|
||||||
|
$this->msg = __('Task configured.');
|
||||||
|
} else {
|
||||||
|
// 1 - Is NOT OK.
|
||||||
|
$this->result = 1;
|
||||||
|
$this->msg = __('Wizard failed. Cannot configure task.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'result' => $this->result,
|
||||||
|
'id' => $this->task['id_rt'],
|
||||||
|
'msg' => $this->msg,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_require_javascript_file('pandora_modules');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,767 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Extension to schedule tasks on Pandora FMS Console
|
||||||
|
*
|
||||||
|
* @category Wizard
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Host&Devices
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ManageNetScanScripts. Host and devices child class.
|
||||||
|
*/
|
||||||
|
class ManageNetScanScripts extends Wizard
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of pages to control breadcrum.
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
public $MAXPAGES = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Labels for breadcrum.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $pageLabels = [
|
||||||
|
'List net scan scripts',
|
||||||
|
'Operation net scan cripts',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param integer $page Page.
|
||||||
|
* @param array $breadcrum Breadcrum.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(int $page, array $breadcrum)
|
||||||
|
{
|
||||||
|
$this->url = ui_get_full_url(
|
||||||
|
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd'
|
||||||
|
);
|
||||||
|
$this->page = $page;
|
||||||
|
$this->breadcrum = $breadcrum;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run function. It will be call into HostsDevices class.
|
||||||
|
* Page 0: Upload form.
|
||||||
|
* Page 1: Task resume.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function runManageNetScanScript()
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if (check_acl($config['id_user'], 0, 'AW') === 0) {
|
||||||
|
db_pandora_audit(
|
||||||
|
'ACL Violation',
|
||||||
|
'Trying to access Net Scan Script.'
|
||||||
|
);
|
||||||
|
include 'general/noaccess.php';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$run_url = 'index.php?sec=gservers&sec2=godmode/servers/discovery';
|
||||||
|
|
||||||
|
$breadcrum = [
|
||||||
|
[
|
||||||
|
'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery',
|
||||||
|
'label' => 'Discovery',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => $run_url.'&wiz=hd',
|
||||||
|
'label' => __('Host & Devices'),
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
for ($i = 0; $i < $this->MAXPAGES; $i++) {
|
||||||
|
$breadcrum[] = [
|
||||||
|
'link' => $run_url.'&wiz=hd&mode=managenetscanscripts&page='.$i,
|
||||||
|
'label' => __($this->pageLabels[$i]),
|
||||||
|
'selected' => (($i == $this->page) ? 1 : 0),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->page < $this->MAXPAGES) {
|
||||||
|
// Avoid to print header out of wizard.
|
||||||
|
$this->prepareBreadcrum($breadcrum);
|
||||||
|
|
||||||
|
// Header
|
||||||
|
ui_print_page_header(__('Net scan scripts'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
$id_script = get_parameter('id_script', 0);
|
||||||
|
|
||||||
|
// Initialize msg.
|
||||||
|
$msg = [];
|
||||||
|
|
||||||
|
// Operations.
|
||||||
|
$operation_scp = get_parameter('operation_scp', '');
|
||||||
|
if ($operation_scp !== '') {
|
||||||
|
switch ($operation_scp) {
|
||||||
|
case 'update_scp':
|
||||||
|
$msg = $this->updateScanScripts($id_script);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'delete_scp':
|
||||||
|
$msg = $this->deleteScanScripts($id_script);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'create_scp':
|
||||||
|
$msg = $this->createScanScripts($id_script);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Nothing for doing. Never exist other operation.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($this->page) || $this->page === 0) {
|
||||||
|
$this->printListNetScanScripts($msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($this->page) || $this->page === 1) {
|
||||||
|
$this->printFormScanScripts($id_script);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create net scan script.
|
||||||
|
*
|
||||||
|
* @return array Check msg successfully or problem
|
||||||
|
*/
|
||||||
|
private function createScanScripts()
|
||||||
|
{
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
$reconscript_name = get_parameter('form_name', '');
|
||||||
|
$reconscript_description = get_parameter('form_description', '');
|
||||||
|
$reconscript_script = get_parameter('form_script', '');
|
||||||
|
|
||||||
|
// Get macros.
|
||||||
|
$i = 1;
|
||||||
|
$macros = [];
|
||||||
|
while (1) {
|
||||||
|
$macro = (string) get_parameter('field'.$i.'_macro');
|
||||||
|
if ($macro == '') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$desc = (string) get_parameter('field'.$i.'_desc');
|
||||||
|
$help = (string) get_parameter('field'.$i.'_help');
|
||||||
|
$value = (string) get_parameter('field'.$i.'_value');
|
||||||
|
$hide = get_parameter('field'.$i.'_hide');
|
||||||
|
|
||||||
|
$macros[$i]['macro'] = $macro;
|
||||||
|
$macros[$i]['desc'] = $desc;
|
||||||
|
$macros[$i]['help'] = $help;
|
||||||
|
$macros[$i]['value'] = $value;
|
||||||
|
$macros[$i]['hide'] = $hide;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$macros = io_json_mb_encode($macros);
|
||||||
|
|
||||||
|
$values = [
|
||||||
|
'name' => $reconscript_name,
|
||||||
|
'description' => $reconscript_description,
|
||||||
|
'script' => $reconscript_script,
|
||||||
|
'macros' => $macros,
|
||||||
|
];
|
||||||
|
|
||||||
|
$result_crt = false;
|
||||||
|
if ($values['name'] !== '' && $values['script'] !== '') {
|
||||||
|
$result_crt = db_process_sql_insert('trecon_script', $values);
|
||||||
|
if (!$result_crt) {
|
||||||
|
$result = [
|
||||||
|
'error' => 1,
|
||||||
|
'msg' => __('Problem creating'),
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$result = [
|
||||||
|
'error' => 0,
|
||||||
|
'msg' => __('Created successfully'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = [
|
||||||
|
'error' => 1,
|
||||||
|
'msg' => __('Name or Script fullpath they can not be empty'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update net scan script.
|
||||||
|
*
|
||||||
|
* @param integer $id_script Id script.
|
||||||
|
*
|
||||||
|
* @return array Check msg successfully or problem
|
||||||
|
*/
|
||||||
|
private function updateScanScripts(int $id_script)
|
||||||
|
{
|
||||||
|
$result = [];
|
||||||
|
if (isset($id_script) === false || $id_script === 0) {
|
||||||
|
$result = [
|
||||||
|
'error' => 1,
|
||||||
|
'msg' => __('Problem deleting Net scan Scripts, Not selected script'),
|
||||||
|
];
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If modified any parameter.
|
||||||
|
$reconscript_name = get_parameter('form_name', '');
|
||||||
|
$reconscript_description = get_parameter('form_description', '');
|
||||||
|
$reconscript_script = get_parameter('form_script', '');
|
||||||
|
|
||||||
|
// Get macros.
|
||||||
|
$i = 1;
|
||||||
|
$macros = [];
|
||||||
|
while (1) {
|
||||||
|
$macro = (string) get_parameter('field'.$i.'_macro');
|
||||||
|
if ($macro == '') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$desc = (string) get_parameter('field'.$i.'_desc');
|
||||||
|
$help = (string) get_parameter('field'.$i.'_help');
|
||||||
|
$value = (string) get_parameter('field'.$i.'_value');
|
||||||
|
$hide = get_parameter('field'.$i.'_hide');
|
||||||
|
|
||||||
|
$macros[$i]['macro'] = $macro;
|
||||||
|
$macros[$i]['desc'] = $desc;
|
||||||
|
$macros[$i]['help'] = $help;
|
||||||
|
$macros[$i]['value'] = $value;
|
||||||
|
$macros[$i]['hide'] = $hide;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$macros = io_json_mb_encode($macros);
|
||||||
|
|
||||||
|
$sql_update = sprintf(
|
||||||
|
"UPDATE trecon_script SET
|
||||||
|
name = '%s',
|
||||||
|
description = '%s',
|
||||||
|
script = '%s',
|
||||||
|
macros = '%s'
|
||||||
|
WHERE id_recon_script = %d",
|
||||||
|
$reconscript_name,
|
||||||
|
$reconscript_description,
|
||||||
|
$reconscript_script,
|
||||||
|
$macros,
|
||||||
|
$id_script
|
||||||
|
);
|
||||||
|
|
||||||
|
$result_upd = false;
|
||||||
|
if ($reconscript_name !== '' && $reconscript_script !== '') {
|
||||||
|
$result_upd = db_process_sql($sql_update);
|
||||||
|
if (!$result_upd) {
|
||||||
|
$result = [
|
||||||
|
'error' => 1,
|
||||||
|
'msg' => __('Problem updating'),
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$result = [
|
||||||
|
'error' => 0,
|
||||||
|
'msg' => __('Updated successfully'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = [
|
||||||
|
'error' => 1,
|
||||||
|
'msg' => __('Name or Script fullpath they can not be empty'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete net scan script.
|
||||||
|
*
|
||||||
|
* @param integer $id_script Id script.
|
||||||
|
*
|
||||||
|
* @return array Check msg successfully or problem
|
||||||
|
*/
|
||||||
|
private function deleteScanScripts(int $id_script)
|
||||||
|
{
|
||||||
|
$result = [];
|
||||||
|
if (isset($id_script) === false || $id_script === 0) {
|
||||||
|
$result = [
|
||||||
|
'error' => 1,
|
||||||
|
'msg' => __('Problem deleting Net scan Scripts, Not selected script'),
|
||||||
|
];
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result_dlt = db_process_sql_delete(
|
||||||
|
'trecon_script',
|
||||||
|
['id_recon_script' => $id_script]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!$result_dlt) {
|
||||||
|
$result = [
|
||||||
|
'error' => 1,
|
||||||
|
'msg' => __('Problem deleting Net scan Scripts'),
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$result_dlt2 = db_process_sql_delete(
|
||||||
|
'trecon_task',
|
||||||
|
['id_recon_script' => $id_script]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!$result_dlt2) {
|
||||||
|
$result = [
|
||||||
|
'error' => 1,
|
||||||
|
'msg' => __('Problem deleting Net scan Scripts'),
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$result = [
|
||||||
|
'error' => 0,
|
||||||
|
'msg' => __('Deleted successfully'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print list Net scan scripts and messages operations.
|
||||||
|
*
|
||||||
|
* @param array $msg Print msg if necessary.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function printListNetScanScripts(array $msg)
|
||||||
|
{
|
||||||
|
if (count($msg) > 0) {
|
||||||
|
if ($msg['error'] === 1) {
|
||||||
|
ui_print_error_message($msg['msg']);
|
||||||
|
} else {
|
||||||
|
ui_print_success_message($msg['msg']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = 'index.php?sec=gservers&sec2=godmode/servers/discovery';
|
||||||
|
$url .= '&wiz=hd&mode=managenetscanscripts';
|
||||||
|
|
||||||
|
// List available Net scan scripts.
|
||||||
|
$rows = db_get_all_rows_in_table('trecon_script');
|
||||||
|
|
||||||
|
if ($rows !== false) {
|
||||||
|
echo '<table width="100%" cellspacing="4" cellpadding="4" class="databox data">';
|
||||||
|
echo '<th>'.__('Name').'</th>';
|
||||||
|
echo '<th>'.__('Description').'</th>';
|
||||||
|
echo '<th>'.__('Delete').'</th>';
|
||||||
|
$color = 0;
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
if ($color == 1) {
|
||||||
|
$tdcolor = 'datos';
|
||||||
|
$color = 0;
|
||||||
|
} else {
|
||||||
|
$tdcolor = 'datos2';
|
||||||
|
$color = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<tr>';
|
||||||
|
echo "<td class='".$tdcolor."' style='min-width: 100px;'>";
|
||||||
|
echo '<b><a href="'.$url.'&page=1&id_script='.$row['id_recon_script'].'">';
|
||||||
|
echo $row['name'];
|
||||||
|
echo '</a></b></td>';
|
||||||
|
echo "</td><td class='".$tdcolor."'>";
|
||||||
|
$desc = io_safe_output(
|
||||||
|
$row['description']
|
||||||
|
);
|
||||||
|
|
||||||
|
$desc = str_replace(
|
||||||
|
"\n",
|
||||||
|
'<br>',
|
||||||
|
$desc
|
||||||
|
);
|
||||||
|
|
||||||
|
echo $desc.'<br><br>';
|
||||||
|
echo '<b>'.__('Command').': </b><i>'.$row['script'].'</i>';
|
||||||
|
echo "</td><td align='center' class='".$tdcolor."'>";
|
||||||
|
// Delete.
|
||||||
|
echo '<form
|
||||||
|
method="post"
|
||||||
|
onsubmit="if (! confirm (\''.__('Are you sure delete script?').'\')) return false"
|
||||||
|
style="display: inline;">';
|
||||||
|
echo html_print_input_hidden('page', 0, true);
|
||||||
|
echo html_print_input_hidden(
|
||||||
|
'operation_scp',
|
||||||
|
'delete_scp',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
echo html_print_input_hidden(
|
||||||
|
'id_script',
|
||||||
|
$row['id_recon_script'],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
echo html_print_input_image(
|
||||||
|
'delete',
|
||||||
|
'images/cross.png',
|
||||||
|
1,
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => __('Delete Script'),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
echo '</form>';
|
||||||
|
echo '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</table>';
|
||||||
|
|
||||||
|
echo "<form name=reconscript method='post' action='".$url."'>";
|
||||||
|
echo html_print_input_hidden('page', 1, true);
|
||||||
|
echo "<input name='crtbutton' style='float:right;' type='submit' class='sub next' value='".__('Add')."'>";
|
||||||
|
echo '</form>';
|
||||||
|
} else {
|
||||||
|
ui_print_info_message(
|
||||||
|
[
|
||||||
|
'no_close' => true,
|
||||||
|
'message' => __(
|
||||||
|
'There are no net scan scripts in the system'
|
||||||
|
),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print form net scan scripts.
|
||||||
|
*
|
||||||
|
* @param integer $id_script Id script.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function printFormScanScripts(int $id_script)
|
||||||
|
{
|
||||||
|
// Initialize vars.
|
||||||
|
if ($id_script !== 0) {
|
||||||
|
$form_id = $id_script;
|
||||||
|
$reconscript = db_get_row(
|
||||||
|
'trecon_script',
|
||||||
|
'id_recon_script',
|
||||||
|
$form_id
|
||||||
|
);
|
||||||
|
$form_name = $reconscript['name'];
|
||||||
|
$form_description = $reconscript['description'];
|
||||||
|
$form_script = $reconscript['script'];
|
||||||
|
$macros = $reconscript['macros'];
|
||||||
|
} else {
|
||||||
|
$form_name = '';
|
||||||
|
$form_description = '';
|
||||||
|
$form_script = '';
|
||||||
|
$macros = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = 'index.php?sec=gservers&sec2=godmode/servers/discovery';
|
||||||
|
$url .= '&wiz=hd&mode=managenetscanscripts';
|
||||||
|
|
||||||
|
if ($id_script !== 0) {
|
||||||
|
echo '<form name=reconscript method="post" action="'.$url.'&id_script='.$id_script.'">';
|
||||||
|
echo html_print_input_hidden('page', 0, true);
|
||||||
|
echo html_print_input_hidden(
|
||||||
|
'operation_scp',
|
||||||
|
'update_scp',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
echo '<form name=reconscript method="post" action="'.$url.'">';
|
||||||
|
echo html_print_input_hidden('page', 0, true);
|
||||||
|
echo html_print_input_hidden(
|
||||||
|
'operation_scp',
|
||||||
|
'create_scp',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$table = new stdClass();
|
||||||
|
$table->width = '100%';
|
||||||
|
$table->id = 'table-form';
|
||||||
|
$table->class = 'databox filters';
|
||||||
|
$table->style = [];
|
||||||
|
$table->style[0] = 'font-weight: bold';
|
||||||
|
$table->style[2] = 'font-weight: bold';
|
||||||
|
$table->data = [];
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$data[0] = __('Name');
|
||||||
|
$data[0] .= ui_print_help_icon(
|
||||||
|
'reconscript_definition',
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
'images/help_w.png'
|
||||||
|
);
|
||||||
|
|
||||||
|
$data[1] = '<input type="text" name="form_name" size=30 value="'.$form_name.'">';
|
||||||
|
$table->data['recon_name'] = $data;
|
||||||
|
$table->colspan['recon_name'][1] = 3;
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$data[0] = __('Script fullpath');
|
||||||
|
$data[1] = '<input type="text" name="form_script" size=70 value="'.$form_script.'">';
|
||||||
|
$table->data['recon_fullpath'] = $data;
|
||||||
|
$table->colspan['recon_fullpath'][1] = 3;
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$data[0] = __('Description');
|
||||||
|
$data[1] = '<textarea name="form_description" cols="50" rows="4">';
|
||||||
|
$data[1] .= $form_description;
|
||||||
|
$data[1] .= '</textarea>';
|
||||||
|
$table->data['recon_description'] = $data;
|
||||||
|
$table->colspan['recon_description'][1] = 3;
|
||||||
|
|
||||||
|
$macros = json_decode($macros, true);
|
||||||
|
|
||||||
|
// This code is ready to add locked feature as plugins.
|
||||||
|
$locked = false;
|
||||||
|
|
||||||
|
// The next row number is recon_3.
|
||||||
|
$next_name_number = 3;
|
||||||
|
$i = 1;
|
||||||
|
while (1) {
|
||||||
|
// Always print at least one macro.
|
||||||
|
if ((!isset($macros[$i]) || $macros[$i]['desc'] == '') && $i > 1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$macro_desc_name = 'field'.$i.'_desc';
|
||||||
|
$macro_desc_value = '';
|
||||||
|
$macro_help_name = 'field'.$i.'_help';
|
||||||
|
$macro_help_value = '';
|
||||||
|
$macro_value_name = 'field'.$i.'_value';
|
||||||
|
$macro_value_value = '';
|
||||||
|
$macro_name_name = 'field'.$i.'_macro';
|
||||||
|
$macro_name = '_field'.$i.'_';
|
||||||
|
$macro_hide_value_name = 'field'.$i.'_hide';
|
||||||
|
$macro_hide_value_value = 0;
|
||||||
|
|
||||||
|
if (isset($macros[$i]['desc'])) {
|
||||||
|
$macro_desc_value = $macros[$i]['desc'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($macros[$i]['help'])) {
|
||||||
|
$macro_help_value = $macros[$i]['help'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($macros[$i]['value'])) {
|
||||||
|
$macro_value_value = $macros[$i]['value'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($macros[$i]['hide'])) {
|
||||||
|
$macro_hide_value_value = $macros[$i]['hide'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$datam = [];
|
||||||
|
$datam[0] = __('Description');
|
||||||
|
$datam[0] .= "<span style='font-weight: normal'> ( ";
|
||||||
|
$datam[0] .= $macro_name;
|
||||||
|
$datam[0] .= ' )</span>';
|
||||||
|
$datam[0] .= html_print_input_hidden(
|
||||||
|
$macro_name_name,
|
||||||
|
$macro_name,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$datam[1] = html_print_input_text_extended(
|
||||||
|
$macro_desc_name,
|
||||||
|
$macro_desc_value,
|
||||||
|
'text-'.$macro_desc_name,
|
||||||
|
'',
|
||||||
|
30,
|
||||||
|
255,
|
||||||
|
$locked,
|
||||||
|
'',
|
||||||
|
"class='command_advanced_conf'",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
if ($locked) {
|
||||||
|
$datam[1] .= html_print_image(
|
||||||
|
'images/lock.png',
|
||||||
|
true,
|
||||||
|
['class' => 'command_advanced_conf']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$datam[2] = __('Default value');
|
||||||
|
$datam[2] .= "<span style='font-weight: normal'> ( ";
|
||||||
|
$datam[2] .= $macro_name;
|
||||||
|
$datam[2] .= ' ) </span>';
|
||||||
|
$datam[3] = html_print_input_text_extended(
|
||||||
|
$macro_value_name,
|
||||||
|
$macro_value_value,
|
||||||
|
'text-'.$macro_value_name,
|
||||||
|
'',
|
||||||
|
30,
|
||||||
|
255,
|
||||||
|
$locked,
|
||||||
|
'',
|
||||||
|
"class='command_component command_advanced_conf'",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
if ($locked) {
|
||||||
|
$datam[3] .= html_print_image(
|
||||||
|
'images/lock.png',
|
||||||
|
true,
|
||||||
|
['class' => 'command_advanced_conf']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->data['recon_'.$next_name_number] = $datam;
|
||||||
|
|
||||||
|
$next_name_number++;
|
||||||
|
|
||||||
|
$table->colspan['recon_'.$next_name_number][1] = 3;
|
||||||
|
|
||||||
|
$datam = [];
|
||||||
|
$datam[0] = __('Hide value');
|
||||||
|
$datam[0] .= ui_print_help_tip(
|
||||||
|
__('This field will show up as dots like a password'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$datam[1] = html_print_checkbox_extended(
|
||||||
|
$macro_hide_value_name,
|
||||||
|
1,
|
||||||
|
$macro_hide_value_value,
|
||||||
|
0,
|
||||||
|
'',
|
||||||
|
['class' => 'command_advanced_conf'],
|
||||||
|
true,
|
||||||
|
'checkbox-'.$macro_hide_value_name
|
||||||
|
);
|
||||||
|
|
||||||
|
$table->data['recon_'.$next_name_number] = $datam;
|
||||||
|
$next_name_number++;
|
||||||
|
|
||||||
|
$table->colspan['recon_'.$next_name_number][1] = 3;
|
||||||
|
|
||||||
|
$datam = [];
|
||||||
|
$datam[0] = __('Help');
|
||||||
|
$datam[0] .= "<span style='font-weight: normal'> ( ";
|
||||||
|
$datam[0] .= $macro_name;
|
||||||
|
$datam[0] .= ' )</span><br><br><br>';
|
||||||
|
|
||||||
|
$tadisabled = ($locked === true) ? ' disabled' : '';
|
||||||
|
|
||||||
|
$datam[1] = html_print_textarea(
|
||||||
|
$macro_help_name,
|
||||||
|
6,
|
||||||
|
100,
|
||||||
|
$macro_help_value,
|
||||||
|
'class="command_advanced_conf" style="width: 97%;"'.$tadisabled,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($locked) {
|
||||||
|
$datam[1] .= html_print_image(
|
||||||
|
'images/lock.png',
|
||||||
|
true,
|
||||||
|
['class' => 'command_advanced_conf']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$datam[1] .= '<br><br><br>';
|
||||||
|
|
||||||
|
$table->data['recon_'.$next_name_number] = $datam;
|
||||||
|
$next_name_number++;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$locked) {
|
||||||
|
$datam = [];
|
||||||
|
$datam[0] = '<span style="font-weight: bold">';
|
||||||
|
$datam[0] .= __('Add macro').'</span>';
|
||||||
|
$datam[0] .= '<a href="javascript:new_macro(\'table-form-recon_\');update_preview();">';
|
||||||
|
$datam[0] .= html_print_image(
|
||||||
|
'images/add.png',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$datam[0] .= '</a>';
|
||||||
|
$datam[0] .= '<div id="next_macro" style="display:none">';
|
||||||
|
$datam[0] .= $i.'</div>';
|
||||||
|
$datam[0] .= '<div id="next_row" style="display:none">';
|
||||||
|
$datam[0] .= $next_name_number.'</div>';
|
||||||
|
|
||||||
|
$delete_macro_style = '';
|
||||||
|
if ($i <= 2) {
|
||||||
|
$delete_macro_style = 'display:none;';
|
||||||
|
}
|
||||||
|
|
||||||
|
$datam[2] = '<div id="delete_macro_button" style="'.$delete_macro_style.'">';
|
||||||
|
$datam[2] .= __('Delete macro');
|
||||||
|
$datam[2] .= '<a href="javascript:delete_macro_form(\'table-form-recon_\');update_preview();">';
|
||||||
|
$datam[2] .= html_print_image(
|
||||||
|
'images/delete.png',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$datam[2] .= '</a></div>';
|
||||||
|
|
||||||
|
$table->colspan['recon_action'][0] = 2;
|
||||||
|
$table->rowstyle['recon_action'] = 'text-align:center';
|
||||||
|
$table->colspan['recon_action'][2] = 2;
|
||||||
|
$table->data['recon_action'] = $datam;
|
||||||
|
}
|
||||||
|
|
||||||
|
html_print_table($table);
|
||||||
|
|
||||||
|
echo '<table width=100%>';
|
||||||
|
echo '<tr><td align="right">';
|
||||||
|
|
||||||
|
if ($id_script === 0) {
|
||||||
|
echo "<input name='crtbutton' type='submit' class='sub wand' value='".__('Create')."'>";
|
||||||
|
} else {
|
||||||
|
echo "<input name='uptbutton' type='submit' class='sub upd' value='".__('Update')."'>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</form></table>';
|
||||||
|
|
||||||
|
ui_require_javascript_file('pandora_modules');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -195,6 +195,14 @@ define('AGENT_STATUS_UNKNOWN', 3);
|
||||||
define('AGENT_STATUS_ALERT_FIRED', 4);
|
define('AGENT_STATUS_ALERT_FIRED', 4);
|
||||||
define('AGENT_STATUS_WARNING', 2);
|
define('AGENT_STATUS_WARNING', 2);
|
||||||
|
|
||||||
|
// Pseudo criticity analysis.
|
||||||
|
define('NO_CRIT', -1);
|
||||||
|
define('CRIT_0', 0);
|
||||||
|
define('CRIT_1', 1);
|
||||||
|
define('CRIT_2', 2);
|
||||||
|
define('CRIT_3', 3);
|
||||||
|
define('CRIT_4', 4);
|
||||||
|
define('CRIT_5', 5);
|
||||||
|
|
||||||
// Visual maps contants.
|
// Visual maps contants.
|
||||||
// The items kind.
|
// The items kind.
|
||||||
|
@ -506,6 +514,18 @@ define('OPTION_COLOR_PICKER', 11);
|
||||||
define('NODE_TYPE', 0);
|
define('NODE_TYPE', 0);
|
||||||
define('ARROW_TYPE', 1);
|
define('ARROW_TYPE', 1);
|
||||||
|
|
||||||
|
// Discovery task steps.
|
||||||
|
define('STEP_SCANNING', 1);
|
||||||
|
define('STEP_AFT', 2);
|
||||||
|
define('STEP_TRACEROUTE', 3);
|
||||||
|
define('STEP_GATEWAY', 4);
|
||||||
|
|
||||||
|
// Networkmap node types.
|
||||||
|
define('NODE_AGENT', 0);
|
||||||
|
define('NODE_MODULE', 1);
|
||||||
|
define('NODE_PANDORA', 2);
|
||||||
|
define('NODE_GENERIC', 3);
|
||||||
|
|
||||||
// SAML attributes constants.
|
// SAML attributes constants.
|
||||||
define('SAML_ROLE_AND_TAG', 'eduPersonEntitlement');
|
define('SAML_ROLE_AND_TAG', 'eduPersonEntitlement');
|
||||||
define('SAML_USER_DESC', 'commonName');
|
define('SAML_USER_DESC', 'commonName');
|
||||||
|
@ -535,12 +555,41 @@ define('MAP_GENERATION_RADIAL', 2);
|
||||||
define('MAP_GENERATION_SPRING1', 3);
|
define('MAP_GENERATION_SPRING1', 3);
|
||||||
define('MAP_GENERATION_SPRING2', 4);
|
define('MAP_GENERATION_SPRING2', 4);
|
||||||
|
|
||||||
|
// Algorithm: Circo.
|
||||||
|
define('LAYOUT_CIRCULAR', 0);
|
||||||
|
// Algorithm: Dot.
|
||||||
|
define('LAYOUT_FLAT', 1);
|
||||||
|
// Algorithm: Twopi.
|
||||||
|
define('LAYOUT_RADIAL', 2);
|
||||||
|
// Algorithm: Neato.
|
||||||
|
define('LAYOUT_SPRING1', 3);
|
||||||
|
// Algorithm: Fdp.
|
||||||
|
define('LAYOUT_SPRING2', 4);
|
||||||
|
// Extra: radial dynamic.
|
||||||
|
define('LAYOUT_RADIAL_DYNAMIC', 6);
|
||||||
|
|
||||||
|
// Map sources.
|
||||||
|
define('SOURCE_GROUP', 0);
|
||||||
|
define('SOURCE_TASK', 1);
|
||||||
|
define('SOURCE_NETWORK', 2);
|
||||||
|
|
||||||
|
// Backward compatibility ~ Migration.
|
||||||
define('MAP_SOURCE_GROUP', 0);
|
define('MAP_SOURCE_GROUP', 0);
|
||||||
define('MAP_SOURCE_IP_MASK', 1);
|
define('MAP_SOURCE_IP_MASK', 1);
|
||||||
|
|
||||||
define('NETWORKMAP_DEFAULT_WIDTH', 800);
|
define('NETWORKMAP_DEFAULT_WIDTH', 800);
|
||||||
define('NETWORKMAP_DEFAULT_HEIGHT', 800);
|
define('NETWORKMAP_DEFAULT_HEIGHT', 800);
|
||||||
|
|
||||||
|
// Discovery task types.
|
||||||
|
define('DISCOVERY_HOSTDEVICES', 0);
|
||||||
|
define('DISCOVERY_HOSTDEVICES_CUSTOM', 1);
|
||||||
|
define('DISCOVERY_CLOUD_AWS', 10);
|
||||||
|
define('DISCOVERY_APP_VMWARE', 100);
|
||||||
|
|
||||||
|
// Discovery task descriptions.
|
||||||
|
define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2');
|
||||||
|
define('CLOUDWIZARD_VMWARE_DESCRIPTION', 'Discovery.App.VMware');
|
||||||
|
|
||||||
// Background options.
|
// Background options.
|
||||||
define('CENTER', 0);
|
define('CENTER', 0);
|
||||||
define('MOSAIC', 1);
|
define('MOSAIC', 1);
|
||||||
|
|
|
@ -434,15 +434,15 @@ function agents_get_agents(
|
||||||
$filter_nogroup = $filter;
|
$filter_nogroup = $filter;
|
||||||
|
|
||||||
// Get user groups
|
// Get user groups
|
||||||
$groups = array_keys(users_get_groups($config['id_user'], $access, false));
|
$groups = array_keys(users_get_groups($config['id_user'], $access, true));
|
||||||
|
|
||||||
// If no group specified, get all user groups
|
// If no group specified, get all user groups
|
||||||
if (empty($filter['id_grupo'])) {
|
if (isset($filter['id_grupo']) === false) {
|
||||||
$all_groups = true;
|
$all_groups = true;
|
||||||
$filter['id_grupo'] = $groups;
|
$filter['id_grupo'] = $groups;
|
||||||
} else if (! is_array($filter['id_grupo'])) {
|
} else if (! is_array($filter['id_grupo'])) {
|
||||||
$all_groups = false;
|
$all_groups = false;
|
||||||
// If group is specified but not allowed, return false
|
// If group is specified but not allowed, return false.
|
||||||
if (! in_array($filter['id_grupo'], $groups)) {
|
if (! in_array($filter['id_grupo'], $groups)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -466,11 +466,6 @@ function agents_get_agents(
|
||||||
|
|
||||||
$filter['id_group'] = $filter['id_grupo'];
|
$filter['id_group'] = $filter['id_grupo'];
|
||||||
|
|
||||||
if (in_array(0, $filter['id_grupo'])) {
|
|
||||||
unset($filter['id_grupo']);
|
|
||||||
unset($filter['id_group']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_array($fields)) {
|
if (!is_array($fields)) {
|
||||||
$fields = [];
|
$fields = [];
|
||||||
$fields[0] = 'id_agente';
|
$fields[0] = 'id_agente';
|
||||||
|
@ -578,6 +573,7 @@ function agents_get_agents(
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = sprintf('%s %s', $sql, $limit_sql);
|
$sql = sprintf('%s %s', $sql, $limit_sql);
|
||||||
|
|
||||||
if ($return) {
|
if ($return) {
|
||||||
return $sql;
|
return $sql;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2202,7 +2198,7 @@ function agents_delete_agent($id_agents, $disableACL=false)
|
||||||
|
|
||||||
// Delete agent in networkmap enterprise
|
// Delete agent in networkmap enterprise
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
enterprise_include_once('include/functions_pandora_networkmap.php');
|
enterprise_include_once('include/functions_networkmap.php');
|
||||||
networkmap_delete_nodes_by_agent([$id_agent]);
|
networkmap_delete_nodes_by_agent([$id_agent]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2700,9 +2700,7 @@ function config_check()
|
||||||
if (enterprise_installed() === false) {
|
if (enterprise_installed() === false) {
|
||||||
$supervisor = new ConsoleSupervisor(false);
|
$supervisor = new ConsoleSupervisor(false);
|
||||||
$supervisor->run();
|
$supervisor->run();
|
||||||
} else if ($config['cron_last_run'] == 0
|
} else {
|
||||||
|| (get_system_time() - $config['cron_last_run']) > 3600
|
|
||||||
) {
|
|
||||||
$supervisor = new ConsoleSupervisor(false);
|
$supervisor = new ConsoleSupervisor(false);
|
||||||
$supervisor->runBasic();
|
$supervisor->runBasic();
|
||||||
}
|
}
|
||||||
|
|
|
@ -382,13 +382,16 @@ function extensions_load_extensions($process_login)
|
||||||
// ~ else {
|
// ~ else {
|
||||||
try {
|
try {
|
||||||
include_once $path_extension;
|
include_once $path_extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PHP 7
|
// PHP 7
|
||||||
catch (Throwable $e) {
|
catch (Throwable $e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// PHP 5
|
// PHP 5
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ }
|
// ~ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,3 +188,252 @@ function maps_add_node_relationship($values)
|
||||||
$result_add_node_rel = db_process_sql_insert('trel_item', $values);
|
$result_add_node_rel = db_process_sql_insert('trel_item', $values);
|
||||||
return $result_add_node_rel;
|
return $result_add_node_rel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function run_graphviz($filename_map, $filename_dot, $layout, $graph)
|
||||||
|
{
|
||||||
|
switch (PHP_OS) {
|
||||||
|
case 'WIN32':
|
||||||
|
case 'WINNT':
|
||||||
|
case 'Windows':
|
||||||
|
$filename_plain = sys_get_temp_dir().'\\plain.txt';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$filename_plain = sys_get_temp_dir().'/plain.txt';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
file_put_contents($filename_dot, $graph);
|
||||||
|
file_put_contents($filename_dot, $graph);
|
||||||
|
|
||||||
|
$cmd = $layout.' -Tcmapx -o'.$filename_map.' -Tplain -o'.$filename_plain.' '.$filename_dot;
|
||||||
|
|
||||||
|
system($cmd);
|
||||||
|
|
||||||
|
if (file_exists($filename_map)) {
|
||||||
|
unlink($filename_map);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_exists($filename_dot)) {
|
||||||
|
unlink($filename_dot);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $filename_plain;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function open_graph($size_x=50, $size_y=25)
|
||||||
|
{
|
||||||
|
$size = '';
|
||||||
|
|
||||||
|
$size = $size_x.','.$size_y;
|
||||||
|
|
||||||
|
// BEWARE: graphwiz DONT use single ('), you need double (").
|
||||||
|
$head = 'graph vmwaremap { labeljust=l; margin=0; ';
|
||||||
|
$head .= 'ratio=fill;';
|
||||||
|
$head .= 'root=0;';
|
||||||
|
$head .= 'rankdir=LR;';
|
||||||
|
$head .= 'size="'.$size.'";';
|
||||||
|
|
||||||
|
return $head;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function create_node($node, $font_size=10)
|
||||||
|
{
|
||||||
|
// Set node status.
|
||||||
|
if (isset($node['status'])) {
|
||||||
|
switch ($node['status']) {
|
||||||
|
case AGENT_MODULE_STATUS_NORMAL:
|
||||||
|
$status_color = COL_NORMAL;
|
||||||
|
// Normal monitor.
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
||||||
|
$status_color = COL_CRITICAL;
|
||||||
|
// Critical monitor.
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AGENT_MODULE_STATUS_WARNING:
|
||||||
|
$status_color = COL_WARNING;
|
||||||
|
// Warning monitor.
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AGENT_STATUS_ALERT_FIRED:
|
||||||
|
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
||||||
|
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
||||||
|
$status_color = COL_ALERTFIRED;
|
||||||
|
// Alert fired.
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AGENT_MODULE_STATUS_NOT_INIT:
|
||||||
|
$status_color = COL_NOTINIT;
|
||||||
|
// Not init.
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$status_color = COL_UNKNOWN;
|
||||||
|
// Unknown monitor.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$status_color = 'color="'.$status_color.'",';
|
||||||
|
} else {
|
||||||
|
$status_color = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Short name.
|
||||||
|
if (isset($node['nombre'])) {
|
||||||
|
$name = io_safe_output(strtolower($node['nombre']));
|
||||||
|
if (strlen($name) > 16) {
|
||||||
|
$name = substr($name, 0, 16).'...';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set node icon.
|
||||||
|
if (isset($node['image'])) {
|
||||||
|
if (file_exists($node['image'])) {
|
||||||
|
$img_node = $node['image'];
|
||||||
|
} else {
|
||||||
|
$img_node = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$img_node = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $node['id_node'].' [ '.$status_color.' fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>'.html_print_image($img_node, true, false, false, true).'</TD></TR>
|
||||||
|
<TR><TD>'.$name.'</TD></TR></TABLE>>,
|
||||||
|
shape="doublecircle",
|
||||||
|
tooltip="ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='.$node['id'].'"];';
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an edge definition.
|
||||||
|
*
|
||||||
|
* @param string $head Origin.
|
||||||
|
* @param string $tail Target.
|
||||||
|
*
|
||||||
|
* @return string Edge str.
|
||||||
|
*/
|
||||||
|
function create_edge($head, $tail)
|
||||||
|
{
|
||||||
|
// Token edgeURL allows node navigation.
|
||||||
|
$edge = $head.' -- '.$tail.'[color="#BDBDBD", headclip=false, tailclip=false];'."\n";
|
||||||
|
|
||||||
|
return $edge;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Closes a graph definition
|
||||||
|
function close_graph()
|
||||||
|
{
|
||||||
|
return '}';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function loadfile_map($file='', $graph)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$networkmap_nodes = [];
|
||||||
|
|
||||||
|
$relations = [];
|
||||||
|
|
||||||
|
$other_file = file($file);
|
||||||
|
$graph = explode(']', $graph);
|
||||||
|
|
||||||
|
$ids = [];
|
||||||
|
foreach ($graph as $node) {
|
||||||
|
$line = str_replace("\n", ' ', $node);
|
||||||
|
if (preg_match('/([0-9]+) \[.*tooltip.*id_agent=([0-9]+)/', $line, $match) != 0) {
|
||||||
|
$ids[$match[1]] = ['id_agent' => $match[2]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($other_file as $key => $line) {
|
||||||
|
$line = preg_replace('/[ ]+/', ' ', $line);
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
if (preg_match('/^node.*$/', $line) != 0) {
|
||||||
|
$items = explode(' ', $line);
|
||||||
|
$node_id = $items[1];
|
||||||
|
$node_x = ($items[2] * 100);
|
||||||
|
// 200 is for show more big
|
||||||
|
$node_y = ($height_map - $items[3] * 100);
|
||||||
|
// 200 is for show more big
|
||||||
|
$data['id'] = $node_id;
|
||||||
|
$data['image'] = '';
|
||||||
|
$data['width'] = 10;
|
||||||
|
$data['height'] = 10;
|
||||||
|
$data['id_agent'] = 0;
|
||||||
|
|
||||||
|
if (preg_match('/<img src=\"([^\"]*)\"/', $line, $match) == 1) {
|
||||||
|
$image = $match[1];
|
||||||
|
$data['image'] = $config['homeurl'].'/'.$image;
|
||||||
|
$size = getimagesize($config['homeurl'].'/'.$image);
|
||||||
|
$data['image_width'] = $size[0];
|
||||||
|
$data['image_height'] = $size[1];
|
||||||
|
if ($ids[$node_id]['id_agent'] == '') {
|
||||||
|
$data['id_agent'] = 0;
|
||||||
|
$data['label'] = get_product_name();
|
||||||
|
$data['color'] = COL_UNKNOWN;
|
||||||
|
} else {
|
||||||
|
$data['id_agent'] = $ids[$node_id]['id_agent'];
|
||||||
|
$data['label'] = io_safe_output(agents_get_alias($data['id_agent']));
|
||||||
|
|
||||||
|
$status = agents_get_status($data['id_agent']);
|
||||||
|
|
||||||
|
switch ($status) {
|
||||||
|
case 0:
|
||||||
|
$status_color = COL_NORMAL;
|
||||||
|
// Normal monitor
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
$status_color = COL_CRITICAL;
|
||||||
|
// Critical monitor
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
$status_color = COL_WARNING;
|
||||||
|
// Warning monitor
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
$status_color = COL_ALERTFIRED;
|
||||||
|
// Alert fired
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$status_color = COL_UNKNOWN;
|
||||||
|
// Unknown monitor
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['color'] = $status_color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['x'] = $node_x;
|
||||||
|
$data['y'] = $node_y;
|
||||||
|
|
||||||
|
$networkmap_nodes['nodes'][] = $data;
|
||||||
|
} else if (preg_match('/^edge.*$/', $line) != 0) {
|
||||||
|
$items = explode(' ', $line);
|
||||||
|
$line_orig = $items[2];
|
||||||
|
$line_dest = $items[1];
|
||||||
|
|
||||||
|
$networkmap_nodes['arrows'][] = [
|
||||||
|
'orig' => $line_orig,
|
||||||
|
'dest' => $line_dest,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $networkmap_nodes;
|
||||||
|
}
|
||||||
|
|
|
@ -19,8 +19,10 @@
|
||||||
|
|
||||||
|
|
||||||
// Set session variable to store menu type (classic or collapsed) within this session
|
// Set session variable to store menu type (classic or collapsed) within this session
|
||||||
if (!empty(get_parameter('menuType')))
|
if (!empty(get_parameter('menuType'))) {
|
||||||
$_SESSION['menu_type'] = get_parameter('menuType', 'collapsed');
|
$_SESSION['menu_type'] = get_parameter('menuType', 'classic');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints a complete menu structure.
|
* Prints a complete menu structure.
|
||||||
|
@ -80,10 +82,17 @@ function menu_print_menu(&$menu)
|
||||||
|
|
||||||
$submenu = false;
|
$submenu = false;
|
||||||
|
|
||||||
if ($_SESSION['menu_type']=='classic')
|
if ($_SESSION['menu_type'] == 'classic') {
|
||||||
$classes = ['menu_icon', 'no_hidden_menu'];
|
$classes = [
|
||||||
else
|
'menu_icon',
|
||||||
$classes = ['menu_icon', 'menu_icon_collapsed'];
|
'no_hidden_menu',
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$classes = [
|
||||||
|
'menu_icon',
|
||||||
|
'menu_icon_collapsed',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($main['sub'])) {
|
if (isset($main['sub'])) {
|
||||||
$classes[] = '';
|
$classes[] = '';
|
||||||
|
@ -383,10 +392,11 @@ function menu_print_menu(&$menu)
|
||||||
$length = strlen(__($main['text']));
|
$length = strlen(__($main['text']));
|
||||||
$padding_top = ( $length >= 18) ? 6 : 12;
|
$padding_top = ( $length >= 18) ? 6 : 12;
|
||||||
|
|
||||||
if ($_SESSION['menu_type']=='classic')
|
if ($_SESSION['menu_type'] == 'classic') {
|
||||||
$output .= '<div id="title_menu" class="title_menu_classic" style="padding-top:'.$padding_top.'px; display:none;">'.$main['text'].'</div>';
|
$output .= '<div id="title_menu" class="title_menu_classic" style="padding-top:'.$padding_top.'px; display:none;">'.$main['text'].'</div>';
|
||||||
else
|
} else {
|
||||||
$output .= '<div id="title_menu" class="title_menu_collapsed" style="padding-top:'.$padding_top.'px; display:none;">'.$main['text'].'</div>';
|
$output .= '<div id="title_menu" class="title_menu_collapsed" style="padding-top:'.$padding_top.'px; display:none;">'.$main['text'].'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
// Add the notification ball if defined
|
// Add the notification ball if defined
|
||||||
if (isset($main['notification'])) {
|
if (isset($main['notification'])) {
|
||||||
|
|
|
@ -582,6 +582,56 @@ function messages_get_overview_sent(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a message interpreted as a conversation.
|
||||||
|
*
|
||||||
|
* @param mixed $data Complete message or message id.
|
||||||
|
*
|
||||||
|
* @return mixed False if fails. A string array with the conversation.
|
||||||
|
*/
|
||||||
|
function messages_get_conversation($data)
|
||||||
|
{
|
||||||
|
if (is_array($data)) {
|
||||||
|
$message = $data;
|
||||||
|
} else {
|
||||||
|
$message = messages_get_message($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($message) || !is_array($message)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$conversation = [];
|
||||||
|
$target_str = $message['mensaje'];
|
||||||
|
|
||||||
|
while (preg_match_all(
|
||||||
|
'/(.*)On(.*)wrote:(.*)/',
|
||||||
|
$target_str,
|
||||||
|
$decoded,
|
||||||
|
PREG_PATTERN_ORDER
|
||||||
|
) !== false && empty($target_str) !== true) {
|
||||||
|
if (empty($decoded[2]) !== true) {
|
||||||
|
array_push(
|
||||||
|
$conversation,
|
||||||
|
[
|
||||||
|
'message' => array_pop($decoded)[0],
|
||||||
|
'date' => array_pop($decoded)[0],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
array_push(
|
||||||
|
$conversation,
|
||||||
|
['message' => $target_str]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$target_str = $decoded[1][0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $conversation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the URL of a message. If field in db is null, it returs a link to
|
* Get the URL of a message. If field in db is null, it returs a link to
|
||||||
* messages view.
|
* messages view.
|
||||||
|
|
|
@ -1,17 +1,29 @@
|
||||||
<?php
|
<?php
|
||||||
;
|
/**
|
||||||
// Pandora FMS - http://pandorafms.com
|
* Library for networkmaps in Pandora FMS
|
||||||
// ==================================================
|
*
|
||||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
* @category Deprecated
|
||||||
// Please see http://pandorafms.org for full contribution list
|
* @package Pandora FMS
|
||||||
// This program is free software; you can redistribute it and/or
|
* @subpackage NetworkMap
|
||||||
// modify it under the terms of the GNU Lesser General Public License
|
* @version 1.0.0
|
||||||
// as published by the Free Software Foundation; version 2
|
* @license See below
|
||||||
// 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 Networkmaps
|
* ============================================================================
|
||||||
|
* 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.
|
||||||
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Deprecated.
|
||||||
|
|
|
@ -993,7 +993,7 @@ function notifications_print_dropdown_element($message_info)
|
||||||
$message_info['id_mensaje'],
|
$message_info['id_mensaje'],
|
||||||
messages_get_url($message_info['id_mensaje']),
|
messages_get_url($message_info['id_mensaje']),
|
||||||
html_print_image('images/'.$message_info['icon'], true),
|
html_print_image('images/'.$message_info['icon'], true),
|
||||||
$message_info['subject'],
|
io_safe_output($message_info['subject']),
|
||||||
str_replace([io_safe_input('<br>')], ' ', $message_info['mensaje'])
|
strip_tags(io_safe_output($message_info['mensaje']), '<br><pre>')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1697,6 +1697,7 @@ function reporting_event_report_group(
|
||||||
}
|
}
|
||||||
|
|
||||||
$return['description'] = $content['description'];
|
$return['description'] = $content['description'];
|
||||||
|
$return['show_extended_events'] = $content['show_extended_events'];
|
||||||
$return['date'] = reporting_get_date_text($report, $content);
|
$return['date'] = reporting_get_date_text($report, $content);
|
||||||
|
|
||||||
$event_filter = $content['style'];
|
$event_filter = $content['style'];
|
||||||
|
@ -1917,6 +1918,7 @@ function reporting_event_report_module(
|
||||||
}
|
}
|
||||||
|
|
||||||
$return['description'] = $content['description'];
|
$return['description'] = $content['description'];
|
||||||
|
$return['show_extended_events'] = $content['show_extended_events'];
|
||||||
$return['date'] = reporting_get_date_text($report, $content);
|
$return['date'] = reporting_get_date_text($report, $content);
|
||||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||||
|
|
||||||
|
@ -2756,6 +2758,7 @@ function reporting_event_report_agent(
|
||||||
$return['date'] = reporting_get_date_text($report, $content);
|
$return['date'] = reporting_get_date_text($report, $content);
|
||||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||||
$return['show_summary_group'] = $content['style']['show_summary_group'];
|
$return['show_summary_group'] = $content['style']['show_summary_group'];
|
||||||
|
$return['show_extended_events'] = $content['show_extended_events'];
|
||||||
|
|
||||||
$style = $content['style'];
|
$style = $content['style'];
|
||||||
|
|
||||||
|
@ -7734,6 +7737,7 @@ function reporting_get_agents_detailed_event(
|
||||||
'criticity' => $e['criticity'],
|
'criticity' => $e['criticity'],
|
||||||
'validated_by' => $e['id_usuario'],
|
'validated_by' => $e['id_usuario'],
|
||||||
'timestamp' => $e['timestamp_rep'],
|
'timestamp' => $e['timestamp_rep'],
|
||||||
|
'id_evento' => $e['id_evento'],
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$return_data[] = [
|
$return_data[] = [
|
||||||
|
@ -7743,6 +7747,7 @@ function reporting_get_agents_detailed_event(
|
||||||
'criticity' => $e['criticity'],
|
'criticity' => $e['criticity'],
|
||||||
'validated_by' => $e['id_usuario'],
|
'validated_by' => $e['id_usuario'],
|
||||||
'timestamp' => $e['timestamp'],
|
'timestamp' => $e['timestamp'],
|
||||||
|
'id_evento' => $e['id_evento'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -910,6 +910,9 @@ function reporting_html_top_n($table, $item, $pdf=0)
|
||||||
function reporting_html_event_report_group($table, $item, $pdf=0)
|
function reporting_html_event_report_group($table, $item, $pdf=0)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
$show_extended_events = $item['show_extended_events'];
|
||||||
|
|
||||||
if ($item['total_events']) {
|
if ($item['total_events']) {
|
||||||
$table1 = new stdClass();
|
$table1 = new stdClass();
|
||||||
$table1->width = '99%';
|
$table1->width = '99%';
|
||||||
|
@ -1017,6 +1020,17 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push($table1->data, $data);
|
array_push($table1->data, $data);
|
||||||
|
|
||||||
|
if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) {
|
||||||
|
$extended_events = events_get_extended_events($event['id_evento']);
|
||||||
|
|
||||||
|
foreach ($extended_events as $extended_event) {
|
||||||
|
$extended_data = [];
|
||||||
|
|
||||||
|
$extended_data[] = "<td colspan='5'><font style='font-style: italic;'>".io_safe_output($extended_event['description'])."</font></td><td><font style='font-size: 6pt; font-style: italic;'>".date($config['date_format'], $extended_event['utimestamp']).'</font></td>';
|
||||||
|
array_push($table1->data, $extended_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pdf) {
|
if ($pdf) {
|
||||||
|
@ -1126,6 +1140,9 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
|
||||||
function reporting_html_event_report_module($table, $item, $pdf=0)
|
function reporting_html_event_report_module($table, $item, $pdf=0)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
$show_extended_events = $item['show_extended_events'];
|
||||||
|
|
||||||
$show_summary_group = $item['show_summary_group'];
|
$show_summary_group = $item['show_summary_group'];
|
||||||
if ($item['total_events']) {
|
if ($item['total_events']) {
|
||||||
if (!empty($item['failed'])) {
|
if (!empty($item['failed'])) {
|
||||||
|
@ -1209,6 +1226,17 @@ function reporting_html_event_report_module($table, $item, $pdf=0)
|
||||||
}
|
}
|
||||||
|
|
||||||
$table1->data[] = $data;
|
$table1->data[] = $data;
|
||||||
|
|
||||||
|
if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) {
|
||||||
|
$extended_events = events_get_extended_events($event['id_evento']);
|
||||||
|
|
||||||
|
foreach ($extended_events as $extended_event) {
|
||||||
|
$extended_data = [];
|
||||||
|
|
||||||
|
$extended_data[] = "<td colspan='3'><font style='font-style: italic;'>".io_safe_output($extended_event['description'])."</font></td><td><font style='font-style: italic;'>".date($config['date_format'], $extended_event['utimestamp']).'</font></td>';
|
||||||
|
array_push($table1->data, $extended_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1898,6 +1926,8 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
$show_extended_events = $item['show_extended_events'];
|
||||||
|
|
||||||
if ($item['total_events'] != 0) {
|
if ($item['total_events'] != 0) {
|
||||||
$table1 = new stdClass();
|
$table1 = new stdClass();
|
||||||
$table1->width = '99%';
|
$table1->width = '99%';
|
||||||
|
@ -1985,6 +2015,17 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push($table1->data, $data);
|
array_push($table1->data, $data);
|
||||||
|
|
||||||
|
if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) {
|
||||||
|
$extended_events = events_get_extended_events($event['id_evento']);
|
||||||
|
|
||||||
|
foreach ($extended_events as $extended_event) {
|
||||||
|
$extended_data = [];
|
||||||
|
|
||||||
|
$extended_data[] = "<td colspan='4'><font style='font-style: italic;'>".io_safe_output($extended_event['description'])."</font></td><td><font style='font-size: 6pt; font-style: italic;'>".date($config['date_format'], $extended_event['utimestamp']).'</font></td>';
|
||||||
|
array_push($table1->data, $extended_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pdf) {
|
if ($pdf) {
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
require_once 'include/functions_modules.php';
|
require_once __DIR__.'/functions_modules.php';
|
||||||
require_once 'include/functions_events.php';
|
require_once __DIR__.'/functions_events.php';
|
||||||
require_once 'include/functions_groups.php';
|
require_once __DIR__.'/functions_groups.php';
|
||||||
require_once 'include/functions_netflow.php';
|
require_once __DIR__.'/functions_netflow.php';
|
||||||
enterprise_include_once('include/functions_metaconsole.php');
|
enterprise_include_once('include/functions_metaconsole.php');
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,58 @@ function servers_force_recon_task($id_recon_task)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves total number of modules per server.
|
||||||
|
*
|
||||||
|
* @return array Modules per server (total).
|
||||||
|
*/
|
||||||
|
function servers_get_total_modules()
|
||||||
|
{
|
||||||
|
$modules = [];
|
||||||
|
|
||||||
|
$modules_from_monitors = db_get_all_rows_sql(
|
||||||
|
'SELECT
|
||||||
|
tserver.server_type,
|
||||||
|
count(tagente_estado.id_agente_modulo) as modules_assigned
|
||||||
|
FROM tserver, tagente_estado, tagente_modulo, tagente
|
||||||
|
WHERE tagente.disabled=0
|
||||||
|
AND tagente_modulo.id_agente = tagente.id_agente
|
||||||
|
AND tagente_modulo.disabled = 0
|
||||||
|
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||||
|
AND tagente_estado.running_by = tserver.id_server
|
||||||
|
GROUP BY tserver.server_type;'
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($modules_from_monitors !== false) {
|
||||||
|
$modules = array_reduce(
|
||||||
|
$modules_from_monitors,
|
||||||
|
function ($carry, $item) {
|
||||||
|
$carry[$item['server_type']] = $item['modules_assigned'];
|
||||||
|
return $carry;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$modules[SERVER_TYPE_INVENTORY] = db_get_sql(
|
||||||
|
'SELECT COUNT(tagent_module_inventory.id_agent_module_inventory)
|
||||||
|
FROM tagente, tagent_module_inventory
|
||||||
|
WHERE tagente.disabled=0
|
||||||
|
AND tagent_module_inventory.id_agente = tagente.id_agente'
|
||||||
|
);
|
||||||
|
|
||||||
|
$modules[SERVER_TYPE_EXPORT] = db_get_sql(
|
||||||
|
'SELECT COUNT(tagente_modulo.id_agente_modulo)
|
||||||
|
FROM tagente, tagente_modulo
|
||||||
|
WHERE tagente.disabled=0
|
||||||
|
AND tagente_modulo.id_agente = tagente.id_agente
|
||||||
|
AND tagente_modulo.id_export != 0'
|
||||||
|
);
|
||||||
|
|
||||||
|
return $modules;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function will get several metrics from the database to get info about server performance
|
* This function will get several metrics from the database to get info about server performance
|
||||||
*
|
*
|
||||||
|
@ -989,6 +1041,9 @@ function servers_get_server_string_name(int $server)
|
||||||
case SERVER_TYPE_WUX:
|
case SERVER_TYPE_WUX:
|
||||||
return __('WUX server');
|
return __('WUX server');
|
||||||
|
|
||||||
|
case SERVER_TYPE_ENTERPRISE_SATELLITE:
|
||||||
|
return __('Satellite');
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return __('N/A');
|
return __('N/A');
|
||||||
}
|
}
|
||||||
|
|
|
@ -2768,7 +2768,8 @@ function ui_print_page_header(
|
||||||
$modal=false,
|
$modal=false,
|
||||||
$message='',
|
$message='',
|
||||||
$numChars=GENERIC_SIZE_TEXT,
|
$numChars=GENERIC_SIZE_TEXT,
|
||||||
$alias=''
|
$alias='',
|
||||||
|
$breadcrumbs=''
|
||||||
) {
|
) {
|
||||||
$title = io_safe_input_html($title);
|
$title = io_safe_input_html($title);
|
||||||
if (($icon == '') && ($godmode == true)) {
|
if (($icon == '') && ($godmode == true)) {
|
||||||
|
@ -2781,15 +2782,20 @@ function ui_print_page_header(
|
||||||
|
|
||||||
if ($godmode == true) {
|
if ($godmode == true) {
|
||||||
$type = 'view';
|
$type = 'view';
|
||||||
$type2 = 'menu_tab_frame_view';
|
$type2 = (empty($breadcrumbs)) ? 'menu_tab_frame_view' : 'menu_tab_frame_view_bc';
|
||||||
$separator_class = 'separator';
|
$separator_class = 'separator';
|
||||||
} else {
|
} else {
|
||||||
$type = 'view';
|
$type = 'view';
|
||||||
$type2 = 'menu_tab_frame_view';
|
$type2 = (empty($breadcrumbs)) ? 'menu_tab_frame_view' : 'menu_tab_frame_view_bc';
|
||||||
$separator_class = 'separator_view';
|
$separator_class = 'separator_view';
|
||||||
}
|
}
|
||||||
|
|
||||||
$buffer = '<div id="'.$type2.'" style=""><div id="menu_tab_left">';
|
$buffer = '<div id="'.$type2.'" style="">';
|
||||||
|
|
||||||
|
if (!empty($breadcrumbs))
|
||||||
|
$buffer .= '<div class="breadcrumbs_container">'.$breadcrumbs.'</div>';
|
||||||
|
|
||||||
|
$buffer .= '<div id="menu_tab_left">';
|
||||||
|
|
||||||
$buffer .= '<ul class="mn"><li class="'.$type.'">';
|
$buffer .= '<ul class="mn"><li class="'.$type.'">';
|
||||||
|
|
||||||
|
|
|
@ -354,8 +354,19 @@ function ux_console_phases_donut($phases, $id, $return=false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function d3_progress_bar($id, $percentile, $width, $height, $color, $unit='%', $text='', $fill_color='#FFFFFF')
|
function d3_progress_bar(
|
||||||
{
|
$id,
|
||||||
|
$percentile,
|
||||||
|
$width,
|
||||||
|
$height,
|
||||||
|
$color,
|
||||||
|
$unit='%',
|
||||||
|
$text='',
|
||||||
|
$fill_color='#FFFFFF',
|
||||||
|
$radiusx=10,
|
||||||
|
$radiusy=10,
|
||||||
|
$transition=1
|
||||||
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$recipient_name = 'progress_bar_'.$id;
|
$recipient_name = 'progress_bar_'.$id;
|
||||||
|
@ -366,8 +377,20 @@ function d3_progress_bar($id, $percentile, $width, $height, $color, $unit='%', $
|
||||||
$output .= '<div id='.$recipient_name." style='overflow: hidden;'></div>";
|
$output .= '<div id='.$recipient_name." style='overflow: hidden;'></div>";
|
||||||
$output .= include_javascript_d3(true);
|
$output .= include_javascript_d3(true);
|
||||||
$output .= "<script language=\"javascript\" type=\"text/javascript\">
|
$output .= "<script language=\"javascript\" type=\"text/javascript\">
|
||||||
progress_bar_d3('".$recipient_name_to_js."', ".(int) $percentile.', '.(int) $width.', '.(int) $height.", '".$color."', '".$unit."', '".$text."', '".$fill_color."');
|
progress_bar_d3(
|
||||||
</script>";
|
'".$recipient_name_to_js."',
|
||||||
|
".(int) $percentile.',
|
||||||
|
'.(int) $width.',
|
||||||
|
'.(int) $height.",
|
||||||
|
'".$color."',
|
||||||
|
'".$unit."',
|
||||||
|
'".$text."',
|
||||||
|
'".$fill_color."',
|
||||||
|
".(int) $radiusx.',
|
||||||
|
'.(int) $radiusy.',
|
||||||
|
'.(int) $transition.'
|
||||||
|
);
|
||||||
|
</script>';
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1782,7 +1782,10 @@ function progress_bar_d3(
|
||||||
color,
|
color,
|
||||||
unit,
|
unit,
|
||||||
label,
|
label,
|
||||||
label_color
|
label_color,
|
||||||
|
radiusx,
|
||||||
|
radiusy,
|
||||||
|
transition
|
||||||
) {
|
) {
|
||||||
var startPercent = 0;
|
var startPercent = 0;
|
||||||
var endPercent = parseInt(percentile) / 100;
|
var endPercent = parseInt(percentile) / 100;
|
||||||
|
@ -1799,20 +1802,20 @@ function progress_bar_d3(
|
||||||
.append("rect")
|
.append("rect")
|
||||||
.attr("fill", "#000000")
|
.attr("fill", "#000000")
|
||||||
.attr("fill-opacity", 0.5)
|
.attr("fill-opacity", 0.5)
|
||||||
.attr("height", 20)
|
.attr("height", height)
|
||||||
.attr("width", width)
|
.attr("width", width)
|
||||||
.attr("rx", 10)
|
.attr("rx", radiusx)
|
||||||
.attr("ry", 10)
|
.attr("ry", radiusy)
|
||||||
.attr("x", 0);
|
.attr("x", 0);
|
||||||
|
|
||||||
var progress_front = circle
|
var progress_front = circle
|
||||||
.append("rect")
|
.append("rect")
|
||||||
.attr("fill", color)
|
.attr("fill", color)
|
||||||
.attr("fill-opacity", 1)
|
.attr("fill-opacity", 1)
|
||||||
.attr("height", 20)
|
.attr("height", height)
|
||||||
.attr("width", 0)
|
.attr("width", 0)
|
||||||
.attr("rx", 10)
|
.attr("rx", radiusx)
|
||||||
.attr("ry", 10)
|
.attr("ry", radiusy)
|
||||||
.attr("x", 0);
|
.attr("x", 0);
|
||||||
|
|
||||||
var labelText = circle
|
var labelText = circle
|
||||||
|
@ -1834,7 +1837,7 @@ function progress_bar_d3(
|
||||||
.style("font-weight", "bold")
|
.style("font-weight", "bold")
|
||||||
.style("font-size", 14)
|
.style("font-size", 14)
|
||||||
.attr("text-anchor", "middle")
|
.attr("text-anchor", "middle")
|
||||||
.attr("dy", "-10");
|
.attr("dy", (height - height / 2) / 4);
|
||||||
|
|
||||||
function updateProgress(bar_progress) {
|
function updateProgress(bar_progress) {
|
||||||
var percent_value = Number(bar_progress * 100);
|
var percent_value = Number(bar_progress * 100);
|
||||||
|
@ -1842,17 +1845,21 @@ function progress_bar_d3(
|
||||||
progress_front.attr("width", width * bar_progress);
|
progress_front.attr("width", width * bar_progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
var bar_progress = startPercent;
|
if (transition == 0) {
|
||||||
|
var bar_progress = endPercent;
|
||||||
(function loops() {
|
|
||||||
updateProgress(bar_progress);
|
updateProgress(bar_progress);
|
||||||
|
} else {
|
||||||
|
var bar_progress = startPercent;
|
||||||
|
(function loops() {
|
||||||
|
updateProgress(bar_progress);
|
||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
count--;
|
count--;
|
||||||
bar_progress += step;
|
bar_progress += step;
|
||||||
setTimeout(loops, 30);
|
setTimeout(loops, 30);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function progress_bubble_d3(
|
function progress_bubble_d3(
|
||||||
|
|
|
@ -1,5 +1,49 @@
|
||||||
|
/* global jQuery */
|
||||||
|
/* global $ */
|
||||||
|
/* global context_minimap */
|
||||||
|
/* global minimap_w */
|
||||||
|
/* global minimap_h */
|
||||||
|
/* global minimap_relation */
|
||||||
|
/* global graph */
|
||||||
|
/* global translation */
|
||||||
|
/* global scale */
|
||||||
|
/* global width_svg */
|
||||||
|
/* global height_svg */
|
||||||
|
/* global networkmap_dimensions */
|
||||||
|
/* global node_radius */
|
||||||
|
/* global holding_area_dimensions */
|
||||||
|
/* global networkmap_id */
|
||||||
|
/* global enterprise_installed */
|
||||||
|
/* global force */
|
||||||
|
/* global layer_graph_nodes */
|
||||||
|
/* global layer_graph_links */
|
||||||
|
/* global ellipsize */
|
||||||
|
/* global d3 */
|
||||||
|
/* global dialog_node_edit_title */
|
||||||
|
/* global click_menu_position_svg */
|
||||||
|
/* global show_labels:true */
|
||||||
|
/* global show_minimap:true */
|
||||||
|
/* global layer_graph */
|
||||||
|
/* global zoom_obj */
|
||||||
|
/* global disabled_drag_zoom */
|
||||||
|
/* global scale:true */
|
||||||
|
/* global link */
|
||||||
|
/* global siblingCount:true */
|
||||||
|
/* global xRotation:true */
|
||||||
|
/* global largeArc:true */
|
||||||
|
/* global node */
|
||||||
|
|
||||||
|
/* exported delete_link */
|
||||||
|
/* exported update_fictional_node */
|
||||||
|
/* exported update_node_name */
|
||||||
|
/* exported change_shape */
|
||||||
|
/* exported add_agent_node_from_the_filter_group */
|
||||||
|
/* exported hide_labels */
|
||||||
|
/* exported toggle_minimap */
|
||||||
|
/* exported over_node */
|
||||||
|
|
||||||
function draw_minimap() {
|
function draw_minimap() {
|
||||||
//Clean the canvas
|
// Clean the canvas.
|
||||||
context_minimap.clearRect(0, 0, minimap_w, minimap_h);
|
context_minimap.clearRect(0, 0, minimap_w, minimap_h);
|
||||||
|
|
||||||
context_minimap.beginPath();
|
context_minimap.beginPath();
|
||||||
|
@ -20,6 +64,9 @@ function draw_minimap() {
|
||||||
jQuery.each(graph.nodes, function(key, value) {
|
jQuery.each(graph.nodes, function(key, value) {
|
||||||
if (typeof value == "undefined") return;
|
if (typeof value == "undefined") return;
|
||||||
|
|
||||||
|
var center_orig_x;
|
||||||
|
var center_orig_y;
|
||||||
|
|
||||||
context_minimap.beginPath();
|
context_minimap.beginPath();
|
||||||
//Paint the item
|
//Paint the item
|
||||||
if (graph.nodes.length > 100) {
|
if (graph.nodes.length > 100) {
|
||||||
|
@ -36,7 +83,7 @@ function draw_minimap() {
|
||||||
|
|
||||||
context_minimap.arc(center_orig_x, center_orig_y, 2, 0, Math.PI * 2, false);
|
context_minimap.arc(center_orig_x, center_orig_y, 2, 0, Math.PI * 2, false);
|
||||||
//Check if the pandora point
|
//Check if the pandora point
|
||||||
if (value.id_agent == -1) {
|
if (value.type == 2) {
|
||||||
context_minimap.fillStyle = "#364D1F";
|
context_minimap.fillStyle = "#364D1F";
|
||||||
} else {
|
} else {
|
||||||
context_minimap.fillStyle = "#000";
|
context_minimap.fillStyle = "#000";
|
||||||
|
@ -96,11 +143,11 @@ function inner_minimap_box(param_x, param_y) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_center(id, event) {
|
function set_center(id) {
|
||||||
pos_x = width_svg / 2 - translation[0] / scale;
|
var pos_x = width_svg / 2 - translation[0] / scale;
|
||||||
pos_y = height_svg / 2 - translation[1] / scale;
|
var pos_y = height_svg / 2 - translation[1] / scale;
|
||||||
|
|
||||||
var params = [];
|
var params = [];
|
||||||
|
|
||||||
params.push("set_center=1");
|
params.push("set_center=1");
|
||||||
params.push("id=" + id);
|
params.push("id=" + id);
|
||||||
params.push("x=" + pos_x);
|
params.push("x=" + pos_x);
|
||||||
|
@ -111,11 +158,7 @@ function set_center(id, event) {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php"
|
||||||
success: function(data) {
|
|
||||||
if (data["correct"]) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +207,7 @@ function delete_link(
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data["correct"]) {
|
if (data["correct"]) {
|
||||||
var found = -1;
|
var found = -1;
|
||||||
|
@ -222,7 +265,7 @@ function update_fictional_node(id_db_node) {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data["correct"]) {
|
if (data["correct"]) {
|
||||||
$("#dialog_node_edit").dialog("close");
|
$("#dialog_node_edit").dialog("close");
|
||||||
|
@ -262,7 +305,7 @@ function update_node_name(id_db_node) {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data["correct"]) {
|
if (data["correct"]) {
|
||||||
$("#dialog_node_edit").dialog("close");
|
$("#dialog_node_edit").dialog("close");
|
||||||
|
@ -308,13 +351,13 @@ function change_shape(id_db_node) {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$("#shape_icon_in_progress").css("display", "none");
|
$("#shape_icon_in_progress").css("display", "none");
|
||||||
if (data["correct"]) {
|
if (data["correct"]) {
|
||||||
$("#shape_icon_correct").css("display", "");
|
$("#shape_icon_correct").css("display", "");
|
||||||
|
|
||||||
count = graph.nodes.length;
|
var count = graph.nodes.length;
|
||||||
|
|
||||||
jQuery.each(graph.nodes, function(i, element) {
|
jQuery.each(graph.nodes, function(i, element) {
|
||||||
if (element.id_db == id_db_node) {
|
if (element.id_db == id_db_node) {
|
||||||
|
@ -585,7 +628,7 @@ function update_link(row_index, id_link) {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$(".edit_icon_progress_" + row_index).css("display", "none");
|
$(".edit_icon_progress_" + row_index).css("display", "none");
|
||||||
|
|
||||||
|
@ -607,12 +650,10 @@ function update_link(row_index, id_link) {
|
||||||
"']"
|
"']"
|
||||||
).prop("selected", true);
|
).prop("selected", true);
|
||||||
|
|
||||||
var id = "";
|
|
||||||
var index = -1;
|
var index = -1;
|
||||||
$.each(graph.links, function(j, link) {
|
$.each(graph.links, function(j, link) {
|
||||||
if (link["id_db"] == id_link) {
|
if (link["id_db"] == id_link) {
|
||||||
index = j;
|
index = j;
|
||||||
id = String(id_link);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -706,7 +747,7 @@ function move_to_networkmap(node) {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data["correct"]) {
|
if (data["correct"]) {
|
||||||
window.location =
|
window.location =
|
||||||
|
@ -726,6 +767,7 @@ function edit_node(data_node, dblClick) {
|
||||||
|
|
||||||
//Only select one node
|
//Only select one node
|
||||||
var selection = d3.selectAll(".node_selected");
|
var selection = d3.selectAll(".node_selected");
|
||||||
|
var id;
|
||||||
|
|
||||||
if (selection[0].length == 1) {
|
if (selection[0].length == 1) {
|
||||||
edit_node = selection[0].pop();
|
edit_node = selection[0].pop();
|
||||||
|
@ -746,12 +788,12 @@ function edit_node(data_node, dblClick) {
|
||||||
.select(edit_node)
|
.select(edit_node)
|
||||||
.attr("id")
|
.attr("id")
|
||||||
.replace("id_node_", "");
|
.replace("id_node_", "");
|
||||||
id_networkmap_lenght = networkmap_id.toString().length;
|
var id_networkmap_lenght = networkmap_id.toString().length;
|
||||||
id_node_length = id.length - id_networkmap_lenght;
|
var id_node_length = id.length - id_networkmap_lenght;
|
||||||
id = id.substring(0, id_node_length);
|
id = id.substring(0, id_node_length);
|
||||||
node_selected = graph.nodes[id];
|
var node_selected = graph.nodes[id];
|
||||||
|
|
||||||
selected_links = get_relations(node_selected);
|
var selected_links = get_relations(node_selected);
|
||||||
|
|
||||||
$(
|
$(
|
||||||
"select[name='shape'] option[value='" + node_selected.shape + "']"
|
"select[name='shape'] option[value='" + node_selected.shape + "']"
|
||||||
|
@ -779,7 +821,7 @@ function edit_node(data_node, dblClick) {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$("#node_details-0-1").html(
|
$("#node_details-0-1").html(
|
||||||
'<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' +
|
'<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' +
|
||||||
|
@ -795,7 +837,7 @@ function edit_node(data_node, dblClick) {
|
||||||
addresses += data["adressess"][i] + "<br>";
|
addresses += data["adressess"][i] + "<br>";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (address in data["adressess"]) {
|
for (var address in data["adressess"]) {
|
||||||
addresses += address + "<br>";
|
addresses += address + "<br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -826,7 +868,7 @@ function edit_node(data_node, dblClick) {
|
||||||
); // It doesn't eval the possible XSS so it's ok
|
); // It doesn't eval the possible XSS so it's ok
|
||||||
$("#dialog_node_edit").dialog("open");
|
$("#dialog_node_edit").dialog("open");
|
||||||
|
|
||||||
if (node_selected.id_agent == undefined || node_selected.id_agent == -2) {
|
if (node_selected.id_agent == undefined || node_selected.type == 3) {
|
||||||
//Fictional node
|
//Fictional node
|
||||||
$("#node_options-fictional_node_name").css("display", "");
|
$("#node_options-fictional_node_name").css("display", "");
|
||||||
$("input[name='edit_name_fictional_node']").val(node_selected.text); // It doesn't eval the possible XSS so it's ok
|
$("input[name='edit_name_fictional_node']").val(node_selected.text); // It doesn't eval the possible XSS so it's ok
|
||||||
|
@ -868,7 +910,7 @@ function get_interface_data_to_table(node_selected, selected_links) {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data.length == 0) {
|
if (data.length == 0) {
|
||||||
$("#interface_information")
|
$("#interface_information")
|
||||||
|
@ -880,10 +922,11 @@ function get_interface_data_to_table(node_selected, selected_links) {
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
jQuery.each(data, function(j, interface) {
|
jQuery.each(data, function(j, interface) {
|
||||||
|
var interf_graph;
|
||||||
if (interface["graph"] == "") {
|
if (interface["graph"] == "") {
|
||||||
var interf_graph = "--";
|
interf_graph = "--";
|
||||||
} else {
|
} else {
|
||||||
var interf_graph = interface["graph"];
|
interf_graph = interface["graph"];
|
||||||
}
|
}
|
||||||
$("#interface_information")
|
$("#interface_information")
|
||||||
.find("tbody")
|
.find("tbody")
|
||||||
|
@ -955,7 +998,7 @@ function load_interfaces(selected_links) {
|
||||||
type: "POST",
|
type: "POST",
|
||||||
async: true,
|
async: true,
|
||||||
cache: false,
|
cache: false,
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data["correct"]) {
|
if (data["correct"]) {
|
||||||
$(
|
$(
|
||||||
|
@ -1075,7 +1118,7 @@ function add_node() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_agent_node_from_the_filter_group() {
|
function add_agent_node_from_the_filter_group() {
|
||||||
agents = $("select[name='agents_filter_group']").val();
|
var agents = $("select[name='agents_filter_group']").val();
|
||||||
|
|
||||||
add_agent_node(agents);
|
add_agent_node(agents);
|
||||||
}
|
}
|
||||||
|
@ -1122,7 +1165,7 @@ function add_agent_node(agents) {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data["correct"]) {
|
if (data["correct"]) {
|
||||||
$("#agent_name").val("");
|
$("#agent_name").val("");
|
||||||
|
@ -1210,24 +1253,17 @@ function add_agent_node(agents) {
|
||||||
|
|
||||||
var temp_node = {};
|
var temp_node = {};
|
||||||
temp_node["id"] = graph.nodes.length;
|
temp_node["id"] = graph.nodes.length;
|
||||||
temp_node["id_db"] = data["id_node"];
|
temp_node["id_db"] = graph.nodes.length;
|
||||||
temp_node["id_agent"] = data["id_agent"];
|
temp_node["id_agent"] = id_agent;
|
||||||
temp_node["id_module"] = "";
|
temp_node["id_module"] = "";
|
||||||
temp_node["px"] = data["x"];
|
temp_node["px"] = x;
|
||||||
temp_node["py"] = data["y"];
|
temp_node["py"] = y;
|
||||||
temp_node["x"] = data["x"];
|
temp_node["x"] = x;
|
||||||
temp_node["y"] = data["y"];
|
temp_node["y"] = y;
|
||||||
temp_node["z"] = 0;
|
temp_node["z"] = 0;
|
||||||
temp_node["fixed"] = true;
|
temp_node["fixed"] = true;
|
||||||
temp_node["type"] = 0;
|
temp_node["type"] = 0;
|
||||||
temp_node["color"] = data["status"];
|
temp_node["map_id"] = networkmap_id;
|
||||||
temp_node["shape"] = data["shape"];
|
|
||||||
temp_node["text"] = data["text"];
|
|
||||||
temp_node["image_url"] = data["image_url"];
|
|
||||||
temp_node["image_width"] = data["width"];
|
|
||||||
temp_node["image_height"] = data["height"];
|
|
||||||
temp_node["map_id"] = data["map_id"];
|
|
||||||
temp_node["state"] = data["state"];
|
|
||||||
|
|
||||||
graph.nodes.push(temp_node);
|
graph.nodes.push(temp_node);
|
||||||
}
|
}
|
||||||
|
@ -1320,9 +1356,10 @@ function delete_nodes() {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data["correct"]) {
|
if (data["correct"]) {
|
||||||
|
var found = -1;
|
||||||
do {
|
do {
|
||||||
found = -1;
|
found = -1;
|
||||||
jQuery.each(graph.links, function(i, element) {
|
jQuery.each(graph.links, function(i, element) {
|
||||||
|
@ -1600,7 +1637,7 @@ function set_positions_graph() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function over_node(d) {
|
function over_node(d) {
|
||||||
over = d3.select("#id_node_" + d.id + networkmap_id).classed("node_over");
|
var over = d3.select("#id_node_" + d.id + networkmap_id).classed("node_over");
|
||||||
|
|
||||||
in_a_node = !in_a_node;
|
in_a_node = !in_a_node;
|
||||||
|
|
||||||
|
@ -1644,7 +1681,8 @@ function clear_selection() {
|
||||||
function update_networkmap() {
|
function update_networkmap() {
|
||||||
if (enterprise_installed) {
|
if (enterprise_installed) {
|
||||||
node.each(function(d) {
|
node.each(function(d) {
|
||||||
if (d.id_agent != -1) {
|
// Do not update Pandora FMS node.
|
||||||
|
if (d.type != 2) {
|
||||||
var params = [];
|
var params = [];
|
||||||
params.push("update_node_color=1");
|
params.push("update_node_color=1");
|
||||||
params.push("id=" + d.id_db);
|
params.push("id=" + d.id_db);
|
||||||
|
@ -1656,7 +1694,7 @@ function update_networkmap() {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
d3.select(
|
d3.select(
|
||||||
"#id_node_" + d.id + networkmap_id + " .node_shape"
|
"#id_node_" + d.id + networkmap_id + " .node_shape"
|
||||||
|
@ -1668,7 +1706,7 @@ function update_networkmap() {
|
||||||
|
|
||||||
link.each(function(d) {
|
link.each(function(d) {
|
||||||
if (d.id_module_start != 0 || d.id_module_end != 0) {
|
if (d.id_module_start != 0 || d.id_module_end != 0) {
|
||||||
if (d.id_module_start != 0) {
|
if (d.id_module_start && d.id_module_start > 0) {
|
||||||
var params = [];
|
var params = [];
|
||||||
params.push("module_get_status=1");
|
params.push("module_get_status=1");
|
||||||
params.push("page=operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
|
@ -1677,7 +1715,7 @@ function update_networkmap() {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
d3.selectAll(".id_module_start_" + d.id_module_start).attr(
|
d3.selectAll(".id_module_start_" + d.id_module_start).attr(
|
||||||
"marker-start",
|
"marker-start",
|
||||||
|
@ -1691,7 +1729,7 @@ function update_networkmap() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d.id_module_end != 0) {
|
if (d.id_module_end && d.id_module_end > 0) {
|
||||||
var params = [];
|
var params = [];
|
||||||
params.push("module_get_status=1");
|
params.push("module_get_status=1");
|
||||||
params.push("page=operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
|
@ -1700,7 +1738,7 @@ function update_networkmap() {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
d3.selectAll(".id_module_end_" + d.id_module_end).attr(
|
d3.selectAll(".id_module_end_" + d.id_module_end).attr(
|
||||||
"marker-end",
|
"marker-end",
|
||||||
|
@ -1859,7 +1897,7 @@ function show_menu(item, data) {
|
||||||
icon: "interface_link_children",
|
icon: "interface_link_children",
|
||||||
disabled: function() {
|
disabled: function() {
|
||||||
if (enterprise_installed) {
|
if (enterprise_installed) {
|
||||||
if (data.type == 3) {
|
if (data.type == 3 || data.type == 2) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1929,7 +1967,7 @@ function show_menu(item, data) {
|
||||||
icon: "interface_link_parent",
|
icon: "interface_link_parent",
|
||||||
disabled: function() {
|
disabled: function() {
|
||||||
if (enterprise_installed) {
|
if (enterprise_installed) {
|
||||||
if (data.type == 3) {
|
if (data.type == 3 || data.type == 2) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -2015,7 +2053,8 @@ function show_menu(item, data) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.id_agent != -1) {
|
// Avoid deletion if Pandora FMS node.
|
||||||
|
if (data.type != 2) {
|
||||||
items_list["delete"] = {
|
items_list["delete"] = {
|
||||||
name: delete_menu,
|
name: delete_menu,
|
||||||
icon: "delete",
|
icon: "delete",
|
||||||
|
@ -2141,21 +2180,25 @@ function show_menu(item, data) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
$.contextMenu("destroy");
|
if (typeof $.contextMenu == "function") {
|
||||||
$.contextMenu({
|
$.contextMenu("destroy");
|
||||||
disabled: false,
|
$.contextMenu({
|
||||||
selector: "#networkconsole_" + networkmap_id,
|
disabled: false,
|
||||||
// define the elements of the menu
|
selector: "#networkconsole_" + networkmap_id,
|
||||||
items: items_list
|
// define the elements of the menu
|
||||||
});
|
items: items_list
|
||||||
|
});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Force to show in the mouse position
|
//Force to show in the mouse position
|
||||||
$("#networkconsole_" + networkmap_id).contextMenu({
|
if (typeof $("#networkconsole_" + networkmap_id).contextMenu == "function") {
|
||||||
x: mouse[0],
|
$("#networkconsole_" + networkmap_id).contextMenu({
|
||||||
y: mouse[1]
|
x: mouse[0],
|
||||||
});
|
y: mouse[1]
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_interface_link(data_parent) {
|
function add_interface_link(data_parent) {
|
||||||
|
@ -2205,7 +2248,7 @@ function add_interface_link(data_parent) {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
var parent_name = data_parent.text;
|
var parent_name = data_parent.text;
|
||||||
var child_name = child_data.text;
|
var child_name = child_data.text;
|
||||||
|
@ -2250,32 +2293,32 @@ function add_interface_link_js() {
|
||||||
cancel_set_parent_interface();
|
cancel_set_parent_interface();
|
||||||
$("#dialog_interface_link").dialog("close");
|
$("#dialog_interface_link").dialog("close");
|
||||||
|
|
||||||
source_value = $("#interface_source_select").val();
|
var source_value = $("#interface_source_select").val();
|
||||||
source_text = $("#interface_source_select")
|
var source_text = $("#interface_source_select")
|
||||||
.find("option:selected")
|
.find("option:selected")
|
||||||
.text();
|
.text();
|
||||||
target_value = $("#interface_target_select").val();
|
var target_value = $("#interface_target_select").val();
|
||||||
target_text = $("#interface_target_select")
|
var target_text = $("#interface_target_select")
|
||||||
.find("option:selected")
|
.find("option:selected")
|
||||||
.text();
|
.text();
|
||||||
|
|
||||||
var params = [];
|
|
||||||
params.push("add_interface_relation=1");
|
|
||||||
params.push("id=" + networkmap_id);
|
|
||||||
params.push("source_value=" + source_value);
|
|
||||||
params.push("target_value=" + target_value);
|
|
||||||
params.push("source_text=" + source_text);
|
|
||||||
params.push("target_text=" + target_text);
|
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
|
||||||
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: {
|
||||||
|
page: "enterprise/operation/agentes/pandora_networkmap.view",
|
||||||
|
add_interface_relation: 1,
|
||||||
|
id: networkmap_id,
|
||||||
|
source_value: source_value,
|
||||||
|
target_value: target_value,
|
||||||
|
source_text: source_text,
|
||||||
|
target_text: target_text
|
||||||
|
},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data["correct"]) {
|
if (data["correct"]) {
|
||||||
var temp_link = {};
|
var temp_link = {};
|
||||||
|
temp_link["id"] = graph.links.length;
|
||||||
temp_link["status_start"] = "0";
|
temp_link["status_start"] = "0";
|
||||||
temp_link["status_end"] = "0";
|
temp_link["status_end"] = "0";
|
||||||
|
|
||||||
|
@ -2284,8 +2327,9 @@ function add_interface_link_js() {
|
||||||
if (data["type_source"] == 1) {
|
if (data["type_source"] == 1) {
|
||||||
temp_link["arrow_start"] = "module";
|
temp_link["arrow_start"] = "module";
|
||||||
temp_link["id_module_start"] = source_value;
|
temp_link["id_module_start"] = source_value;
|
||||||
temp_link["status_start"] = data["status"];
|
temp_link["status_start"] = data["status_start"];
|
||||||
temp_link["link_color"] = data["status"] == "1" ? "#FC4444" : "#999";
|
temp_link["link_color"] =
|
||||||
|
data["status_start"] == "1" ? "#FC4444" : "#999";
|
||||||
} else {
|
} else {
|
||||||
temp_link["arrow_start"] = "";
|
temp_link["arrow_start"] = "";
|
||||||
temp_link["id_agent_start"] = source_value;
|
temp_link["id_agent_start"] = source_value;
|
||||||
|
@ -2294,8 +2338,9 @@ function add_interface_link_js() {
|
||||||
if (data["type_target"] == 1) {
|
if (data["type_target"] == 1) {
|
||||||
temp_link["arrow_end"] = "module";
|
temp_link["arrow_end"] = "module";
|
||||||
temp_link["id_module_end"] = target_value;
|
temp_link["id_module_end"] = target_value;
|
||||||
temp_link["status_end"] = data["status"];
|
temp_link["status_end"] = data["status_end"];
|
||||||
temp_link["link_color"] = data["status"] == "1" ? "#FC4444" : "#999";
|
temp_link["link_color"] =
|
||||||
|
data["status_end"] == "1" ? "#FC4444" : "#999";
|
||||||
} else {
|
} else {
|
||||||
temp_link["arrow_end"] = "";
|
temp_link["arrow_end"] = "";
|
||||||
temp_link["id_agent_end"] = target_value;
|
temp_link["id_agent_end"] = target_value;
|
||||||
|
@ -2325,8 +2370,8 @@ function add_interface_link_js() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function refresh_holding_area() {
|
function refresh_holding_area() {
|
||||||
holding_pos_x = d3.select("#holding_area_" + networkmap_id).attr("x");
|
var holding_pos_x = d3.select("#holding_area_" + networkmap_id).attr("x");
|
||||||
holding_pos_y = d3.select("#holding_area_" + networkmap_id).attr("y");
|
var holding_pos_y = d3.select("#holding_area_" + networkmap_id).attr("y");
|
||||||
|
|
||||||
var pos_x = parseInt(holding_pos_x) + parseInt(node_radius);
|
var pos_x = parseInt(holding_pos_x) + parseInt(node_radius);
|
||||||
var pos_y = parseInt(holding_pos_y) + parseInt(node_radius);
|
var pos_y = parseInt(holding_pos_y) + parseInt(node_radius);
|
||||||
|
@ -2342,7 +2387,7 @@ function refresh_holding_area() {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data["correct"]) {
|
if (data["correct"]) {
|
||||||
window.holding_area = data["holding_area"];
|
window.holding_area = data["holding_area"];
|
||||||
|
@ -2510,28 +2555,29 @@ function proceed_to_restart_map() {
|
||||||
text: ok_button,
|
text: ok_button,
|
||||||
click: function() {
|
click: function() {
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
var new_elements = [];
|
var data = {
|
||||||
new_elements[0] = $("#text-name").val();
|
params: {
|
||||||
new_elements[1] = $("#id_group").val();
|
name: $("#text-name").val(),
|
||||||
new_elements[2] = $("#text-node_radius").val();
|
id_group: $("#id_group").val(),
|
||||||
new_elements[3] = $("#textarea_description").val();
|
node_radius: $("#text-node_radius").val(),
|
||||||
new_elements[4] = $("input[name=source]:checked").val();
|
description: $("#textarea_description").val(),
|
||||||
if (new_elements[4] == "group") {
|
source: $("input[name=source]:checked").val(),
|
||||||
new_elements[5] = $("#checkbox-dont_show_subgroups").is(":checked");
|
dont_show_subgroups: $("#checkbox-dont_show_subgroups").is(
|
||||||
} else if (new_elements[4] == "recon_task") {
|
":checked"
|
||||||
new_elements[5] = $("#recon_task_id").val();
|
),
|
||||||
} else {
|
recon_task_id: $("#recon_task_id").val(),
|
||||||
new_elements[5] = $("#text-ip_mask").val();
|
ip_mask: $("#text-ip_mask").val(),
|
||||||
}
|
generation_method: $("#method").val(),
|
||||||
new_elements[6] = $("#method").val();
|
pos_x: $("#text-pos_x").val(),
|
||||||
new_elements[7] = $("#text-pos_x").val();
|
pos_y: $("#text-pos_y").val(),
|
||||||
new_elements[8] = $("#text-pos_y").val();
|
scale_z: $("#text-scale_z").val(),
|
||||||
new_elements[9] = $("#text-scale_z").val();
|
node_sep: $("#text-node_sep").val(),
|
||||||
new_elements[10] = $("#text-node_sep").val();
|
mindist: $("#text-mindist").val(),
|
||||||
new_elements[11] = $("#text-mindist").val();
|
rank_sep: $("#text-rank_sep").val(),
|
||||||
new_elements[12] = $("#text-rank_sep").val();
|
kval: $("#text-kval").val()
|
||||||
new_elements[13] = $("#text-kval").val();
|
}
|
||||||
reset_map_from_form(new_elements);
|
};
|
||||||
|
reset_map_from_form(data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -2551,31 +2597,29 @@ function proceed_to_restart_map() {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "html",
|
dataType: "html",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$("#restart_map_form").html(data);
|
$("#restart_map_form")
|
||||||
$("#restart_map_form").dialog("open");
|
.html(data)
|
||||||
|
.dialog("open");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset_map_from_form(new_elements) {
|
function reset_map_from_form(new_elements) {
|
||||||
var params = [];
|
var data = new_elements;
|
||||||
params.push("reset_map=1");
|
data.map_id = networkmap_id;
|
||||||
params.push("map_id=" + networkmap_id);
|
data.reset_map = 1;
|
||||||
params.push("elems[]=" + new_elements);
|
data.page = "enterprise/operation/agentes/pandora_networkmap.view";
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: data,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(d) {
|
||||||
if (!data["error"]) {
|
window.location =
|
||||||
window.location =
|
"index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap=" +
|
||||||
"index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap=" +
|
networkmap_id;
|
||||||
networkmap_id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2636,7 +2680,7 @@ function set_parent(parent_data) {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data["correct"]) {
|
if (data["correct"]) {
|
||||||
//Add the relationship and paint
|
//Add the relationship and paint
|
||||||
|
@ -2727,23 +2771,25 @@ function init_drag_and_drop() {
|
||||||
var selection = d3.selectAll(".node_selected");
|
var selection = d3.selectAll(".node_selected");
|
||||||
|
|
||||||
if (enterprise_installed) {
|
if (enterprise_installed) {
|
||||||
holding_pos_x = d3.select("#holding_area_" + networkmap_id).attr("x");
|
var holding_pos_x = d3
|
||||||
holding_pos_y = d3.select("#holding_area_" + networkmap_id).attr("y");
|
.select("#holding_area_" + networkmap_id)
|
||||||
|
.attr("x");
|
||||||
|
var holding_pos_y = d3
|
||||||
|
.select("#holding_area_" + networkmap_id)
|
||||||
|
.attr("y");
|
||||||
delete d.raw_text;
|
delete d.raw_text;
|
||||||
selection.each(function(d) {
|
selection.each(function(d) {
|
||||||
var params = [];
|
|
||||||
params.push("update_node=1");
|
|
||||||
params.push("node=" + JSON.stringify(d));
|
|
||||||
params.push("x=" + holding_pos_x);
|
|
||||||
params.push("y=" + holding_pos_y);
|
|
||||||
params.push(
|
|
||||||
"page=enterprise/operation/agentes/pandora_networkmap.view"
|
|
||||||
);
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
|
data: {
|
||||||
|
node: JSON.stringify(d),
|
||||||
|
x: holding_pos_x,
|
||||||
|
y: holding_pos_y,
|
||||||
|
update_node: 1,
|
||||||
|
page: "enterprise/operation/agentes/pandora_networkmap.view"
|
||||||
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (d.state == "holding_area") {
|
if (d.state == "holding_area") {
|
||||||
//It is out the holding area
|
//It is out the holding area
|
||||||
|
@ -2777,7 +2823,7 @@ function init_drag_and_drop() {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data["correct"]) {
|
if (data["correct"]) {
|
||||||
$("#open_version_dialog").dialog();
|
$("#open_version_dialog").dialog();
|
||||||
|
@ -2840,7 +2886,7 @@ function add_fictional_node() {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data["correct"]) {
|
if (data["correct"]) {
|
||||||
$("#dialog_node_add").dialog("close");
|
$("#dialog_node_add").dialog("close");
|
||||||
|
@ -2909,6 +2955,13 @@ function init_graph(parameter_object) {
|
||||||
window.height_svg =
|
window.height_svg =
|
||||||
$(window).height() - $("#menu_tab_frame_view").height() - 20; // 20 of margin
|
$(window).height() - $("#menu_tab_frame_view").height() - 20; // 20 of margin
|
||||||
}
|
}
|
||||||
|
if (!window.height_svg) {
|
||||||
|
window.height_svg = $("#networkconsole_" + networkmap_id).height();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof parameter_object.font_size != "undefined") {
|
||||||
|
window.font_size = parameter_object.font_size;
|
||||||
|
}
|
||||||
|
|
||||||
window.refresh_period = 5 * 1000; //milliseconds
|
window.refresh_period = 5 * 1000; //milliseconds
|
||||||
if (typeof parameter_object.refresh_period != "undefined") {
|
if (typeof parameter_object.refresh_period != "undefined") {
|
||||||
|
@ -3922,6 +3975,10 @@ function draw_elements_graph() {
|
||||||
|
|
||||||
var font_size = node_radius / 1.5;
|
var font_size = node_radius / 1.5;
|
||||||
|
|
||||||
|
if (typeof window.font_size != "undefined") {
|
||||||
|
font_size = window.font_size;
|
||||||
|
}
|
||||||
|
|
||||||
node_temp
|
node_temp
|
||||||
.append("text")
|
.append("text")
|
||||||
.attr("class", "node_text")
|
.attr("class", "node_text")
|
||||||
|
@ -3991,7 +4048,7 @@ function choose_group_for_show_agents() {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "ajax.php"),
|
url: "ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data["correct"]) {
|
if (data["correct"]) {
|
||||||
$("#agents_filter_group").html("");
|
$("#agents_filter_group").html("");
|
||||||
|
@ -4013,162 +4070,6 @@ function choose_group_for_show_agents() {
|
||||||
'<option value="-1">' + translation_none + "</option>"
|
'<option value="-1">' + translation_none + "</option>"
|
||||||
);
|
);
|
||||||
$("#spinner_group").css("display", "none");
|
$("#spinner_group").css("display", "none");
|
||||||
function show_networkmap_node(id_agent_param, refresh_state) {
|
|
||||||
id_agent = id_agent_param;
|
|
||||||
|
|
||||||
canvas = $("#node_info");
|
|
||||||
context_popup = canvas[0].getContext("2d");
|
|
||||||
|
|
||||||
dirty_popup = true;
|
|
||||||
self.setInterval("check_popup_modification()", 1000 / 30);
|
|
||||||
|
|
||||||
$("#node_info").mousemove(function(event) {
|
|
||||||
var x = event.pageX - $("#node_info").offset().left;
|
|
||||||
var y = event.pageY - $("#node_info").offset().top;
|
|
||||||
|
|
||||||
module_inner = inner_module(x, y);
|
|
||||||
|
|
||||||
if (module_inner != null) {
|
|
||||||
document.body.style.cursor = "pointer";
|
|
||||||
} else {
|
|
||||||
document.body.style.cursor = "default";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#node_info").mousedown(function(event) {
|
|
||||||
var x = event.pageX - $("#node_info").offset().left;
|
|
||||||
var y = event.pageY - $("#node_info").offset().top;
|
|
||||||
|
|
||||||
if (module_inner != null) {
|
|
||||||
show_tooltip(module_inner, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
event.stopPropagation();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#node_info").mouseup(function(event) {
|
|
||||||
var x = event.pageX - $("#node_info").offset().left;
|
|
||||||
var y = event.pageY - $("#node_info").offset().top;
|
|
||||||
|
|
||||||
drag = false;
|
|
||||||
drag_x = 0;
|
|
||||||
drag_y = 0;
|
|
||||||
dirty_popup = true;
|
|
||||||
|
|
||||||
document.body.style.cursor = "default";
|
|
||||||
|
|
||||||
module_inner = null;
|
|
||||||
|
|
||||||
event.stopPropagation();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#node_info").mouseout(function(event) {
|
|
||||||
var x = event.pageX - $("#node_info").offset().left;
|
|
||||||
var y = event.pageY - $("#node_info").offset().top;
|
|
||||||
|
|
||||||
drag = false;
|
|
||||||
drag_x = 0;
|
|
||||||
drag_y = 0;
|
|
||||||
dirty_popup = true;
|
|
||||||
|
|
||||||
document.body.style.cursor = "default";
|
|
||||||
|
|
||||||
module_inner = null;
|
|
||||||
|
|
||||||
event.stopPropagation();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$(window).resize(function() {
|
|
||||||
function show_networkmap_node(id_agent_param, refresh_state) {
|
|
||||||
id_agent = id_agent_param;
|
|
||||||
|
|
||||||
canvas = $("#node_info");
|
|
||||||
context_popup = canvas[0].getContext("2d");
|
|
||||||
|
|
||||||
dirty_popup = true;
|
|
||||||
self.setInterval("check_popup_modification()", 1000 / 30);
|
|
||||||
|
|
||||||
$("#node_info").mousemove(function(event) {
|
|
||||||
var x = event.pageX - $("#node_info").offset().left;
|
|
||||||
var y = event.pageY - $("#node_info").offset().top;
|
|
||||||
|
|
||||||
module_inner = inner_module(x, y);
|
|
||||||
|
|
||||||
if (module_inner != null) {
|
|
||||||
document.body.style.cursor = "pointer";
|
|
||||||
} else {
|
|
||||||
document.body.style.cursor = "default";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#node_info").mousedown(function(event) {
|
|
||||||
var x = event.pageX - $("#node_info").offset().left;
|
|
||||||
var y = event.pageY - $("#node_info").offset().top;
|
|
||||||
|
|
||||||
if (module_inner != null) {
|
|
||||||
show_tooltip(module_inner, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
event.stopPropagation();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#node_info").mouseup(function(event) {
|
|
||||||
var x = event.pageX - $("#node_info").offset().left;
|
|
||||||
var y = event.pageY - $("#node_info").offset().top;
|
|
||||||
|
|
||||||
drag = false;
|
|
||||||
drag_x = 0;
|
|
||||||
drag_y = 0;
|
|
||||||
dirty_popup = true;
|
|
||||||
|
|
||||||
document.body.style.cursor = "default";
|
|
||||||
|
|
||||||
module_inner = null;
|
|
||||||
|
|
||||||
event.stopPropagation();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#node_info").mouseout(function(event) {
|
|
||||||
var x = event.pageX - $("#node_info").offset().left;
|
|
||||||
var y = event.pageY - $("#node_info").offset().top;
|
|
||||||
|
|
||||||
drag = false;
|
|
||||||
drag_x = 0;
|
|
||||||
drag_y = 0;
|
|
||||||
dirty_popup = true;
|
|
||||||
|
|
||||||
document.body.style.cursor = "default";
|
|
||||||
|
|
||||||
module_inner = null;
|
|
||||||
|
|
||||||
event.stopPropagation();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$(window).resize(function() {
|
|
||||||
pos_scroll = Math.floor(
|
|
||||||
$("#content_node_info").width() / 2
|
|
||||||
);
|
|
||||||
|
|
||||||
$("#content_node_info").scrollLeft(pos_scroll);
|
|
||||||
|
|
||||||
dirty_popup = true;
|
|
||||||
check_popup_modification();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
pos_scroll = Math.floor($("#content_node_info").width() / 2);
|
|
||||||
|
|
||||||
$("#content_node_info").scrollLeft(pos_scroll);
|
|
||||||
|
|
||||||
dirty_popup = true;
|
|
||||||
check_popup_modification();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -4213,7 +4114,7 @@ function get_status_node() {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "../../../ajax.php"),
|
url: "../../../ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data["correct"]) {
|
if (data["correct"]) {
|
||||||
color_status_node = data["status_agent"];
|
color_status_node = data["status_agent"];
|
||||||
|
@ -4235,7 +4136,7 @@ function get_status_module() {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "../../../ajax.php"),
|
url: "../../../ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data["correct"]) {
|
if (data["correct"]) {
|
||||||
modules[data["id"]].status_color = data["status_color"];
|
modules[data["id"]].status_color = data["status_color"];
|
||||||
|
@ -4333,7 +4234,7 @@ function show_tooltip_content(id) {
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "../../../ajax.php"),
|
url: "../../../ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data["correct"]) {
|
if (data["correct"]) {
|
||||||
$("#tooltip").html(data["content"]);
|
$("#tooltip").html(data["content"]);
|
||||||
|
@ -4353,7 +4254,7 @@ function show_tooltip(id, x, y) {
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params1.join("&"),
|
data: params1.join("&"),
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: (action = "../../../ajax.php"),
|
url: "../../../ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$("#tooltip").html(data);
|
$("#tooltip").html(data);
|
||||||
$("#tooltip").css("display", "");
|
$("#tooltip").css("display", "");
|
||||||
|
|
|
@ -834,12 +834,10 @@ function add_macro_field(macro, row_model_id) {
|
||||||
$("#" + row_id)
|
$("#" + row_id)
|
||||||
.children()
|
.children()
|
||||||
.eq(1)
|
.eq(1)
|
||||||
.children()
|
|
||||||
.attr("id", "text-" + macro_macro);
|
.attr("id", "text-" + macro_macro);
|
||||||
$("#" + row_id)
|
$("#" + row_id)
|
||||||
.children()
|
.children()
|
||||||
.eq(1)
|
.eq(1)
|
||||||
.children()
|
|
||||||
.attr("name", macro_macro);
|
.attr("name", macro_macro);
|
||||||
|
|
||||||
macro_field_hide = false;
|
macro_field_hide = false;
|
||||||
|
@ -859,13 +857,11 @@ function add_macro_field(macro, row_model_id) {
|
||||||
$("#" + row_id)
|
$("#" + row_id)
|
||||||
.children()
|
.children()
|
||||||
.eq(1)
|
.eq(1)
|
||||||
.children()
|
|
||||||
.attr("type", "password");
|
.attr("type", "password");
|
||||||
}
|
}
|
||||||
$("#" + row_id)
|
$("#" + row_id)
|
||||||
.children()
|
.children()
|
||||||
.eq(1)
|
.eq(1)
|
||||||
.children()
|
|
||||||
.val(macro_value);
|
.val(macro_value);
|
||||||
|
|
||||||
$("#" + row_id).show();
|
$("#" + row_id).show();
|
||||||
|
@ -1121,3 +1117,90 @@ function delete_macro(num) {
|
||||||
|
|
||||||
// Do not decrease the macro counter or new macros may overlap existing ones!
|
// Do not decrease the macro counter or new macros may overlap existing ones!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_explanation_recon_script(id, id_rt, url) {
|
||||||
|
var xhrManager = function() {
|
||||||
|
var manager = {};
|
||||||
|
|
||||||
|
manager.tasks = [];
|
||||||
|
|
||||||
|
manager.addTask = function(xhr) {
|
||||||
|
manager.tasks.push(xhr);
|
||||||
|
};
|
||||||
|
|
||||||
|
manager.stopTasks = function() {
|
||||||
|
while (manager.tasks.length > 0) manager.tasks.pop().abort();
|
||||||
|
};
|
||||||
|
|
||||||
|
return manager;
|
||||||
|
};
|
||||||
|
|
||||||
|
var taskManager = new xhrManager();
|
||||||
|
|
||||||
|
// Stop old ajax tasks.
|
||||||
|
taskManager.stopTasks();
|
||||||
|
|
||||||
|
// Show the spinners.
|
||||||
|
$("#textarea_explanation").hide();
|
||||||
|
$("#spinner_layout").show();
|
||||||
|
|
||||||
|
var xhr = jQuery.ajax({
|
||||||
|
data: {
|
||||||
|
page: "enterprise/include/ajax/hostDevices.ajax",
|
||||||
|
get_explanation: 1,
|
||||||
|
id: id,
|
||||||
|
id_rt: id_rt
|
||||||
|
},
|
||||||
|
url: url,
|
||||||
|
type: "POST",
|
||||||
|
dataType: "text",
|
||||||
|
complete: function(xhr, textStatus) {
|
||||||
|
$("#spinner_layout").hide();
|
||||||
|
},
|
||||||
|
success: function(data, textStatus, xhr) {
|
||||||
|
$("#textarea_explanation").val(data);
|
||||||
|
$("#textarea_explanation").show();
|
||||||
|
},
|
||||||
|
error: function(xhr, textStatus, errorThrown) {
|
||||||
|
console.log(errorThrown);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
taskManager.addTask(xhr);
|
||||||
|
|
||||||
|
// Delete all the macro fields.
|
||||||
|
$(".macro_field").remove();
|
||||||
|
$("#spinner_recon_script").show();
|
||||||
|
|
||||||
|
var xhr = jQuery.ajax({
|
||||||
|
data: {
|
||||||
|
page: "enterprise/include/ajax/hostDevices.ajax",
|
||||||
|
get_recon_script_macros: 1,
|
||||||
|
id: id,
|
||||||
|
id_rt: id_rt
|
||||||
|
},
|
||||||
|
url: url,
|
||||||
|
type: "POST",
|
||||||
|
dataType: "json",
|
||||||
|
complete: function(xhr, textStatus) {
|
||||||
|
$("#spinner_recon_script").hide();
|
||||||
|
forced_title_callback();
|
||||||
|
},
|
||||||
|
success: function(data, textStatus, xhr) {
|
||||||
|
if (data.array !== null) {
|
||||||
|
$("#hidden-macros").val(data.base64);
|
||||||
|
|
||||||
|
jQuery.each(data.array, function(i, macro) {
|
||||||
|
if (macro.desc != "") {
|
||||||
|
add_macro_field(macro, "table_recon-macro");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, textStatus, errorThrown) {
|
||||||
|
console.log(errorThrown);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
taskManager.addTask(xhr);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*
|
||||||
|
global $
|
||||||
|
global jQuery
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function for create modal with progress task
|
||||||
|
* and recalculate 3 second.
|
||||||
|
* @param {int} id
|
||||||
|
* @param {string} name
|
||||||
|
*/
|
||||||
|
function progress_task_list(id, title) {
|
||||||
|
var timeoutRef = null;
|
||||||
|
var xhr = null;
|
||||||
|
var $elem = $("#progress_task_" + id);
|
||||||
|
|
||||||
|
$elem
|
||||||
|
.hide()
|
||||||
|
.empty()
|
||||||
|
.dialog({
|
||||||
|
title: title,
|
||||||
|
draggable: true,
|
||||||
|
modal: false,
|
||||||
|
width: 600,
|
||||||
|
height: 420,
|
||||||
|
close: function() {
|
||||||
|
if (xhr != null) xhr.abort();
|
||||||
|
if (timeoutRef != null) clearTimeout(timeoutRef);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Function var.
|
||||||
|
var handleFetchTaskList = function(err, data) {
|
||||||
|
if (err) {
|
||||||
|
// TODO: Show info about the problem.
|
||||||
|
}
|
||||||
|
|
||||||
|
$elem.html(data.html);
|
||||||
|
if (!$elem.dialog("isOpen")) $elem.dialog("open");
|
||||||
|
|
||||||
|
if (data.status != -1) {
|
||||||
|
timeoutRef = setTimeout(function() {
|
||||||
|
xhr = fetchTaskList(id, handleFetchTaskList);
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
xhr = fetchTaskList(id, handleFetchTaskList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function that performs ajax request to return
|
||||||
|
* the progress of the task.
|
||||||
|
* @param {int} id Id task.
|
||||||
|
* @param {function} callback Function callback.
|
||||||
|
*/
|
||||||
|
function fetchTaskList(id, callback) {
|
||||||
|
return jQuery.ajax({
|
||||||
|
data: {
|
||||||
|
page: "include/ajax/task_list.ajax",
|
||||||
|
progress_task_discovery: 1,
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
url: "ajax.php",
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
callback(null, data);
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
callback(new Error("cannot fetch the list"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function show_map(id, name) {
|
||||||
|
$("#map_task")
|
||||||
|
.empty()
|
||||||
|
.hide()
|
||||||
|
.append("<p>Loading map</p>")
|
||||||
|
.dialog({
|
||||||
|
title: "Task: " + name,
|
||||||
|
resizable: true,
|
||||||
|
draggable: true,
|
||||||
|
modal: false,
|
||||||
|
width: 1280,
|
||||||
|
height: 700
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
|
||||||
|
jQuery.ajax({
|
||||||
|
data: {
|
||||||
|
page: "include/ajax/task_list.ajax",
|
||||||
|
showmap: 1,
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
url: "ajax.php",
|
||||||
|
dataType: "html",
|
||||||
|
success: function(data) {
|
||||||
|
$("#map_task")
|
||||||
|
.empty()
|
||||||
|
.append(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
|
@ -58,7 +58,7 @@
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
#cluster_map {
|
#simple_map {
|
||||||
border: 1px solid lightgray;
|
border: 1px solid lightgray;
|
||||||
width: 900px;
|
width: 900px;
|
||||||
height: 500px;
|
height: 500px;
|
||||||
|
|
|
@ -49,7 +49,6 @@ div.data_container:hover {
|
||||||
h1.wizard {
|
h1.wizard {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
margin-top: -1.25em;
|
|
||||||
}
|
}
|
||||||
h1.wizard a {
|
h1.wizard a {
|
||||||
margin-left: -20px;
|
margin-left: -20px;
|
||||||
|
@ -65,7 +64,6 @@ h1.wizard a:hover {
|
||||||
div.arrow_box {
|
div.arrow_box {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
position: relative;
|
position: relative;
|
||||||
background: #ccc;
|
|
||||||
color: #888;
|
color: #888;
|
||||||
padding: 1.3em;
|
padding: 1.3em;
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
|
@ -73,16 +71,6 @@ div.arrow_box {
|
||||||
padding-left: 3em;
|
padding-left: 3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.arrow_box:before {
|
|
||||||
top: 50%;
|
|
||||||
border: solid transparent;
|
|
||||||
content: " ";
|
|
||||||
height: 0;
|
|
||||||
width: 0;
|
|
||||||
position: absolute;
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
.arrow_box.selected {
|
.arrow_box.selected {
|
||||||
background: #424242;
|
background: #424242;
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
|
@ -111,3 +99,68 @@ div.arrow_box:before {
|
||||||
.arrow_box:hover {
|
.arrow_box:hover {
|
||||||
color: #000;
|
color: #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Breadcrum
|
||||||
|
*/
|
||||||
|
|
||||||
|
#menu_tab_frame_view_bc {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
border-bottom: 2px solid #82b92e;
|
||||||
|
max-height: 70px;
|
||||||
|
min-height: 55px;
|
||||||
|
width: 100%;
|
||||||
|
padding-right: 0px;
|
||||||
|
margin-left: 0px !important;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
height: 55px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color: #fafafa;
|
||||||
|
border-top-right-radius: 7px;
|
||||||
|
border-top-left-radius: 7px;
|
||||||
|
box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.1);
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu_tab_frame_view_bc .breadcrumbs_container {
|
||||||
|
align-self: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumbs_container {
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-top: 4px;
|
||||||
|
text-indent: 0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb_link {
|
||||||
|
color: #848484;
|
||||||
|
font-size: 10pt !important;
|
||||||
|
font-family: "lato-bolder", "Open Sans", sans-serif !important;
|
||||||
|
text-decoration: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.breadcrumb_link {
|
||||||
|
color: #d0d0d0;
|
||||||
|
font-size: 12pt !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb_link.selected {
|
||||||
|
color: #95b750;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb_link.selected:hover {
|
||||||
|
color: #95b750;
|
||||||
|
}
|
||||||
|
.breadcrumb_link:hover {
|
||||||
|
color: #95b750;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form_grid_items {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.form_grid_items .form_grid_item {
|
||||||
|
float: left;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@ div.new_task_cluster > div {
|
||||||
}
|
}
|
||||||
#description_task {
|
#description_task {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
line-height: 1.8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#fuerte {
|
#fuerte {
|
||||||
|
|
|
@ -107,61 +107,61 @@
|
||||||
background-position: 4px 2px;
|
background-position: 4px 2px;
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-edit {
|
.context-menu-item.icon-edit {
|
||||||
background-image: url(../../images/page_white_edit.png);
|
background-image: url(../../../images/page_white_edit.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-cut {
|
.context-menu-item.icon-cut {
|
||||||
background-image: url(../../images/cut.png);
|
background-image: url(../../../images/cut.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-copy {
|
.context-menu-item.icon-copy {
|
||||||
background-image: url(../../images/page_white_copy.png);
|
background-image: url(../../../images/page_white_copy.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-paste {
|
.context-menu-item.icon-paste {
|
||||||
background-image: url(../../images/page_white_paste.png);
|
background-image: url(../../../images/page_white_paste.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-delete {
|
.context-menu-item.icon-delete {
|
||||||
background-image: url(../../images/delete.png);
|
background-image: url(../../../images/delete.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-add {
|
.context-menu-item.icon-add {
|
||||||
background-image: url(../../images/page_white_add.png);
|
background-image: url(../../../images/page_white_add.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-quit {
|
.context-menu-item.icon-quit {
|
||||||
background-image: url(../../images/door.png);
|
background-image: url(../../../images/door.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-refresh {
|
.context-menu-item.icon-refresh {
|
||||||
background-image: url(../../images/refresh.png);
|
background-image: url(../../../images/refresh.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-center {
|
.context-menu-item.icon-center {
|
||||||
background-image: url(../../images/set_center.png);
|
background-image: url(../../../images/set_center.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-details {
|
.context-menu-item.icon-details {
|
||||||
background-image: url(../../images/show_details.png);
|
background-image: url(../../../images/show_details.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-children {
|
.context-menu-item.icon-children {
|
||||||
background-image: url(../../images/children.png);
|
background-image: url(../../../images/children.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-cancel_set_parent {
|
.context-menu-item.icon-cancel_set_parent {
|
||||||
background-image: url(../../images/link_delete.png);
|
background-image: url(../../../images/link_delete.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-set_parent {
|
.context-menu-item.icon-set_parent {
|
||||||
background-image: url(../../images/father.png);
|
background-image: url(../../../images/father.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-add_node {
|
.context-menu-item.icon-add_node {
|
||||||
background-image: url(../../images/add.png);
|
background-image: url(../../../images/add.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-refresh_holding_area {
|
.context-menu-item.icon-refresh_holding_area {
|
||||||
background-image: url(../../images/refresh_holding_area.png);
|
background-image: url(../../../images/refresh_holding_area.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-restart_map {
|
.context-menu-item.icon-restart_map {
|
||||||
background-image: url(../../images/reset.png);
|
background-image: url(../../../images/reset.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-interface_link_children {
|
.context-menu-item.icon-interface_link_children {
|
||||||
background-image: url(../../images/icono_link_hijo.png);
|
background-image: url(../../../images/icono_link_hijo.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-interface_link_parent {
|
.context-menu-item.icon-interface_link_parent {
|
||||||
background-image: url(../../images/icono_link_padre.png);
|
background-image: url(../../../images/icono_link_padre.png);
|
||||||
}
|
}
|
||||||
.context-menu-item.icon-interface_link_cancel {
|
.context-menu-item.icon-interface_link_cancel {
|
||||||
background-image: url(../../images/link_abortar.png);
|
background-image: url(../../../images/link_abortar.png);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vertically align inside labels */
|
/* vertically align inside labels */
|
||||||
|
|
|
@ -31,8 +31,7 @@
|
||||||
.operation .menu_icon ul.submenu > li,
|
.operation .menu_icon ul.submenu > li,
|
||||||
.godmode .menu_icon ul.submenu > li {
|
.godmode .menu_icon ul.submenu > li {
|
||||||
background-color: #282828;
|
background-color: #282828;
|
||||||
padding-left: 10px;
|
padding-left: 1.5em;
|
||||||
padding-right: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu ul {
|
.menu ul {
|
||||||
|
@ -58,7 +57,7 @@ li:hover ul {
|
||||||
.submenu_text {
|
.submenu_text {
|
||||||
margin-left: 0px;
|
margin-left: 0px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
color: #9ca4a6;
|
color: #b9b9b9;
|
||||||
font-family: "Open Sans", sans-serif;
|
font-family: "Open Sans", sans-serif;
|
||||||
font-size: 9.4pt;
|
font-size: 9.4pt;
|
||||||
}
|
}
|
||||||
|
@ -71,21 +70,20 @@ li:hover ul {
|
||||||
margin: 0px 0px 0px 0px;
|
margin: 0px 0px 0px 0px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
width: 214px;
|
width: 240px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.submenu2 {
|
.submenu2 {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
left: 214px;
|
left: 240px;
|
||||||
width: 214px;
|
width: 240px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sub_subMenu {
|
.sub_subMenu {
|
||||||
font-weight: normal !important;
|
font-weight: normal !important;
|
||||||
background-color: #202020;
|
background-color: #202020;
|
||||||
padding-left: 10px;
|
padding-left: 1.5em;
|
||||||
padding-right: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sub_subMenu.selected {
|
.sub_subMenu.selected {
|
||||||
|
@ -291,7 +289,7 @@ ul li a:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
.operation {
|
.operation {
|
||||||
background-color: #343434 !important;
|
background-color: #3d3d3d !important;
|
||||||
padding-top: 20px !important;
|
padding-top: 20px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,11 +466,11 @@ ul li a:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
.header_table_classic {
|
.header_table_classic {
|
||||||
padding-left: 250px !important; /* 215 + 35 */
|
padding-left: 235px !important; /* 215 + 35 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.header_table_collapsed {
|
.header_table_collapsed {
|
||||||
padding-left: 95px !important; /* 60 + 35 */
|
padding-left: 80px !important; /* 60 + 35 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.title_menu_classic {
|
.title_menu_classic {
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
.node {
|
||||||
|
stroke: #fff;
|
||||||
|
stroke-width: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.node_over {
|
||||||
|
stroke: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.node_selected {
|
||||||
|
stroke: #343434;
|
||||||
|
stroke-width: 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.node_children {
|
||||||
|
stroke: #00f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link {
|
||||||
|
stroke-opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link_over {
|
||||||
|
stroke: #000;
|
||||||
|
stroke-opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.holding_area {
|
||||||
|
stroke: #0f0;
|
||||||
|
stroke-dasharray: 12, 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.holding_area_link {
|
||||||
|
stroke-dasharray: 12, 3;
|
||||||
|
}
|
|
@ -404,10 +404,10 @@ div#page {
|
||||||
background-image: none;
|
background-image: none;
|
||||||
clear: both;
|
clear: both;
|
||||||
width: auto;
|
width: auto;
|
||||||
padding-top: 20px !important;
|
padding-top: 5px !important;
|
||||||
padding-left: 60px; /* This is overwritten by the classic menu (215px)*/
|
padding-left: 60px; /* This is overwritten by the classic menu (215px)*/
|
||||||
padding-right: 35px;
|
padding-right: 35px;
|
||||||
margin-left: 35px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.pure {
|
body.pure {
|
||||||
|
@ -1266,7 +1266,7 @@ div.title_line {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-color: #fff;
|
background-color: #fafafa;
|
||||||
border-top-right-radius: 7px;
|
border-top-right-radius: 7px;
|
||||||
border-top-left-radius: 7px;
|
border-top-left-radius: 7px;
|
||||||
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
|
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
@ -1305,6 +1305,7 @@ div.title_line {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
|
padding-top: 6px;
|
||||||
}
|
}
|
||||||
#menu_tab li.nomn:hover a,
|
#menu_tab li.nomn:hover a,
|
||||||
#menu_tab li:hover ul a:hover {
|
#menu_tab li:hover ul a:hover {
|
||||||
|
@ -1410,7 +1411,8 @@ div#agent_wizard_subtabs {
|
||||||
#menu_tab_left li a,
|
#menu_tab_left li a,
|
||||||
#menu_tab_left li span {
|
#menu_tab_left li span {
|
||||||
color: #343434;
|
color: #343434;
|
||||||
font-size: 14pt;
|
font-size: 16pt;
|
||||||
|
line-height: 16pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2019,6 +2021,7 @@ div#pandora_logo_header {
|
||||||
|
|
||||||
#header_table_inner {
|
#header_table_inner {
|
||||||
height: 60px;
|
height: 60px;
|
||||||
|
min-width: 790px;
|
||||||
/*width: 100%;*/
|
/*width: 100%;*/
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -3251,7 +3254,7 @@ div.div_groups_status {
|
||||||
}
|
}
|
||||||
|
|
||||||
#title_menu {
|
#title_menu {
|
||||||
color: #9ca4a6;
|
color: #b9b9b9;
|
||||||
float: right;
|
float: right;
|
||||||
width: 72%;
|
width: 72%;
|
||||||
letter-spacing: 0pt;
|
letter-spacing: 0pt;
|
||||||
|
@ -3267,16 +3270,15 @@ div.div_groups_status {
|
||||||
|
|
||||||
#menu_tab li.nomn,
|
#menu_tab li.nomn,
|
||||||
#menu_tab li.nomn_high {
|
#menu_tab li.nomn_high {
|
||||||
background-color: #fff;
|
padding-right: 8px;
|
||||||
padding-right: 3px;
|
padding-left: 8px;
|
||||||
padding-left: 3px;
|
|
||||||
padding-top: 6px;
|
padding-top: 6px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
min-width: 30px;
|
min-width: 30px;
|
||||||
height: 29px;
|
height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#menu_tab li:hover {
|
#menu_tab li:hover {
|
||||||
|
@ -3287,6 +3289,7 @@ div.div_groups_status {
|
||||||
#menu_tab li.nomn_high span {
|
#menu_tab li.nomn_high span {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
box-shadow: inset 0px 4px #82b92e;
|
box-shadow: inset 0px 4px #82b92e;
|
||||||
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
#menu_tab li.nomn img,
|
#menu_tab li.nomn img,
|
||||||
|
@ -4420,6 +4423,10 @@ div#dialog_messages table th:last-child {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.notification-ball.notification-ball-new-messages:hover {
|
||||||
|
box-shadow: 0 0 3px #888;
|
||||||
|
}
|
||||||
|
|
||||||
.notification-ball-no-messages {
|
.notification-ball-no-messages {
|
||||||
background-color: #82b92e;
|
background-color: #82b92e;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
@ -4433,7 +4440,7 @@ div#dialog_messages table th:last-child {
|
||||||
border: #a5a5a5 solid 1px;
|
border: #a5a5a5 solid 1px;
|
||||||
z-index: 900000;
|
z-index: 900000;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 400px;
|
width: 550px;
|
||||||
margin-top: -5px;
|
margin-top: -5px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
@ -4447,8 +4454,7 @@ div#dialog_messages table th:last-child {
|
||||||
border-width: 12px;
|
border-width: 12px;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
bottom: 100%;
|
bottom: 100%;
|
||||||
left: 78%;
|
left: calc(58% - 7px);
|
||||||
left: calc(78% - 2px);
|
|
||||||
margin-left: -12px;
|
margin-left: -12px;
|
||||||
border-bottom-color: white;
|
border-bottom-color: white;
|
||||||
}
|
}
|
||||||
|
@ -4741,8 +4747,8 @@ input:checked + .p-slider:before {
|
||||||
/* New white rounded boxes */
|
/* New white rounded boxes */
|
||||||
.white_box {
|
.white_box {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border: 1px solid #d7d9da;
|
border: 1px solid #f3f3f3;
|
||||||
border-radius: 10px;
|
border-radius: 5px;
|
||||||
padding: 20px 50px;
|
padding: 20px 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Name: Default theme
|
||||||
|
*
|
||||||
|
* Extension to manage a list of gateways and the node address where they should
|
||||||
|
* point to.
|
||||||
|
*
|
||||||
|
* @category css
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
ul.progress_task_discovery {
|
||||||
|
width: 80%;
|
||||||
|
margin: 0 auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.progress_task_discovery li span {
|
||||||
|
font-size: 9pt;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
|
@ -244,7 +244,6 @@ if (strlen($search) > 0) {
|
||||||
|
|
||||||
// Login process
|
// Login process
|
||||||
if (! isset($config['id_user'])) {
|
if (! isset($config['id_user'])) {
|
||||||
|
|
||||||
// Clear error messages.
|
// Clear error messages.
|
||||||
unset($_COOKIE['errormsg']);
|
unset($_COOKIE['errormsg']);
|
||||||
setcookie('errormsg', null, -1);
|
setcookie('errormsg', null, -1);
|
||||||
|
|
|
@ -504,9 +504,9 @@ function create_loading_tooltip(d, x, y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_tooltip(d) {
|
function show_tooltip(d) {
|
||||||
x = d3.event.clientX + 10;
|
x = d3.event.clientX 100;
|
||||||
y = d3.event.clientY + 10;
|
y = d3.event.clientY 100;
|
||||||
|
|
||||||
if (d.default_tooltip) {
|
if (d.default_tooltip) {
|
||||||
create_loading_tooltip(d, x, y);
|
create_loading_tooltip(d, x, y);
|
||||||
|
|
||||||
|
|
|
@ -49,18 +49,18 @@ if ($new_networkmap) {
|
||||||
$id_group = 0;
|
$id_group = 0;
|
||||||
$node_radius = 40;
|
$node_radius = 40;
|
||||||
$description = '';
|
$description = '';
|
||||||
$method = 'fdp';
|
$method = 'neato';
|
||||||
$recon_task_id = 0;
|
$recon_task_id = 0;
|
||||||
$source = 'group';
|
$source = 'group';
|
||||||
$ip_mask = '';
|
$ip_mask = '';
|
||||||
$dont_show_subgroups = false;
|
$dont_show_subgroups = 0;
|
||||||
$offset_x = '';
|
$offset_x = '';
|
||||||
$offset_y = '';
|
$offset_y = '';
|
||||||
$scale_z = 0.5;
|
$scale_z = 0.5;
|
||||||
$node_sep = 0.25;
|
$node_sep = 0.1;
|
||||||
$rank_sep = 1.0;
|
$rank_sep = 1.0;
|
||||||
$mindist = 1.0;
|
$mindist = 1.0;
|
||||||
$kval = 0.3;
|
$kval = 0.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$disabled_generation_method_select = false;
|
$disabled_generation_method_select = false;
|
||||||
|
@ -330,7 +330,13 @@ if ($not_found) {
|
||||||
$table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source);
|
$table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source);
|
||||||
|
|
||||||
$table->data['source_data_dont_show_subgroups'][0] = __('Don\'t show subgroups:');
|
$table->data['source_data_dont_show_subgroups'][0] = __('Don\'t show subgroups:');
|
||||||
$table->data['source_data_dont_show_subgroups'][1] = html_print_checkbox('dont_show_subgroups', '1', $dont_show_subgroups, true, $disabled_source);
|
$table->data['source_data_dont_show_subgroups'][1] = html_print_checkbox(
|
||||||
|
'dont_show_subgroups',
|
||||||
|
'1',
|
||||||
|
$dont_show_subgroups,
|
||||||
|
true,
|
||||||
|
$disabled_source
|
||||||
|
);
|
||||||
|
|
||||||
$methods = [
|
$methods = [
|
||||||
'twopi' => 'radial',
|
'twopi' => 'radial',
|
||||||
|
@ -348,7 +354,7 @@ if ($not_found) {
|
||||||
$method,
|
$method,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'twopi',
|
'neato',
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
|
|
|
@ -30,7 +30,6 @@ if (!$networkmaps_read && !$networkmaps_write && !$networkmaps_manage) {
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once 'include/functions_networkmap.php';
|
require_once 'include/functions_networkmap.php';
|
||||||
require_once 'include/functions_pandora_networkmap.php';
|
|
||||||
|
|
||||||
$new_networkmap = (bool) get_parameter('new_networkmap', false);
|
$new_networkmap = (bool) get_parameter('new_networkmap', false);
|
||||||
$save_networkmap = (bool) get_parameter('save_networkmap', false);
|
$save_networkmap = (bool) get_parameter('save_networkmap', false);
|
||||||
|
@ -45,8 +44,9 @@ $new_empty_networkmap = get_parameter('new_empty_networkmap', false);
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
if ($new_empty_networkmap) {
|
if ($new_empty_networkmap) {
|
||||||
if ($networkmaps_write || $networkmaps_manage) {
|
if ($networkmaps_write || $networkmaps_manage) {
|
||||||
include $config['homedir'].'/enterprise/godmode/agentes/pandora_networkmap_empty.editor.php';
|
enterprise_include(
|
||||||
include 'pandora_networkmap_empty.editor.php';
|
'godmode/agentes/pandora_networkmap_empty.editor.php'
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,12 +71,15 @@ if (enterprise_installed()) {
|
||||||
$name = (string) get_parameter('name', '');
|
$name = (string) get_parameter('name', '');
|
||||||
|
|
||||||
// Default size values
|
// Default size values
|
||||||
$width = 4000;
|
$width = $config['networkmap_max_width'];
|
||||||
$height = 4000;
|
$height = $config['networkmap_max_width'];
|
||||||
|
|
||||||
$method = (string) get_parameter('method', 'fdp');
|
$method = (string) get_parameter('method', 'fdp');
|
||||||
|
|
||||||
$dont_show_subgroups = 0;
|
$dont_show_subgroups = (int) get_parameter_checkbox(
|
||||||
|
'dont_show_subgroups',
|
||||||
|
0
|
||||||
|
);
|
||||||
$node_radius = (int) get_parameter('node_radius', 40);
|
$node_radius = (int) get_parameter('node_radius', 40);
|
||||||
$description = get_parameter('description', '');
|
$description = get_parameter('description', '');
|
||||||
|
|
||||||
|
@ -126,7 +129,14 @@ if (enterprise_installed()) {
|
||||||
$id = $result;
|
$id = $result;
|
||||||
define('_id_', $id);
|
define('_id_', $id);
|
||||||
|
|
||||||
$tab = 'view';
|
if ($result !== false) {
|
||||||
|
$tab = 'view';
|
||||||
|
header(
|
||||||
|
'Location: '.ui_get_full_url(
|
||||||
|
'index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab='.$tab.'&id_networkmap='.$id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
} else if ($update_empty_networkmap) {
|
} else if ($update_empty_networkmap) {
|
||||||
$id_group = (int) get_parameter('id_group', 0);
|
$id_group = (int) get_parameter('id_group', 0);
|
||||||
|
|
||||||
|
@ -161,7 +171,10 @@ if (enterprise_installed()) {
|
||||||
$description = get_parameter('description', '');
|
$description = get_parameter('description', '');
|
||||||
$values['description'] = $description;
|
$values['description'] = $description;
|
||||||
|
|
||||||
$dont_show_subgroups = 0;
|
$dont_show_subgroups = (int) get_parameter_checkbox(
|
||||||
|
'dont_show_subgroups',
|
||||||
|
0
|
||||||
|
);
|
||||||
$node_radius = (int) get_parameter('node_radius', 40);
|
$node_radius = (int) get_parameter('node_radius', 40);
|
||||||
$row = db_get_row('tmap', 'id', $id);
|
$row = db_get_row('tmap', 'id', $id);
|
||||||
$filter = json_decode($row['filter'], true);
|
$filter = json_decode($row['filter'], true);
|
||||||
|
@ -189,9 +202,9 @@ if (enterprise_installed()) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result_txt = '';
|
|
||||||
// The networkmap doesn't exist yet
|
// The networkmap doesn't exist yet
|
||||||
if ($new_networkmap || $save_networkmap) {
|
if ($new_networkmap || $save_networkmap) {
|
||||||
|
$result_txt = '';
|
||||||
if ($new_networkmap) {
|
if ($new_networkmap) {
|
||||||
if ($networkmaps_write || $networkmaps_manage) {
|
if ($networkmaps_write || $networkmaps_manage) {
|
||||||
include 'pandora_networkmap.editor.php';
|
include 'pandora_networkmap.editor.php';
|
||||||
|
@ -226,8 +239,8 @@ if ($new_networkmap || $save_networkmap) {
|
||||||
$name = (string) get_parameter('name', '');
|
$name = (string) get_parameter('name', '');
|
||||||
|
|
||||||
// Default size values
|
// Default size values
|
||||||
$width = 4000;
|
$width = $config['networkmap_max_width'];
|
||||||
$height = 4000;
|
$height = $config['networkmap_max_width'];
|
||||||
|
|
||||||
$method = (string) get_parameter('method', 'fdp');
|
$method = (string) get_parameter('method', 'fdp');
|
||||||
|
|
||||||
|
@ -240,12 +253,15 @@ if ($new_networkmap || $save_networkmap) {
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
$source = (string) get_parameter('source', 'group');
|
$source = (string) get_parameter('source', 'group');
|
||||||
$dont_show_subgroups = (int) get_parameter('dont_show_subgroups', 0);
|
$dont_show_subgroups = (int) get_parameter_checkbox(
|
||||||
|
'dont_show_subgroups',
|
||||||
|
0
|
||||||
|
);
|
||||||
$node_radius = (int) get_parameter('node_radius', 40);
|
$node_radius = (int) get_parameter('node_radius', 40);
|
||||||
$description = get_parameter('description', '');
|
$description = get_parameter('description', '');
|
||||||
|
|
||||||
$offset_x = get_parameter('pos_x');
|
$offset_x = get_parameter('pos_x', 0);
|
||||||
$offset_y = get_parameter('pos_y');
|
$offset_y = get_parameter('pos_y', 0);
|
||||||
$scale_z = get_parameter('scale_z', 0.5);
|
$scale_z = get_parameter('scale_z', 0.5);
|
||||||
|
|
||||||
$node_sep = get_parameter('node_sep', '0.25');
|
$node_sep = get_parameter('node_sep', '0.25');
|
||||||
|
@ -269,31 +285,31 @@ if ($new_networkmap || $save_networkmap) {
|
||||||
|
|
||||||
switch ($method) {
|
switch ($method) {
|
||||||
case 'twopi':
|
case 'twopi':
|
||||||
$values['generation_method'] = 2;
|
$values['generation_method'] = LAYOUT_RADIAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'dot':
|
case 'dot':
|
||||||
$values['generation_method'] = 1;
|
$values['generation_method'] = LAYOUT_FLAT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'circo':
|
case 'circo':
|
||||||
$values['generation_method'] = 0;
|
$values['generation_method'] = LAYOUT_CIRCULAR;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'neato':
|
case 'neato':
|
||||||
$values['generation_method'] = 3;
|
$values['generation_method'] = LAYOUT_SPRING1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'fdp':
|
case 'fdp':
|
||||||
$values['generation_method'] = 4;
|
$values['generation_method'] = LAYOUT_SPRING2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'radial_dinamic':
|
case 'radial_dinamic':
|
||||||
$values['generation_method'] = 6;
|
$values['generation_method'] = LAYOUT_RADIAL_DYNAMIC;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$values['generation_method'] = 2;
|
$values['generation_method'] = LAYOUT_RADIAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,11 +365,25 @@ if ($new_networkmap || $save_networkmap) {
|
||||||
$id = $result;
|
$id = $result;
|
||||||
define('_id_', $id);
|
define('_id_', $id);
|
||||||
|
|
||||||
$tab = 'view';
|
if ($result !== false) {
|
||||||
|
$tab = 'view';
|
||||||
if ($values['generation_method'] == 6) {
|
if ($values['generation_method'] == LAYOUT_RADIAL_DYNAMIC) {
|
||||||
$tab = 'r_dinamic';
|
$tab = 'r_dinamic';
|
||||||
define('_activeTab_', 'radial_dynamic');
|
define('_activeTab_', 'radial_dynamic');
|
||||||
|
$url = 'index.php?sec=network&sec2=operation/agentes/networkmap.dinamic&activeTab=radial_dynamic';
|
||||||
|
header(
|
||||||
|
'Location: '.ui_get_full_url(
|
||||||
|
$url.'&id_networkmap='.$id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$url = 'index.php?sec=network&sec2=operation/agentes/pandora_networkmap';
|
||||||
|
header(
|
||||||
|
'Location: '.ui_get_full_url(
|
||||||
|
$url.'&tab='.$tab.'&id_networkmap='.$id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -419,8 +449,8 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
||||||
|
|
||||||
$source = (string) get_parameter('source', 'group');
|
$source = (string) get_parameter('source', 'group');
|
||||||
|
|
||||||
$offset_x = get_parameter('pos_x');
|
$offset_x = get_parameter('pos_x', 0);
|
||||||
$offset_y = get_parameter('pos_y');
|
$offset_y = get_parameter('pos_y', 0);
|
||||||
$scale_z = get_parameter('scale_z', 0.5);
|
$scale_z = get_parameter('scale_z', 0.5);
|
||||||
|
|
||||||
$values = [];
|
$values = [];
|
||||||
|
@ -712,6 +742,8 @@ switch ($tab) {
|
||||||
if (($count == 0) && ($network_map['source'] != 'empty')) {
|
if (($count == 0) && ($network_map['source'] != 'empty')) {
|
||||||
if ($network_map['generated']) {
|
if ($network_map['generated']) {
|
||||||
$data['nodes'] = __('Empty map');
|
$data['nodes'] = __('Empty map');
|
||||||
|
} else if ($network_map['generation_method'] == LAYOUT_RADIAL_DYNAMIC) {
|
||||||
|
$data['nodes'] = __('Dynamic');
|
||||||
} else {
|
} else {
|
||||||
$data['nodes'] = __('Pending to generate');
|
$data['nodes'] = __('Pending to generate');
|
||||||
}
|
}
|
||||||
|
@ -756,4 +788,3 @@ switch ($tab) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
require_once 'include/functions_pandora_networkmap.php';
|
require_once 'include/functions_networkmap.php';
|
||||||
enterprise_include_once('include/functions_policies.php');
|
enterprise_include_once('include/functions_policies.php');
|
||||||
enterprise_include_once('include/functions_dashboard.php');
|
enterprise_include_once('include/functions_dashboard.php');
|
||||||
require_once 'include/functions_modules.php';
|
require_once 'include/functions_modules.php';
|
||||||
|
@ -80,6 +80,10 @@ if (is_ajax()) {
|
||||||
if ($module_get_status) {
|
if ($module_get_status) {
|
||||||
$id = (int) get_parameter('id', 0);
|
$id = (int) get_parameter('id', 0);
|
||||||
|
|
||||||
|
if ($id == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$return = [];
|
$return = [];
|
||||||
$return['correct'] = true;
|
$return['correct'] = true;
|
||||||
$return['status'] = modules_get_agentmodule_status(
|
$return['status'] = modules_get_agentmodule_status(
|
||||||
|
@ -756,6 +760,7 @@ html_print_input_hidden('center_logo', ui_get_full_url(ui_get_logo_to_center_net
|
||||||
$dash_mode = 0;
|
$dash_mode = 0;
|
||||||
$map_dash_details = [];
|
$map_dash_details = [];
|
||||||
$networkmap = db_get_row('tmap', 'id', $id);
|
$networkmap = db_get_row('tmap', 'id', $id);
|
||||||
|
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
include_once 'enterprise/dashboard/widgets/network_map.php';
|
include_once 'enterprise/dashboard/widgets/network_map.php';
|
||||||
if ($id_networkmap) {
|
if ($id_networkmap) {
|
||||||
|
@ -767,7 +772,6 @@ if (enterprise_installed()) {
|
||||||
$map_dash_details['x_offs'] = $x_offs;
|
$map_dash_details['x_offs'] = $x_offs;
|
||||||
$map_dash_details['y_offs'] = $y_offs;
|
$map_dash_details['y_offs'] = $y_offs;
|
||||||
$map_dash_details['z_dash'] = $z_dash;
|
$map_dash_details['z_dash'] = $z_dash;
|
||||||
|
|
||||||
$networkmap = db_get_row('tmap', 'id', $id);
|
$networkmap = db_get_row('tmap', 'id', $id);
|
||||||
} else {
|
} else {
|
||||||
$networkmap_filter = json_decode($networkmap['filter'], true);
|
$networkmap_filter = json_decode($networkmap['filter'], true);
|
||||||
|
@ -866,9 +870,13 @@ if ($networkmap === false) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$nodes_and_relations = networkmap_process_networkmap($id);
|
include_once $config['homedir'].'/include/class/NetworkMap.class.php';
|
||||||
|
|
||||||
show_networkmap($id, $user_readonly, $nodes_and_relations, $dash_mode, $map_dash_details);
|
$map_manager = new NetworkMap(
|
||||||
|
[ 'id_map' => $networkmap['id']]
|
||||||
|
);
|
||||||
|
|
||||||
|
$map_manager->printMap();
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
@ -335,11 +335,6 @@ if (check_acl($config['id_user'], 0, 'ER')
|
||||||
$sub['operation/events/events_marquee.php']['type'] = 'direct';
|
$sub['operation/events/events_marquee.php']['type'] = 'direct';
|
||||||
}
|
}
|
||||||
|
|
||||||
// CSV
|
|
||||||
$sub['operation/events/export_csv.php?search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0§ion=list&open_filter=0&pure=']['text'] = __('CSV File');
|
|
||||||
$sub['operation/events/export_csv.php?search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0§ion=list&open_filter=0&pure=']['id'] = 'CSV File';
|
|
||||||
$sub['operation/events/export_csv.php?search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0§ion=list&open_filter=0&pure=']['type'] = 'direct';
|
|
||||||
|
|
||||||
// Sound Events
|
// Sound Events
|
||||||
$javascript = "javascript: window.open('operation/events/sound_events.php');";
|
$javascript = "javascript: window.open('operation/events/sound_events.php');";
|
||||||
$javascript = 'javascript: alert(111);';
|
$javascript = 'javascript: alert(111);';
|
||||||
|
|
|
@ -114,32 +114,7 @@ if ($read_message) {
|
||||||
|
|
||||||
echo '<h2>Subject: '.$message['subject'].'</h2>';
|
echo '<h2>Subject: '.$message['subject'].'</h2>';
|
||||||
|
|
||||||
$conversation = [];
|
$conversation = messages_get_conversation($message);
|
||||||
$target_str = $message['mensaje'];
|
|
||||||
|
|
||||||
while (preg_match_all(
|
|
||||||
'/(.*)On(.*)wrote:(.*)/',
|
|
||||||
$target_str,
|
|
||||||
$decoded,
|
|
||||||
PREG_PATTERN_ORDER
|
|
||||||
) !== false && empty($target_str) !== true) {
|
|
||||||
if (empty($decoded[2]) !== true) {
|
|
||||||
array_push(
|
|
||||||
$conversation,
|
|
||||||
[
|
|
||||||
'message' => array_pop($decoded)[0],
|
|
||||||
'date' => array_pop($decoded)[0],
|
|
||||||
]
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
array_push(
|
|
||||||
$conversation,
|
|
||||||
['message' => $target_str]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$target_str = $decoded[1][0];
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_require_css_file('message_edit');
|
ui_require_css_file('message_edit');
|
||||||
foreach ($conversation as $row) {
|
foreach ($conversation as $row) {
|
||||||
|
|
|
@ -785,6 +785,7 @@ CREATE TABLE IF NOT EXISTS `trecon_task` (
|
||||||
`wmi_enabled` tinyint(1) unsigned DEFAULT '0',
|
`wmi_enabled` tinyint(1) unsigned DEFAULT '0',
|
||||||
`auth_strings` text,
|
`auth_strings` text,
|
||||||
`autoconfiguration_enabled` tinyint(1) unsigned default '0',
|
`autoconfiguration_enabled` tinyint(1) unsigned default '0',
|
||||||
|
`summary` text,
|
||||||
PRIMARY KEY (`id_rt`),
|
PRIMARY KEY (`id_rt`),
|
||||||
KEY `recon_task_daemon` (`id_recon_server`)
|
KEY `recon_task_daemon` (`id_recon_server`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
@ -1412,6 +1413,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
|
||||||
`visual_format` tinyint(1) UNSIGNED NOT NULL default '0',
|
`visual_format` tinyint(1) UNSIGNED NOT NULL default '0',
|
||||||
`hide_no_data` tinyint(1) default 0,
|
`hide_no_data` tinyint(1) default 0,
|
||||||
`recursion` tinyint(1) default NULL,
|
`recursion` tinyint(1) default NULL,
|
||||||
|
`show_extended_events` tinyint(1) default '0',
|
||||||
PRIMARY KEY(`id_rc`),
|
PRIMARY KEY(`id_rc`),
|
||||||
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
|
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
|
||||||
ON UPDATE CASCADE ON DELETE CASCADE
|
ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
|
@ -3487,4 +3489,31 @@ CREATE TABLE IF NOT EXISTS `tagent_custom_fields_filter` (
|
||||||
`recursion` int(1) unsigned default '0',
|
`recursion` int(1) unsigned default '0',
|
||||||
`group_search` int(10) unsigned default '0',
|
`group_search` int(10) unsigned default '0',
|
||||||
PRIMARY KEY(`id`)
|
PRIMARY KEY(`id`)
|
||||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table `user_task`
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
CREATE TABLE `tuser_task` (
|
||||||
|
`id` int(20) unsigned NOT NULL auto_increment,
|
||||||
|
`function_name` varchar(80) NOT NULL default '',
|
||||||
|
`parameters` text NOT NULL default '',
|
||||||
|
`name` varchar(60) NOT NULL default '',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table `user_task_scheduled`
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
CREATE TABLE `tuser_task_scheduled` (
|
||||||
|
`id` int(20) unsigned NOT NULL auto_increment,
|
||||||
|
`id_usuario` varchar(60) NOT NULL default '0',
|
||||||
|
`id_user_task` int(20) unsigned NOT NULL default '0',
|
||||||
|
`args` TEXT NOT NULL,
|
||||||
|
`scheduled` enum('no','hourly','daily','weekly','monthly','yearly','custom') default 'no',
|
||||||
|
`last_run` int(20) unsigned default '0',
|
||||||
|
`custom_data` int(10) NULL default '0',
|
||||||
|
`flag_delete` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||||
|
`id_grupo` int(10) unsigned NOT NULL default 0,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
|
@ -31,6 +31,9 @@ INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal
|
||||||
|
|
||||||
LOCK TABLES `tconfig` WRITE;
|
LOCK TABLES `tconfig` WRITE;
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES
|
INSERT INTO `tconfig` (`token`, `value`) VALUES
|
||||||
|
('cron_extension_installed','1'),
|
||||||
|
('cron_extension_sql_version','1'),
|
||||||
|
('cron_last_run','0'),
|
||||||
('language','en_GB'),
|
('language','en_GB'),
|
||||||
('block_size','20'),
|
('block_size','20'),
|
||||||
('days_purge','45'),
|
('days_purge','45'),
|
||||||
|
|
|
@ -26,7 +26,7 @@ use lib '/usr/lib/perl5';
|
||||||
|
|
||||||
use PandoraFMS::Tools;
|
use PandoraFMS::Tools;
|
||||||
use PandoraFMS::DB;
|
use PandoraFMS::DB;
|
||||||
use PandoraFMS::Core;
|
|
||||||
require Exporter;
|
require Exporter;
|
||||||
|
|
||||||
our @ISA = ("Exporter");
|
our @ISA = ("Exporter");
|
||||||
|
@ -226,7 +226,7 @@ sub pandora_load_config {
|
||||||
$pa_config->{"dataserver"} = 1; # default
|
$pa_config->{"dataserver"} = 1; # default
|
||||||
$pa_config->{"networkserver"} = 1; # default
|
$pa_config->{"networkserver"} = 1; # default
|
||||||
$pa_config->{"snmpconsole"} = 1; # default
|
$pa_config->{"snmpconsole"} = 1; # default
|
||||||
$pa_config->{"discoveryserver"} = 1; # default
|
$pa_config->{"discoveryserver"} = 0; # default
|
||||||
$pa_config->{"wmiserver"} = 1; # default
|
$pa_config->{"wmiserver"} = 1; # default
|
||||||
$pa_config->{"pluginserver"} = 1; # default
|
$pa_config->{"pluginserver"} = 1; # default
|
||||||
$pa_config->{"predictionserver"} = 1; # default
|
$pa_config->{"predictionserver"} = 1; # default
|
||||||
|
|
|
@ -3079,12 +3079,14 @@ Create a new entry in B<tagente> optionaly with position information
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub pandora_create_agent ($$$$$$$$$$;$$$$$$$$$) {
|
sub pandora_create_agent ($$$$$$$$$$;$$$$$$$$$$) {
|
||||||
|
# If parameter event_id is not undef, then create an extended event
|
||||||
|
# related to it instead launch new event.
|
||||||
my ($pa_config, $server_name, $agent_name, $address,
|
my ($pa_config, $server_name, $agent_name, $address,
|
||||||
$group_id, $parent_id, $os_id,
|
$group_id, $parent_id, $os_id,
|
||||||
$description, $interval, $dbh, $timezone_offset,
|
$description, $interval, $dbh, $timezone_offset,
|
||||||
$longitude, $latitude, $altitude, $position_description,
|
$longitude, $latitude, $altitude, $position_description,
|
||||||
$custom_id, $url_address, $agent_mode, $alias) = @_;
|
$custom_id, $url_address, $agent_mode, $alias, $event_id) = @_;
|
||||||
|
|
||||||
logger ($pa_config, "Server '$server_name' creating agent '$agent_name' address '$address'.", 10);
|
logger ($pa_config, "Server '$server_name' creating agent '$agent_name' address '$address'.", 10);
|
||||||
|
|
||||||
|
@ -3127,7 +3129,11 @@ sub pandora_create_agent ($$$$$$$$$$;$$$$$$$$$) {
|
||||||
}
|
}
|
||||||
|
|
||||||
logger ($pa_config, "Server '$server_name' CREATED agent '$agent_name' address '$address'.", 10);
|
logger ($pa_config, "Server '$server_name' CREATED agent '$agent_name' address '$address'.", 10);
|
||||||
pandora_event ($pa_config, "Agent [" . safe_output($alias) . "] created by $server_name", $group_id, $agent_id, 2, 0, 0, 'new_agent', 0, $dbh);
|
if (!defined($event_id)) {
|
||||||
|
pandora_event ($pa_config, "Agent [" . safe_output($alias) . "] created by $server_name", $group_id, $agent_id, 2, 0, 0, 'new_agent', 0, $dbh);
|
||||||
|
} else {
|
||||||
|
pandora_extended_event($pa_config, $dbh, $event_id, "Agent [" . safe_output($alias) . "][#".$agent_id."] created by $server_name");
|
||||||
|
}
|
||||||
return $agent_id;
|
return $agent_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3813,7 +3819,10 @@ sub subst_alert_macros ($$;$$$$) {
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub subst_column_macros ($$;$$$$) {
|
sub subst_column_macros ($$;$$$$) {
|
||||||
my ($string, $macros, $pa_config, $dbh, $agent, $module) = @_;
|
my ($string, $macros, $pa_config, $dbh, $agent, $module) = @_;
|
||||||
|
|
||||||
|
# Avoid to manipulate null strings
|
||||||
|
return $string unless defined($string);
|
||||||
|
|
||||||
# Do not attempt to substitute macros unless the string
|
# Do not attempt to substitute macros unless the string
|
||||||
# begins with an underscore.
|
# begins with an underscore.
|
||||||
return $string unless substr($string, 0, 1) eq '_';
|
return $string unless substr($string, 0, 1) eq '_';
|
||||||
|
|
|
@ -469,10 +469,11 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
||||||
# Are we filtering hosts by TCP port?
|
# Are we filtering hosts by TCP port?
|
||||||
return if ($self->{'recon_ports'} ne '' && $self->tcp_scan($device) == 0);
|
return if ($self->{'recon_ports'} ne '' && $self->tcp_scan($device) == 0);
|
||||||
my $location = get_geoip_info($self->{'pa_config'}, $device);
|
my $location = get_geoip_info($self->{'pa_config'}, $device);
|
||||||
$agent_id = pandora_create_agent($self->{'pa_config'}, $self->{'pa_config'}->{'servername'}, $host_name, $device,
|
$agent_id = pandora_create_agent(
|
||||||
$self->{'group_id'}, 0, $id_os,
|
$self->{'pa_config'}, $self->{'pa_config'}->{'servername'},
|
||||||
'', 300, $self->{'dbh'}, undef,
|
$host_name, $device, $self->{'group_id'}, 0, $id_os,
|
||||||
$location->{'longitude'}, $location->{'latitude'}
|
'', 300, $self->{'dbh'}, undef, $location->{'longitude'},
|
||||||
|
$location->{'latitude'}
|
||||||
);
|
);
|
||||||
return undef unless defined ($agent_id) and ($agent_id > 0);
|
return undef unless defined ($agent_id) and ($agent_id > 0);
|
||||||
|
|
||||||
|
@ -833,7 +834,17 @@ sub PandoraFMS::Recon::Base::wmi_module {
|
||||||
sub PandoraFMS::Recon::Base::update_progress ($$) {
|
sub PandoraFMS::Recon::Base::update_progress ($$) {
|
||||||
my ($self, $progress) = @_;
|
my ($self, $progress) = @_;
|
||||||
|
|
||||||
db_do ($self->{'dbh'}, 'UPDATE trecon_task SET utimestamp = ?, status = ? WHERE id_rt = ?', time (), $progress, $self->{'task_id'});
|
my $stats = {};
|
||||||
|
if (defined($self->{'summary'}) && $self->{'summary'} ne '') {
|
||||||
|
$stats->{'summary'} = $self->{'summary'};
|
||||||
|
}
|
||||||
|
$stats->{'step'} = $self->{'step'};
|
||||||
|
$stats->{'c_network_name'} = $self->{'c_network_name'};
|
||||||
|
$stats->{'c_network_percent'} = $self->{'c_network_percent'};
|
||||||
|
|
||||||
|
# Store progress, last contact and overall status.
|
||||||
|
db_do ($self->{'dbh'}, 'UPDATE trecon_task SET utimestamp = ?, status = ?, summary = ? WHERE id_rt = ?',
|
||||||
|
time (), $progress, encode_json($stats), $self->{'task_id'});
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
@ -15,6 +15,14 @@ use PandoraFMS::Recon::NmapParser;
|
||||||
use PandoraFMS::Recon::Util;
|
use PandoraFMS::Recon::Util;
|
||||||
use Socket qw/inet_aton/;
|
use Socket qw/inet_aton/;
|
||||||
|
|
||||||
|
# Constants.
|
||||||
|
use constant {
|
||||||
|
STEP_SCANNING => 1,
|
||||||
|
STEP_AFT => 2,
|
||||||
|
STEP_TRACEROUTE => 3,
|
||||||
|
STEP_GATEWAY => 4
|
||||||
|
};
|
||||||
|
|
||||||
# /dev/null
|
# /dev/null
|
||||||
my $DEVNULL = ($^O eq 'MSWin32') ? '/Nul' : '/dev/null';
|
my $DEVNULL = ($^O eq 'MSWin32') ? '/Nul' : '/dev/null';
|
||||||
|
|
||||||
|
@ -47,33 +55,33 @@ our $SYSUPTIME = ".1.3.6.1.2.1.1.3";
|
||||||
our $VTPVLANIFINDEX = ".1.3.6.1.4.1.9.9.46.1.3.1.1.18.1";
|
our $VTPVLANIFINDEX = ".1.3.6.1.4.1.9.9.46.1.3.1.1.18.1";
|
||||||
|
|
||||||
our @ISA = ("Exporter");
|
our @ISA = ("Exporter");
|
||||||
our %EXPORT_TAGS = ( 'all' => [ qw( ) ] );
|
our %EXPORT_TAGS = ( 'all' => [qw( )] );
|
||||||
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
||||||
our @EXPORT = qw(
|
our @EXPORT = qw(
|
||||||
$DOT1DBASEBRIDGEADDRESS
|
$DOT1DBASEBRIDGEADDRESS
|
||||||
$DOT1DBASEPORTIFINDEX
|
$DOT1DBASEPORTIFINDEX
|
||||||
$DOT1DTPFDBADDRESS
|
$DOT1DTPFDBADDRESS
|
||||||
$DOT1DTPFDBPORT
|
$DOT1DTPFDBPORT
|
||||||
$IFDESC
|
$IFDESC
|
||||||
$IFHCINOCTECTS
|
$IFHCINOCTECTS
|
||||||
$IFHCOUTOCTECTS
|
$IFHCOUTOCTECTS
|
||||||
$IFINDEX
|
$IFINDEX
|
||||||
$IFINOCTECTS
|
$IFINOCTECTS
|
||||||
$IFOPERSTATUS
|
$IFOPERSTATUS
|
||||||
$IFOUTOCTECTS
|
$IFOUTOCTECTS
|
||||||
$IPADENTIFINDEX
|
$IPADENTIFINDEX
|
||||||
$IPENTADDR
|
$IPENTADDR
|
||||||
$IFNAME
|
$IFNAME
|
||||||
$IPNETTOMEDIAPHYSADDRESS
|
$IPNETTOMEDIAPHYSADDRESS
|
||||||
$IFPHYSADDRESS
|
$IFPHYSADDRESS
|
||||||
$IPADENTIFINDEX
|
$IPADENTIFINDEX
|
||||||
$IPROUTEIFINDEX
|
$IPROUTEIFINDEX
|
||||||
$IPROUTENEXTHOP
|
$IPROUTENEXTHOP
|
||||||
$IPROUTETYPE
|
$IPROUTETYPE
|
||||||
$PRTMARKERINDEX
|
$PRTMARKERINDEX
|
||||||
$SYSDESCR
|
$SYSDESCR
|
||||||
$SYSSERVICES
|
$SYSSERVICES
|
||||||
$SYSUPTIME
|
$SYSUPTIME
|
||||||
);
|
);
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
@ -167,6 +175,18 @@ sub new {
|
||||||
snmp_version => 1,
|
snmp_version => 1,
|
||||||
subnets => [],
|
subnets => [],
|
||||||
autoconfiguration_enabled => 0,
|
autoconfiguration_enabled => 0,
|
||||||
|
|
||||||
|
# Store progress summary - Discovery progress view.
|
||||||
|
step => 0,
|
||||||
|
c_network_name => '',
|
||||||
|
c_network_percent => 0.0,
|
||||||
|
summary => {
|
||||||
|
SNMP => 0,
|
||||||
|
WMI => 0,
|
||||||
|
discovered => 0,
|
||||||
|
alive => 0,
|
||||||
|
not_alive => 0
|
||||||
|
},
|
||||||
@_,
|
@_,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -176,25 +196,26 @@ sub new {
|
||||||
|
|
||||||
# Check SNMP params id SNMP is enabled
|
# Check SNMP params id SNMP is enabled
|
||||||
if ($self->{'snmp_enabled'}) {
|
if ($self->{'snmp_enabled'}) {
|
||||||
|
|
||||||
# Check SNMP version
|
# Check SNMP version
|
||||||
if ($self->{'snmp_version'} ne '1' && $self->{'snmp_version'} ne '2'
|
if ( $self->{'snmp_version'} ne '1'
|
||||||
&& $self->{'snmp_version'} ne '2c' && $self->{'snmp_version'} ne '3'
|
&& $self->{'snmp_version'} ne '2'
|
||||||
) {
|
&& $self->{'snmp_version'} ne '2c'
|
||||||
|
&& $self->{'snmp_version'} ne '3') {
|
||||||
$self->{'snmp_enabled'} = 0;
|
$self->{'snmp_enabled'} = 0;
|
||||||
$self->call('message', "SNMP version " . $self->{'snmp_version'} . " not supported (only 1, 2, 2c and 3).", 5);
|
$self->call('message', "SNMP version " . $self->{'snmp_version'} . " not supported (only 1, 2, 2c and 3).", 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check the version 3 parameters
|
# Check the version 3 parameters
|
||||||
if ($self->{'snmp_version'} eq '3') {
|
if ($self->{'snmp_version'} eq '3') {
|
||||||
|
|
||||||
# Fixed some vars
|
# Fixed some vars
|
||||||
$self->{'communities'} = [];
|
$self->{'communities'} = [];
|
||||||
|
|
||||||
# SNMP v3 checks
|
# SNMP v3 checks
|
||||||
if (
|
if ( $self->{'snmp_security_level'} ne 'noAuthNoPriv'
|
||||||
$self->{'snmp_security_level'} ne 'noAuthNoPriv' &&
|
&&$self->{'snmp_security_level'} ne 'authNoPriv'
|
||||||
$self->{'snmp_security_level'} ne 'authNoPriv' &&
|
&&$self->{'snmp_security_level'} ne 'authPriv') {
|
||||||
$self->{'snmp_security_level'} ne 'authPriv'
|
|
||||||
) {
|
|
||||||
$self->{'snmp_enabled'} = 0;
|
$self->{'snmp_enabled'} = 0;
|
||||||
$self->call('message', "Invalid SNMP security level " . $self->{'snmp_security_level'} . ".", 5);
|
$self->call('message', "Invalid SNMP security level " . $self->{'snmp_security_level'} . ".", 5);
|
||||||
}
|
}
|
||||||
|
@ -207,6 +228,7 @@ sub new {
|
||||||
$self->call('message', "Invalid SNMP authentication method " . $self->{'snmp_auth_method'} . ".", 5);
|
$self->call('message', "Invalid SNMP authentication method " . $self->{'snmp_auth_method'} . ".", 5);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
# Fixed some vars
|
# Fixed some vars
|
||||||
$self->{'snmp_auth_user'} = '';
|
$self->{'snmp_auth_user'} = '';
|
||||||
$self->{'snmp_auth_pass'} = '';
|
$self->{'snmp_auth_pass'} = '';
|
||||||
|
@ -296,6 +318,7 @@ sub aft_connectivity($$) {
|
||||||
foreach my $mac ($self->snmp_get_value_array($switch, $DOT1DTPFDBADDRESS)) {
|
foreach my $mac ($self->snmp_get_value_array($switch, $DOT1DTPFDBADDRESS)) {
|
||||||
push(@aft, parse_mac($mac));
|
push(@aft, parse_mac($mac));
|
||||||
}
|
}
|
||||||
|
|
||||||
# Search for matching entries.
|
# Search for matching entries.
|
||||||
foreach my $aft_mac (@aft) {
|
foreach my $aft_mac (@aft) {
|
||||||
|
|
||||||
|
@ -309,7 +332,7 @@ sub aft_connectivity($$) {
|
||||||
|
|
||||||
# Get the interface associated to the port were we found the MAC address.
|
# Get the interface associated to the port were we found the MAC address.
|
||||||
my $switch_if_name = $self->get_if_from_aft($switch, $aft_mac);
|
my $switch_if_name = $self->get_if_from_aft($switch, $aft_mac);
|
||||||
next unless defined ($switch_if_name) and ($switch_if_name ne '');
|
next unless defined($switch_if_name) and ($switch_if_name ne '');
|
||||||
|
|
||||||
# Do not connect a host to a switch twice using the same interface.
|
# Do not connect a host to a switch twice using the same interface.
|
||||||
# The switch is probably connected to another switch.
|
# The switch is probably connected to another switch.
|
||||||
|
@ -342,8 +365,8 @@ sub are_connected($$$$$) {
|
||||||
$if_1 = "ping" if $if_1 eq '';
|
$if_1 = "ping" if $if_1 eq '';
|
||||||
$if_2 = "ping" if $if_2 eq '';
|
$if_2 = "ping" if $if_2 eq '';
|
||||||
|
|
||||||
if (defined($self->{'connections'}->{"${dev_1}\t${if_1}\t${dev_2}\t${if_2}"}) ||
|
if ( defined($self->{'connections'}->{"${dev_1}\t${if_1}\t${dev_2}\t${if_2}"})
|
||||||
defined($self->{'connections'}->{"${dev_2}\t${if_2}\t${dev_1}\t${if_1}"})) {
|
||defined($self->{'connections'}->{"${dev_2}\t${if_2}\t${dev_1}\t${if_1}"})) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,19 +390,20 @@ sub snmp_discovery($$) {
|
||||||
|
|
||||||
# Try to find the MAC with an ARP request.
|
# Try to find the MAC with an ARP request.
|
||||||
$self->get_mac_from_ip($device);
|
$self->get_mac_from_ip($device);
|
||||||
|
|
||||||
# Check if the device responds to SNMP.
|
# Check if the device responds to SNMP.
|
||||||
if ($self->snmp_responds($device)) {
|
if ($self->snmp_responds($device)) {
|
||||||
|
$self->{'summary'}->{'SNMP'} += 1;
|
||||||
|
|
||||||
# Fill the VLAN cache.
|
# Fill the VLAN cache.
|
||||||
$self->find_vlans($device);
|
$self->find_vlans($device);
|
||||||
|
|
||||||
# Guess the device type.
|
# Guess the device type.
|
||||||
$self->guess_device_type($device);
|
$self->guess_device_type($device);
|
||||||
|
|
||||||
# Find aliases for the device.
|
# Find aliases for the device.
|
||||||
$self->find_aliases($device);
|
$self->find_aliases($device);
|
||||||
|
|
||||||
# Find interfaces for the device.
|
# Find interfaces for the device.
|
||||||
$self->find_ifaces($device);
|
$self->find_ifaces($device);
|
||||||
|
|
||||||
|
@ -655,12 +679,12 @@ sub get_if_from_ip($$$) {
|
||||||
|
|
||||||
# Get the port associated to the IP address.
|
# Get the port associated to the IP address.
|
||||||
my $if_index = $self->snmp_get_value($device, "$IPROUTEIFINDEX.$ip_addr");
|
my $if_index = $self->snmp_get_value($device, "$IPROUTEIFINDEX.$ip_addr");
|
||||||
return '' unless defined ($if_index);
|
return '' unless defined($if_index);
|
||||||
|
|
||||||
# Get the name of the interface associated to the port.
|
# Get the name of the interface associated to the port.
|
||||||
my $if_name = $self->snmp_get_value($device, "$IFNAME.$if_index");
|
my $if_name = $self->snmp_get_value($device, "$IFNAME.$if_index");
|
||||||
return '' unless defined ($if_name);
|
return '' unless defined($if_name);
|
||||||
|
|
||||||
$if_name =~ s/"//g;
|
$if_name =~ s/"//g;
|
||||||
return $if_name;
|
return $if_name;
|
||||||
}
|
}
|
||||||
|
@ -686,12 +710,12 @@ sub get_if_from_mac($$$) {
|
||||||
|
|
||||||
# Get the name of the interface associated to the port.
|
# Get the name of the interface associated to the port.
|
||||||
my $if_name = $self->snmp_get_value($device, "$IFNAME.$if_index");
|
my $if_name = $self->snmp_get_value($device, "$IFNAME.$if_index");
|
||||||
return '' unless defined ($if_name);
|
return '' unless defined($if_name);
|
||||||
|
|
||||||
$if_name =~ s/"//g;
|
$if_name =~ s/"//g;
|
||||||
return $if_name;
|
return $if_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -718,13 +742,13 @@ sub get_if_from_port($$$) {
|
||||||
########################################################################################
|
########################################################################################
|
||||||
sub get_if_ip($$$) {
|
sub get_if_ip($$$) {
|
||||||
my ($self, $device, $if_index) = @_;
|
my ($self, $device, $if_index) = @_;
|
||||||
|
|
||||||
my @output = $self->snmp_get($device, $IPADENTIFINDEX);
|
my @output = $self->snmp_get($device, $IPADENTIFINDEX);
|
||||||
foreach my $line (@output) {
|
foreach my $line (@output) {
|
||||||
chomp ($line);
|
chomp($line);
|
||||||
return $1 if ($line =~ m/^$IPADENTIFINDEX.(\S+)\s+=\s+\S+:\s+$if_index$/);
|
return $1 if ($line =~ m/^$IPADENTIFINDEX.(\S+)\s+=\s+\S+:\s+$if_index$/);
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -748,7 +772,7 @@ sub get_if_mac($$$) {
|
||||||
########################################################################################
|
########################################################################################
|
||||||
sub get_if_type($$$) {
|
sub get_if_type($$$) {
|
||||||
my ($self, $device, $if_index) = @_;
|
my ($self, $device, $if_index) = @_;
|
||||||
|
|
||||||
my $type = $self->snmp_get_value($device, "$IFTYPE.$if_index");
|
my $type = $self->snmp_get_value($device, "$IFTYPE.$if_index");
|
||||||
return '' unless defined($type);
|
return '' unless defined($type);
|
||||||
|
|
||||||
|
@ -769,7 +793,7 @@ sub get_ip_from_mac($$) {
|
||||||
}
|
}
|
||||||
|
|
||||||
########################################################################################
|
########################################################################################
|
||||||
# Attemtps to find
|
# Attemtps to find
|
||||||
########################################################################################
|
########################################################################################
|
||||||
sub get_mac_from_ip($$) {
|
sub get_mac_from_ip($$) {
|
||||||
my ($self, $host) = @_;
|
my ($self, $host) = @_;
|
||||||
|
@ -824,7 +848,7 @@ sub get_routes($) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Replace 0.0.0.0 with the default gateway's IP.
|
# Replace 0.0.0.0 with the default gateway's IP.
|
||||||
return unless defined ($self->{'default_gw'});
|
return unless defined($self->{'default_gw'});
|
||||||
foreach my $route (@{$self->{'routes'}}) {
|
foreach my $route (@{$self->{'routes'}}) {
|
||||||
$route->{gw} = $self->{'default_gw'} if ($route->{'gw'} eq '0.0.0.0');
|
$route->{gw} = $self->{'default_gw'} if ($route->{'gw'} eq '0.0.0.0');
|
||||||
}
|
}
|
||||||
|
@ -906,12 +930,15 @@ sub guess_device_type($$) {
|
||||||
# L2?
|
# L2?
|
||||||
my $device_type;
|
my $device_type;
|
||||||
if ($service_bits[1] == 1) {
|
if ($service_bits[1] == 1) {
|
||||||
|
|
||||||
# L3?
|
# L3?
|
||||||
if ($service_bits[2] == 1) {
|
if ($service_bits[2] == 1) {
|
||||||
|
|
||||||
# Bridge MIB?
|
# Bridge MIB?
|
||||||
if (defined($bridge_mib)) {
|
if (defined($bridge_mib)) {
|
||||||
$device_type = 'switch';
|
$device_type = 'switch';
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
# L7?
|
# L7?
|
||||||
if ($service_bits[6] == 1) {
|
if ($service_bits[6] == 1) {
|
||||||
$device_type = 'host';
|
$device_type = 'host';
|
||||||
|
@ -919,8 +946,8 @@ sub guess_device_type($$) {
|
||||||
$device_type = 'router';
|
$device_type = 'router';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}else {
|
||||||
else {
|
|
||||||
# Bridge MIB?
|
# Bridge MIB?
|
||||||
if (defined($bridge_mib)) {
|
if (defined($bridge_mib)) {
|
||||||
$device_type = 'switch';
|
$device_type = 'switch';
|
||||||
|
@ -928,14 +955,16 @@ sub guess_device_type($$) {
|
||||||
$device_type = 'host';
|
$device_type = 'host';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}else {
|
||||||
else {
|
|
||||||
# L3?
|
# L3?
|
||||||
if ($service_bits[2] == 1) {
|
if ($service_bits[2] == 1) {
|
||||||
|
|
||||||
# L4?
|
# L4?
|
||||||
if ($service_bits[3] == 1) {
|
if ($service_bits[3] == 1) {
|
||||||
$device_type = 'switch';
|
$device_type = 'switch';
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
# L7?
|
# L7?
|
||||||
if ($service_bits[6] == 1) {
|
if ($service_bits[6] == 1) {
|
||||||
$device_type = 'host';
|
$device_type = 'host';
|
||||||
|
@ -943,8 +972,8 @@ sub guess_device_type($$) {
|
||||||
$device_type = 'router';
|
$device_type = 'router';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}else {
|
||||||
else {
|
|
||||||
# Printer MIB?
|
# Printer MIB?
|
||||||
my $printer_mib = $self->snmp_get_value($device, $PRTMARKERINDEX);
|
my $printer_mib = $self->snmp_get_value($device, $PRTMARKERINDEX);
|
||||||
if (defined($printer_mib)) {
|
if (defined($printer_mib)) {
|
||||||
|
@ -1016,7 +1045,7 @@ sub is_switch_connected($$$) {
|
||||||
# Check for aliases!
|
# Check for aliases!
|
||||||
$device = $self->{'aliases'}->{$device} if defined($self->{'aliases'}->{$device});
|
$device = $self->{'aliases'}->{$device} if defined($self->{'aliases'}->{$device});
|
||||||
|
|
||||||
return 1 if defined ($self->{'switch_to_switch'}->{"${device}\t${iface}"});
|
return 1 if defined($self->{'switch_to_switch'}->{"${device}\t${iface}"});
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1069,8 +1098,8 @@ sub mark_connected($$;$$$) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Prevent parent-child loops.
|
# Prevent parent-child loops.
|
||||||
if (!defined($self->{'parents'}->{$parent}) ||
|
if (!defined($self->{'parents'}->{$parent})
|
||||||
$self->{'parents'}->{$parent} ne $child) {
|
||$self->{'parents'}->{$parent} ne $child) {
|
||||||
|
|
||||||
# A parent-child relationship is always created to help complete the map with
|
# A parent-child relationship is always created to help complete the map with
|
||||||
# layer 3 information.
|
# layer 3 information.
|
||||||
|
@ -1097,8 +1126,10 @@ sub mark_switch_connected($$$) {
|
||||||
sub mark_visited($$) {
|
sub mark_visited($$) {
|
||||||
my ($self, $device) = @_;
|
my ($self, $device) = @_;
|
||||||
|
|
||||||
$self->{'visited_devices'}->{$device} = { 'addr' => { $device => '' },
|
$self->{'visited_devices'}->{$device} = {
|
||||||
'type' => 'host' };
|
'addr' => { $device => '' },
|
||||||
|
'type' => 'host'
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
########################################################################################
|
########################################################################################
|
||||||
|
@ -1121,8 +1152,8 @@ sub snmp_responds($$) {
|
||||||
return 1 if($self->is_snmp_discovered($device));
|
return 1 if($self->is_snmp_discovered($device));
|
||||||
|
|
||||||
return ($self->{'snmp_version'} eq "3")
|
return ($self->{'snmp_version'} eq "3")
|
||||||
? $self->snmp_responds_v3($device)
|
? $self->snmp_responds_v3($device)
|
||||||
: $self->snmp_responds_v122c($device);
|
: $self->snmp_responds_v122c($device);
|
||||||
}
|
}
|
||||||
|
|
||||||
########################################################################################
|
########################################################################################
|
||||||
|
@ -1221,11 +1252,7 @@ sub remote_arp($$) {
|
||||||
##############################################################################
|
##############################################################################
|
||||||
sub ping ($$$) {
|
sub ping ($$$) {
|
||||||
my ($self, $host) = @_;
|
my ($self, $host) = @_;
|
||||||
my ($timeout, $retries, $packets) = (
|
my ($timeout, $retries, $packets) = ($self->{'icmp_timeout'},$self->{'icmp_checks'},1,);
|
||||||
$self->{'icmp_timeout'},
|
|
||||||
$self->{'icmp_checks'},
|
|
||||||
1,
|
|
||||||
);
|
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
if (($^O eq "MSWin32") || ($^O eq "MSWin32-x64") || ($^O eq "cygwin")){
|
if (($^O eq "MSWin32") || ($^O eq "MSWin32-x64") || ($^O eq "cygwin")){
|
||||||
|
@ -1237,11 +1264,12 @@ sub ping ($$$) {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Solaris
|
# Solaris
|
||||||
if ($^O eq "solaris"){
|
if ($^O eq "solaris"){
|
||||||
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping -A inet6" : "ping";
|
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping -A inet6" : "ping";
|
||||||
for (my $i = 0; $i < $retries; $i++) {
|
for (my $i = 0; $i < $retries; $i++) {
|
||||||
|
|
||||||
# Note: There is no timeout option.
|
# Note: There is no timeout option.
|
||||||
`$ping_command -s -n $host 56 $packets >/dev/null 2>&1`;
|
`$ping_command -s -n $host 56 $packets >/dev/null 2>&1`;
|
||||||
return 1 if ($? == 0);
|
return 1 if ($? == 0);
|
||||||
|
@ -1249,11 +1277,12 @@ sub ping ($$$) {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# FreeBSD
|
# FreeBSD
|
||||||
if ($^O eq "freebsd"){
|
if ($^O eq "freebsd"){
|
||||||
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping -t $timeout";
|
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping -t $timeout";
|
||||||
for (my $i = 0; $i < $retries; $i++) {
|
for (my $i = 0; $i < $retries; $i++) {
|
||||||
|
|
||||||
# Note: There is no timeout option for ping6.
|
# Note: There is no timeout option for ping6.
|
||||||
`$ping_command -q -n -c $packets $host >/dev/null 2>&1`;
|
`$ping_command -q -n -c $packets $host >/dev/null 2>&1`;
|
||||||
return 1 if ($? == 0);
|
return 1 if ($? == 0);
|
||||||
|
@ -1263,9 +1292,10 @@ sub ping ($$$) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# NetBSD
|
# NetBSD
|
||||||
if ($^O eq "netbsd"){
|
if ($^O eq "netbsd"){
|
||||||
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping -w $timeout";
|
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping -w $timeout";
|
||||||
for (my $i = 0; $i < $retries; $i++) {
|
for (my $i = 0; $i < $retries; $i++) {
|
||||||
|
|
||||||
# Note: There is no timeout option for ping6.
|
# Note: There is no timeout option for ping6.
|
||||||
`$ping_command -q -n -c $packets $host >/dev/null 2>&1`;
|
`$ping_command -q -n -c $packets $host >/dev/null 2>&1`;
|
||||||
if ($? == 0) {
|
if ($? == 0) {
|
||||||
|
@ -1275,11 +1305,11 @@ sub ping ($$$) {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Assume Linux by default.
|
# Assume Linux by default.
|
||||||
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping";
|
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping";
|
||||||
for (my $i = 0; $i < $retries; $i++) {
|
for (my $i = 0; $i < $retries; $i++) {
|
||||||
`$ping_command -q -W $timeout -n -c $packets $host >/dev/null 2>&1`;
|
`$ping_command -q -W $timeout -n -c $packets $host >/dev/null 2>&1`;
|
||||||
return 1 if ($? == 0);
|
return 1 if ($? == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1295,11 +1325,13 @@ sub scan_subnet($) {
|
||||||
|
|
||||||
my @subnets = @{$self->get_subnets()};
|
my @subnets = @{$self->get_subnets()};
|
||||||
foreach my $subnet (@subnets) {
|
foreach my $subnet (@subnets) {
|
||||||
|
$self->{'c_network_percent'} = 0;
|
||||||
|
$self->{'c_network_name'} = $subnet;
|
||||||
|
|
||||||
# Clean blanks.
|
# Clean blanks.
|
||||||
$subnet =~ s/\s+//g;
|
$subnet =~ s/\s+//g;
|
||||||
|
|
||||||
my $net_addr = new NetAddr::IP ($subnet);
|
my $net_addr = new NetAddr::IP($subnet);
|
||||||
if (!defined($net_addr)) {
|
if (!defined($net_addr)) {
|
||||||
$self->call('message', "Invalid network: $subnet", 3);
|
$self->call('message', "Invalid network: $subnet", 3);
|
||||||
next;
|
next;
|
||||||
|
@ -1312,46 +1344,68 @@ sub scan_subnet($) {
|
||||||
# fping scan.
|
# fping scan.
|
||||||
if (-x $self->{'fping'} && $net_addr->num() > 1) {
|
if (-x $self->{'fping'} && $net_addr->num() > 1) {
|
||||||
$self->call('message', "Calling fping...", 5);
|
$self->call('message', "Calling fping...", 5);
|
||||||
|
|
||||||
my @hosts = `"$self->{'fping'}" -ga "$subnet" 2>DEVNULL`;
|
my @hosts = `"$self->{'fping'}" -ga "$subnet" 2>DEVNULL`;
|
||||||
next if (scalar(@hosts) == 0);
|
next if (scalar(@hosts) == 0);
|
||||||
|
|
||||||
|
$self->{'summary'}->{'discovered'} += scalar(@hosts);
|
||||||
|
|
||||||
my $step = 50.0 / scalar(@subnets) / scalar(@hosts); # The first 50% of the recon task approx.
|
my $step = 50.0 / scalar(@subnets) / scalar(@hosts); # The first 50% of the recon task approx.
|
||||||
|
my $subnet_step = 100.0 / scalar(@hosts);
|
||||||
foreach my $line (@hosts) {
|
foreach my $line (@hosts) {
|
||||||
chomp($line);
|
chomp($line);
|
||||||
|
|
||||||
my @temp = split(/ /, $line);
|
my @temp = split(/ /, $line);
|
||||||
next if (scalar(@temp) != 1); # Junk is shown for broadcast addresses.
|
if (scalar(@temp) != 1) {
|
||||||
|
|
||||||
|
# Junk is shown for broadcast addresses.
|
||||||
|
# Increase summary.not_alive hosts.
|
||||||
|
$self->{'summary'}->{'not_alive'} += 1;
|
||||||
|
next;
|
||||||
|
}
|
||||||
my $host = $temp[0];
|
my $host = $temp[0];
|
||||||
|
|
||||||
# Skip network and broadcast addresses.
|
# Skip network and broadcast addresses.
|
||||||
next if ($host eq $network->addr() || $host eq $broadcast->addr());
|
next if ($host eq $network->addr() || $host eq $broadcast->addr());
|
||||||
|
|
||||||
|
# Increase self summary.alive hosts.
|
||||||
|
$self->{'summary'}->{'alive'} += 1;
|
||||||
$self->call('message', "Scanning host: $host", 5);
|
$self->call('message', "Scanning host: $host", 5);
|
||||||
$self->call('update_progress', ceil($progress));
|
$self->call('update_progress', ceil($progress));
|
||||||
$progress += $step;
|
$progress += $step;
|
||||||
|
$self->{'c_network_percent'} += $subnet_step;
|
||||||
|
|
||||||
$self->snmp_discovery($host);
|
$self->snmp_discovery($host);
|
||||||
|
|
||||||
# Add wmi scan if enabled.
|
# Add wmi scan if enabled.
|
||||||
$self->wmi_scan($host) if ($self->{'wmi_enabled'} == 1);
|
$self->wmi_scan($host) if ($self->{'wmi_enabled'} == 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# ping scan.
|
# ping scan.
|
||||||
else {
|
else {
|
||||||
my @hosts = map { (split('/', $_))[0] } $net_addr->hostenum;
|
my @hosts = map { (split('/', $_))[0] } $net_addr->hostenum;
|
||||||
next if (scalar(@hosts) == 0);
|
next if (scalar(@hosts) == 0);
|
||||||
|
|
||||||
|
$self->{'summary'}->{'discovered'} += scalar(@hosts);
|
||||||
|
|
||||||
my $step = 50.0 / scalar(@subnets) / scalar(@hosts); # The first 50% of the recon task approx.
|
my $step = 50.0 / scalar(@subnets) / scalar(@hosts); # The first 50% of the recon task approx.
|
||||||
|
my $subnet_step = 100.0 / scalar(@hosts);
|
||||||
foreach my $host (@hosts) {
|
foreach my $host (@hosts) {
|
||||||
|
|
||||||
$self->call('message', "Scanning host: $host", 5);
|
$self->call('message', "Scanning host: $host", 5);
|
||||||
$self->call('update_progress', ceil($progress));
|
$self->call('update_progress', ceil($progress));
|
||||||
$progress += $step;
|
$progress += $step;
|
||||||
|
|
||||||
# Check if the host is up.
|
# Check if the host is up.
|
||||||
next if ($self->ping($host) == 0);
|
if ($self->ping($host) == 0) {
|
||||||
|
$self->{'summary'}->{'not_alive'} += 1;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{'summary'}->{'alive'} += 1;
|
||||||
|
$self->{'c_network_percent'} += $subnet_step;
|
||||||
|
|
||||||
$self->snmp_discovery($host);
|
$self->snmp_discovery($host);
|
||||||
|
|
||||||
# Add wmi scan if enabled.
|
# Add wmi scan if enabled.
|
||||||
|
@ -1373,6 +1427,8 @@ sub scan($) {
|
||||||
|
|
||||||
# Find devices.
|
# Find devices.
|
||||||
$self->call('message', "[1/5] Scanning the network...", 3);
|
$self->call('message', "[1/5] Scanning the network...", 3);
|
||||||
|
$self->{'step'} = STEP_SCANNING;
|
||||||
|
$self->call('update_progress', $progress);
|
||||||
$self->scan_subnet();
|
$self->scan_subnet();
|
||||||
|
|
||||||
# Read the local ARP cache.
|
# Read the local ARP cache.
|
||||||
|
@ -1381,20 +1437,23 @@ sub scan($) {
|
||||||
# Get a list of found hosts.
|
# Get a list of found hosts.
|
||||||
my @hosts = @{$self->get_hosts()};
|
my @hosts = @{$self->get_hosts()};
|
||||||
if (scalar(@hosts) > 0 && $self->{'parent_detection'} == 1) {
|
if (scalar(@hosts) > 0 && $self->{'parent_detection'} == 1) {
|
||||||
# Delete previous connections.
|
|
||||||
|
# Delete previous connections.
|
||||||
$self->call('delete_connections');
|
$self->call('delete_connections');
|
||||||
|
|
||||||
# Connectivity from address forwarding tables.
|
# Connectivity from address forwarding tables.
|
||||||
$self->call('message', "[1/4] Finding address forwarding table connectivity...", 3);
|
$self->call('message', "[1/4] Finding address forwarding table connectivity...", 3);
|
||||||
|
$self->{'step'} = STEP_AFT;
|
||||||
($progress, $step) = (50, 20.0 / scalar(@hosts)); # From 50% to 70%.
|
($progress, $step) = (50, 20.0 / scalar(@hosts)); # From 50% to 70%.
|
||||||
for (my $i = 0; defined($hosts[$i]); $i++) {
|
for (my $i = 0; defined($hosts[$i]); $i++) {
|
||||||
$self->call('update_progress', $progress);
|
$self->call('update_progress', $progress);
|
||||||
$progress += $step;
|
$progress += $step;
|
||||||
$self->aft_connectivity($hosts[$i]);
|
$self->aft_connectivity($hosts[$i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Connect hosts that are still unconnected using traceroute.
|
# Connect hosts that are still unconnected using traceroute.
|
||||||
$self->call('message', "[3/4] Finding traceroute connectivity.", 3);
|
$self->call('message', "[3/4] Finding traceroute connectivity.", 3);
|
||||||
|
$self->{'step'} = STEP_TRACEROUTE;
|
||||||
($progress, $step) = (70, 20.0 / scalar(@hosts)); # From 70% to 90%.
|
($progress, $step) = (70, 20.0 / scalar(@hosts)); # From 70% to 90%.
|
||||||
foreach my $host (@hosts) {
|
foreach my $host (@hosts) {
|
||||||
$self->call('update_progress', $progress);
|
$self->call('update_progress', $progress);
|
||||||
|
@ -1402,9 +1461,10 @@ sub scan($) {
|
||||||
next if ($self->has_parent($host) || $self->has_children($host));
|
next if ($self->has_parent($host) || $self->has_children($host));
|
||||||
$self->traceroute_connectivity($host);
|
$self->traceroute_connectivity($host);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Connect hosts that are still unconnected using known gateways.
|
# Connect hosts that are still unconnected using known gateways.
|
||||||
$self->call('message', "[4/4] Finding host to gateway connectivity.", 3);
|
$self->call('message', "[4/4] Finding host to gateway connectivity.", 3);
|
||||||
|
$self->{'step'} = STEP_GATEWAY;
|
||||||
($progress, $step) = (90, 10.0 / scalar(@hosts)); # From 70% to 90%.
|
($progress, $step) = (90, 10.0 / scalar(@hosts)); # From 70% to 90%.
|
||||||
$self->get_routes(); # Update the route cache.
|
$self->get_routes(); # Update the route cache.
|
||||||
foreach my $host (@hosts) {
|
foreach my $host (@hosts) {
|
||||||
|
@ -1416,8 +1476,9 @@ sub scan($) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Done!
|
# Done!
|
||||||
|
$self->{'step'} = '';
|
||||||
$self->call('update_progress', -1);
|
$self->call('update_progress', -1);
|
||||||
|
|
||||||
# Print debug information on found devices.
|
# Print debug information on found devices.
|
||||||
$self->call('message', "[Summary]", 3);
|
$self->call('message', "[Summary]", 3);
|
||||||
foreach my $host (@hosts) {
|
foreach my $host (@hosts) {
|
||||||
|
@ -1425,7 +1486,7 @@ sub scan($) {
|
||||||
next unless defined($device);
|
next unless defined($device);
|
||||||
|
|
||||||
# Print device information.
|
# Print device information.
|
||||||
my $dev_info = "Device: " . $device->{'type'} . " (";
|
my $dev_info = "Device: " . $device->{'type'} . " (";
|
||||||
foreach my $ip_address ($self->get_addresses($host)) {
|
foreach my $ip_address ($self->get_addresses($host)) {
|
||||||
$dev_info .= "$ip_address,";
|
$dev_info .= "$ip_address,";
|
||||||
}
|
}
|
||||||
|
@ -1473,8 +1534,8 @@ sub snmp_get($$$) {
|
||||||
if (scalar(@vlans) == 0) {
|
if (scalar(@vlans) == 0) {
|
||||||
my $command = $self->snmp_get_command($device, $oid, $community);
|
my $command = $self->snmp_get_command($device, $oid, $community);
|
||||||
@output = `$command`;
|
@output = `$command`;
|
||||||
}
|
}else {
|
||||||
else {
|
|
||||||
# Handle duplicate lines.
|
# Handle duplicate lines.
|
||||||
my %output_hash;
|
my %output_hash;
|
||||||
foreach my $vlan (@vlans) {
|
foreach my $vlan (@vlans) {
|
||||||
|
@ -1528,7 +1589,7 @@ sub snmp_get_value($$$) {
|
||||||
|
|
||||||
my @output = $self->snmp_get($device, $oid);
|
my @output = $self->snmp_get($device, $oid);
|
||||||
foreach my $line (@output) {
|
foreach my $line (@output) {
|
||||||
chomp ($line);
|
chomp($line);
|
||||||
return $1 if ($line =~ /^$oid\s+=\s+\S+:\s+(.*)$/);
|
return $1 if ($line =~ /^$oid\s+=\s+\S+:\s+(.*)$/);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1544,7 +1605,7 @@ sub snmp_get_value_array($$$) {
|
||||||
|
|
||||||
my @output = $self->snmp_get($device, $oid);
|
my @output = $self->snmp_get($device, $oid);
|
||||||
foreach my $line (@output) {
|
foreach my $line (@output) {
|
||||||
chomp ($line);
|
chomp($line);
|
||||||
push(@values, $1) if ($line =~ /^$oid\S*\s+=\s+\S+:\s+(.*)$/);
|
push(@values, $1) if ($line =~ /^$oid\S*\s+=\s+\S+:\s+(.*)$/);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1575,22 +1636,20 @@ sub traceroute_connectivity($$) {
|
||||||
# Perform a traceroute.
|
# Perform a traceroute.
|
||||||
my $nmap_args = '-nsP -PE --traceroute --max-retries '.$self->{'icmp_checks'}.' --host-timeout '.$self->{'icmp_timeout'}.'s -T'.$self->{'recon_timing_template'};
|
my $nmap_args = '-nsP -PE --traceroute --max-retries '.$self->{'icmp_checks'}.' --host-timeout '.$self->{'icmp_timeout'}.'s -T'.$self->{'recon_timing_template'};
|
||||||
my $np = PandoraFMS::Recon::NmapParser->new();
|
my $np = PandoraFMS::Recon::NmapParser->new();
|
||||||
eval {
|
eval {$np->parsescan($self->{'nmap'}, $nmap_args, ($host));};
|
||||||
$np->parsescan($self->{'nmap'}, $nmap_args, ($host));
|
|
||||||
};
|
|
||||||
return if ($@);
|
return if ($@);
|
||||||
|
|
||||||
# Get hops to the host.
|
# Get hops to the host.
|
||||||
my ($h) = $np->all_hosts ();
|
my ($h) = $np->all_hosts();
|
||||||
return unless defined ($h);
|
return unless defined($h);
|
||||||
my @hops = $h->all_trace_hops ();
|
my @hops = $h->all_trace_hops();
|
||||||
|
|
||||||
# Skip the target host.
|
# Skip the target host.
|
||||||
pop(@hops);
|
pop(@hops);
|
||||||
|
|
||||||
# Reverse the host order (closest hosts first).
|
# Reverse the host order (closest hosts first).
|
||||||
@hops = reverse(@hops);
|
@hops = reverse(@hops);
|
||||||
|
|
||||||
# Look for parents.
|
# Look for parents.
|
||||||
my $device = $host;
|
my $device = $host;
|
||||||
for (my $i = 0; $i < $self->{'parent_recursion'}; $i++) {
|
for (my $i = 0; $i < $self->{'parent_recursion'}; $i++) {
|
||||||
|
@ -1601,7 +1660,7 @@ sub traceroute_connectivity($$) {
|
||||||
$self->call('create_agent', $parent);
|
$self->call('create_agent', $parent);
|
||||||
|
|
||||||
$self->call('message', "Host $device is one hop away from host $parent.", 5);
|
$self->call('message', "Host $device is one hop away from host $parent.", 5);
|
||||||
$self->mark_connected($parent, '', $device, '');
|
$self->mark_connected($parent, '', $device, '');
|
||||||
|
|
||||||
# Move on to the next hop.
|
# Move on to the next hop.
|
||||||
$device = $parent;
|
$device = $parent;
|
||||||
|
@ -1643,7 +1702,10 @@ sub wmi_scan {
|
||||||
my $auth = $self->responds_to_wmi($target);
|
my $auth = $self->responds_to_wmi($target);
|
||||||
return unless defined($auth);
|
return unless defined($auth);
|
||||||
|
|
||||||
|
$self->{'summary'}->{'WMI'} += 1;
|
||||||
|
|
||||||
$self->call('message', "[".$target."] WMI available.", 10);
|
$self->call('message', "[".$target."] WMI available.", 10);
|
||||||
|
|
||||||
# Create the agent if it does not exist.
|
# Create the agent if it does not exist.
|
||||||
my $agent_id = $self->call('create_agent', $target);
|
my $agent_id = $self->call('create_agent', $target);
|
||||||
next unless defined($agent_id);
|
next unless defined($agent_id);
|
||||||
|
@ -1651,56 +1713,19 @@ sub wmi_scan {
|
||||||
# CPU.
|
# CPU.
|
||||||
my @cpus = $self->wmi_get_value_array($target, $auth, 'SELECT DeviceId FROM Win32_Processor', 0);
|
my @cpus = $self->wmi_get_value_array($target, $auth, 'SELECT DeviceId FROM Win32_Processor', 0);
|
||||||
foreach my $cpu (@cpus) {
|
foreach my $cpu (@cpus) {
|
||||||
$self->call(
|
$self->call('wmi_module',($agent_id,$target,"SELECT LoadPercentage FROM Win32_Processor WHERE DeviceId='$cpu'",$auth,1,"CPU Load $cpu","Load for $cpu (%)",'generic_data'));
|
||||||
'wmi_module',
|
|
||||||
(
|
|
||||||
$agent_id,
|
|
||||||
$target,
|
|
||||||
"SELECT LoadPercentage FROM Win32_Processor WHERE DeviceId='$cpu'",
|
|
||||||
$auth,
|
|
||||||
1,
|
|
||||||
"CPU Load $cpu",
|
|
||||||
"Load for $cpu (%)",
|
|
||||||
'generic_data'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Memory.
|
# Memory.
|
||||||
my $mem = $self->wmi_get_value($target, $auth, 'SELECT FreePhysicalMemory FROM Win32_OperatingSystem', 0);
|
my $mem = $self->wmi_get_value($target, $auth, 'SELECT FreePhysicalMemory FROM Win32_OperatingSystem', 0);
|
||||||
if (defined($mem)) {
|
if (defined($mem)) {
|
||||||
$self->call('wmi_module',
|
$self->call('wmi_module',($agent_id,$target,"SELECT FreePhysicalMemory, TotalVisibleMemorySize FROM Win32_OperatingSystem",$auth,0,'FreeMemory','Free memory','generic_data','KB'));
|
||||||
(
|
|
||||||
$agent_id,
|
|
||||||
$target,
|
|
||||||
"SELECT FreePhysicalMemory, TotalVisibleMemorySize FROM Win32_OperatingSystem",
|
|
||||||
$auth,
|
|
||||||
0,
|
|
||||||
'FreeMemory',
|
|
||||||
'Free memory',
|
|
||||||
'generic_data',
|
|
||||||
'KB'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Disk.
|
# Disk.
|
||||||
my @units = $self->wmi_get_value_array($target, $auth, 'SELECT DeviceID FROM Win32_LogicalDisk', 0);
|
my @units = $self->wmi_get_value_array($target, $auth, 'SELECT DeviceID FROM Win32_LogicalDisk', 0);
|
||||||
foreach my $unit (@units) {
|
foreach my $unit (@units) {
|
||||||
$self->call(
|
$self->call('wmi_module',($agent_id,$target,"SELECT FreeSpace FROM Win32_LogicalDisk WHERE DeviceID='$unit'",$auth,1,"FreeDisk $unit",'Available disk space in kilobytes','generic_data','KB'));
|
||||||
'wmi_module',
|
|
||||||
(
|
|
||||||
$agent_id,
|
|
||||||
$target,
|
|
||||||
"SELECT FreeSpace FROM Win32_LogicalDisk WHERE DeviceID='$unit'",
|
|
||||||
$auth,
|
|
||||||
1,
|
|
||||||
"FreeDisk $unit",
|
|
||||||
'Available disk space in kilobytes',
|
|
||||||
'generic_data',
|
|
||||||
'KB'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1774,7 +1774,7 @@ sub api_call_url {
|
||||||
|
|
||||||
|
|
||||||
my $ua = LWP::UserAgent->new();
|
my $ua = LWP::UserAgent->new();
|
||||||
$ua->timeout($options->{lwp_timeout});
|
$ua->timeout($pa_config->{'tcp_timeout'});
|
||||||
# Enable environmental proxy settings
|
# Enable environmental proxy settings
|
||||||
$ua->env_proxy;
|
$ua->env_proxy;
|
||||||
# Enable in-memory cookie management
|
# Enable in-memory cookie management
|
||||||
|
|