1 <?php
defined('SYSPATH') OR die('No direct access allowed.');
2 $notes_url_target = config
::get('nagdefault.notes_url_target', '*');
3 $action_url_target = config
::get('nagdefault.action_url_target', '*');
4 $date_format_str = nagstat
::date_format();
6 $green_shield = '<span class="icon-16 x16-shield-up"></span>';
7 $red_shield = '<span class="icon-16 x16-shield-down"></span>';
8 $enabled = $green_shield.' '._('Enabled');
9 $disabled = $red_shield.' '._('Disabled');
12 $logos_path = Kohana
::config('config.logos_path');
13 $logos_path.= substr($logos_path, -1) == '/' ?
'' : '/';
16 if( $object instanceof Host_Model
) {
21 } else if( $object instanceof Service_Model
) {
22 $host = $object->get_host();
27 /* @var $host Host_Model */
28 /* @var $service Service_Model */
29 /* @var $object Service_Model */
32 if (isset($page_links)) {
36 <em
class="page-links-label"><?php
echo _('View').', '.$label_view_for.':'; ?
></em
>
38 <?php
foreach ($page_links as $label => $link) { ?
>
39 <li
><?php
echo html
::anchor($link, $label) ?
></li
>
42 <div
class="clear"></div
>
46 if (!empty($widgets)) {
47 foreach ($widgets as $widget) {
53 <div id
="extinfo_host-info">
57 <?php
if ($service !== false) {
58 echo "<th>" . _("On host") . "</th>";
61 <th
><?php
echo _("Address"); ?
> </th
>
63 <?php
if ($host->get_parents()) { ?
>
64 <th
><?php
echo _("Parents"); ?
> </th
>
67 <th
><?php
echo _('Member of'); ?
></th
>
68 <th
><?php
echo _('Contact groups') ?
></th
>
69 <th
><?php
echo _('Contacts') ?
></th
>
75 if ($service !== false) {
76 echo '<td style="max-width: 300px">';
77 echo html
::anchor('extinfo/details/?host='.urlencode($host->get_name()), html
::specialchars($host->get_display_name()));
78 echo $host->get_alias() ?
' ('.html
::specialchars($host->get_alias()).')' : '';
82 <td
><?php
echo $host->get_address(); ?
></td
>
84 <?php
if ($host->get_parents()) { ?
>
91 return html
::anchor('status/service/'.$parent, $parent);
100 <td style
="white-space: normal">
101 <?php
$groups=$object->get_groups();
102 if( count($groups) == 0 ) {
103 echo _('No '.$type.'groups');
106 foreach( $groups as $group ) {
108 print "<a href=\"" . htmlentities(url
::base(true) . "listview/?q=[" . $table . "] groups >= \"" . urlencode(addslashes($group)) . "\"") . "\">";
109 print html
::specialchars( $group );
118 $groups = $object->get_contact_groups();
119 $contacts = $object->get_contacts();
121 foreach ($groups as $group) {
122 echo '<a href="#" title="'._('Contactgroup').': '.$group.', '._('Click to view contacts').'" class="extinfo_contactgroup" id="extinfo_contactgroup_'.(++
$c).'">';
125 <table id
="extinfo_contacts_<?php echo $c ?>" style
="display:none" class="extinfo_contacts">
127 <th
><?php
echo _('Contact name') ?
></th
>
128 <th
><?php
echo _('Alias') ?
></th
>
129 <th
><?php
echo _('Email') ?
></th
>
130 <th
><?php
echo _('Pager') ?
></th
>
133 $gobj = ContactGroupPool_Model
::all()->reduce_by('name',$group,'=')->one(array('members'));
135 $gmembers = ContactPool_Model
::none();
136 $allcontacts = ContactPool_Model
::all();
138 $group_member_names = $gobj->get_members();
139 $contacts = array_diff( $contacts, $group_member_names );
141 foreach( $group_member_names as $member ) {
142 $gmembers = $gmembers->union($allcontacts->reduce_by('name', $member, '='));
145 foreach ($gmembers as $member) { ?
>
146 <tr
class="<?php echo ($c%2 == 0) ? 'even' : 'odd' ?>">
147 <td
><?php
echo $member->get_name(); ?
></td
>
148 <td
><?php
echo $member->get_alias(); ?
></td
>
149 <td
><?php
echo $member->get_email(); ?
></td
>
150 <td
><?php
echo $member->get_pager(); ?
></td
>
156 <td style
="padding: 0">
157 <?php
if( count( $contacts ) ) { ?
>
158 <table
class="extinfo_contacts" style
="display: table; border: none">
160 <td style
="border-top: none"><?php
echo _('Name') ?
></td
>
161 <td style
="border-top: none"><?php
echo _('Alias') ?
></td
>
162 <td style
="border-top: none"><?php
echo _('Email') ?
></td
>
163 <td style
="border-top: none"><?php
echo _('Pager') ?
></td
>
167 $gmembers = ContactPool_Model
::none();
168 $allcontacts = ContactPool_Model
::all();
169 foreach( $contacts as $member ) {
170 $gmembers = $gmembers->union($allcontacts->reduce_by('name', $member, '='));
173 foreach ($gmembers as $member) { ?
>
174 <tr
class="<?php echo ($c%2 == 0) ? 'even' : 'odd' ?>">
175 <td
><?php
echo $member->get_name(); ?
></td
>
176 <td
><?php
echo $member->get_alias(); ?
></td
>
177 <td
><?php
echo $member->get_email(); ?
></td
>
178 <td
><?php
echo $member->get_pager(); ?
></td
>
186 <?php
if ($object->get_notes()) {?
>
187 <td
><strong
><?php
echo _('Notes') ?
></strong
></td
>
188 <td
><?php
echo $object->get_notes() ?
></td
>
190 <td colspan
="5" style
="padding-top: 7px; border-bottom: none">
192 if ($url = $object->get_action_url()) {
193 echo '<a href="'.$url.'" target="'.$action_url_target.'">';
194 echo '<span class="icon-16 x16-host-actions" title="'. _('Perform extra '.$type.' actions').'"></span>';
195 echo _('Extra actions').'</a>';
197 if ($url = $object->get_notes_url()) {
198 echo ' <a target="'.$notes_url_target.'" href="'.$url.'">';
199 echo '<span class="icon-16 x16-host-notes" title="'. _('View extra '.$type.' notes').'"></span>';
200 echo _('Extra notes').'</a>';
202 if ($url = $object->get_config_url()) {
203 echo ' <a href="'.$url.'">';
204 echo '<span class="icon-16 x16-nacoma" title="'. _('Configure '.$type).'"></span>';
205 echo _('Configure').'</a>';
207 if (0<$object->get_pnpgraph_present()) {
208 $url = url
::site() . 'pnp/?host=' . rawurlencode($host->get_name());
209 $pnp_host = $host->get_name();
210 $pnp_service = "_HOST_";
211 if($service!==false) {
212 $url .= '&srv=' . rawurlencode($service->get_description());
213 $pnp_service = $service->get_description();
215 $url .= '&srv=_HOST_';
217 echo ' <a class="pnp_graph" data-host="'.$pnp_host.'" data-srv="'.$pnp_service.'" href="'.$url.'">';
218 echo '<span class="icon-16 x16-pnp"></span>';
219 echo _('Show performance graph').'</a>';
227 <div
class="clear"></div
>
229 <div
class="left width-66" id
="extinfo_current">
232 <th colspan
="2"><?php
echo $object->get_key() ?
></th
>
235 <td style
="width: 160px" class="dark bt"><?php
echo _('Current status'); ?
></td
>
236 <td
class="bt" id
="field_current_status">
237 <span
class="status-<?php echo strtolower($object->get_state_text()) ?>"><span
class="icon-16 x16-shield-<?php echo strtolower($object->get_state_text()); ?>"></span
><?php
echo ucfirst(strtolower($object->get_state_text())) ?
></span
>
238 (<?php
echo _('for'); ?
> <?php
echo $object->get_duration()>=0 ? time
::to_string($object->get_duration()) : _('N/A') ?
>)
242 $output = $object->get_plugin_output();
243 $long_plugin_output = $object->get_long_plugin_output();
244 if($long_plugin_output) {
245 $output .= '<br />'.nl2br($long_plugin_output);
249 <td
class="dark"><?php
echo _('Status information'); ?
></td
>
250 <td
class="long_output" style
="white-space: normal" id
="field_plugin_output"><?php
echo security
::xss_clean($output) ?
></td
>
253 <td
class="dark"><?php
echo _('Performance data'); ?
></td
>
254 <td style
="white-space: normal" id
="field_perf_data">
256 $perf_data = $object->get_perf_data();
257 if(count($perf_data)):
262 <th
><?php
echo _('Data source');?
></th
>
263 <th
><?php
echo _('Value');?
></th
>
264 <th
><?php
echo _('Warn');?
></th
>
265 <th
><?php
echo _('Crit');?
></th
>
266 <th
><?php
echo _('Min');?
></th
>
267 <th
><?php
echo _('Max');?
></th
>
271 <?php
foreach($perf_data as $ds_name => $ds): ?
>
273 <td
><?php
echo html
::specialchars($ds_name); ?
></td
>
274 <td
><?php
echo isset($ds['value']) ? html
::specialchars($ds['value'] . (isset($ds['unit'])?
' '.$ds['unit']:'')) : ''; ?
></td
>
275 <td
><?php
echo isset($ds['warn']) ? html
::specialchars($ds['warn']) : ''; ?
></td
>
276 <td
><?php
echo isset($ds['crit']) ? html
::specialchars($ds['crit']) : ''; ?
></td
>
277 <td
><?php
echo isset($ds['min']) ? html
::specialchars($ds['min'] . (isset($ds['unit'])?
' '.$ds['unit']:'')) : ''; ?
></td
>
278 <td
><?php
echo isset($ds['max']) ? html
::specialchars($ds['max'] . (isset($ds['unit'])?
' '.$ds['unit']:'')) : ''; ?
></td
>
284 echo _('No performance data');
289 <td
class="dark"><?php
echo _('Current attempt'); ?
></td
>
290 <td id
="field_current_attempt"><?php
echo $object->get_current_attempt() ?
>/<?php
echo $object->get_max_check_attempts() ?
> (<?php
echo $object->get_state_type_text() ?
>)</td
>
293 <td
class="dark"><?php
echo _('Last check time'); ?
></td
>
294 <td id
="field_last_check"><?php
echo $object->get_last_check() ?
date($date_format_str, $object->get_last_check()) : _('N/A') ?
></td
>
297 <td
class="dark"><?php
echo _('Check source'); ?
></td
>
298 <td id
="field_check_source"><?php
echo $object->get_source_node(); ?
> (<?php
echo $object->get_source_type(); ?
>)</td
>
301 <td
class="dark"><?php
echo _('Check type'); ?
></td
>
302 <td id
="field_check_type">
303 <span
class="<?php echo $object->get_check_type_str() ?>"><?php
echo ($object->get_check_type_str() == 'active' ?
$green_shield : $red_shield).' '.ucfirst($object->get_check_type_str()) ?
></span
>
307 <td
class="dark"><?php
echo _('Check latency / duration'); ?
></td
>
308 <td id
="field_latency"><?php
echo number_format($object->get_latency(), 3) ?
> / <?php
echo number_format($object->get_execution_time(), 3) ?
> <?php
echo _('seconds'); ?
></td
>
311 <td
class="dark"><?php
echo $service!==false?
_('Next scheduled active check'):_('Next scheduled check') ?
></td
>
312 <td id
="field_next_check"><?php
echo $object->get_next_check() && $object->get_active_checks_enabled() ?
date($date_format_str, $object->get_next_check()) : _('N/A') ?
></td
>
315 <td
class="dark"><?php
echo _('Last state change'); ?
></td
>
316 <td id
="field_last_state_change"><?php
echo $object->get_last_state_change() ?
date($date_format_str, $object->get_last_state_change()) : _('N/A') ?
></td
>
319 <td
class="dark"><?php
echo _('Last notification'); ?
></td
>
320 <?php
$last_notification = $object->get_last_notification()!=0 ?
date(nagstat
::date_format(), $object->get_last_notification()) : _('N/A'); ?
>
321 <td id
="field_last_notification"><?php
echo $last_notification ?
> 
;(<?php
echo _('Notifications'); ?
>: <?php
echo $object->get_current_notification_number() ?
>)</td
>
324 <td
class="dark"><?php
echo _('Is this '.$type.' flapping?') ?
></td
>
325 <td id
="field_flap_detection_enabled">
327 $flap_value = $object->get_flap_detection_enabled() && $object->get_is_flapping() ?
$red_shield.' '.$yes : $green_shield.' '.$no;
328 $percent_state_change_str = '('.number_format((int)$object->get_percent_state_change(), 2).'% '._('state change').')';
329 echo $flap_value.' '.$percent_state_change_str; ?
>
333 <td
class="dark"><?php
echo _('In scheduled downtime?'); ?
></td
>
334 <td id
="field_scheduled_downtime">
336 $in_downtime = $object->get_scheduled_downtime_depth();
337 $host_in_downtime = false;
338 if( $type == 'service' && $host->get_scheduled_downtime_depth() ) {
340 $host_in_downtime = true;
342 echo $in_downtime ?
$red_shield.' '.$yes : $green_shield.' '.$no;
343 if( $host_in_downtime ) {
344 echo ' (' . _('host in downtime') . ')';
350 <td
class="dark" style
="width: 160px"><?php
echo _('Active checks'); ?
></td
>
351 <td id
="field_active_checks_enabled">
352 <span
class="<?php echo $object->get_active_checks_enabled() ? _('enabled') : _('disabled'); ?>"><?php
echo $object->get_active_checks_enabled() ?
$enabled : $disabled; ?
></span
>
356 <td
class="dark"><?php
echo _('Passive checks'); ?
></td
>
357 <td id
="field_accept_passive_checks">
358 <span
class="<?php echo $object->get_accept_passive_checks() ? _('enabled') : _('disabled'); ?>"><?php
echo $object->get_accept_passive_checks() ?
$enabled : $disabled; ?
></span
>
362 <td
class="dark"><?php
echo _('Obsessing'); ?
></td
>
363 <td id
="field_obsess">
364 <span
class="<?php echo $object->get_obsess() ? _('enabled') : _('disabled'); ?>"><?php
echo $object->get_obsess() ?
$enabled : $disabled; ?
></span
>
368 <td
class="dark"><?php
echo _('Notifications'); ?
></td
>
369 <td id
="field_notifications">
370 <span
class="<?php echo $object->get_notifications_enabled() ? _('enabled') : _('disabled'); ?>"><?php
echo $object->get_notifications_enabled() ?
$enabled : $disabled; ?
></span
>
374 <td
class="dark"><?php
echo _('Event handler'); ?
></td
>
375 <td id
="field_event_handler">
376 <span
class="<?php echo $object->get_event_handler_enabled() ? _('enabled') : _('disabled'); ?>"><?php
echo $object->get_event_handler_enabled() ?
$enabled : $disabled; ?
></span
>
381 <td
class="dark"><?php
echo _('Flap detection') ?
></td
>
382 <td id
="field_flap_detection">
383 <span
class="<?php echo $object->get_flap_detection_enabled() ? _('enabled') : _('disabled'); ?>"><?php
echo $object->get_flap_detection_enabled() ?
$enabled : $disabled; ?
></span
>
386 <?php
if($object->get_custom_variables()) {
387 foreach($object->get_custom_variables() as $variable => $value) {
388 if (substr($variable, 0, 6) !== 'OP5H__') { ?
>
390 <td
class="dark">_
<?php
echo html
::specialchars($variable); ?
></td
>
391 <td
><?php
echo link
::linkify(security
::xss_clean($value)) ?
></td
>
401 if (!empty($commands))
405 <div
class="clear"></div
>
409 if (isset($comments)) {
411 echo "<div style=\"padding: 0 8px\">";
413 $label = _("Submit a $type comment");
414 $cmd = $type == 'host' ? nagioscmd
::command_id('ADD_HOST_COMMENT') : nagioscmd
::command_id('ADD_SVC_COMMENT');
415 echo '<span class="icon-16 x16-add-comment" title="' . html
::specialchars($label) . '"></span>';
416 echo nagioscmd
::command_link($cmd, $host->get_name(), $service === false ?
false : $service->get_description(), $label, 'submit', false, array('id'=>'submit_comment_button'));
418 $label = _("Delete all $type comments");
419 $cmd = $type == 'host' ? nagioscmd
::command_id('DEL_ALL_HOST_COMMENTS') : nagioscmd
::command_id('DEL_ALL_SVC_COMMENTS');
420 echo '<span class="icon-16 x16-delete-comment" title="' . html
::specialchars($label) . '"></span>';
421 echo nagioscmd
::command_link($cmd, $host->get_name(), $service === false ?
false : $service->get_description(), $label, 'submit', false, array('id'=>'delete_all_comments_button'));
428 if (isset($downtimes))