From 5205e0e06f78a42909f8b38bb6f8e08f3fe0f498 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 6 Apr 2020 12:05:03 +0200 Subject: [PATCH] minor update --- .../wizards/DiscoveryTaskList.class.php | 91 +++++++++++++++---- .../lib/PandoraFMS/DiscoveryServer.pm | 2 +- 2 files changed, 72 insertions(+), 21 deletions(-) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index 3b3f6dcf36..434c79fbc4 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -1033,32 +1033,83 @@ class DiscoveryTaskList extends HTML $table->rowid = []; $table->data = []; - // Content. - $table->data[$i][0] = ''.__('Hosts discovered').''; - $table->data[$i][1] = ''; - $table->data[$i][1] .= $task['stats']['summary']['discovered']; - $table->data[$i++][1] .= ''; + if ($task['review_mode'] == DISCOVERY_RESULTS) { + $agents_review = db_get_all_rows_filter( + 'tdiscovery_tmp_agents', + ['id_rt' => $task['id_rt']] + ); - $table->data[$i][0] = ''.__('Alive').''; - $table->data[$i][1] = ''; - $table->data[$i][1] .= $task['stats']['summary']['alive']; - $table->data[$i++][1] .= ''; + $agents = 0; + $total = 0; + if (is_array($agents_review)) { + foreach ($agents_review as $agent) { + $data = json_decode(base64_decode($agent['data']), true); - $table->data[$i][0] = ''.__('Not alive').''; - $table->data[$i][1] = ''; - $table->data[$i][1] .= $task['stats']['summary']['not_alive']; - $table->data[$i++][1] .= ''; + if (is_array($data) === false) { + continue; + } - if ($task['type'] == DISCOVERY_HOSTDEVICES) { - $table->data[$i][0] = ''.__('Responding SNMP').''; - $table->data[$i][1] = ''; - $table->data[$i][1] .= $task['stats']['summary']['SNMP']; + if (is_array($data['agent']) === false) { + continue; + } + + // 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] = ''.__('Host&devices total').''; + $table->data[$i][1] = ''; + $table->data[$i][1] .= $total; $table->data[$i++][1] .= ''; - $table->data[$i][0] = ''.__('Responding WMI').''; - $table->data[$i][1] = ''; - $table->data[$i][1] .= $task['stats']['summary']['WMI']; + $table->data[$i][0] = ''.__('Agents monitored').''; + $table->data[$i][1] = ''; + $table->data[$i][1] .= $agents; $table->data[$i++][1] .= ''; + + $table->data[$i][0] = ''.__('Agents pending').''; + $table->data[$i][1] = ''; + $table->data[$i][1] .= ($total - $agents); + $table->data[$i++][1] .= ''; + } else { + // Content. + $table->data[$i][0] = ''.__('Hosts discovered').''; + $table->data[$i][1] = ''; + $table->data[$i][1] .= $task['stats']['summary']['discovered']; + $table->data[$i++][1] .= ''; + + $table->data[$i][0] = ''.__('Alive').''; + $table->data[$i][1] = ''; + $table->data[$i][1] .= $task['stats']['summary']['alive']; + $table->data[$i++][1] .= ''; + + $table->data[$i][0] = ''.__('Not alive').''; + $table->data[$i][1] = ''; + $table->data[$i][1] .= $task['stats']['summary']['not_alive']; + $table->data[$i++][1] .= ''; + + if ($task['type'] == DISCOVERY_HOSTDEVICES) { + $table->data[$i][0] = ''.__('Responding SNMP').''; + $table->data[$i][1] = ''; + $table->data[$i][1] .= $task['stats']['summary']['SNMP']; + $table->data[$i++][1] .= ''; + + $table->data[$i][0] = ''.__('Responding WMI').''; + $table->data[$i][1] = ''; + $table->data[$i][1] .= $task['stats']['summary']['WMI']; + $table->data[$i++][1] .= ''; + } } $output = '
'.__('Summary').'
'; diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index bacda962d4..ad71eb829f 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -1595,7 +1595,7 @@ sub PandoraFMS::Recon::Base::update_progress ($$) { my $stats = {}; if (defined($self->{'summary'}) && $self->{'summary'} ne '') { - $stats->{'summary'} = $self->{'summary'}; + $stats->{'summary'} = $self->{'task_data'}{'summary'}; } $stats->{'step'} = $self->{'step'}; $stats->{'c_network_name'} = $self->{'c_network_name'};