Skip to content

Commit

Permalink
Add host_never_unhandled option to views
Browse files Browse the repository at this point in the history
fixes #14
  • Loading branch information
lazyfrosch committed Oct 11, 2017
1 parent ed160b8 commit 9b6c26b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
34 changes: 23 additions & 11 deletions library/Toplevelview/Tree/TLVHostGroupNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,29 @@ public function getStatus()
$status->set('total', $data->hosts_total + $data->services_total);
$status->set('ok', $data->hosts_up + $data->services_ok);

$status->set(
'critical_handled',
$data->hosts_down_handled
+ $data->hosts_unreachable_handled
+ $data->services_critical_handled
);
$status->set('critical_unhandled',
$data->hosts_down_unhandled
+ $data->hosts_unreachable_unhandled
+ $data->services_critical_unhandled
);
$status->set('critical_handled', $data->services_critical_handled);
$status->set('critical_unhandled', $data->services_critical_unhandled);

if ($this->getRoot()->get('host_never_unhandled') === true) {
$status->add(
'critical_handled',
$data->hosts_down_handled
+ $data->hosts_unreachable_handled
+ $data->hosts_down_unhandled
+ $data->hosts_unreachable_unhandled
);
} else {
$status->add(
'critical_handled',
$data->hosts_down_handled
+ $data->hosts_unreachable_handled
);
$status->add(
'critical_unhandled',
$data->hosts_down_unhandled
+ $data->hosts_unreachable_unhandled
);
}

$status->set('warning_handled', $data->services_warning_handled);
$status->set('warning_unhandled', $data->services_warning_unhandled);
Expand Down
2 changes: 1 addition & 1 deletion library/Toplevelview/Tree/TLVHostNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function getStatus()
$status->add('downtime_active');
$state = '10';
$handled = '';
} elseif ($data->host_handled === '1') {
} elseif ($data->host_handled === '1' || $this->getRoot()->get('host_never_unhandled') === true) {
$handled = '_handled';
} else {
$handled = '_unhandled';
Expand Down

0 comments on commit 9b6c26b

Please sign in to comment.