histogram: Make histograms crash less
[ninja.git] / application / views / extinfo / commands.php
blob9a347ef992056b605ed8033bae1c48e36e7a3a42
1 <?php defined('SYSPATH') OR die('No direct access allowed.');
3 /* @var $set ObjectSet_Model */
4 $it = $set->it(false, array(), 1, 0);
5 /* @var $object Object_Model */
6 $object = $it->current();
8 if( $object instanceof Host_Model ) {
9 $host = $object;
10 $service = false;
11 $type = 'host';
12 } else if( $object instanceof Service_Model ) {
13 $host = $object->get_host();
14 $service = $object;
15 $type = 'service';
17 /* @var $host Host_Model */
18 /* @var $service Service_Model */
20 /* @var $object Service_Model */
24 <div class="right width-33" id="extinfo_info">
26 <table class="ext">
27 <tr>
28 <th colspan="2"><?php echo ($type == 'host' ? _('Host Commands') : _('Service Commands')) ?></th>
29 </tr>
30 <?php # only for hosts!
31 $i =0;
32 if ($type == 'host' && Kohana::config('nagvis.nagvis_real_path', false, false)) {
34 <tr>
35 <td class="icon dark">
36 <span class="icon-16 x16-locate-host-on-map" title="<?php echo _('Locate host on map') ?>"></span>
37 </td>
38 <td class="bt"><?php echo html::anchor('nagvis/automap/host/'.$host->get_name(), _('Locate host on map')) ?></td>
39 </tr>
40 <?php } ?>
41 <tr>
42 <?php
43 $img = 'add-comment';
44 $label = _("Submit a $type comment");
45 $cmd = $type == 'host' ? nagioscmd::command_id('ADD_HOST_COMMENT') : nagioscmd::command_id('ADD_SVC_COMMENT');
47 <td class="icon dark">
48 <span class="icon-16 x16-<?php echo $img ?>" title="<?php echo $label ?>"></span>
49 </td>
50 <td>
51 <?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?>
52 </td>
53 </tr>
54 <tr>
55 <?php
56 if ($object->get_active_checks_enabled()) {
57 $img = 'disabled';
58 $label = _("Disable active checks of this $type");
59 $cmd = $type == 'host' ? nagioscmd::command_id('DISABLE_HOST_CHECK') : nagioscmd::command_id('DISABLE_SVC_CHECK');
60 } else {
61 $img = 'enabled';
62 $label = _("Enable active checks of this $type");
63 $cmd = $type == 'host' ? nagioscmd::command_id('ENABLE_HOST_CHECK') : nagioscmd::command_id('ENABLE_SVC_CHECK');
64 } ?>
65 <td class="icon dark">
66 <span class="icon-16 x16-<?php echo $img ?>" title="<?php echo $label ?>"></span>
67 </td>
68 <td>
69 <?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?>
70 </td>
71 </tr>
72 <tr>
73 <?php
74 $label = _("Re-schedule next $type check");
75 $cmd = $type == 'host' ? nagioscmd::command_id('SCHEDULE_HOST_CHECK') : nagioscmd::command_id('SCHEDULE_SVC_CHECK'); ?>
76 <td class="icon dark">
77 <?php echo html::image($this->add_path('icons/16x16/re-schedule.png'), array('alt' => $label, 'title' => $label)); ?>
78 </td>
79 <td><?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?></td>
80 </tr>
81 <?php
82 if ($object->get_accept_passive_checks()) {
83 $label = _("Submit passive check result for this $type");
84 $cmd = $type == 'host' ? nagioscmd::command_id('PROCESS_HOST_CHECK_RESULT') : nagioscmd::command_id('PROCESS_SERVICE_CHECK_RESULT') ?>
85 <tr>
86 <td class="icon dark">
87 <span class="icon-16 x16-checks-passive" title="<?php echo $label ?>"></span>
88 </td>
89 <td><?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?></td>
90 </tr>
91 <?php } ?>
92 <tr>
93 <?php
94 if ($object->get_accept_passive_checks()) {
95 $img = 'disabled';
96 $label = _("Stop accepting passive checks for this $type");
97 $cmd = $type == 'host' ? nagioscmd::command_id('DISABLE_PASSIVE_HOST_CHECKS') : nagioscmd::command_id('DISABLE_PASSIVE_SVC_CHECKS');
98 } else {
99 $img = 'enabled';
100 $label= _("Start accepting passive checks for this $type");
101 $cmd = $type == 'host' ? nagioscmd::command_id('ENABLE_PASSIVE_HOST_CHECKS') : nagioscmd::command_id('ENABLE_PASSIVE_SVC_CHECKS');
102 } ?>
103 <td class="icon dark">
104 <span class="icon-16 x16-<?php echo $img ?>" title="<?php echo $label ?>"></span>
105 </td>
106 <td><?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?></td>
107 </tr>
108 <tr>
109 <?php
110 if ($object->get_obsess()) {
111 $img = 'disabled';
112 $label = _("Stop obsessing over this $type");
113 $cmd = $type == 'host' ? nagioscmd::command_id('STOP_OBSESSING_OVER_HOST') : nagioscmd::command_id('STOP_OBSESSING_OVER_SVC');
114 } else {
115 $img = 'enabled';
116 $label = _('Start obsessing over this host');
117 $cmd = $type == 'host' ? nagioscmd::command_id('START_OBSESSING_OVER_HOST') : nagioscmd::command_id('START_OBSESSING_OVER_SVC');
118 } ?>
119 <td class="icon dark">
120 <span class="icon-16 x16-<?php echo $img ?>" title="<?php echo $label ?>"></span>
121 </td>
122 <td><?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?></td>
123 </tr>
124 <?php if ($object->get_state()) {
125 if ($object->get_acknowledged()) {
126 $img = 'remove';
127 $label = _('Remove problem acknowledgement');
128 $cmd = $type == 'host' ? nagioscmd::command_id('REMOVE_HOST_ACKNOWLEDGEMENT') : nagioscmd::command_id('REMOVE_SVC_ACKNOWLEDGEMENT');
129 } else {
130 $img = 'acknowledged';
131 $label = _("Acknowledge this $type problem");
132 $cmd = $type == 'host' ? nagioscmd::command_id('ACKNOWLEDGE_HOST_PROBLEM') : nagioscmd::command_id('ACKNOWLEDGE_SVC_PROBLEM');
133 } ?>
134 <tr>
135 <td class="icon dark">
136 <span class="icon-16 x16-<?php echo $img ?>" title="<?php echo $label ?>"></span>
137 </td>
138 <td><?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?></td>
139 </tr>
140 <?php } ?>
141 <tr>
142 <?php
143 $img = 'notify-disabled';
144 if ($object->get_notifications_enabled()) {
145 $label = _("Disable notifications for this $type");
146 $cmd = $type == 'host' ? nagioscmd::command_id('DISABLE_HOST_NOTIFICATIONS') : nagioscmd::command_id('DISABLE_SVC_NOTIFICATIONS');
147 } else {
148 $label = _("Enable notifications for this $type");
149 $cmd = $type == 'host' ? nagioscmd::command_id('ENABLE_HOST_NOTIFICATIONS') : nagioscmd::command_id('ENABLE_SVC_NOTIFICATIONS');
150 } ?>
151 <td class="icon dark">
152 <span class="icon-16 x16-<?php echo $img ?>" title="<?php echo $label ?>"></span>
153 </td>
154 <td><?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?></td>
155 </tr>
156 <tr>
157 <?php
158 $label = _('Send custom notification');
159 $cmd = $type == 'host' ? nagioscmd::command_id('SEND_CUSTOM_HOST_NOTIFICATION') : nagioscmd::command_id('SEND_CUSTOM_SVC_NOTIFICATION');
161 <td class="icon dark">
162 <span class="icon-16 x16-notify-send" title="<?php echo $label ?>"></span>
163 </td>
164 <td><?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?></td>
165 </tr>
166 <?php if ($object->get_state() && $object->get_notifications_enabled()) {
167 $label = _("Delay next $type notification");
168 $cmd = $type == 'host' ? nagioscmd::command_id('DELAY_HOST_NOTIFICATION') : nagioscmd::command_id('DELAY_SVC_NOTIFICATION');
170 <tr>
171 <td class="icon dark">
172 <span class="icon-16 x16-notify-delay" title="<?php echo $label ?>"></span>
173 </td>
174 <td><?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?></td>
175 </tr>
176 <?php } ?>
177 <tr>
178 <?php
179 $label = _("Schedule downtime for this $type");
180 $cmd = $type == 'host' ? nagioscmd::command_id('SCHEDULE_HOST_DOWNTIME') : nagioscmd::command_id('SCHEDULE_SVC_DOWNTIME');
182 <td class="icon dark">
183 <span class="icon-16 x16-scheduled-downtime" title="<?php echo $label ?>"></span>
184 </td>
185 <td><?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?></td>
186 </tr>
187 <?php if ($type == 'host') {?>
188 <tr>
189 <?php
190 $label = _('Disable notifications for all services on this host');
191 $cmd = nagioscmd::command_id('DISABLE_HOST_SVC_NOTIFICATIONS');
193 <td class="icon dark">
194 <span class="icon-16 x16-notify-disabled" title="<?php echo $label ?>"></span>
195 </td>
196 <td><?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?></td>
197 </tr>
198 <tr>
199 <?php
200 $label = _('Enable notifications for all services on this host');
201 $cmd = nagioscmd::command_id('ENABLE_HOST_SVC_NOTIFICATIONS');
203 <td class="icon dark">
204 <span class="icon-16 x16-notify" title="<?php echo $label ?>"></span>
205 </td>
206 <td><?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?></td>
207 </tr>
208 <tr>
209 <?php
210 $label = _('Schedule a check of all services on this host');
211 $cmd = nagioscmd::command_id('SCHEDULE_HOST_SVC_CHECKS');
213 <td class="icon dark">
214 <span class="icon-16 x16-schedule" title="<?php echo $label ?>"></span>
215 </td>
216 <td><?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?></td>
217 </tr>
218 <tr>
219 <?php
220 $label = _('Disable checks of all services on this host');
221 $cmd = nagioscmd::command_id('DISABLE_HOST_SVC_CHECKS');
223 <td class="icon dark">
224 <span class="icon-16 x16-disabled" title="<?php echo $label ?>"></span>
225 </td>
226 <td><?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?></td>
227 </tr>
228 <tr>
229 <?php
230 $label = _('Enable checks of all services on this host');
231 $cmd = nagioscmd::command_id('ENABLE_HOST_SVC_CHECKS');
233 <td class="icon dark">
234 <span class="icon-16 x16-enabled" title="<?php echo $label ?>"></span>
235 </td>
236 <td><?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?></td>
237 </tr>
238 <?php } ?>
239 <tr>
240 <?php
241 if ($object->get_event_handler_enabled()) {
242 $img = 'disabled';
243 $label = _("Disable event handler for this $type");
244 $cmd = $type == 'host' ? nagioscmd::command_id('DISABLE_HOST_EVENT_HANDLER') : nagioscmd::command_id('DISABLE_SVC_EVENT_HANDLER');
245 } else {
246 $img = 'enabled';
247 $label = _("Enable event handler for this $type");
248 $cmd = $type == 'host' ? nagioscmd::command_id('ENABLE_HOST_EVENT_HANDLER') : nagioscmd::command_id('ENABLE_SVC_EVENT_HANDLER');
251 <td class="icon dark">
252 <span class="icon-16 x16-<?php echo $img ?>" title="<?php echo $label ?>"></span>
253 </td>
254 <td><?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?></td>
255 </tr>
256 <tr>
257 <?php
258 if ($object->get_flap_detection_enabled()) {
259 $img = 'disabled';
260 $label = _("Disable flap detection for this $type");
261 $cmd = $type == 'host' ? nagioscmd::command_id('DISABLE_HOST_FLAP_DETECTION') : nagioscmd::command_id('DISABLE_SVC_FLAP_DETECTION');
262 } else {
263 $img = 'enabled';
264 $label = _("Enable flap detection for this $type");
265 $cmd = $type == 'host' ? nagioscmd::command_id('ENABLE_HOST_FLAP_DETECTION') : nagioscmd::command_id('ENABLE_SVC_FLAP_DETECTION');
268 <td class="icon dark">
269 <span class="icon-16 x16-<?php echo $img ?>" title="<?php echo $label ?>"></span>
270 </td>
271 <td><?php echo nagioscmd::command_link($cmd, $host->get_name(), $service === false ? false : $service->get_description(), $label); ?></td>
272 </tr>
273 <?php foreach ($object->get_custom_commands() as $command_name => $action) {
274 $linktext = ucwords(strtolower(str_replace('_', ' ', $command_name)));
275 $title = "$command_name;$type";
276 $title .= ';' . $host->get_name();
277 if( $service !== false ) {
278 $title .= ';' . $service->get_description();
280 $link = "<a href='#' title='" . $title . "'>" . $linktext . "</a>";
282 <tr>
283 <td class="icon dark">
284 <span class="icon-16 x16-cli" title="<?php echo _("$command_name") ?>"></span>
285 </td>
286 <td class="custom_command"><?php echo $link ?></td>
287 </tr>
288 <?php } ?>
289 </table>
290 </div>