summaryrefslogtreecommitdiffstats
path: root/modules/monitoring/application/views/scripts/list/hostgroup-grid.phtml
blob: 34498d03cbc6d3f44c5ca834943de0c5aea54e08 (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
<?php if (! $this->compact): ?>
<div class="controls">
    <?= $this->tabs ?>
    <div class="sort-controls-container">
        <?= $this->sortBox ?>
        <a href="<?= $this->href('monitoring/list/hostgroups')->addFilter($this->filterEditor->getFilter()) ?>" class="grid-toggle-link"
           title="<?= $this->translate('Toogle grid view mode') ?>">
            <?= $this->icon('th-list', null, ['class' => '-inactive']) ?>
            <?= $this->icon('th-thumb-empty', null, ['class' => '-active']) ?>
        </a>
    </div>
    <?= $this->filterEditor ?>
</div>
<?php endif ?>
<div class="content" data-base-target="_next">
<?php /** @var \Icinga\Module\Monitoring\DataView\Hostgroup $hostGroups */
if (! $hostGroups->hasResult()): ?>
    <p><?= $this->translate('No host groups found matching the filter.') ?></p>
</div>
<?php return; endif ?>
<div class="group-grid">
<?php foreach ($hostGroups as $hostGroup): ?>
    <div class="group-grid-cell">
    <?php if ($hostGroup->hosts_down_unhandled > 0): ?>
        <?= $this->qlink(
            $hostGroup->hosts_down_unhandled,
            $this->url('monitoring/list/hosts')->addFilter($this->filterEditor->getFilter()),
            [
                'hostgroup_name'    => $hostGroup->hostgroup_name,
                'host_handled'      => 0,
                'host_state'        => 1
            ],
            [
                'class' => 'state-down',
                'title' => sprintf(
                    $this->translatePlural(
                        'List %u host that is currently in state DOWN in the host group "%s"',
                        'List %u hosts which are currently in state DOWN in the host group "%s"',
                        $hostGroup->hosts_down_unhandled
                    ),
                    $hostGroup->hosts_down_unhandled,
                    $hostGroup->hostgroup_alias
                )
            ]
        ) ?>
    <?php elseif ($hostGroup->hosts_unreachable_unhandled > 0): ?>
        <?= $this->qlink(
            $hostGroup->hosts_unreachable_unhandled,
            $this->url('monitoring/list/hosts')->addFilter($this->filterEditor->getFilter()),
            [
                'hostgroup_name'    => $hostGroup->hostgroup_name,
                'host_handled'      => 0,
                'host_state'        => 2
            ],
            [
                'class' => 'state-unreachable',
                'title' => sprintf(
                    $this->translatePlural(
                        'List %u host that is currently in state UNREACHABLE in the host group "%s"',
                        'List %u hosts which are currently in state UNREACHABLE in the host group "%s"',
                        $hostGroup->hosts_unreachable_unhandled
                    ),
                    $hostGroup->hosts_unreachable_unhandled,
                    $hostGroup->hostgroup_alias
                )
            ]
        ) ?>
    <?php elseif ($hostGroup->hosts_down_handled > 0): ?>
        <?= $this->qlink(
            $hostGroup->hosts_down_handled,
            $this->url('monitoring/list/hosts')->addFilter($this->filterEditor->getFilter()),
            [
                'hostgroup_name'    => $hostGroup->hostgroup_name,
                'host_handled'      => 1,
                'host_state'        => 1
            ],
            [
                'class' => 'state-down handled',
                'title' => sprintf(
                    $this->translatePlural(
                        'List %u host that is currently in state DOWN (Acknowledged) in the host group "%s"',
                        'List %u hosts which are currently in state DOWN (Acknowledged) in the host group "%s"',
                        $hostGroup->hosts_down_handled
                    ),
                    $hostGroup->hosts_down_handled,
                    $hostGroup->hostgroup_alias
                )
            ]
        ) ?>
    <?php elseif ($hostGroup->hosts_unreachable_handled > 0): ?>
        <?= $this->qlink(
            $hostGroup->hosts_unreachable_handled,
            $this->url('monitoring/list/hosts')->addFilter($this->filterEditor->getFilter()),
            [
                'hostgroup_name'    => $hostGroup->hostgroup_name,
                'host_handled'      => 0,
                'host_state'        => 2
            ],
            [
                'class' => 'state-unreachable handled',
                'title' => sprintf(
                    $this->translatePlural(
                        'List %u host that is currently in state UNREACHABLE (Acknowledged) in the host group "%s"',
                        'List %u hosts which are currently in state UNREACHABLE (Acknowledged) in the host group "%s"',
                        $hostGroup->hosts_unreachable_handled
                    ),
                    $hostGroup->hosts_unreachable_handled,
                    $hostGroup->hostgroup_alias
                )
            ]
        ) ?>
    <?php elseif ($hostGroup->hosts_pending > 0): ?>
        <?= $this->qlink(
            $hostGroup->hosts_pending,
            $this->url('monitoring/list/hosts')->addFilter($this->filterEditor->getFilter()),
            [
                'hostgroup_name'    => $hostGroup->hostgroup_name,
                'host_state'        => 99
            ],
            [
                'class' => 'state-pending',
                'title' => sprintf(
                    $this->translatePlural(
                        'List %u host that is currently in state PENDING in the host group "%s"',
                        'List %u hosts which are currently in state PENDING in the host group "%s"',
                        $hostGroup->hosts_pending
                    ),
                    $hostGroup->hosts_pending,
                    $hostGroup->hostgroup_alias
                )
            ]
        ) ?>
    <?php elseif ($hostGroup->hosts_up > 0): ?>
        <?= $this->qlink(
            $hostGroup->hosts_up,
            $this->url('monitoring/list/hosts')->addFilter($this->filterEditor->getFilter()),
            [
                'hostgroup_name'    => $hostGroup->hostgroup_name,
                'host_state'        => 0
            ],
            [
                'class' => 'state-up',
                'title' => sprintf(
                    $this->translatePlural(
                        'List %u host that is currently in state UP in the host group "%s"',
                        'List %u hosts which are currently in state UP in the host group "%s"',
                        $hostGroup->hosts_up
                    ),
                    $hostGroup->hosts_up,
                    $hostGroup->hostgroup_alias
                )
            ]
        ) ?>
    <?php else: ?>
        <div class="state-none">
            0
        </div>
    <?php endif ?>
        <?= $this->qlink(
            $hostGroup->hostgroup_alias,
            $this->url('monitoring/list/hosts')->addFilter($this->filterEditor->getFilter()),
            ['hostgroup_name' => $hostGroup->hostgroup_name],
            [
                'title' => sprintf(
                    $this->translate('List all hosts in the group "%s"'),
                    $hostGroup->hostgroup_alias
                )
            ]
        ) ?>
    </div>
<?php endforeach ?>
</div>
</div>