blob: fc64c7d7376788db29a16e07108bf160fa700c69 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
<?php
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
namespace Icinga\Module\Icingadb\Web\Navigation\Renderer;
use Icinga\Module\Icingadb\Common\Auth;
use Icinga\Module\Icingadb\Common\Links;
use Icinga\Module\Icingadb\Model\HoststateSummary;
use ipl\Web\Url;
class HostProblemsBadge extends ProblemsBadge
{
use Auth;
protected function fetchProblemsCount()
{
$summary = HoststateSummary::on($this->getDb());
$this->applyRestrictions($summary);
$count = (int) $summary->first()->hosts_down_unhandled;
if ($count) {
$this->setTitle(sprintf(
tp('One unhandled host down', '%d unhandled hosts down', $count),
$count
));
}
return $count;
}
protected function getUrl(): Url
{
return Links::hosts()->setParams(['host.state.is_problem' => 'y', 'sort' => 'host.state.severity desc']);
}
}
|