Merge remote-tracking branch 'origin/ent-3595-discovery-fase-2' into ent-3409-pandora-network-traffic-analyzer-ntop-fork-fase-1

Conflicts:
	pandora_console/extras/mr/26.sql
	pandora_console/include/class/ConsoleSupervisor.php
	pandora_console/include/class/NetworkMap.class.php
	pandora_console/include/styles/pandora.css
	pandora_console/operation/menu.php

Former-commit-id: 2a0661a65772d4a91f95587d77b0d1287fb66b18
This commit is contained in:
fermin831 2019-03-27 12:11:23 +01:00
commit b2f046e4d6
43 changed files with 708 additions and 382 deletions

View File

@ -11,6 +11,7 @@ CREATE TABLE IF NOT EXISTS `tnetwork_matrix` (
UNIQUE (`source`, `destination`, `utimestamp`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ;
ALTER TABLE `treport_content` ADD COLUMN `show_extended_events` tinyint(1) default '0';
UPDATE `treport_content` SET type="netflow_summary" WHERE type="netflow_pie" OR type="netflow_statistics";
UPDATE `tnetflow_filter` SET aggregate="dstip" WHERE aggregate NOT IN ("dstip", "srcip", "dstport", "srcport");
@ -22,4 +23,6 @@ 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;

View File

@ -1413,6 +1413,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 `auth_strings` text;
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`

View File

@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
<?php echo html_print_image('images/icono_grande_reconserver.png', true, ['title' => __('Collections')]); ?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Collections'); ?> <p id="description_task">
<h3> <?php echo __('Create Collections'); ?></h3><p id="description_task">
<?php
echo __(
"A file collection is a group of files (e.g. scripts or executables) which are

View File

@ -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')]); ?>
</div>
<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
echo __(
"Custom fields are an easy way to personalized agent's information.

View File

@ -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')]); ?>
</div>
<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
echo __(
"Graphs are designed to show the data collected by %s in a temporary scale defined by the user.

View File

@ -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')]); ?>
</div>
<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
echo __(
"Custom fields are an easy way to personalized agent's information.

View File

@ -28,7 +28,7 @@ if ($incident_w || $incident_m) {
<?php echo html_print_image('images/firts_task/icono_grande_incidencia.png', true, ['title' => __('Incidents')]); ?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Incidents'); ?> <p id="description_task">
<h3> <?php echo __('Create Incidents'); ?></h3><p id="description_task">
<?php
echo __(
"Besides receiving and processing data to monitor systems or applications,

View File

@ -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')]); ?>
</div>
<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
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'.",

View File

@ -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')]); ?>
</div>
<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
echo __(
'There is also an open-source version of the network map.

View File

@ -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')]); ?>
</div>
<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
echo __(
"%s contains a scheduled downtime management system.

View File

@ -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')]); ?>
</div>
<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
echo __(
'Discovery Task are used to find new elements in the network.

View File

@ -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')]); ?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Services'); ?> <p id="description_task">
<h3> <?php echo __('Create Services'); ?></h3><p id="description_task">
<?php
echo __(
"A service is a way to group your IT resources based on their functionalities.

View File

@ -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')]); ?>
</div>
<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
echo __(
"Some systems receive a high number of traps.

View File

@ -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')]); ?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Tags'); ?> <p id="description_task">
<h3> <?php echo __('Create Tags'); ?></h3><p id="description_task">
<?php
echo __(
"Access to modules can be configured by a tagging system.

View File

@ -28,7 +28,7 @@ if ($networkmaps_write || $networkmaps_manage) {
<?php echo html_print_image('images/firts_task/icono_grande_topology.png', true, ['title' => __('Transactions')]); ?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Transactions'); ?> <p id="description_task">
<h3> <?php echo __('Create Transactions'); ?></h3><p id="description_task">
<?php
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.

View File

@ -305,12 +305,12 @@ if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
echo '<div class ="img_banner_login">';
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
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 {
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 {
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>';

View File

@ -15,8 +15,6 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
ui_require_css_file('discovery');
ui_print_page_header(__('Discovery'), '', false, '', true);
/**
* Mask class names.

View File

@ -96,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.
if ($status === 0) {
@ -432,7 +433,7 @@ class DiscoveryTaskList extends Wizard
// Name task.
$data[1] = '';
if ($task['disabled'] != 2) {
$data[1] .= '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\',\''.$url_ajax.'\')">';
$data[1] .= '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
}
$data[1] .= '<b>'.$task['name'].'</b>';
@ -503,7 +504,7 @@ class DiscoveryTaskList extends Wizard
}
if ($task['disabled'] != 2) {
$data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\',\''.$url_ajax.'\')">';
$data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[9] .= html_print_image(
'images/eye.png',
true
@ -512,7 +513,7 @@ class DiscoveryTaskList extends Wizard
}
if ($task['disabled'] != 2 && $task['utimestamp'] > 0) {
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\',\''.$url_ajax.'\')">';
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[9] .= html_print_image(
'images/dynamic_network_icon.png',
true
@ -565,6 +566,9 @@ class DiscoveryTaskList extends Wizard
$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);
}
@ -576,8 +580,8 @@ class DiscoveryTaskList extends Wizard
html_print_table($table);
}
// Div neccesary for modal progress task.
echo '<div id="progress_task" style="display:none"></div>';
// Div neccesary for modal map task.
echo '<div id="map_task" style="display:none"></div>';
unset($table);

View File

@ -152,7 +152,7 @@ class HostDevices extends Wizard
]
);
$this->printHeader();
ui_print_page_header(__('Host & devices'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
$this->printBigButtonsList($buttons);
return;
@ -512,9 +512,15 @@ class HostDevices extends Wizard
$task_url = '&task='.$this->task['id_rt'];
}
$breadcrum[] = [
'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd',
'label' => __($this->label),
$breadcrum = [
[
'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++) {
$breadcrum[] = [
@ -527,7 +533,7 @@ class HostDevices extends Wizard
if ($this->page < $this->maxPagesNetScan) {
// Avoid to print header out of wizard.
$this->prepareBreadcrum($breadcrum);
$this->printHeader();
ui_print_page_header(__('NetScan'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
}
if (isset($this->page) === true

View File

@ -196,20 +196,38 @@ class Wizard
*
* @return void
*/
public function prepareBreadcrum(array $urls, bool $add=false)
public function prepareBreadcrum(array $urls, bool $add=false, bool $separator_beginning=false)
{
$bc = [];
$i = 0;
$count = 0;
$array_size = count($urls);
foreach ($urls as $url) {
$count++;
if ($url['selected'] == 1) {
$class = 'selected';
} else {
$class = '';
}
$bc[$i] = '<a href="'.$url['link'].'" class="text_color">';
$bc[$i] .= '<div class="arrow_box '.$class.'">'.$url['label'];
$bc[$i++] .= '</div></a>';
$bc[$i] = '';
if ($separator_beginning === true) {
$bc[$i] .= '<span class="breadcrumb_link">&nbsp/&nbsp</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">&nbsp/&nbsp</span>';
}
$bc[$i] .= '</span>';
$i++;
}
if ($add === true) {
@ -257,7 +275,7 @@ class Wizard
*/
public function printBreadcrum()
{
return '<h1 class="wizard">'.implode('', $this->breadcrum).'</h1>';
return implode('', $this->breadcrum);
}

View File

@ -34,14 +34,23 @@ $showmap = (bool) get_parameter('showmap', 0);
if ($progress_task_discovery) {
$id_task = get_parameter('id', 0);
if ($id_task !== 0) {
$result = '';
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,
90,
($global_progress < 0) ? 100 : $global_progress,
460,
30,
'#EA5434',
@ -49,40 +58,104 @@ if ($progress_task_discovery) {
'',
'#FFFFFF',
0,
0
);
$result .= '</li>';
$result .= '<li><h1>'.__('Searching devices in').' red a scanear</h1></li>';
$result .= '<li>';
$result .= d3_progress_bar(
$id_task.'_2',
30,
460,
30,
'#2751E1',
'%',
'',
'#FFFFFF',
0,
0
);
$result .= '</li>';
$result .= '<li><h1>'.__('Summary').'</h1></li>';
$result .= '<li><span><b>'.__('Estimated').'</b>: total de host</span></li>';
$result .= '<li><span><b>'.__('Discovered').'</b>: total de agentes</span></li>';
$result .= '<li><span><b>'.__('Not alive/Not found').'</b>: total de agentes 1-2</span></li>';
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>';
echo $result;
$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 {
// Error.
ui_print_error_message(
__('Please, select task')
);
$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;
}

View File

@ -36,7 +36,7 @@ require_once $config['homedir'].'/include/functions_servers.php';
// Enterprise includes.
enterprise_include_once('include/functions_metaconsole.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

View File

@ -337,9 +337,15 @@ class CustomNetScan extends Wizard
$task_url = '&task='.$this->task['id_rt'];
}
$breadcrum[] = [
'link' => $run_url.'&wiz=hd',
'label' => __('Host & Devices'),
$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++) {
@ -353,7 +359,9 @@ class CustomNetScan extends Wizard
if ($this->page < $this->MAXPAGES) {
// Avoid to print header out of wizard.
$this->prepareBreadcrum($breadcrum);
$this->printHeader();
// Header
ui_print_page_header(__('NetScan Custom'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
}
$task_url = '';
@ -376,7 +384,9 @@ class CustomNetScan extends Wizard
if ($this->page < $this->maxPagesNetScan) {
// Avoid to print header out of wizard.
$this->prepareBreadcrum($breadcrum);
$this->printHeader();
// Header
ui_print_page_header(__('NetScan Custom'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
}
if (isset($this->page) === true

View File

@ -92,9 +92,15 @@ class ManageNetScanScripts extends Wizard
$run_url = 'index.php?sec=gservers&sec2=godmode/servers/discovery';
$breadcrum[] = [
'link' => $run_url.'&wiz=hd',
'label' => __('Host & Devices'),
$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++) {
@ -108,7 +114,9 @@ class ManageNetScanScripts extends Wizard
if ($this->page < $this->MAXPAGES) {
// Avoid to print header out of wizard.
$this->prepareBreadcrum($breadcrum);
$this->printHeader();
// Header
ui_print_page_header(__('Net scan scripts'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
}
$id_script = get_parameter('id_script', 0);

View File

@ -212,6 +212,13 @@ class NetworkMap
*/
public $tooltipParams;
/**
* Shows the map using 100% of height and width if is a widget.
*
* @var boolean
*/
public $isWidget;
/**
* Defines a custom method to parse Graphviz output and generate Graph.
* Function pointer.
@ -380,6 +387,12 @@ class NetworkMap
$this->noPopUp = $options['no_popup'];
}
// Initialize as widget?
if (isset($options['widget'])) {
$this->isWidget = (bool) $options['widget'];
$this->isWidget = true;
}
// Use a custom parser.
if (isset($options['custom_parser'])) {
$this->customParser = $options['custom_parser'];
@ -596,10 +609,6 @@ class NetworkMap
$this->idGroup = $this->map['id_group'];
switch ($this->map['source']) {
case SOURCE_GROUP:
$this->idGroup = $this->map['source_data'];
break;
case SOURCE_TASK:
$this->idTask = $this->map['source_data'];
break;
@ -608,6 +617,8 @@ class NetworkMap
$this->network = $this->map['source_data'];
break;
case SOURCE_GROUP:
// Already load.
default:
// Ignore.
break;
@ -764,7 +775,9 @@ class NetworkMap
// Empty map returns no data.
$nodes = [];
} else {
if ($this->mapOptions['map_filter']['dont_show_subgroups'] == 'true') {
if ($this->mapOptions['map_filter']['dont_show_subgroups'] === 'true'
|| $this->mapOptions['map_filter']['dont_show_subgroups'] == 1
) {
// Show only current selected group.
$filter['id_grupo'] = $this->idGroup;
} else {
@ -2776,6 +2789,10 @@ class NetworkMap
false,
true
);
$output .= '</div>';
$output .= '</div>';
return $output;
}
@ -2999,7 +3016,11 @@ class NetworkMap
$table->data = [];
$table->data['interface_row']['node_source_interface'] = html_print_label('', 'node_source_interface');
$table->data['interface_row']['node_source_interface'] = html_print_label(
'',
'node_source_interface',
true
);
$table->data['interface_row']['interface_source_select'] = html_print_select(
[],
@ -3023,10 +3044,11 @@ class NetworkMap
$table->data['interface_row']['node_target_interface'] = html_print_label(
'',
'node_target_interface'
'node_target_interface',
true
);
$output .= 'br><br>';
$output .= '<br>';
$table->data['interface_row']['interface_link_button'] = html_print_button(
__('Add interface link'),
@ -3228,7 +3250,8 @@ class NetworkMap
enterprise_installed: enterprise_installed,
node_radius: node_radius,
holding_area_dimensions: networkmap_holding_area_dimensions,
url_background_grid: url_background_grid
url_background_grid: url_background_grid,
font_size: '.$this->mapOptions['font_size'].'
});
init_drag_and_drop();
init_minimap();
@ -3289,7 +3312,10 @@ class NetworkMap
'/enterprise/include/styles/tooltipster.bundle.min.css'
).'" />'."\n";
$output .= '<div id="simple_map" data-id="'.$this->idMap.'" style="border: 1px #dddddd solid;">';
$output .= '<div id="simple_map" data-id="'.$this->idMap.'" ';
$output .= 'style="border: 1px #ddd solid;';
$output .= ' width:'.$this->mapOptions['width'];
$output .= ' ;height:'.$this->mapOptions['height'].'">';
$output .= '<svg id="svg'.$this->idMap.'" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" pointer-events="all" width="'.$this->mapOptions['width'].'" height="'.$this->mapOptions['height'].'px">';
$output .= '</svg>';
$output .= '</div>';
@ -3321,7 +3347,11 @@ class NetworkMap
// Open networkconsole_id div.
$output .= '<div id="networkconsole_'.$networkmap['id'].'"';
$output .= ' style="width: '.$this->mapOptions['width'].'; height: '.$this->mapOptions['height'].';position: relative; overflow: hidden; background: #FAFAFA">';
if ($this->isWidget) {
$output .= ' style="width: 100%; height: 100%;position: relative; overflow: hidden; background: #FAFAFA">';
} else {
$output .= ' style="width: '.$this->mapOptions['width'].'px; height: '.$this->mapOptions['height'].'px;position: relative; overflow: hidden; background: #FAFAFA">';
}
$output .= '<div style="display: '.$minimap_display.';">';
$output .= '<canvas id="minimap_'.$networkmap['id'].'"';

View File

@ -514,6 +514,12 @@ define('OPTION_COLOR_PICKER', 11);
define('NODE_TYPE', 0);
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);

View File

@ -19,8 +19,10 @@
// Set session variable to store menu type (classic or collapsed) within this session
if (!empty(get_parameter('menuType')))
$_SESSION['menu_type'] = get_parameter('menuType', 'collapsed');
if (!empty(get_parameter('menuType'))) {
$_SESSION['menu_type'] = get_parameter('menuType', 'classic');
}
/**
* Prints a complete menu structure.
@ -80,10 +82,17 @@ function menu_print_menu(&$menu)
$submenu = false;
if ($_SESSION['menu_type']=='classic')
$classes = ['menu_icon', 'no_hidden_menu'];
else
$classes = ['menu_icon', 'menu_icon_collapsed'];
if ($_SESSION['menu_type'] == 'classic') {
$classes = [
'menu_icon',
'no_hidden_menu',
];
} else {
$classes = [
'menu_icon',
'menu_icon_collapsed',
];
}
if (isset($main['sub'])) {
$classes[] = '';
@ -383,10 +392,11 @@ function menu_print_menu(&$menu)
$length = strlen(__($main['text']));
$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>';
else
} else {
$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
if (isset($main['notification'])) {

View File

@ -11,10 +11,10 @@
// 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/functions_modules.php';
require_once 'include/functions_events.php';
require_once 'include/functions_groups.php';
require_once 'include/functions_netflow.php';
require_once __DIR__.'/functions_modules.php';
require_once __DIR__.'/functions_events.php';
require_once __DIR__.'/functions_groups.php';
require_once __DIR__.'/functions_netflow.php';
enterprise_include_once('include/functions_metaconsole.php');

View File

@ -2768,7 +2768,8 @@ function ui_print_page_header(
$modal=false,
$message='',
$numChars=GENERIC_SIZE_TEXT,
$alias=''
$alias='',
$breadcrumbs=''
) {
$title = io_safe_input_html($title);
if (($icon == '') && ($godmode == true)) {
@ -2781,15 +2782,21 @@ function ui_print_page_header(
if ($godmode == true) {
$type = 'view';
$type2 = 'menu_tab_frame_view';
$type2 = (empty($breadcrumbs)) ? 'menu_tab_frame_view' : 'menu_tab_frame_view_bc';
$separator_class = 'separator';
} else {
$type = 'view';
$type2 = 'menu_tab_frame_view';
$type2 = (empty($breadcrumbs)) ? 'menu_tab_frame_view' : 'menu_tab_frame_view_bc';
$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.'">';

View File

@ -364,7 +364,8 @@ function d3_progress_bar(
$text='',
$fill_color='#FFFFFF',
$radiusx=10,
$radiusy=10
$radiusy=10,
$transition=1
) {
global $config;
@ -387,6 +388,7 @@ function d3_progress_bar(
'".$fill_color."',
".(int) $radiusx.',
'.(int) $radiusy.',
'.(int) $transition.'
);
</script>';

View File

@ -1776,7 +1776,8 @@ function progress_bar_d3(
label,
label_color,
radiusx,
radiusy
radiusy,
transition
) {
var startPercent = 0;
var endPercent = parseInt(percentile) / 100;
@ -1836,17 +1837,21 @@ function progress_bar_d3(
progress_front.attr("width", width * bar_progress);
}
var bar_progress = startPercent;
(function loops() {
if (transition == 0) {
var bar_progress = endPercent;
updateProgress(bar_progress);
} else {
var bar_progress = startPercent;
(function loops() {
updateProgress(bar_progress);
if (count > 0) {
count--;
bar_progress += step;
setTimeout(loops, 30);
}
})();
if (count > 0) {
count--;
bar_progress += step;
setTimeout(loops, 30);
}
})();
}
}
function progress_bubble_d3(

View File

@ -83,7 +83,7 @@ function draw_minimap() {
context_minimap.arc(center_orig_x, center_orig_y, 2, 0, Math.PI * 2, false);
//Check if the pandora point
if (value.id_agent == -1) {
if (value.type == 2) {
context_minimap.fillStyle = "#364D1F";
} else {
context_minimap.fillStyle = "#000";
@ -868,7 +868,7 @@ function edit_node(data_node, dblClick) {
); // It doesn't eval the possible XSS so it's ok
$("#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
$("#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
@ -1681,7 +1681,8 @@ function clear_selection() {
function update_networkmap() {
if (enterprise_installed) {
node.each(function(d) {
if (d.id_agent != -1) {
// Do not update Pandora FMS node.
if (d.type != 2) {
var params = [];
params.push("update_node_color=1");
params.push("id=" + d.id_db);
@ -1896,7 +1897,7 @@ function show_menu(item, data) {
icon: "interface_link_children",
disabled: function() {
if (enterprise_installed) {
if (data.type == 3) {
if (data.type == 3 || data.type == 2) {
return true;
} else {
return false;
@ -1966,7 +1967,7 @@ function show_menu(item, data) {
icon: "interface_link_parent",
disabled: function() {
if (enterprise_installed) {
if (data.type == 3) {
if (data.type == 3 || data.type == 2) {
return true;
} else {
return false;
@ -2052,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"] = {
name: delete_menu,
icon: "delete",
@ -2291,26 +2293,25 @@ function add_interface_link_js() {
cancel_set_parent_interface();
$("#dialog_interface_link").dialog("close");
source_value = $("#interface_source_select").val();
source_text = $("#interface_source_select")
var source_value = $("#interface_source_select").val();
var source_text = $("#interface_source_select")
.find("option:selected")
.text();
target_value = $("#interface_target_select").val();
target_text = $("#interface_target_select")
var target_value = $("#interface_target_select").val();
var target_text = $("#interface_target_select")
.find("option:selected")
.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({
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",
type: "POST",
url: "ajax.php",
@ -2326,8 +2327,9 @@ function add_interface_link_js() {
if (data["type_source"] == 1) {
temp_link["arrow_start"] = "module";
temp_link["id_module_start"] = source_value;
temp_link["status_start"] = data["status"];
temp_link["link_color"] = data["status"] == "1" ? "#FC4444" : "#999";
temp_link["status_start"] = data["status_start"];
temp_link["link_color"] =
data["status_start"] == "1" ? "#FC4444" : "#999";
} else {
temp_link["arrow_start"] = "";
temp_link["id_agent_start"] = source_value;
@ -2336,8 +2338,9 @@ function add_interface_link_js() {
if (data["type_target"] == 1) {
temp_link["arrow_end"] = "module";
temp_link["id_module_end"] = target_value;
temp_link["status_end"] = data["status"];
temp_link["link_color"] = data["status"] == "1" ? "#FC4444" : "#999";
temp_link["status_end"] = data["status_end"];
temp_link["link_color"] =
data["status_end"] == "1" ? "#FC4444" : "#999";
} else {
temp_link["arrow_end"] = "";
temp_link["id_agent_end"] = target_value;
@ -2596,8 +2599,9 @@ function proceed_to_restart_map() {
type: "POST",
url: "ajax.php",
success: function(data) {
$("#restart_map_form").html(data);
$("#restart_map_form").dialog("open");
$("#restart_map_form")
.html(data)
.dialog("open");
}
});
}
@ -2951,6 +2955,13 @@ function init_graph(parameter_object) {
window.height_svg =
$(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
if (typeof parameter_object.refresh_period != "undefined") {
@ -3964,6 +3975,10 @@ function draw_elements_graph() {
var font_size = node_radius / 1.5;
if (typeof window.font_size != "undefined") {
font_size = window.font_size;
}
node_temp
.append("text")
.attr("class", "node_text")

View File

@ -1,44 +1,80 @@
/**
*
* @param {*} id
* @param {*} name
*/
function progress_task_list(id, name, url) {
var params = [];
params.push("page=include/ajax/task_list.ajax");
params.push("progress_task_discovery=1");
params.push("id=" + id);
/*
global $
global jQuery
*/
jQuery.ajax({
data: params.join("&"),
/**
* 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: (action = url),
dataType: "html",
url: "ajax.php",
dataType: "json",
success: function(data) {
$("#progress_task")
.hide()
.empty()
.append(data)
.dialog({
title: "Task: " + name,
resizable: true,
draggable: true,
modal: false,
width: 600,
height: 400
})
.show();
callback(null, data);
},
error: function() {
callback(new Error("cannot fetch the list"));
}
});
}
function show_map(id, name, url) {
var params = [];
params.push("page=include/ajax/task_list.ajax");
params.push("showmap=1");
params.push("id=" + id);
$("#progress_task")
function show_map(id, name) {
$("#map_task")
.empty()
.hide()
.append("<p>Loading map</p>")
@ -53,12 +89,16 @@ function show_map(id, name, url) {
.show();
jQuery.ajax({
data: params.join("&"),
data: {
page: "include/ajax/task_list.ajax",
showmap: 1,
id: id
},
type: "POST",
url: (action = url),
url: "ajax.php",
dataType: "html",
success: function(data) {
$("#progress_task")
$("#map_task")
.empty()
.append(data);
}

View File

@ -64,7 +64,6 @@ h1.wizard a:hover {
div.arrow_box {
display: inline-block;
position: relative;
background: #ccc;
color: #888;
padding: 1.3em;
margin-left: 20px;
@ -72,16 +71,6 @@ div.arrow_box {
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 {
background: #424242;
color: #ccc;
@ -110,3 +99,68 @@ div.arrow_box:before {
.arrow_box:hover {
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;
}

View File

@ -72,6 +72,7 @@ div.new_task_cluster > div {
}
#description_task {
font-size: 12px;
line-height: 1.8em;
}
#fuerte {

View File

@ -31,8 +31,7 @@
.operation .menu_icon ul.submenu > li,
.godmode .menu_icon ul.submenu > li {
background-color: #282828;
padding-left: 10px;
padding-right: 10px;
padding-left: 1.5em;
}
.menu ul {
@ -58,7 +57,7 @@ li:hover ul {
.submenu_text {
margin-left: 0px;
width: 100%;
color: #9ca4a6;
color: #b9b9b9;
font-family: "Open Sans", sans-serif;
font-size: 9.4pt;
}
@ -71,21 +70,20 @@ li:hover ul {
margin: 0px 0px 0px 0px;
position: absolute;
z-index: 999;
width: 214px;
width: 240px;
}
.submenu2 {
position: absolute;
z-index: 999;
left: 214px;
width: 214px;
left: 240px;
width: 240px;
}
.sub_subMenu {
font-weight: normal !important;
background-color: #202020;
padding-left: 10px;
padding-right: 10px;
padding-left: 1.5em;
}
.sub_subMenu.selected {
@ -291,7 +289,7 @@ ul li a:hover {
}
.operation {
background-color: #343434 !important;
background-color: #3d3d3d !important;
padding-top: 20px !important;
}
@ -468,11 +466,11 @@ ul li a:hover {
}
.header_table_classic {
padding-left: 250px !important; /* 215 + 35 */
padding-left: 235px !important; /* 215 + 35 */
}
.header_table_collapsed {
padding-left: 95px !important; /* 60 + 35 */
padding-left: 80px !important; /* 60 + 35 */
}
.title_menu_classic {

View File

@ -404,10 +404,10 @@ div#page {
background-image: none;
clear: both;
width: auto;
padding-top: 20px !important;
padding-top: 5px !important;
padding-left: 60px; /* This is overwritten by the classic menu (215px)*/
padding-right: 35px;
margin-left: 35px;
margin-left: 20px;
}
body.pure {
@ -1266,7 +1266,7 @@ div.title_line {
margin-bottom: 20px;
height: 50px;
box-sizing: border-box;
background-color: #fff;
background-color: #fafafa;
border-top-right-radius: 7px;
border-top-left-radius: 7px;
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
@ -1305,6 +1305,7 @@ div.title_line {
text-decoration: none;
padding: 0px;
margin: 0px;
padding-top: 6px;
}
#menu_tab li.nomn:hover a,
#menu_tab li:hover ul a:hover {
@ -1410,7 +1411,8 @@ div#agent_wizard_subtabs {
#menu_tab_left li a,
#menu_tab_left li span {
color: #343434;
font-size: 14pt;
font-size: 16pt;
line-height: 16pt;
}
/*
@ -2019,6 +2021,7 @@ div#pandora_logo_header {
#header_table_inner {
height: 60px;
min-width: 790px;
/*width: 100%;*/
display: flex;
align-items: center;
@ -3251,7 +3254,7 @@ div.div_groups_status {
}
#title_menu {
color: #9ca4a6;
color: #b9b9b9;
float: right;
width: 72%;
letter-spacing: 0pt;
@ -3267,16 +3270,15 @@ div.div_groups_status {
#menu_tab li.nomn,
#menu_tab li.nomn_high {
background-color: #fff;
padding-right: 3px;
padding-left: 3px;
padding-right: 8px;
padding-left: 8px;
padding-top: 6px;
font-weight: bold;
text-decoration: none;
font-size: 14px;
margin-top: 0;
min-width: 30px;
height: 29px;
height: 40px;
}
#menu_tab li:hover {
@ -3287,6 +3289,7 @@ div.div_groups_status {
#menu_tab li.nomn_high span {
color: #fff;
box-shadow: inset 0px 4px #82b92e;
background-color: #fff;
}
#menu_tab li.nomn img,
@ -4427,21 +4430,7 @@ div#dialog_messages table th:last-child {
* ---------------------------------------------------------------------
*/
div#header_discovery {
border-radius: 50%;
box-shadow: 0 0 15px 0px #949494;
width: 9px;
font-weight: bold;
color: #fff;
margin-right: 15px;
}
div#header_discovery:hover {
box-shadow: 0 0 5px 2px #949494;
}
.notification-ball {
border: #fff solid 2px;
border-radius: 50%;
width: 24px;
height: 24px;
@ -4453,6 +4442,10 @@ div#header_discovery:hover {
font-weight: bold;
}
.notification-ball.notification-ball-new-messages:hover {
box-shadow: 0 0 3px #888;
}
.notification-ball-no-messages {
background-color: #82b92e;
cursor: pointer;
@ -4466,10 +4459,9 @@ div#header_discovery:hover {
border: #a5a5a5 solid 1px;
z-index: 900000;
position: absolute;
width: 590px;
width: 550px;
margin-top: -5px;
border-radius: 5px;
margin-left: -146px;
}
#notification-wrapper::before {
content: "";
@ -4481,8 +4473,7 @@ div#header_discovery:hover {
border-width: 12px;
border-style: solid;
bottom: 100%;
left: 78%;
left: calc(78% - 2px);
left: calc(58% - 7px);
margin-left: -12px;
border-bottom-color: white;
}
@ -4775,8 +4766,8 @@ input:checked + .p-slider:before {
/* New white rounded boxes */
.white_box {
background-color: #fff;
border: 1px solid #d7d9da;
border-radius: 10px;
border: 1px solid #f3f3f3;
border-radius: 5px;
padding: 20px 50px;
}

View File

@ -53,7 +53,7 @@ if ($new_networkmap) {
$recon_task_id = 0;
$source = 'group';
$ip_mask = '';
$dont_show_subgroups = false;
$dont_show_subgroups = 0;
$offset_x = '';
$offset_y = '';
$scale_z = 0.5;
@ -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_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 = [
'twopi' => 'radial',

View File

@ -76,7 +76,10 @@ if (enterprise_installed()) {
$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);
$description = get_parameter('description', '');
@ -168,7 +171,10 @@ if (enterprise_installed()) {
$description = get_parameter('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);
$row = db_get_row('tmap', 'id', $id);
$filter = json_decode($row['filter'], true);
@ -247,7 +253,10 @@ if ($new_networkmap || $save_networkmap) {
''
);
$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);
$description = get_parameter('description', '');

View File

@ -384,11 +384,6 @@ if (check_acl($config['id_user'], 0, 'ER')
$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&section=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&section=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&section=list&open_filter=0&pure=']['type'] = 'direct';
// Sound Events.
$javascript = "javascript: window.open('operation/events/sound_events.php');";
$javascript = 'javascript: alert(111);';

View File

@ -785,6 +785,7 @@ CREATE TABLE IF NOT EXISTS `trecon_task` (
`wmi_enabled` tinyint(1) unsigned DEFAULT '0',
`auth_strings` text,
`autoconfiguration_enabled` tinyint(1) unsigned default '0',
`summary` text,
PRIMARY KEY (`id_rt`),
KEY `recon_task_daemon` (`id_recon_server`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -834,7 +834,17 @@ sub PandoraFMS::Recon::Base::wmi_module {
sub PandoraFMS::Recon::Base::update_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;

View File

@ -15,6 +15,14 @@ use PandoraFMS::Recon::NmapParser;
use PandoraFMS::Recon::Util;
use Socket qw/inet_aton/;
# Constants.
use constant {
STEP_SCANNING => 1,
STEP_AFT => 2,
STEP_TRACEROUTE => 3,
STEP_GATEWAY => 4
};
# /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 @ISA = ("Exporter");
our %EXPORT_TAGS = ( 'all' => [ qw( ) ] );
our %EXPORT_TAGS = ( 'all' => [qw( )] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw(
$DOT1DBASEBRIDGEADDRESS
$DOT1DBASEPORTIFINDEX
$DOT1DTPFDBADDRESS
$DOT1DTPFDBPORT
$IFDESC
$IFHCINOCTECTS
$IFHCOUTOCTECTS
$IFINDEX
$IFINOCTECTS
$IFOPERSTATUS
$IFOUTOCTECTS
$IPADENTIFINDEX
$IPENTADDR
$IFNAME
$IPNETTOMEDIAPHYSADDRESS
$IFPHYSADDRESS
$IPADENTIFINDEX
$IPROUTEIFINDEX
$IPROUTENEXTHOP
$IPROUTETYPE
$PRTMARKERINDEX
$SYSDESCR
$SYSSERVICES
$SYSUPTIME
$DOT1DBASEBRIDGEADDRESS
$DOT1DBASEPORTIFINDEX
$DOT1DTPFDBADDRESS
$DOT1DTPFDBPORT
$IFDESC
$IFHCINOCTECTS
$IFHCOUTOCTECTS
$IFINDEX
$IFINOCTECTS
$IFOPERSTATUS
$IFOUTOCTECTS
$IPADENTIFINDEX
$IPENTADDR
$IFNAME
$IPNETTOMEDIAPHYSADDRESS
$IFPHYSADDRESS
$IPADENTIFINDEX
$IPROUTEIFINDEX
$IPROUTENEXTHOP
$IPROUTETYPE
$PRTMARKERINDEX
$SYSDESCR
$SYSSERVICES
$SYSUPTIME
);
#######################################################################
@ -167,6 +175,18 @@ sub new {
snmp_version => 1,
subnets => [],
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
if ($self->{'snmp_enabled'}) {
# Check SNMP version
if ($self->{'snmp_version'} ne '1' && $self->{'snmp_version'} ne '2'
&& $self->{'snmp_version'} ne '2c' && $self->{'snmp_version'} ne '3'
) {
if ( $self->{'snmp_version'} ne '1'
&& $self->{'snmp_version'} ne '2'
&& $self->{'snmp_version'} ne '2c'
&& $self->{'snmp_version'} ne '3') {
$self->{'snmp_enabled'} = 0;
$self->call('message', "SNMP version " . $self->{'snmp_version'} . " not supported (only 1, 2, 2c and 3).", 5);
}
# Check the version 3 parameters
if ($self->{'snmp_version'} eq '3') {
# Fixed some vars
$self->{'communities'} = [];
# SNMP v3 checks
if (
$self->{'snmp_security_level'} ne 'noAuthNoPriv' &&
$self->{'snmp_security_level'} ne 'authNoPriv' &&
$self->{'snmp_security_level'} ne 'authPriv'
) {
if ( $self->{'snmp_security_level'} ne 'noAuthNoPriv'
&&$self->{'snmp_security_level'} ne 'authNoPriv'
&&$self->{'snmp_security_level'} ne 'authPriv') {
$self->{'snmp_enabled'} = 0;
$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);
}
} else {
# Fixed some vars
$self->{'snmp_auth_user'} = '';
$self->{'snmp_auth_pass'} = '';
@ -296,6 +318,7 @@ sub aft_connectivity($$) {
foreach my $mac ($self->snmp_get_value_array($switch, $DOT1DTPFDBADDRESS)) {
push(@aft, parse_mac($mac));
}
# Search for matching entries.
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.
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.
# The switch is probably connected to another switch.
@ -342,8 +365,8 @@ sub are_connected($$$$$) {
$if_1 = "ping" if $if_1 eq '';
$if_2 = "ping" if $if_2 eq '';
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}"})) {
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}"})) {
return 1;
}
@ -367,19 +390,20 @@ sub snmp_discovery($$) {
# Try to find the MAC with an ARP request.
$self->get_mac_from_ip($device);
# Check if the device responds to SNMP.
if ($self->snmp_responds($device)) {
$self->{'summary'}->{'SNMP'} += 1;
# Fill the VLAN cache.
$self->find_vlans($device);
# Guess the device type.
$self->guess_device_type($device);
# Find aliases for the device.
$self->find_aliases($device);
# Find interfaces for the device.
$self->find_ifaces($device);
@ -655,12 +679,12 @@ sub get_if_from_ip($$$) {
# Get the port associated to the IP address.
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.
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;
return $if_name;
}
@ -686,12 +710,12 @@ sub get_if_from_mac($$$) {
# Get the name of the interface associated to the port.
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;
return $if_name;
}
return '';
}
@ -718,13 +742,13 @@ sub get_if_from_port($$$) {
########################################################################################
sub get_if_ip($$$) {
my ($self, $device, $if_index) = @_;
my @output = $self->snmp_get($device, $IPADENTIFINDEX);
foreach my $line (@output) {
chomp ($line);
chomp($line);
return $1 if ($line =~ m/^$IPADENTIFINDEX.(\S+)\s+=\s+\S+:\s+$if_index$/);
}
return '';
}
@ -748,7 +772,7 @@ sub get_if_mac($$$) {
########################################################################################
sub get_if_type($$$) {
my ($self, $device, $if_index) = @_;
my $type = $self->snmp_get_value($device, "$IFTYPE.$if_index");
return '' unless defined($type);
@ -769,7 +793,7 @@ sub get_ip_from_mac($$) {
}
########################################################################################
# Attemtps to find
# Attemtps to find
########################################################################################
sub get_mac_from_ip($$) {
my ($self, $host) = @_;
@ -824,7 +848,7 @@ sub get_routes($) {
}
# 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'}}) {
$route->{gw} = $self->{'default_gw'} if ($route->{'gw'} eq '0.0.0.0');
}
@ -906,12 +930,15 @@ sub guess_device_type($$) {
# L2?
my $device_type;
if ($service_bits[1] == 1) {
# L3?
if ($service_bits[2] == 1) {
# Bridge MIB?
if (defined($bridge_mib)) {
$device_type = 'switch';
} else {
# L7?
if ($service_bits[6] == 1) {
$device_type = 'host';
@ -919,8 +946,8 @@ sub guess_device_type($$) {
$device_type = 'router';
}
}
}
else {
}else {
# Bridge MIB?
if (defined($bridge_mib)) {
$device_type = 'switch';
@ -928,14 +955,16 @@ sub guess_device_type($$) {
$device_type = 'host';
}
}
}
else {
}else {
# L3?
if ($service_bits[2] == 1) {
# L4?
if ($service_bits[3] == 1) {
$device_type = 'switch';
} else {
# L7?
if ($service_bits[6] == 1) {
$device_type = 'host';
@ -943,8 +972,8 @@ sub guess_device_type($$) {
$device_type = 'router';
}
}
}
else {
}else {
# Printer MIB?
my $printer_mib = $self->snmp_get_value($device, $PRTMARKERINDEX);
if (defined($printer_mib)) {
@ -1016,7 +1045,7 @@ sub is_switch_connected($$$) {
# Check for aliases!
$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;
}
@ -1069,8 +1098,8 @@ sub mark_connected($$;$$$) {
}
# Prevent parent-child loops.
if (!defined($self->{'parents'}->{$parent}) ||
$self->{'parents'}->{$parent} ne $child) {
if (!defined($self->{'parents'}->{$parent})
||$self->{'parents'}->{$parent} ne $child) {
# A parent-child relationship is always created to help complete the map with
# layer 3 information.
@ -1097,8 +1126,10 @@ sub mark_switch_connected($$$) {
sub mark_visited($$) {
my ($self, $device) = @_;
$self->{'visited_devices'}->{$device} = { 'addr' => { $device => '' },
'type' => 'host' };
$self->{'visited_devices'}->{$device} = {
'addr' => { $device => '' },
'type' => 'host'
};
}
########################################################################################
@ -1121,8 +1152,8 @@ sub snmp_responds($$) {
return 1 if($self->is_snmp_discovered($device));
return ($self->{'snmp_version'} eq "3")
? $self->snmp_responds_v3($device)
: $self->snmp_responds_v122c($device);
? $self->snmp_responds_v3($device)
: $self->snmp_responds_v122c($device);
}
########################################################################################
@ -1221,11 +1252,7 @@ sub remote_arp($$) {
##############################################################################
sub ping ($$$) {
my ($self, $host) = @_;
my ($timeout, $retries, $packets) = (
$self->{'icmp_timeout'},
$self->{'icmp_checks'},
1,
);
my ($timeout, $retries, $packets) = ($self->{'icmp_timeout'},$self->{'icmp_checks'},1,);
# Windows
if (($^O eq "MSWin32") || ($^O eq "MSWin32-x64") || ($^O eq "cygwin")){
@ -1237,11 +1264,12 @@ sub ping ($$$) {
return 0;
}
# Solaris
if ($^O eq "solaris"){
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping -A inet6" : "ping";
for (my $i = 0; $i < $retries; $i++) {
# Note: There is no timeout option.
`$ping_command -s -n $host 56 $packets >/dev/null 2>&1`;
return 1 if ($? == 0);
@ -1249,11 +1277,12 @@ sub ping ($$$) {
return 0;
}
# FreeBSD
if ($^O eq "freebsd"){
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping -t $timeout";
for (my $i = 0; $i < $retries; $i++) {
# Note: There is no timeout option for ping6.
`$ping_command -q -n -c $packets $host >/dev/null 2>&1`;
return 1 if ($? == 0);
@ -1263,9 +1292,10 @@ sub ping ($$$) {
}
# NetBSD
if ($^O eq "netbsd"){
if ($^O eq "netbsd"){
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping -w $timeout";
for (my $i = 0; $i < $retries; $i++) {
# Note: There is no timeout option for ping6.
`$ping_command -q -n -c $packets $host >/dev/null 2>&1`;
if ($? == 0) {
@ -1275,11 +1305,11 @@ sub ping ($$$) {
return 0;
}
# Assume Linux by default.
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping";
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);
}
@ -1295,11 +1325,13 @@ sub scan_subnet($) {
my @subnets = @{$self->get_subnets()};
foreach my $subnet (@subnets) {
$self->{'c_network_percent'} = 0;
$self->{'c_network_name'} = $subnet;
# Clean blanks.
$subnet =~ s/\s+//g;
my $net_addr = new NetAddr::IP ($subnet);
my $net_addr = new NetAddr::IP($subnet);
if (!defined($net_addr)) {
$self->call('message', "Invalid network: $subnet", 3);
next;
@ -1312,46 +1344,68 @@ sub scan_subnet($) {
# fping scan.
if (-x $self->{'fping'} && $net_addr->num() > 1) {
$self->call('message', "Calling fping...", 5);
my @hosts = `"$self->{'fping'}" -ga "$subnet" 2>DEVNULL`;
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 $subnet_step = 100.0 / scalar(@hosts);
foreach my $line (@hosts) {
chomp($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];
# Skip network and broadcast addresses.
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('update_progress', ceil($progress));
$progress += $step;
$self->{'c_network_percent'} += $subnet_step;
$self->snmp_discovery($host);
# Add wmi scan if enabled.
$self->wmi_scan($host) if ($self->{'wmi_enabled'} == 1);
}
}
# ping scan.
else {
my @hosts = map { (split('/', $_))[0] } $net_addr->hostenum;
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 $subnet_step = 100.0 / scalar(@hosts);
foreach my $host (@hosts) {
$self->call('message', "Scanning host: $host", 5);
$self->call('update_progress', ceil($progress));
$progress += $step;
# 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);
# Add wmi scan if enabled.
@ -1373,6 +1427,8 @@ sub scan($) {
# Find devices.
$self->call('message', "[1/5] Scanning the network...", 3);
$self->{'step'} = STEP_SCANNING;
$self->call('update_progress', $progress);
$self->scan_subnet();
# Read the local ARP cache.
@ -1381,20 +1437,23 @@ sub scan($) {
# Get a list of found hosts.
my @hosts = @{$self->get_hosts()};
if (scalar(@hosts) > 0 && $self->{'parent_detection'} == 1) {
# Delete previous connections.
# Delete previous connections.
$self->call('delete_connections');
# Connectivity from address forwarding tables.
$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%.
for (my $i = 0; defined($hosts[$i]); $i++) {
$self->call('update_progress', $progress);
$progress += $step;
$self->aft_connectivity($hosts[$i]);
}
# Connect hosts that are still unconnected using traceroute.
$self->call('message', "[3/4] Finding traceroute connectivity.", 3);
$self->{'step'} = STEP_TRACEROUTE;
($progress, $step) = (70, 20.0 / scalar(@hosts)); # From 70% to 90%.
foreach my $host (@hosts) {
$self->call('update_progress', $progress);
@ -1402,9 +1461,10 @@ sub scan($) {
next if ($self->has_parent($host) || $self->has_children($host));
$self->traceroute_connectivity($host);
}
# Connect hosts that are still unconnected using known gateways.
$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%.
$self->get_routes(); # Update the route cache.
foreach my $host (@hosts) {
@ -1416,8 +1476,9 @@ sub scan($) {
}
# Done!
$self->{'step'} = '';
$self->call('update_progress', -1);
# Print debug information on found devices.
$self->call('message', "[Summary]", 3);
foreach my $host (@hosts) {
@ -1425,7 +1486,7 @@ sub scan($) {
next unless defined($device);
# Print device information.
my $dev_info = "Device: " . $device->{'type'} . " (";
my $dev_info = "Device: " . $device->{'type'} . " (";
foreach my $ip_address ($self->get_addresses($host)) {
$dev_info .= "$ip_address,";
}
@ -1473,8 +1534,8 @@ sub snmp_get($$$) {
if (scalar(@vlans) == 0) {
my $command = $self->snmp_get_command($device, $oid, $community);
@output = `$command`;
}
else {
}else {
# Handle duplicate lines.
my %output_hash;
foreach my $vlan (@vlans) {
@ -1528,7 +1589,7 @@ sub snmp_get_value($$$) {
my @output = $self->snmp_get($device, $oid);
foreach my $line (@output) {
chomp ($line);
chomp($line);
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);
foreach my $line (@output) {
chomp ($line);
chomp($line);
push(@values, $1) if ($line =~ /^$oid\S*\s+=\s+\S+:\s+(.*)$/);
}
@ -1575,22 +1636,20 @@ sub traceroute_connectivity($$) {
# 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 $np = PandoraFMS::Recon::NmapParser->new();
eval {
$np->parsescan($self->{'nmap'}, $nmap_args, ($host));
};
eval {$np->parsescan($self->{'nmap'}, $nmap_args, ($host));};
return if ($@);
# Get hops to the host.
my ($h) = $np->all_hosts ();
return unless defined ($h);
my @hops = $h->all_trace_hops ();
my ($h) = $np->all_hosts();
return unless defined($h);
my @hops = $h->all_trace_hops();
# Skip the target host.
pop(@hops);
# Reverse the host order (closest hosts first).
@hops = reverse(@hops);
# Look for parents.
my $device = $host;
for (my $i = 0; $i < $self->{'parent_recursion'}; $i++) {
@ -1601,7 +1660,7 @@ sub traceroute_connectivity($$) {
$self->call('create_agent', $parent);
$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.
$device = $parent;
@ -1643,7 +1702,10 @@ sub wmi_scan {
my $auth = $self->responds_to_wmi($target);
return unless defined($auth);
$self->{'summary'}->{'WMI'} += 1;
$self->call('message', "[".$target."] WMI available.", 10);
# Create the agent if it does not exist.
my $agent_id = $self->call('create_agent', $target);
next unless defined($agent_id);
@ -1651,56 +1713,19 @@ sub wmi_scan {
# CPU.
my @cpus = $self->wmi_get_value_array($target, $auth, 'SELECT DeviceId FROM Win32_Processor', 0);
foreach my $cpu (@cpus) {
$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'
)
);
$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'));
}
# Memory.
my $mem = $self->wmi_get_value($target, $auth, 'SELECT FreePhysicalMemory FROM Win32_OperatingSystem', 0);
if (defined($mem)) {
$self->call('wmi_module',
(
$agent_id,
$target,
"SELECT FreePhysicalMemory, TotalVisibleMemorySize FROM Win32_OperatingSystem",
$auth,
0,
'FreeMemory',
'Free memory',
'generic_data',
'KB'
)
);
$self->call('wmi_module',($agent_id,$target,"SELECT FreePhysicalMemory, TotalVisibleMemorySize FROM Win32_OperatingSystem",$auth,0,'FreeMemory','Free memory','generic_data','KB'));
}
# Disk.
my @units = $self->wmi_get_value_array($target, $auth, 'SELECT DeviceID FROM Win32_LogicalDisk', 0);
foreach my $unit (@units) {
$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'
)
);
$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'));
}
}