commit
ff58d1b675
|
@ -599,6 +599,14 @@ class Form extends Zend_Form
|
|||
{
|
||||
parent::addElement($element, $name, $options);
|
||||
$el = $name ? $this->getElement($name) : $element;
|
||||
|
||||
// Do not add structural elements to invisible elements
|
||||
// which produces ugly views
|
||||
if (strpos(strtolower(get_class($el)), 'hidden') !== false) {
|
||||
$el->setDecorators(array('ViewHelper'));
|
||||
return $this;
|
||||
}
|
||||
|
||||
if ($el) {
|
||||
$el->removeDecorator('HtmlTag');
|
||||
$el->removeDecorator('Label');
|
||||
|
|
|
@ -88,7 +88,7 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
|
|||
|
||||
$cfg = $this->getConfiguration();
|
||||
$preferences = $this->getUserPreferences();
|
||||
$downtimes = Backend::getInstance($this->getRequest()->getParam('backend'))->select()
|
||||
$downtimes = Backend::createBackend($this->getRequest()->getParam('backend'))->select()
|
||||
->from(
|
||||
'downtime',
|
||||
array(
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Web\Form;
|
||||
|
||||
/**
|
||||
|
@ -16,29 +15,102 @@ class Zend_View_Helper_CommandForm extends Zend_View_Helper_Abstract
|
|||
* Creates a simple form without additional input fields
|
||||
*
|
||||
* @param string $commandName Name of command (icinga 2 web name)
|
||||
* @param string $submitLabel Label of submit button
|
||||
* @param array $arguments Add parameter as hidden fields
|
||||
*
|
||||
* @return string Html form content
|
||||
* @return Form Form to modify
|
||||
*/
|
||||
public function simpleForm($commandName, $submitLabel, array $arguments = array())
|
||||
private function simpleForm($commandName, array $arguments = array())
|
||||
{
|
||||
$form = new Form();
|
||||
|
||||
$form->setIgnoreChangeDiscarding(true);
|
||||
$form->setAttrib('data-icinga-component', 'app/ajaxPostSubmitForm');
|
||||
|
||||
$form->setRequest(Zend_Controller_Front::getInstance()->getRequest());
|
||||
$form->setSubmitLabel($submitLabel !== null ? $submitLabel : 'Submit');
|
||||
$form->setAction($this->view->href('monitoring/command/' . $commandName));
|
||||
|
||||
foreach ($arguments as $elementName => $elementValue) {
|
||||
$hiddenField = new Zend_Form_Element_Hidden($elementName);
|
||||
$hiddenField->setValue($elementValue);
|
||||
$form->addElement($hiddenField);
|
||||
|
||||
$hiddenField = $form->getElement($elementName);
|
||||
}
|
||||
|
||||
return $form->render();
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an iconized submit form
|
||||
*
|
||||
* @param string $iconCls Css class of icon
|
||||
* @param string $submitTitle Title of submit button
|
||||
* @param string $cls Css class names
|
||||
* @param string $commandName Name of command
|
||||
* @param array $arguments Additional arguments
|
||||
*
|
||||
* @return Form
|
||||
*/
|
||||
public function iconSubmitForm($iconCls, $submitTitle, $cls, $commandName, array $arguments = array())
|
||||
{
|
||||
$form = $this->labelSubmitForm('', $submitTitle, $cls, $commandName, $arguments);
|
||||
$submit = $form->getElement('btn_submit');
|
||||
$submit->setLabel(sprintf('<i class="%s"></i>', $iconCls));
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a simple for with a labeled submit button
|
||||
*
|
||||
* @param string $submitLabel Label of submit button
|
||||
* @param string $submitTitle Title of submit button
|
||||
* @param string $cls Css class names
|
||||
* @param string $commandName Name of command
|
||||
* @param array $arguments Additional arguments
|
||||
*
|
||||
* @return Form
|
||||
*/
|
||||
public function labelSubmitForm($submitLabel, $submitTitle, $cls, $commandName, array $arguments = array())
|
||||
{
|
||||
$form = $this->simpleForm($commandName, $arguments);
|
||||
|
||||
$button = new Zend_Form_Element_Button(
|
||||
array(
|
||||
'name' => 'btn_submit',
|
||||
'class' => $this->mergeClass('button btn-common', $cls),
|
||||
'escape' => false,
|
||||
'value' => '1',
|
||||
'type' => 'submit',
|
||||
'label' => $submitLabel,
|
||||
'title' => $submitTitle
|
||||
)
|
||||
);
|
||||
|
||||
$form->addElement($button);
|
||||
|
||||
// Because of implicit added decorators
|
||||
$form->getElement('btn_submit')->setDecorators(array('ViewHelper'));
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges css class names together
|
||||
*
|
||||
* @param string $base
|
||||
* @param string $additional
|
||||
* @param string ...
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function mergeClass($base, $additional)
|
||||
{
|
||||
$args = func_get_args();
|
||||
$base = explode(' ', array_shift($args));
|
||||
while (($additional = array_shift($args))) {
|
||||
$base = array_merge($base, explode(' ', $additional));
|
||||
}
|
||||
return implode(' ', $base);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
$dateHelper = $this->getHelper('DateFormat');
|
||||
|
||||
/** @var Zend_View_Helper_CommandForm $commandHelper */
|
||||
$commandHelper = $this->getHelper('CommandForm');
|
||||
?>
|
||||
<?= $this->tabs->render($this); ?>
|
||||
|
@ -114,10 +116,12 @@ $viewHelper = $this->getHelper('MonitoringState');
|
|||
$data['service'] = $comment->service_name;
|
||||
}
|
||||
|
||||
echo $commandHelper->simpleForm(
|
||||
'removecomment',
|
||||
'Remove Comment',
|
||||
$data
|
||||
echo $commandHelper->iconSubmitForm(
|
||||
'icinga-icon-remove',
|
||||
'Remove comment',
|
||||
'btn-small',
|
||||
'removecomment',
|
||||
$data
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
<div class="panel panel-default">
|
||||
<div>
|
||||
<div class="panel-heading">
|
||||
{{CHECK_COMMAND_ICON}}
|
||||
<span>Check Command</span>
|
||||
<div class="panel-hostname">
|
||||
Check Command
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="separator" />
|
||||
|
||||
<div class="panel-body">
|
||||
<table>
|
||||
<tr>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
<?php
|
||||
/** @var Zend_View_Helper_CommandForm $cf */
|
||||
$cf = $this->getHelper('CommandForm');
|
||||
?>
|
||||
<div>
|
||||
<div class="panel-heading">
|
||||
<div class="panel-hostname">
|
||||
|
@ -32,9 +36,28 @@
|
|||
<div class="panel-body">
|
||||
<table class="table table-condensed table-detail">
|
||||
<tbody>
|
||||
<?php if (empty($object->comments)): ?>
|
||||
<tr>
|
||||
<td>No comments</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($object->comments as $comment): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="pull-right">
|
||||
<?php
|
||||
$deleteData = $data;
|
||||
$deleteData['commentid'] = $comment->comment_internal_id;
|
||||
|
||||
echo $cf->iconSubmitForm(
|
||||
'icinga-icon-remove',
|
||||
'Remove comment',
|
||||
'btn-small',
|
||||
'removecomment',
|
||||
$deleteData
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?= $this->escape($comment->comment_author); ?>, <?= $comment->comment_type; ?>
|
||||
(<?= $this->format()->timeSince($comment->comment_timestamp); ?>)
|
||||
<div class="small-row">
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<?php if (!empty($object->contacts)): ?>
|
||||
<?php
|
||||
$contacts = array();
|
||||
foreach ($object->contacts as $contact) {
|
||||
|
@ -14,17 +13,24 @@ foreach ($object->contacts as $contact) {
|
|||
. '</a>';
|
||||
}
|
||||
?>
|
||||
<div class="panel panel-default">
|
||||
<div>
|
||||
<div class="panel-heading">
|
||||
{{CONTACT_ICON}} <span>Contacts</span>
|
||||
<div class="panel-hostname">
|
||||
Contacts
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="separator" />
|
||||
|
||||
<div class="panel-body">
|
||||
<?= implode(', ', $contacts); ?>
|
||||
<?php if (!count($contacts)): ?>
|
||||
No Contacts
|
||||
<?php else: ?>
|
||||
<?= implode(', ', $contacts); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($object->contactgroups)): ?>
|
||||
<?php
|
||||
$contactgroups = array();
|
||||
foreach ($object->contactgroups as $contactgroup) {
|
||||
|
@ -40,12 +46,20 @@ foreach ($object->contactgroups as $contactgroup) {
|
|||
. '</a>';
|
||||
}
|
||||
?>
|
||||
<div class="panel panel-default">
|
||||
<div>
|
||||
<div class="panel-heading">
|
||||
{{CONTACTGROUP_ICON}} <span>Contactgroups</span>
|
||||
<div class="panel-hostname">
|
||||
Contactgroups
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="separator" />
|
||||
|
||||
<div class="panel-body">
|
||||
<?= implode(', ', $contactgroups); ?>
|
||||
<?php if (!count($contactgroups)): ?>
|
||||
No Contactgroups
|
||||
<?php else: ?>
|
||||
<?= implode(', ', $contactgroups); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,23 +1,22 @@
|
|||
|
||||
<div class="panel panel-default">
|
||||
<div>
|
||||
<div class="panel-heading">
|
||||
<span>Customvariables</span>
|
||||
<div class="panel-hostname">
|
||||
Custom Variables
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="separator" />
|
||||
|
||||
<div class="panel-body">
|
||||
<?php if (isset($object->customvars) && count($object->customvars)) { ?>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
<?php foreach ($object->customvars as $name => $value) { ?>
|
||||
<tr>
|
||||
<td><?= $this->escape($name) ?></td>
|
||||
<td><?= $this->escape($value) ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
<?php } ?>
|
||||
<?php if (empty($this->object->customvars)): ?>
|
||||
No customvars
|
||||
<?php else: ?>
|
||||
<dl class="dl-horizontal">
|
||||
<?php foreach ($this->object->customvars as $varname => $varvalue): ?>
|
||||
<dt><?= $varname; ?></dt>
|
||||
<dd><?= $varvalue; ?></dd>
|
||||
<?php endforeach; ?>
|
||||
</dl>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -28,20 +28,69 @@
|
|||
}
|
||||
?>
|
||||
<?php endif; ?>
|
||||
<div class="panel panel-default">
|
||||
<div>
|
||||
<div class="panel-heading">
|
||||
{{IN_DOWNTIME_ICON}}<span>Downtimes</span>
|
||||
<div class="panel-hostname">
|
||||
|
||||
<div class="pull-right">
|
||||
<?php
|
||||
$scheduleDowntimeData = array(
|
||||
'host' => $this->object->host_name,
|
||||
'service' => $this->object->service_description
|
||||
);
|
||||
|
||||
$scheduleDowntimeHref = $this->href('monitoring/command/scheduleDowntime', $scheduleDowntimeData);
|
||||
?>
|
||||
<a href="<?= $scheduleDowntimeHref; ?>" class="btn-common btn-small button" title="Schedule downtime">
|
||||
<i class="icinga-icon-in-downtime"></i>
|
||||
</a>
|
||||
</div>
|
||||
Downtimes
|
||||
</div>
|
||||
</div>
|
||||
<hr class="separator" />
|
||||
<div class="panel-body">
|
||||
<a href="#" class="button">{{SCHEDULE_DOWNTIME_COMMAND_BUTTON}}</a><br/>
|
||||
<?php if (!empty($this->downtimes)): ?>
|
||||
<table>
|
||||
<tr>
|
||||
<?= implode('</tr><tr>', $list); ?>
|
||||
</tr>
|
||||
<table class="table table-condensed table-detail">
|
||||
<tbody>
|
||||
<?php if (empty($this->object->downtimes)): ?>
|
||||
<tr>
|
||||
<td>No Downtimes</td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($this->object->downtimes as $downtime): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="pull-right">
|
||||
<form action="<?= $this->href('monitoring/command/removeDowntime'); ?>" data-icinga-component="app/ajaxPostSubmitForm">
|
||||
<button type="submit" class="button btn-common btn-small" name="btn_submit" value="1">
|
||||
<i class="icinga-icon-remove"></i>
|
||||
</button>
|
||||
<input type="hidden" name="host" value="<?= $downtime->host_name; ?>" />
|
||||
<input type="hidden" name="service" value="<?= $downtime->service_description; ?>" />
|
||||
<input type="hidden" name="downtimeid" value="<?= $downtime->downtime_internal_downtime_id; ?>" />
|
||||
<input type="hidden" name="CSRFToken" value="" />
|
||||
</form>
|
||||
</div>
|
||||
<?php if ($downtime->downtime_is_in_effect === '1'): ?>
|
||||
Running since <?= $this->timeSince($downtime->downtime_actual_start_time); ?>
|
||||
<?php else: ?>
|
||||
<?php if ($downtime->downtime_is_fixed): ?>
|
||||
Scheduled for <?= $downtime->downtime_scheduled_start_time; ?>
|
||||
<?php else: ?>
|
||||
Waiting
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
Triggered by <?= $downtime->downtime_author_name; ?>
|
||||
|
||||
<div class="small-row">
|
||||
<?= $downtime->downtime_comment_data; ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
Not in downtime
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,22 +1,55 @@
|
|||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Heading</div>
|
||||
<?php
|
||||
$o = $this->object;
|
||||
|
||||
/** @var Zend_View_Helper_CommandForm $cf */
|
||||
$cf = $this->getHelper('CommandForm');
|
||||
?>
|
||||
<div>
|
||||
<div class="panel-heading">
|
||||
<div class="panel-hostname">
|
||||
Configuration
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="separator" />
|
||||
|
||||
<div class="panel-body">
|
||||
<table class="table table-condensed">
|
||||
<?php foreach ($this->monitoringFlags($object) as $flag => $enabled): ?>
|
||||
<tr>
|
||||
<th><?= $flag; ?></th>
|
||||
<td>
|
||||
<?php if ($enabled === true): ?>
|
||||
<span>{{ENABLED_ICON}} ENABLED</span>
|
||||
<?php else: ?>
|
||||
<span>{{DISABLED_ICON}} DISABLED</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<a class="button" href="#">{{{ENABLE_OR_DISABLE_COMMAND}}}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<table class="table table-condensed table-detail">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Passive Checks</td>
|
||||
<td><div class="icon-table-hint icon-edit pull-left"></div></td>
|
||||
<td>
|
||||
<input type="checkbox" id="#" name="#" class="pull-right" <?= ($o->passive_checks_enabled === '1') ? 'checked="true"' : '' ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Active Checks</td>
|
||||
<td></td>
|
||||
<td><input type="checkbox" id="#" name="#" class="pull-right" <?= ($o->active_checks_enabled === '1') ? 'checked="true"' : '' ?> /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Obsessing</td>
|
||||
<td></td>
|
||||
<td><input type="checkbox" id="#" name="#" class="pull-right" <?= ($o->obsessing === '1') ? 'checked="true"' : '' ?> /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Notifications</td>
|
||||
<td></td>
|
||||
<td><input type="checkbox" id="#" name="#" class="pull-right" <?= ($o->notifications_enabled === '1') ? 'checked="true"' : '' ?> /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Event Handler</td>
|
||||
<td></div></td>
|
||||
<td><input type="checkbox" id="#" name="#" class="pull-right" <?= ($o->event_handler_enabled === '1') ? 'checked="true"' : '' ?> /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Flap Detection</td>
|
||||
<td></td>
|
||||
<td><input type="checkbox" id="#" name="#" class="pull-right" <?= ($o->flap_detection_enabled === '1') ? 'checked="true"' : '' ?> /></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<?php if (!empty($object->hostgroups)): ?>
|
||||
<?php
|
||||
$hostgroups = array();
|
||||
foreach ($object->hostgroups as $name => $alias) {
|
||||
|
@ -7,12 +6,20 @@ foreach ($object->hostgroups as $name => $alias) {
|
|||
. '</a>';
|
||||
}
|
||||
?>
|
||||
<div class="panel panel-default">
|
||||
<div>
|
||||
<div class="panel-heading">
|
||||
{{HOSTGROUP_ICON}} <span>Hostgroups</span>
|
||||
<div class="panel-hostname">
|
||||
Hostgroups
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="separator" />
|
||||
|
||||
<div class="panel-body">
|
||||
<?= implode(', ', $hostgroups); ?>
|
||||
<?php if (!count($hostgroups)): ?>
|
||||
No Hostgroups
|
||||
<?php else: ?>
|
||||
<?= implode(', ', $hostgroups); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
|
@ -1,93 +1,22 @@
|
|||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Properties</div>
|
||||
<div class="panel-body">
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<th>Current Attempt</th>
|
||||
<td>
|
||||
<?= sprintf(
|
||||
'%s/%s (%s state)',
|
||||
$object->current_check_attempt,
|
||||
$object->max_check_attempts,
|
||||
($object->state_type === '1') ? 'HARD' : 'SOFT'
|
||||
); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Check Type</th>
|
||||
<td>
|
||||
<?php if ($object->passive_checks_enabled === '1' && $object->active_checks_enabled === '0'): ?>
|
||||
PASSIVE
|
||||
<?php elseif ($object->passive_checks_enabled === '0' && $object->active_checks_enabled === '0'): ?>
|
||||
DISABLED
|
||||
<?php else: ?>
|
||||
ACTIVE
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Check Latency / Duration</th>
|
||||
<td>
|
||||
<?php if ($object->passive_checks_enabled === '0' && $object->active_checks_enabled === '0'): ?>
|
||||
N/A
|
||||
<?php else: ?>
|
||||
<?= sprintf('%.4f', $object->check_latency); ?> / <?= sprintf('%.4f', $object->check_execution_time); ?> seconds
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Last Notification</th>
|
||||
<td>
|
||||
<?php
|
||||
if ($object->service_description) {
|
||||
$notificationsHref = $this->href('monitoring/list/notifications',
|
||||
array(
|
||||
'host' => $object->host_name,
|
||||
'service' => $object->service_description
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$notificationsHref = $this->href('monitoring/list/notifications',
|
||||
array(
|
||||
'host' => $object->host_name
|
||||
)
|
||||
);
|
||||
}
|
||||
?>
|
||||
<a href="<?= $notificationsHref ?>">
|
||||
<?php if ($object->last_notification === '0000-00-00 00:00:00'): ?>
|
||||
N/A
|
||||
<?php else: ?>
|
||||
<?= $object->last_notification ?>
|
||||
<?php if ($object->current_notification_number > 0): ?>
|
||||
<br />
|
||||
<?= $object->current_notification_number ?> notifications sent during current problem state
|
||||
<?php endif ;?>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Is This <?= $object->service_description ? 'Service' : 'Host' ?> Flapping?</th>
|
||||
<td>
|
||||
<?php if ($object->is_flapping === '1'): ?>
|
||||
YES
|
||||
<?php else: ?>
|
||||
NO
|
||||
<?php endif; ?>
|
||||
<?= sprintf('%.2f', $object->percent_state_change); ?>% state change
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>In Scheduled Downtime?</th>
|
||||
<td>
|
||||
<?php if ($object->in_downtime === '1'): ?>
|
||||
YES
|
||||
<?php else: ?>
|
||||
NO
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div>
|
||||
<div class="panel-heading">
|
||||
<div class="panel-hostname">
|
||||
Check Statistics
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="separator" />
|
||||
<div class="panel-body">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Latency</dt>
|
||||
<dd><?= sprintf('%.2f', $this->object->check_execution_time); ?>s</dd>
|
||||
<dt>Duration</dt>
|
||||
<dd><?= sprintf('%.2f', $this->object->check_latency); ?>s</dd>
|
||||
<dt>Attempt</dt>
|
||||
<dd>
|
||||
<?= $this->object->current_check_attempt; ?>/<?= $this->object->max_check_attempts; ?>
|
||||
(<?= ($this->object->host_state_type === '1') ? 'Hard' : 'Soft'; ?>)
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
|
@ -1,4 +1,3 @@
|
|||
<?php if (!empty($object->servicegroups)): ?>
|
||||
<?php
|
||||
$servicegroups = array();
|
||||
foreach ($object->servicegroups as $name => $alias) {
|
||||
|
@ -7,12 +6,20 @@ foreach ($object->servicegroups as $name => $alias) {
|
|||
. '</a>';
|
||||
}
|
||||
?>
|
||||
<div class="panel panel-default">
|
||||
<div>
|
||||
<div class="panel-heading">
|
||||
{{SERVICEGROUP_ICON}} <span>Servicegroups</span>
|
||||
<div class="panel-hostname">
|
||||
Servicegroups
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="separator" />
|
||||
|
||||
<div class="panel-body">
|
||||
<?= implode(', ', $servicegroups); ?>
|
||||
<?php if (!count($servicegroups)): ?>
|
||||
No Servicegroups
|
||||
<?php else: ?>
|
||||
<?= implode(', ', $servicegroups); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
$object = $this->object;
|
||||
$type = (isset($object->service_description) === true) ? 'service' : 'host';
|
||||
|
||||
/** @var Zend_View_Helper_CommandForm $cf */
|
||||
$cf = $this->getHelper('CommandForm');
|
||||
|
||||
if ($type === 'host') {
|
||||
$objectStateName = strtolower($this->util()->getHostStateName($this->object->host_state));
|
||||
$objectState = (int) $object->host_state;
|
||||
|
@ -72,14 +75,44 @@
|
|||
<div class="panel-row">
|
||||
<p><?= $this->pluginOutput($object->output); ?></p>
|
||||
|
||||
<form>
|
||||
|
||||
<?php if ($objectState > 0): ?>
|
||||
<button type="submit" class="button btn-cta btn-half-left">Acknowledge</button>
|
||||
<?php if ($this->object->host_acknowledged || $this->object->service_acknowledged): ?>
|
||||
<?= $cf->labelSubmitForm(
|
||||
'Remove Ack',
|
||||
'Remove problem acknowledgement',
|
||||
'btn-cta btn-half-left',
|
||||
'removeacknowledgement',
|
||||
array(
|
||||
'host' => $this->object->host_name,
|
||||
'service' => $this->object->service_description
|
||||
)
|
||||
) ?>
|
||||
<?php else: ?>
|
||||
<a href="<?=
|
||||
$this->href(
|
||||
'monitoring/command/acknowledgeproblem',
|
||||
array(
|
||||
'host' => $this->object->host_name,
|
||||
'service' => $this->object->service_description
|
||||
)
|
||||
);
|
||||
?>" class="button btn-cta btn-half-left">
|
||||
Acknowledge
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<button type="submit" class="button btn-cta <?= ($objectState > 0) ? 'btn-half-right' : 'btn-wide'; ?>">Recheck</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<?= $cf->labelSubmitForm(
|
||||
'Recheck',
|
||||
'Reschedule next check immediately',
|
||||
'btn-cta ' . (($objectState > 0) ? 'btn-half-right' : 'btn-wide'),
|
||||
'reschedulenextcheck',
|
||||
array(
|
||||
'host' => $this->object->host_name,
|
||||
'service' => $this->object->service_description,
|
||||
'checktime' => time(),
|
||||
'forcecheck' => '1'
|
||||
)
|
||||
) ?>
|
||||
</div>
|
||||
|
||||
<div class="panel-row">
|
||||
|
@ -123,11 +156,17 @@
|
|||
<?= $this->dateFormat()->formatDateTime($object->next_check); ?>
|
||||
</div>
|
||||
<div class="panel-button">
|
||||
<form>
|
||||
<button class="button btn-common btn-small">
|
||||
<i class="icinga-icon-reschedule"></i>
|
||||
</button>
|
||||
</form>
|
||||
<a href="<?=
|
||||
$this->href(
|
||||
'monitoring/command/reschedulenextcheck',
|
||||
array(
|
||||
'host' => $this->object->host_name,
|
||||
'service' => $this->object->serivce_description
|
||||
)
|
||||
);
|
||||
?>" class="button btn-common btn-small">
|
||||
<i class="icinga-icon-reschedule"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,17 +1,10 @@
|
|||
<?= $this->tabs->render($this); ?>
|
||||
<?= $this->render('show/components/status.phtml'); ?>
|
||||
|
||||
<?= $this->render('show/components/comments.phtml'); ?>
|
||||
<?= $this->render('show/components/downtime.phtml'); ?>
|
||||
|
||||
<?= $this->render('show/components/properties.phtml'); ?>
|
||||
|
||||
<?= $this->render('show/components/flags.phtml'); ?>
|
||||
|
||||
<?= $this->render('show/components/hostgroups.phtml'); ?>
|
||||
|
||||
<?= $this->render('show/components/eventHistory.phtml'); ?>
|
||||
|
||||
<?= $this->render('show/components/contacts.phtml'); ?>
|
||||
|
||||
<?= $this->render('show/components/customvars.phtml'); ?>
|
||||
|
||||
<?= $this->render('show/components/command.phtml'); ?>
|
||||
<?= $this->render('show/components/hostgroups.phtml'); ?>
|
||||
<?= $this->render('show/components/contacts.phtml'); ?>
|
||||
<?= $this->render('show/components/command.phtml') ?>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<?= $this->render('show/components/status.phtml'); ?>
|
||||
<?= $this->render('show/components/comments.phtml'); ?>
|
||||
<?= $this->render('show/components/downtime.phtml'); ?>
|
||||
<?= $this->render('show/components/properties.phtml'); ?>
|
||||
<?= $this->render('show/components/flags.phtml'); ?>
|
||||
<?= $this->render('show/components/customvars.phtml'); ?>
|
||||
<?= $this->render('show/components/servicegroups.phtml'); ?>
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
*
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Module\Monitoring\DataView;
|
||||
|
||||
/**
|
||||
* Represent customvar view
|
||||
*/
|
||||
class Customvar extends DataView
|
||||
{
|
||||
/**
|
||||
* Retrieve columns provided by this view
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getColumns()
|
||||
{
|
||||
return array(
|
||||
'varname',
|
||||
'varvalue',
|
||||
'object_type'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve default sorting rules for particular columns. These involve sort order and potential additional to sort
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSortRules()
|
||||
{
|
||||
return array(
|
||||
'varname' => array(
|
||||
'varname' => self::SORT_ASC,
|
||||
'varvalue' => self::SORT_ASC,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,10 +1,40 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
*
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Module\Monitoring\Object;
|
||||
|
||||
use Icinga\Data\AbstractQuery as Query;
|
||||
use \Icinga\Module\Monitoring\Backend;
|
||||
|
||||
/**
|
||||
* Generic icinga object with belongings
|
||||
*/
|
||||
abstract class AbstractObject
|
||||
{
|
||||
protected $backend;
|
||||
|
@ -17,14 +47,7 @@ abstract class AbstractObject
|
|||
|
||||
protected $properties;
|
||||
|
||||
protected $foreign = array(
|
||||
// 'hostgroups' => null,
|
||||
// 'contacts' => null,
|
||||
// 'contactgroups' => null,
|
||||
// 'servicegroups' => null,
|
||||
// 'customvars' => null,
|
||||
// 'comments' => null,
|
||||
);
|
||||
protected $foreign = array();
|
||||
|
||||
public function __construct(Backend $backend, $name1, $name2 = null)
|
||||
{
|
||||
|
@ -81,10 +104,13 @@ abstract class AbstractObject
|
|||
protected function fetchHostgroups()
|
||||
{
|
||||
$this->foreign['hostgroups'] = $this->applyObjectFilter(
|
||||
$this->backend->select()->from('hostgroup', array(
|
||||
'hostgroup_name',
|
||||
'hostgroup_alias'
|
||||
))
|
||||
$this->backend->select()->from(
|
||||
'hostgroup',
|
||||
array(
|
||||
'hostgroup_name',
|
||||
'hostgroup_alias'
|
||||
)
|
||||
)
|
||||
)->fetchPairs();
|
||||
return $this;
|
||||
}
|
||||
|
@ -92,10 +118,13 @@ abstract class AbstractObject
|
|||
protected function fetchServicegroups()
|
||||
{
|
||||
$this->foreign['servicegroups'] = $this->applyObjectFilter(
|
||||
$this->backend->select()->from('servicegroup', array(
|
||||
'servicegroup_name',
|
||||
'servicegroup_alias'
|
||||
))
|
||||
$this->backend->select()->from(
|
||||
'servicegroup',
|
||||
array(
|
||||
'servicegroup_name',
|
||||
'servicegroup_alias'
|
||||
)
|
||||
)
|
||||
)->fetchPairs();
|
||||
return $this;
|
||||
}
|
||||
|
@ -103,12 +132,15 @@ abstract class AbstractObject
|
|||
protected function fetchContacts()
|
||||
{
|
||||
$this->foreign['contacts'] = $this->applyObjectFilter(
|
||||
$this->backend->select()->from('contact', array(
|
||||
'contact_name',
|
||||
'contact_alias',
|
||||
'contact_email',
|
||||
'contact_pager',
|
||||
))
|
||||
$this->backend->select()->from(
|
||||
'contact',
|
||||
array(
|
||||
'contact_name',
|
||||
'contact_alias',
|
||||
'contact_email',
|
||||
'contact_pager',
|
||||
)
|
||||
)
|
||||
)->fetchAll();
|
||||
return $this;
|
||||
}
|
||||
|
@ -116,10 +148,13 @@ abstract class AbstractObject
|
|||
protected function fetchContactgroups()
|
||||
{
|
||||
$this->foreign['contactgroups'] = $this->applyObjectFilter(
|
||||
$this->backend->select()->from('contactgroup', array(
|
||||
'contactgroup_name',
|
||||
'contactgroup_alias',
|
||||
))
|
||||
$this->backend->select()->from(
|
||||
'contactgroup',
|
||||
array(
|
||||
'contactgroup_name',
|
||||
'contactgroup_alias',
|
||||
)
|
||||
)
|
||||
)->fetchAll();
|
||||
return $this;
|
||||
}
|
||||
|
@ -127,12 +162,16 @@ abstract class AbstractObject
|
|||
protected function fetchComments()
|
||||
{
|
||||
$this->foreign['comments'] = $this->applyObjectFilter(
|
||||
$this->backend->select()->from('comment', array(
|
||||
'comment_timestamp',
|
||||
'comment_author',
|
||||
'comment_data',
|
||||
'comment_type',
|
||||
))->where('comment_objecttype_id', $this->type)
|
||||
$this->backend->select()->from(
|
||||
'comment',
|
||||
array(
|
||||
'comment_timestamp',
|
||||
'comment_author',
|
||||
'comment_data',
|
||||
'comment_type',
|
||||
'comment_internal_id'
|
||||
)
|
||||
)->where('comment_objecttype_id', $this->type)
|
||||
)->fetchAll();
|
||||
return $this;
|
||||
}
|
||||
|
@ -140,12 +179,13 @@ abstract class AbstractObject
|
|||
protected function fetchCustomvars()
|
||||
{
|
||||
$this->foreign['customvars'] = $this->applyObjectFilter(
|
||||
$this->backend->select()->from('customvar', array(
|
||||
'varname',
|
||||
'varvalue'
|
||||
))
|
||||
->where('varname', '-*PW*,-*PASS*,-*COMMUNITY*')
|
||||
->where('object_type', 'host')
|
||||
$this->backend->select()->from(
|
||||
'customvar',
|
||||
array(
|
||||
'varname',
|
||||
'varvalue'
|
||||
)
|
||||
)->where('varname', '-*PW*,-*PASS*,-*COMMUNITY*')
|
||||
)->fetchPairs();
|
||||
return $this;
|
||||
}
|
||||
|
@ -153,18 +193,52 @@ abstract class AbstractObject
|
|||
public function fetchEventHistory()
|
||||
{
|
||||
$this->foreign['eventHistory'] = $this->applyObjectFilter(
|
||||
$this->backend->select()->from('eventHistory', array(
|
||||
'object_type',
|
||||
'host_name',
|
||||
'service_description',
|
||||
'timestamp',
|
||||
'state',
|
||||
'attempt',
|
||||
'max_attempts',
|
||||
'output',
|
||||
'type'
|
||||
))
|
||||
$this->backend->select()->from(
|
||||
'eventHistory',
|
||||
array(
|
||||
'object_type',
|
||||
'host_name',
|
||||
'service_description',
|
||||
'timestamp',
|
||||
'state',
|
||||
'attempt',
|
||||
'max_attempts',
|
||||
'output',
|
||||
'type'
|
||||
)
|
||||
)
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function fetchDowtimes()
|
||||
{
|
||||
$this->foreign['downtimes'] = $this->applyObjectFilter(
|
||||
$this->backend->select()->from(
|
||||
'downtime',
|
||||
array(
|
||||
'host_name',
|
||||
'object_type',
|
||||
'service_host_name',
|
||||
'service_description',
|
||||
'downtime_type',
|
||||
'downtime_author_name',
|
||||
'downtime_comment_data',
|
||||
'downtime_is_fixed',
|
||||
'downtime_duration',
|
||||
'downtime_entry_time',
|
||||
'downtime_scheduled_start_time',
|
||||
'downtime_scheduled_end_time',
|
||||
'downtime_was_started',
|
||||
'downtime_actual_start_time',
|
||||
'downtime_actual_start_time_usec',
|
||||
'downtime_is_in_effect',
|
||||
'downtime_trigger_time',
|
||||
'downtime_triggered_by_id',
|
||||
'downtime_internal_downtime_id'
|
||||
)
|
||||
)
|
||||
)->fetchAll(9);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,39 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
*
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Module\Monitoring\Object;
|
||||
|
||||
use Icinga\Data\AbstractQuery as Query;
|
||||
|
||||
/**
|
||||
* Represent a host object
|
||||
*/
|
||||
class Host extends AbstractObject
|
||||
{
|
||||
protected $foreign = array(
|
||||
|
@ -12,65 +42,92 @@ class Host extends AbstractObject
|
|||
'contactgroups' => null,
|
||||
'customvars' => null,
|
||||
'comments' => null,
|
||||
'downtimes' => null,
|
||||
'customvars' => null
|
||||
);
|
||||
|
||||
/**
|
||||
* Statename
|
||||
*/
|
||||
public function stateName()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter object belongings
|
||||
*
|
||||
* @param Query $query
|
||||
*
|
||||
* @return Query
|
||||
*/
|
||||
protected function applyObjectFilter(Query $query)
|
||||
{
|
||||
return $query->where('host_name', $this->name1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load foreign object data
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function prefetch()
|
||||
{
|
||||
return $this->fetchHostgroups()
|
||||
->fetchContacts()
|
||||
->fetchContactgroups()
|
||||
->fetchCustomvars()
|
||||
->fetchComments();
|
||||
->fetchComments()
|
||||
->fetchDowtimes()
|
||||
->fetchCustomvars();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object data
|
||||
* @return object
|
||||
*/
|
||||
protected function fetchObject()
|
||||
{
|
||||
return $this->backend->select()->from('status', array(
|
||||
'host_name',
|
||||
'host_alias',
|
||||
'host_address',
|
||||
'host_state',
|
||||
'host_handled',
|
||||
'in_downtime' => 'host_in_downtime',
|
||||
'host_acknowledged',
|
||||
'host_last_state_change',
|
||||
'last_state_change' => 'host_last_state_change',
|
||||
'last_notification' => 'host_last_notification',
|
||||
'last_check' => 'host_last_check',
|
||||
'next_check' => 'host_next_check',
|
||||
'check_execution_time' => 'host_check_execution_time',
|
||||
'check_latency' => 'host_check_latency',
|
||||
'output' => 'host_output',
|
||||
'long_output' => 'host_long_output',
|
||||
'check_command' => 'host_check_command',
|
||||
'perfdata' => 'host_perfdata',
|
||||
'host_icon_image',
|
||||
'passive_checks_enabled' => 'host_passive_checks_enabled',
|
||||
'obsessing' => 'host_obsessing',
|
||||
'notifications_enabled' => 'host_notifications_enabled',
|
||||
'event_handler_enabled' => 'host_event_handler_enabled',
|
||||
'flap_detection_enabled' => 'host_flap_detection_enabled',
|
||||
'active_checks_enabled' => 'host_active_checks_enabled',
|
||||
'current_check_attempt' => 'host_current_check_attempt',
|
||||
'max_check_attempts' => 'host_max_check_attempts',
|
||||
'last_notification' => 'host_last_notification',
|
||||
'current_notification_number' => 'host_current_notification_number',
|
||||
'percent_state_change' => 'host_percent_state_change',
|
||||
'is_flapping' => 'host_is_flapping',
|
||||
'last_comment' => 'host_last_comment',
|
||||
'action_url' => 'host_action_url',
|
||||
'notes_url' => 'host_notes_url',
|
||||
'percent_state_change' => 'host_percent_state_change'
|
||||
))->where('host_name', $this->name1)->fetchRow();
|
||||
return $this->backend->select()->from(
|
||||
'status',
|
||||
array(
|
||||
'host_name',
|
||||
'host_alias',
|
||||
'host_address',
|
||||
'host_state',
|
||||
'host_handled',
|
||||
'host_in_downtime',
|
||||
'in_downtime' => 'host_in_downtime',
|
||||
'host_acknowledged',
|
||||
'host_last_state_change',
|
||||
'last_state_change' => 'host_last_state_change',
|
||||
'last_notification' => 'host_last_notification',
|
||||
'last_check' => 'host_last_check',
|
||||
'next_check' => 'host_next_check',
|
||||
'check_execution_time' => 'host_check_execution_time',
|
||||
'check_latency' => 'host_check_latency',
|
||||
'output' => 'host_output',
|
||||
'long_output' => 'host_long_output',
|
||||
'check_command' => 'host_check_command',
|
||||
'perfdata' => 'host_perfdata',
|
||||
'host_icon_image',
|
||||
'passive_checks_enabled' => 'host_passive_checks_enabled',
|
||||
'obsessing' => 'host_obsessing',
|
||||
'notifications_enabled' => 'host_notifications_enabled',
|
||||
'event_handler_enabled' => 'host_event_handler_enabled',
|
||||
'flap_detection_enabled' => 'host_flap_detection_enabled',
|
||||
'active_checks_enabled' => 'host_active_checks_enabled',
|
||||
'current_check_attempt' => 'host_current_check_attempt',
|
||||
'max_check_attempts' => 'host_max_check_attempts',
|
||||
'last_notification' => 'host_last_notification',
|
||||
'current_notification_number' => 'host_current_notification_number',
|
||||
'percent_state_change' => 'host_percent_state_change',
|
||||
'is_flapping' => 'host_is_flapping',
|
||||
'last_comment' => 'host_last_comment',
|
||||
'action_url' => 'host_action_url',
|
||||
'notes_url' => 'host_notes_url',
|
||||
'percent_state_change' => 'host_percent_state_change'
|
||||
)
|
||||
)->where('host_name', $this->name1)->fetchRow();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,84 +1,146 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
*
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Module\Monitoring\Object;
|
||||
|
||||
use Icinga\Data\AbstractQuery as Query;
|
||||
|
||||
/**
|
||||
* Represent a single service
|
||||
*/
|
||||
class Service extends AbstractObject
|
||||
{
|
||||
/**
|
||||
* Foreign references to objects
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $foreign = array(
|
||||
'servicegroups' => null,
|
||||
'contacts' => null,
|
||||
'contactgroups' => null,
|
||||
'customvars' => null,
|
||||
'comments' => null,
|
||||
'downtimes' => null,
|
||||
'customvars' => null
|
||||
);
|
||||
|
||||
/**
|
||||
* Statename
|
||||
*/
|
||||
public function stateName()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter foreign object belongings
|
||||
*
|
||||
* @param Query $query
|
||||
*
|
||||
* @return Query
|
||||
*/
|
||||
protected function applyObjectFilter(Query $query)
|
||||
{
|
||||
return $query->where('service_host_name', $this->name1)
|
||||
->where('service_description', $this->name2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect foreign data
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function prefetch()
|
||||
{
|
||||
return $this->fetchServicegroups()
|
||||
->fetchContacts()
|
||||
->fetchContactgroups()
|
||||
->fetchCustomvars()
|
||||
->fetchComments();
|
||||
->fetchComments()
|
||||
->fetchDowtimes()
|
||||
->fetchCustomvars();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function fetchObject()
|
||||
{
|
||||
return $this->backend->select()->from('status', array(
|
||||
'host_name',
|
||||
'host_alias',
|
||||
'host_address',
|
||||
'host_state',
|
||||
'host_handled',
|
||||
'host_in_downtime',
|
||||
'host_acknowledged',
|
||||
'host_last_state_change',
|
||||
'service_description',
|
||||
'service_state',
|
||||
'service_handled',
|
||||
'service_acknowledged',
|
||||
'service_in_downtime',
|
||||
'service_last_state_change',
|
||||
'last_check' => 'service_last_check',
|
||||
'next_check' => 'service_next_check',
|
||||
'check_execution_time' => 'service_check_execution_time',
|
||||
'check_latency' => 'service_check_latency',
|
||||
'output' => 'service_output',
|
||||
'long_output' => 'service_long_output',
|
||||
'check_command' => 'service_check_command',
|
||||
'perfdata' => 'service_perfdata',
|
||||
'current_check_attempt' => 'service_current_check_attempt',
|
||||
'max_check_attempts' => 'service_max_check_attempts',
|
||||
'state_type' => 'service_state_type',
|
||||
'passive_checks_enabled' => 'service_passive_checks_enabled',
|
||||
'last_state_change' => 'service_last_state_change',
|
||||
'last_notification' => 'service_last_notification',
|
||||
'current_notification_number' => 'service_current_notification_number',
|
||||
'is_flapping' => 'service_is_flapping',
|
||||
'percent_state_change' => 'service_percent_state_change',
|
||||
'in_downtime' => 'service_in_downtime',
|
||||
'passive_checks_enabled' => 'service_passive_checks_enabled',
|
||||
'obsessing' => 'service_obsessing',
|
||||
'notifications_enabled' => 'service_notifications_enabled',
|
||||
'event_handler_enabled' => 'service_event_handler_enabled',
|
||||
'flap_detection_enabled' => 'service_flap_detection_enabled',
|
||||
'active_checks_enabled' => 'service_active_checks_enabled',
|
||||
'last_comment' => 'service_last_comment',
|
||||
'action_url' => 'service_action_url',
|
||||
'notes_url' => 'service_notes_url'
|
||||
))
|
||||
return $this->backend->select()->from(
|
||||
'status',
|
||||
array(
|
||||
'host_name',
|
||||
'host_alias',
|
||||
'host_address',
|
||||
'host_state',
|
||||
'host_handled',
|
||||
'host_in_downtime',
|
||||
'host_acknowledged',
|
||||
'host_last_state_change',
|
||||
'service_description',
|
||||
'service_state',
|
||||
'service_handled',
|
||||
'service_acknowledged',
|
||||
'service_in_downtime',
|
||||
'service_last_state_change',
|
||||
'last_check' => 'service_last_check',
|
||||
'next_check' => 'service_next_check',
|
||||
'check_execution_time' => 'service_check_execution_time',
|
||||
'check_latency' => 'service_check_latency',
|
||||
'output' => 'service_output',
|
||||
'long_output' => 'service_long_output',
|
||||
'check_command' => 'service_check_command',
|
||||
'perfdata' => 'service_perfdata',
|
||||
'current_check_attempt' => 'service_current_check_attempt',
|
||||
'max_check_attempts' => 'service_max_check_attempts',
|
||||
'state_type' => 'service_state_type',
|
||||
'passive_checks_enabled' => 'service_passive_checks_enabled',
|
||||
'last_state_change' => 'service_last_state_change',
|
||||
'last_notification' => 'service_last_notification',
|
||||
'current_notification_number' => 'service_current_notification_number',
|
||||
'is_flapping' => 'service_is_flapping',
|
||||
'percent_state_change' => 'service_percent_state_change',
|
||||
'in_downtime' => 'service_in_downtime',
|
||||
'passive_checks_enabled' => 'service_passive_checks_enabled',
|
||||
'obsessing' => 'service_obsessing',
|
||||
'notifications_enabled' => 'service_notifications_enabled',
|
||||
'event_handler_enabled' => 'service_event_handler_enabled',
|
||||
'flap_detection_enabled' => 'service_flap_detection_enabled',
|
||||
'active_checks_enabled' => 'service_active_checks_enabled',
|
||||
'last_comment' => 'service_last_comment',
|
||||
'action_url' => 'service_action_url',
|
||||
'notes_url' => 'service_notes_url'
|
||||
)
|
||||
)
|
||||
->where('host_name', $this->name1)
|
||||
->where('service_description', $this->name2)
|
||||
->fetchRow();
|
||||
|
|
|
@ -83,6 +83,13 @@ a {
|
|||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.button {
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
a.btn-small {
|
||||
height: 25px;
|
||||
}
|
||||
/**
|
||||
* Address `outline` inconsistency between Chrome and other browsers.
|
||||
*/
|
||||
|
@ -149,6 +156,22 @@ th {
|
|||
border-bottom: 2px solid #ddd;
|
||||
}
|
||||
|
||||
|
||||
.table-detail th {
|
||||
font-size: 16px;
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.table-detail thead > tr > th, .table tbody > tr > th,
|
||||
.table-detail tbody > tr > td, .table tfoot > tr > td {
|
||||
border-top: 0 !important;
|
||||
}
|
||||
|
||||
.table-detail > thead {
|
||||
border-top: 0 !important;
|
||||
}
|
||||
|
||||
|
||||
td {
|
||||
padding: 8px 10px 8px 8px !important;
|
||||
border-bottom: 1px dotted #ddd !important;
|
||||
|
@ -223,6 +246,9 @@ td {
|
|||
Forms
|
||||
========================================================================== */
|
||||
|
||||
.panel-row form {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.form-inline .form-group {
|
||||
display: inline-block;
|
||||
|
@ -242,11 +268,7 @@ label {
|
|||
.input-sm {
|
||||
border-radius: 3px;
|
||||
font-size: 16px;
|
||||
|
||||
|
||||
padding: 5px;
|
||||
margin-right: 15px;
|
||||
|
||||
}
|
||||
.form-control {
|
||||
background-color: #FFFFFF;
|
||||
|
@ -418,6 +440,16 @@ select.input-sm {
|
|||
display: block;
|
||||
}
|
||||
|
||||
.icon-table-hint {
|
||||
width: 16px;
|
||||
height: 20px;
|
||||
display: block;
|
||||
background-position: 50% 50%;
|
||||
}
|
||||
.icon-table-hint:after {
|
||||
content: "edited";
|
||||
padding-left: 22px;
|
||||
}
|
||||
|
||||
.icon-flapping {
|
||||
background-image: url('../img/icons/flapping.png');
|
||||
|
|
|
@ -54,7 +54,7 @@ define(['components/app/container', 'jquery'], function(Container, $) {
|
|||
var submitHandler = function(e) {
|
||||
var form = $(this);
|
||||
var url = form.attr('action');
|
||||
var submit = form.find('input[type="submit"]');
|
||||
var submit = form.find('button[type="submit"]', 'input[type="submit"]');
|
||||
var data = form.serialize();
|
||||
|
||||
e.preventDefault();
|
||||
|
@ -70,13 +70,13 @@ define(['components/app/container', 'jquery'], function(Container, $) {
|
|||
type: 'POST',
|
||||
data: data,
|
||||
beforeSend: function() {
|
||||
submit.prop('disabled', true);
|
||||
submit.attr('disabled', true);
|
||||
}
|
||||
}).done(function() {
|
||||
var container = getOwnerContainer(form);
|
||||
container.replaceDomFromUrl(container.getContainerHref());
|
||||
}).error(function() {
|
||||
submit.removeProp('disabled');
|
||||
submit.removeAttr('disabled');
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -125,13 +125,17 @@ function(Container, $, logger, URI) {
|
|||
var targetEl = ev.target || ev.toElement || ev.relatedTarget,
|
||||
a = $(targetEl).closest('a');
|
||||
|
||||
var nodeNames = [];
|
||||
nodeNames.push($(targetEl).prop('nodeName').toLowerCase());
|
||||
nodeNames.push($(targetEl).parent().prop('nodeName').toLowerCase());
|
||||
|
||||
if (a.length) {
|
||||
// test if the URL is on the current server, if not open it directly
|
||||
if (true || Container.isExternalLink(a.attr('href'))) {
|
||||
return true;
|
||||
}
|
||||
} else if (targetEl.nodeName.toLowerCase() === 'input') {
|
||||
var type = $(targetEl).attr('type');
|
||||
} else if ($.inArray('input', nodeNames) > -1 || $.inArray('button', nodeNames) > -1) {
|
||||
var type = $(targetEl).attr('type') || $(targetEl).parent().attr('type');
|
||||
if (type === 'submit') {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue