/monitoring/tactical: don't show negative amounts of monitored objects

refs #4174
This commit is contained in:
Alexander A. Klimov 2020-06-15 13:21:20 +02:00 committed by Johannes Meyer
parent 0520ed348d
commit 361fc27922
2 changed files with 17 additions and 12 deletions

View File

@ -37,6 +37,7 @@ class TacticalController extends Controller
'hosts_unreachable_handled',
'hosts_unreachable_unhandled',
'hosts_pending',
'hosts_pending_not_checked',
'hosts_not_checked',
'services_ok',
@ -47,6 +48,7 @@ class TacticalController extends Controller
'services_unknown_handled',
'services_unknown_unhandled',
'services_pending',
'services_pending_not_checked',
'services_not_checked',
)
);
@ -63,8 +65,8 @@ class TacticalController extends Controller
$summary = $stats->fetchRow();
// Correct pending counts. Done here instead of in the query for compatibility reasons.
$summary->hosts_pending -= $summary->hosts_not_checked;
$summary->services_pending -= $summary->services_not_checked;
$summary->hosts_pending -= $summary->hosts_pending_not_checked;
$summary->services_pending -= $summary->services_pending_not_checked;
$hostSummaryChart = new Donut();
$hostSummaryChart
@ -74,7 +76,7 @@ class TacticalController extends Controller
->addSlice($summary->hosts_unreachable_handled, array('class' => 'slice-state-unreachable-handled'))
->addSlice($summary->hosts_unreachable_unhandled, array('class' => 'slice-state-unreachable'))
->addSlice($summary->hosts_pending, array('class' => 'slice-state-pending'))
->addSlice($summary->hosts_not_checked, array('class' => 'slice-state-not-checked'))
->addSlice($summary->hosts_pending_not_checked, array('class' => 'slice-state-not-checked'))
->setLabelBig($summary->hosts_down_unhandled)
->setLabelBigEyeCatching($summary->hosts_down_unhandled > 0)
->setLabelSmall($this->translate('Hosts Down'));
@ -89,7 +91,7 @@ class TacticalController extends Controller
->addSlice($summary->services_unknown_handled, array('class' => 'slice-state-unknown-handled'))
->addSlice($summary->services_unknown_unhandled, array('class' => 'slice-state-unknown'))
->addSlice($summary->services_pending, array('class' => 'slice-state-pending'))
->addSlice($summary->services_not_checked, array('class' => 'slice-state-not-checked'))
->addSlice($summary->services_pending_not_checked, array('class' => 'slice-state-not-checked'))
->setLabelBig($summary->services_critical_unhandled)
->setLabelBigEyeCatching($summary->services_critical_unhandled > 0)
->setLabelSmall($this->translate('Services Critical'));

View File

@ -1,3 +1,6 @@
<?php
use Icinga\Data\Filter\Filter;
?>
<?php if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs ?>
@ -53,15 +56,15 @@
<?php endif ?>
<?php if ($statusSummary->hosts_pending): ?>
<li>
<a href="<?= $this->filteredUrl('monitoring/list/hosts', array('host_state' => 99, 'sort' => 'host_last_check', 'dir' => 'asc')) ?>">
<a href="<?= $this->filteredUrl('monitoring/list/hosts', array('host_state' => 99, 'sort' => 'host_last_check', 'dir' => 'asc'))->addFilter(Filter::not(Filter::where('host_active_checks_enabled', 0), Filter::where('host_passive_checks_enabled', 0))) ?>">
<span class="state state-pending badge"><?= $statusSummary->hosts_pending ?></span><?= $this->translate('Pending') ?>
</a>
</li>
<?php endif ?>
<?php if ($statusSummary->hosts_not_checked): ?>
<?php if ($statusSummary->hosts_pending_not_checked): ?>
<li>
<a href="<?= $this->filteredUrl('monitoring/list/hosts', array('host_active_checks_enabled' => 0, 'host_passive_checks_enabled' => 0, 'sort' => 'host_last_check', 'dir' => 'asc')) ?>">
<span class="state slice-state-not-checked badge"><?= $statusSummary->hosts_not_checked ?></span><?= $this->translate('Not Checked') ?>
<a href="<?= $this->filteredUrl('monitoring/list/hosts', array('host_state' => 99, 'host_active_checks_enabled' => 0, 'host_passive_checks_enabled' => 0, 'sort' => 'host_last_check', 'dir' => 'asc')) ?>">
<span class="state slice-state-not-checked badge"><?= $statusSummary->hosts_pending_not_checked ?></span><?= $this->translate('Not Checked') ?>
</a>
</li>
<?php endif ?>
@ -124,15 +127,15 @@
<?php endif;
if ($statusSummary->services_pending):?>
<li>
<a href="<?= $this->filteredUrl('monitoring/list/services', array('service_state' => 99, 'sort' => 'service_last_check', 'dir' => 'asc')) ?>">
<a href="<?= $this->filteredUrl('monitoring/list/services', array('service_state' => 99, 'sort' => 'service_last_check', 'dir' => 'asc'))->addFilter(Filter::not(Filter::where('service_active_checks_enabled', 0), Filter::where('service_passive_checks_enabled', 0))) ?>">
<span class="state state-pending badge"><?= $statusSummary->services_pending ?></span><?= $this->translate('Pending') ?>
</a>
</li>
<?php endif;
if ($statusSummary->services_not_checked):?>
if ($statusSummary->services_pending_not_checked):?>
<li>
<a href="<?= $this->filteredUrl('monitoring/list/services', array('service_active_checks_enabled' => 0, 'service_passive_checks_enabled' => 0, 'sort' => 'service_last_check', 'dir' => 'asc')) ?>">
<span class="state slice-state-not-checked badge"><?= $statusSummary->services_not_checked ?></span><?= $this->translate('Not Checked') ?>
<a href="<?= $this->filteredUrl('monitoring/list/services', array('service_state' => 99, 'service_active_checks_enabled' => 0, 'service_passive_checks_enabled' => 0, 'sort' => 'service_last_check', 'dir' => 'asc')) ?>">
<span class="state slice-state-not-checked badge"><?= $statusSummary->services_pending_not_checked ?></span><?= $this->translate('Not Checked') ?>
</a>
</li>
<?php endif?>