Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/Icingadb/Common/Icons.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Icons

const IS_ACKNOWLEDGED = 'check';

const IS_FLAPPING = 'bolt';
const IS_FLAPPING = 'random';

const IS_PERSISTENT = 'thumbtack';

Expand Down
23 changes: 11 additions & 12 deletions library/Icingadb/Model/State.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,31 +151,30 @@ public function getIcon(): ?Icon
$icon = null;
switch (true) {
case $this->is_acknowledged:
$icon = new Icon(Icons::IS_ACKNOWLEDGED);
$icon = new Icon(Icons::IS_ACKNOWLEDGED, [
'title' => sprintf('%s (%s)', strtoupper($this->getStateTextTranslated()), t('is acknowledged'))
]);

break;
case $this->in_downtime:
$icon = new Icon(
Icons::IN_DOWNTIME,
['title' => sprintf(
$icon = new Icon(Icons::IN_DOWNTIME, [
'title' => sprintf(
'%s (%s)',
strtoupper($this->getStateTextTranslated()),
$this->is_handled ? t('handled by Downtime') : t('in Downtime')
)]
);
)
]);

break;
case $this->is_flapping:
$icon = new Icon(Icons::IS_FLAPPING);
$icon = new Icon(Icons::IS_FLAPPING, [
'title' => sprintf('%s (%s)', strtoupper($this->getStateTextTranslated()), t('is flapping'))
]);

break;
case ! $this->is_reachable:
$icon = new Icon(Icons::HOST_DOWN, [
'title' => sprintf(
'%s (%s)',
strtoupper($this->getStateTextTranslated()),
t('is unreachable')
)
'title' => sprintf('%s (%s)', strtoupper($this->getStateTextTranslated()), t('is unreachable'))
]);

break;
Expand Down
47 changes: 42 additions & 5 deletions library/Icingadb/View/BaseHostAndServiceRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,19 +220,56 @@ public function assembleFooter($item, HtmlDocument $footer, string $layout): voi
);
}

if ($item->state->is_acknowledged) {
$title = $isService
? sprintf(
$this->translate('Service "%s" on "%s" is acknowledged'),
$item->display_name,
$item->host->display_name
)
: sprintf($this->translate('Host "%s" is acknowledged'), $item->display_name);

$statusIcons->addHtml(new Icon(Icons::IS_ACKNOWLEDGED, ['title' => $title]));
}

if ($item->state->in_downtime) {
if ($isService) {
$message = $item->state->is_handled
? 'Service "%s" on "%s" is handled by Downtime'
: 'Service "%s" on "%s" is in Downtime';

$title = sprintf($this->translate($message), $item->display_name, $item->host->display_name);
} else {
$message = $item->state->is_handled ? 'Host "%s" is handled by Downtime' : 'Host "%s" is in Downtime';

$title = sprintf($this->translate($message), $item->display_name);
}

$statusIcons->addHtml(new Icon(Icons::IN_DOWNTIME, ['title' => $title]));
}

if ($item->state->is_flapping) {
$title = $isService
? sprintf(
$this->translate('Service "%s" on "%s" is in flapping state'),
$item->display_name,
$item->host->display_name
)
: sprintf(
$this->translate('Host "%s" is in flapping state'),
$item->display_name
);
: sprintf($this->translate('Host "%s" is in flapping state'), $item->display_name);

$statusIcons->addHtml(new Icon(Icons::IS_FLAPPING, ['title' => $title]));
}

if (! $item->state->is_reachable) {
$title = $isService
? sprintf(
$this->translate('Service "%s" on "%s" is unreachable'),
$item->display_name,
$item->host->display_name
)
: sprintf($this->translate('Host "%s" is unreachable'), $item->display_name);

$statusIcons->addHtml(new Icon('random', ['title' => $title]));
$statusIcons->add(new Icon(Icons::HOST_DOWN, ['title' => $title]));
}

if (! $item->notifications_enabled) {
Expand Down
Loading