summaryrefslogtreecommitdiffstats
path: root/modules/monitoring/application/views/scripts/list/services.phtml
blob: b2088e9c7bfbd05fb278b205c10aee3d6b35a4df (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php
use Icinga\Date\DateFormatter;
use Icinga\Module\Monitoring\Object\Host;
use Icinga\Module\Monitoring\Object\Service;

if (! $this->compact): ?>
<div class="controls">
    <?= $this->tabs ?>
    <?= $this->paginator ?>
    <div class="sort-controls-container">
        <?= $this->limiter ?>
        <?= $this->sortBox ?>
    </div>
    <?= $this->filterEditor ?>
</div>
<?php endif ?>
<div class="content">
<?php if (! $services->hasResult()): ?>
    <p><?= $this->translate('No services found matching the filter.') ?></p>
</div>
<?php return; endif ?>
    <table data-base-target="_next"
           class="table-row-selectable state-table multiselect<?php if ($this->compact): ?> compact<?php endif ?>"
           data-icinga-multiselect-url="<?= $this->href('monitoring/services/show') ?>"
           data-icinga-multiselect-controllers="<?= $this->href('monitoring/services') ?>"
           data-icinga-multiselect-data="service,host">
    <thead class="print-only">
        <tr>
            <th><?= $this->translate('State') ?></th>
            <th><?= $this->translate('Service') ?></th>
        <?php foreach($this->addColumns as $col): ?>
            <th><?= $this->escape($col) ?></th>
        <?php endforeach ?>
        </tr>
    </thead>
    <tbody>
    <?php foreach ($services->peekAhead($this->compact) as $service):
        $serviceLink = $this->href(
            'monitoring/service/show',
            array(
                'host'      => $service->host_name,
                'service'   => $service->service_description
            )
        );
        $hostLink = $this->href(
            'monitoring/host/show',
            array(
                'host' => $service->host_name,
            )
        );
        $serviceStateName = Service::getStateText($service->service_state);
        $serviceCheckOverdue = $service->service_next_update < time(); ?>
        <tr<?= $serviceCheckOverdue ? ' class="state-outdated"' : '' ?>>
            <td class="state-col state-<?= $serviceStateName ?><?= $service->service_handled ? ' handled' : '' ?>">
                <div class="state-label">
                <?php if ($serviceCheckOverdue): ?>
                    <?= $this->icon('clock', sprintf($this->translate('Overdue %s'), DateFormatter::timeSince($service->service_next_update))) ?>
                <?php endif ?>
                    <?= Service::getStateText($service->service_state, true) ?>
                </div>
            <?php if ((int) $service->service_state !== 99): ?>
                <div class="state-meta">
                    <?= $this->timeSince($service->service_last_state_change, $this->compact) ?>
                <?php if ((int) $service->service_state > 0 && (int) $service->service_state_type === 0): ?>
                    <div><?= $this->translate('Soft', 'Soft state') ?> <?= $service->service_attempt ?></div>
                <?php endif ?>
                </div>
            <?php endif ?>
            </td>

            <td>
                <div class="state-header">
                  <span class="service-on">
                  <?= $this->iconImage()->service($service) ?>
                  <?php
                  if ($this->showHost) {
                      echo sprintf(
                          $this->translate('%s on %s', 'service on host'),
                          $this->qlink(
                              $service->service_display_name,
                              $serviceLink,
                              null,
                              array(
                                  'title' => sprintf(
                                      $this->translate('Show detailed information for service %s on host %s'),
                                      $service->service_display_name,
                                      $service->host_display_name
                                  ),
                                  'class' => 'rowaction'
                              )
                          ),
                              $this->qlink(
                                  $service->host_display_name
                                  . ($service->host_state != 0 ? ' (' . Host::getStateText($service->host_state, true) . ')' : ''),
                                  $hostLink,
                                  null,
                                  [
                                      'title' => sprintf(
                                          $this->translate('Show detailed information for host %s'),
                                          $service->host_display_name
                                      )
                                  ]
                              )
                          );
                  } else {
                      echo $this->qlink(
                          $service->service_display_name,
                          $serviceLink,
                          null,
                          array(
                              'title' => sprintf(
                                  $this->translate('Show detailed information for service %s on host %s'),
                                  $service->service_display_name,
                                  $service->host_display_name
                              ),
                              'class' => 'rowaction'
                          )
                      );
                  }
                  ?>
                  </span>
                  <span class="state-icons"><?= $this->serviceFlags($service) ?></span>
                </div>
                <div class="overview-plugin-output-container">
                    <div class="overview-performance-data">
                        <?= $this->perfdata($service->service_perfdata, true, 5) ?>
                    </div>
                    <p class="overview-plugin-output"><?= $this->pluginOutput($this->ellipsis($service->service_output, 10000), true, $service->service_check_command) ?></p>
                </div>
            </td>
        <?php foreach($this->addColumns as $col): ?>
          <?php if ($service->$col && preg_match('~^_(host|service)_([a-zA-Z0-9_]+)$~', $col, $m)): ?>
            <td><?= $this->escape(\Icinga\Module\Monitoring\Object\MonitoredObject::protectCustomVars([$m[2] => $service->$col])[$m[2]]) ?></td>
          <?php else: ?>
            <td><?= $this->escape($service->$col) ?></td>
          <?php endif ?>
        <?php endforeach ?>
        </tr>
    <?php endforeach ?>
    </tbody>
    </table>
<?php if ($services->hasMore()): ?>
<div class="dont-print action-links">
    <?= $this->qlink(
        $this->translate('Show More'),
        $this->url()->without(array('showCompact', 'limit')),
        null,
        array(
            'class'             => 'action-link',
            'data-base-target'  => '_next'
        )
    ) ?>
</div>
<?php endif ?>
</div>
<?php if (! $this->compact): ?>
<div class="monitoring-statusbar dont-print">
    <?= $this->render('list/components/servicesummary.phtml') ?>
    <?= $this->render('list/components/selectioninfo.phtml') ?>
</div>
<?php endif ?>