Merge branch 'ent-5575-wizard-de-modulos-y-recon-by-steps' of brutus.artica.es:artica/pandorafms into ent-5575-wizard-de-modulos-y-recon-by-steps

This commit is contained in:
Jose Gonzalez 2020-04-06 12:15:05 +02:00
commit dacde2d0b2
2 changed files with 72 additions and 21 deletions

View File

@ -1033,32 +1033,83 @@ class DiscoveryTaskList extends HTML
$table->rowid = []; $table->rowid = [];
$table->data = []; $table->data = [];
// Content. if ($task['review_mode'] == DISCOVERY_RESULTS) {
$table->data[$i][0] = '<b>'.__('Hosts discovered').'</b>'; $agents_review = db_get_all_rows_filter(
$table->data[$i][1] = '<span id="discovered">'; 'tdiscovery_tmp_agents',
$table->data[$i][1] .= $task['stats']['summary']['discovered']; ['id_rt' => $task['id_rt']]
$table->data[$i++][1] .= '</span>'; );
$table->data[$i][0] = '<b>'.__('Alive').'</b>'; $agents = 0;
$table->data[$i][1] = '<span id="alive">'; $total = 0;
$table->data[$i][1] .= $task['stats']['summary']['alive']; if (is_array($agents_review)) {
$table->data[$i++][1] .= '</span>'; foreach ($agents_review as $agent) {
$data = json_decode(base64_decode($agent['data']), true);
$table->data[$i][0] = '<b>'.__('Not alive').'</b>'; if (is_array($data) === false) {
$table->data[$i][1] = '<span id="not_alive">'; continue;
$table->data[$i][1] .= $task['stats']['summary']['not_alive']; }
$table->data[$i++][1] .= '</span>';
if ($task['type'] == DISCOVERY_HOSTDEVICES) { if (is_array($data['agent']) === false) {
$table->data[$i][0] = '<b>'.__('Responding SNMP').'</b>'; continue;
$table->data[$i][1] = '<span id="SNMP">'; }
$table->data[$i][1] .= $task['stats']['summary']['SNMP'];
// Ensure agent_id really exists.
$agent_id = agents_get_agent_id(
$data['agent']['nombre'],
true
);
if ($agent_id > 0) {
$agents++;
}
$total++;
}
}
// Content.
$table->data[$i][0] = '<b>'.__('Host&devices total').'</b>';
$table->data[$i][1] = '<span id="discovered">';
$table->data[$i][1] .= $total;
$table->data[$i++][1] .= '</span>'; $table->data[$i++][1] .= '</span>';
$table->data[$i][0] = '<b>'.__('Responding WMI').'</b>'; $table->data[$i][0] = '<b>'.__('Agents monitored').'</b>';
$table->data[$i][1] = '<span id="WMI">'; $table->data[$i][1] = '<span id="alive">';
$table->data[$i][1] .= $task['stats']['summary']['WMI']; $table->data[$i][1] .= $agents;
$table->data[$i++][1] .= '</span>'; $table->data[$i++][1] .= '</span>';
$table->data[$i][0] = '<b>'.__('Agents pending').'</b>';
$table->data[$i][1] = '<span id="alive">';
$table->data[$i][1] .= ($total - $agents);
$table->data[$i++][1] .= '</span>';
} else {
// Content.
$table->data[$i][0] = '<b>'.__('Hosts discovered').'</b>';
$table->data[$i][1] = '<span id="discovered">';
$table->data[$i][1] .= $task['stats']['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] .= $task['stats']['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] .= $task['stats']['summary']['not_alive'];
$table->data[$i++][1] .= '</span>';
if ($task['type'] == DISCOVERY_HOSTDEVICES) {
$table->data[$i][0] = '<b>'.__('Responding SNMP').'</b>';
$table->data[$i][1] = '<span id="SNMP">';
$table->data[$i][1] .= $task['stats']['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] .= $task['stats']['summary']['WMI'];
$table->data[$i++][1] .= '</span>';
}
} }
$output = '<div class="subtitle"><span>'.__('Summary').'</span></div>'; $output = '<div class="subtitle"><span>'.__('Summary').'</span></div>';

View File

@ -1595,7 +1595,7 @@ sub PandoraFMS::Recon::Base::update_progress ($$) {
my $stats = {}; my $stats = {};
if (defined($self->{'summary'}) && $self->{'summary'} ne '') { if (defined($self->{'summary'}) && $self->{'summary'} ne '') {
$stats->{'summary'} = $self->{'summary'}; $stats->{'summary'} = $self->{'task_data'}{'summary'};
} }
$stats->{'step'} = $self->{'step'}; $stats->{'step'} = $self->{'step'};
$stats->{'c_network_name'} = $self->{'c_network_name'}; $stats->{'c_network_name'} = $self->{'c_network_name'};