1 <?php
defined('SYSPATH') OR die('No direct access allowed.');
3 * Hosts widget for tactical overview
7 class Tac_acknowledged_Widget
extends widget_Base
{
8 protected $duplicatable = true;
9 public function index()
11 # fetch widget view path
12 $view_path = $this->view_path('view');
14 $current_status = $this->get_current_status();
16 # HOSTS DOWN / problems
20 if ($current_status->hst
->down_and_ack
) {
21 $problem[$i]['type'] = _('Host');
22 $problem[$i]['status'] = _('Down');
23 $problem[$i]['url'] = 'status/host/all/'.nagstat
::HOST_DOWN
.'/?hostprops='.nagstat
::HOST_STATE_ACKNOWLEDGED
;
24 $problem[$i]['title'] = $current_status->hst
->down_and_ack
.' '._('Acknowledged hosts');
28 if ($current_status->hst
->unreachable_and_ack
) {
29 $problem[$i]['type'] = _('Host');
30 $problem[$i]['status'] = _('Unreachable');
31 $problem[$i]['url'] = 'status/host/all/'.nagstat
::HOST_UNREACHABLE
.'/?hostprops='.nagstat
::HOST_STATE_ACKNOWLEDGED
;
32 $problem[$i]['title'] = $current_status->hst
->unreachable_and_ack
.' '._('Acknowledged hosts');
36 if ($current_status->svc
->critical_and_ack
) {
37 $problem[$i]['type'] = _('Service');
38 $problem[$i]['status'] = _('Critical');
39 $problem[$i]['url'] = 'status/service/all/'.(nagstat
::HOST_UP|nagstat
::HOST_DOWN|nagstat
::HOST_UNREACHABLE|nagstat
::HOST_PENDING
).
40 '/'.nagstat
::SERVICE_CRITICAL
.'/'.nagstat
::SERVICE_STATE_ACKNOWLEDGED
;
41 $problem[$i]['title'] = $current_status->svc
->critical_and_ack
.' '._('Acknowledged services');
45 if ($current_status->svc
->warning_and_ack
) {
46 $problem[$i]['type'] = _('Service');
47 $problem[$i]['status'] = _('Warning');
48 $problem[$i]['url'] = 'status/service/all/'.(nagstat
::HOST_UP|nagstat
::HOST_DOWN|nagstat
::HOST_UNREACHABLE|nagstat
::HOST_PENDING
).
49 '/'.nagstat
::SERVICE_WARNING
.'/'.nagstat
::SERVICE_STATE_ACKNOWLEDGED
;
50 $problem[$i]['title'] = $current_status->svc
->warning_and_ack
.' '._('Acknowledged services');
54 if ($current_status->svc
->unknown_and_ack
) {
55 $problem[$i]['type'] = _('Service');
56 $problem[$i]['status'] = _('Unknown');
57 $problem[$i]['url'] = 'status/service/all/'.(nagstat
::HOST_UP|nagstat
::HOST_DOWN|nagstat
::HOST_UNREACHABLE|nagstat
::HOST_PENDING
).
58 '/'.nagstat
::SERVICE_UNKNOWN
.'/'.nagstat
::SERVICE_STATE_ACKNOWLEDGED
;
59 $problem[$i]['title'] = $current_status->svc
->unknown_and_ack
.' '._('Acknowledged services');