summaryrefslogtreecommitdiffstats
path: root/modules/monitoring/application/views/scripts/list/servicegroups.phtml
blob: c915b30126fcc5b2e809a598184e3e1c636faa7d (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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<?php use Icinga\Module\Monitoring\Web\Widget\StateBadges;

if (! $this->compact): ?>
<div class="controls">
    <?= $this->tabs ?>
    <?= $this->paginator ?>
    <div class="sort-controls-container">
        <?= $this->limiter ?>
        <?= $this->sortBox ?>
        <a href="<?= $this->href('monitoring/list/servicegroup-grid')->addFilter(clone $this->filterEditor->getFilter()) ?>" class="grid-toggle-link"
           title="<?= $this->translate('Toogle grid view mode') ?>">
            <?= $this->icon('th-list', null, ['class' => '-active']) ?>
            <?= $this->icon('th-thumb-empty', null, ['class' => '-inactive']) ?>
        </a>
    </div>
    <?= $this->filterEditor ?>
</div>
<?php endif ?>
<div class="content">
<?php if (! $serviceGroups->hasResult()): ?>
    <p><?= $this->translate('No service groups found matching the filter.') ?></p>
</div>
<?php return; endif ?>
    <table class="table-row-selectable common-table" data-base-target="_next">
    <thead>
        <tr>
            <th></th>
            <th><?= $this->translate('Service Group') ?></th>
            <th><?= $this->translate('Service States') ?></th>
        </tr>
    </thead>
    <tbody>
    <?php foreach ($serviceGroups->peekAhead($this->compact) as  $serviceGroup): ?>
        <tr>
            <td class="count-col">
                <span class="badge"><?= $serviceGroup->services_total ?></span>
            </td>
            <th>
                <?= $this->qlink(
                    $serviceGroup->servicegroup_alias,
                    $this
                        ->url('monitoring/list/services')
                        ->setParams(['servicegroup_name' => $serviceGroup->servicegroup_name])
                        ->addFilter($this->filterEditor->getFilter()),
                    ['sort' => 'service_severity'],
                    ['title' => sprintf($this->translate('List all services in the group "%s"'),  $serviceGroup->servicegroup_alias)]
                ) ?>
            </th>
            <td>
                <?php
                $stateBadges = new StateBadges();
                $stateBadges
                    ->setUrl('monitoring/list/services')
                    ->setBaseFilter($this->filterEditor->getFilter())
                    ->add(
                        StateBadges::STATE_OK,
                        $serviceGroup->services_ok,
                        array(
                            'service_state'     => 0,
                            'servicegroup_name' => $serviceGroup->servicegroup_name,
                            'sort'              => 'service_severity'
                        ),
                        'List %s service that is currently in state OK in service group "%s"',
                        'List %s services which are currently in state OK in service group "%s"',
                        array($serviceGroup->services_ok, $serviceGroup->servicegroup_alias)
                    )
                    ->add(
                        StateBadges::STATE_CRITICAL,
                        $serviceGroup->services_critical_unhandled,
                        array(
                            'service_state'         => 2,
                            'service_acknowledged'  => 0,
                            'service_in_downtime'   => 0,
                            'host_problem'          => 0,
                            'servicegroup_name'     => $serviceGroup->servicegroup_name,
                            'sort'                  => 'service_severity'
                        ),
                        'List %s service that is currently in state CRITICAL in service group "%s"',
                        'List %s services which are currently in state CRITICAL in service group "%s"',
                        array($serviceGroup->services_critical_unhandled, $serviceGroup->servicegroup_alias)
                    )
                    ->add(
                        StateBadges::STATE_CRITICAL_HANDLED,
                        $serviceGroup->services_critical_handled,
                        array(
                            'service_state'     => 2,
                            'service_handled'   => 1,
                            'servicegroup_name' => $serviceGroup->servicegroup_name,
                            'sort'              => 'service_severity'
                        ),
                        'List %s service that is currently in state CRITICAL (Acknowledged) in service group "%s"',
                        'List %s services which are currently in state CRITICAL (Acknowledged) in service group "%s"',
                        array($serviceGroup->services_critical_handled, $serviceGroup->servicegroup_alias)
                    )
                    ->add(
                        StateBadges::STATE_UNKNOWN,
                        $serviceGroup->services_unknown_unhandled,
                        array(
                            'service_state'         => 3,
                            'service_acknowledged'  => 0,
                            'service_in_downtime'   => 0,
                            'host_problem'          => 0,
                            'servicegroup_name'     => $serviceGroup->servicegroup_name,
                            'sort'                  => 'service_severity'
                        ),
                        'List %s service that is currently in state UNKNOWN in service group "%s"',
                        'List %s services which are currently in state UNKNOWN in service group "%s"',
                        array($serviceGroup->services_unknown_unhandled, $serviceGroup->servicegroup_alias)
                    )
                    ->add(
                        StateBadges::STATE_UNKNOWN_HANDLED,
                        $serviceGroup->services_unknown_handled,
                        array(
                            'service_state'     => 3,
                            'service_handled'   => 1,
                            'servicegroup_name' => $serviceGroup->servicegroup_name,
                            'sort'              => 'service_severity'
                        ),
                        'List %s service that is currently in state UNKNOWN (Acknowledged) in service group "%s"',
                        'List %s services which are currently in state UNKNOWN (Acknowledged) in service group "%s"',
                        array($serviceGroup->services_unknown_handled, $serviceGroup->servicegroup_alias)

                    )
                    ->add(
                        StateBadges::STATE_WARNING,
                        $serviceGroup->services_warning_unhandled,
                        array(
                            'service_state'         => 1,
                            'service_acknowledged'  => 0,
                            'service_in_downtime'   => 0,
                            'host_problem'          => 0,
                            'servicegroup_name'     => $serviceGroup->servicegroup_name,
                            'sort'                  => 'service_severity'
                        ),
                        'List %s service that is currently in state WARNING in service group "%s"',
                        'List %s services which are currently in state WARNING in service group "%s"',
                        array($serviceGroup->services_warning_unhandled, $serviceGroup->servicegroup_alias)
                    )
                    ->add(
                        StateBadges::STATE_WARNING_HANDLED,
                        $serviceGroup->services_warning_handled,
                        array(
                            'service_state'     => 1,
                            'service_handled'   => 1,
                            'servicegroup_name' => $serviceGroup->servicegroup_name,
                            'sort'              => 'service_severity'
                        ),
                        'List %s service that is currently in state WARNING (Acknowledged) in service group "%s"',
                        'List %s services which are currently in state WARNING (Acknowledged) in service group "%s"',
                        array($serviceGroup->services_warning_handled, $serviceGroup->servicegroup_alias)
                    )
                    ->add(
                        StateBadges::STATE_PENDING,
                        $serviceGroup->services_pending,
                        array(
                            'service_state'     => 99,
                            'servicegroup_name' => $serviceGroup->servicegroup_name,
                            'sort'              => 'service_severity'
                        ),
                        'List %s service that is currenlty in state PENDING in service group "%s"',
                        'List %s services which are currently in state PENDING in service group "%s"',
                        array($serviceGroup->services_pending, $serviceGroup->servicegroup_alias)
                    );
                echo $stateBadges->render();
                ?>
            </td>
        </tr>
    <?php endforeach ?>
    </tbody>
    </table>
<?php if ($serviceGroups->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>