mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 15:54:03 +02:00
commit
e9b002bdcd
@ -71,7 +71,6 @@ class AuthenticationController extends ActionController
|
|||||||
|
|
||||||
if ($this->view->form->isPostAndValid()) {
|
if ($this->view->form->isPostAndValid()) {
|
||||||
|
|
||||||
|
|
||||||
$credentials->setUsername($this->view->form->getValue('username'));
|
$credentials->setUsername($this->view->form->getValue('username'));
|
||||||
$credentials->setPassword($this->view->form->getValue('password'));
|
$credentials->setPassword($this->view->form->getValue('password'));
|
||||||
|
|
||||||
|
0
config/backends.ini.in
Normal file → Executable file
0
config/backends.ini.in
Normal file → Executable file
0
config/menu.ini
Normal file → Executable file
0
config/menu.ini
Normal file → Executable file
1
config/modules/monitoring/menu.ini
Normal file → Executable file
1
config/modules/monitoring/menu.ini
Normal file → Executable file
@ -9,4 +9,5 @@ _1 = 1
|
|||||||
|
|
||||||
Hosts = "/monitoring/list/hosts"
|
Hosts = "/monitoring/list/hosts"
|
||||||
Services = "/monitoring/list/services"
|
Services = "/monitoring/list/services"
|
||||||
|
Downtimes = "/monitoring/list/downtimes"
|
||||||
Summaries = "/monitoring/summary/group/by/hostgroup"
|
Summaries = "/monitoring/summary/group/by/hostgroup"
|
||||||
|
@ -45,7 +45,6 @@ class Monitoring_ListController extends ModuleActionController
|
|||||||
'host_last_comment'
|
'host_last_comment'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function servicesAction()
|
public function servicesAction()
|
||||||
@ -86,9 +85,7 @@ class Monitoring_ListController extends ModuleActionController
|
|||||||
'service_notes_url',
|
'service_notes_url',
|
||||||
'service_last_comment'
|
'service_last_comment'
|
||||||
));
|
));
|
||||||
if ($this->_getParam('sort')) {
|
$this->inheritCurrentSortColumn();
|
||||||
$this->view->sort = $this->_getParam('sort');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hostgroupsAction()
|
public function hostgroupsAction()
|
||||||
@ -145,6 +142,36 @@ class Monitoring_ListController extends ModuleActionController
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch the current downtimes and put them into the view
|
||||||
|
* property 'downtimes'
|
||||||
|
*/
|
||||||
|
public function downtimesAction()
|
||||||
|
{
|
||||||
|
$query = $this->backend->select()
|
||||||
|
->from('downtime',array(
|
||||||
|
'host_name',
|
||||||
|
'object_type',
|
||||||
|
'service_description',
|
||||||
|
'downtime_entry_time',
|
||||||
|
'downtime_internal_downtime_id',
|
||||||
|
'downtime_author_name',
|
||||||
|
'downtime_comment_data',
|
||||||
|
'downtime_duration',
|
||||||
|
'downtime_scheduled_start_time',
|
||||||
|
'downtime_scheduled_end_time',
|
||||||
|
'downtime_is_fixed',
|
||||||
|
'downtime_is_in_effect',
|
||||||
|
'downtime_triggered_by_id',
|
||||||
|
'downtime_trigger_time'
|
||||||
|
));
|
||||||
|
if (!$this->_getParam('sort')) {
|
||||||
|
$query->order('downtime_is_in_effect');
|
||||||
|
}
|
||||||
|
$this->view->downtimes = $query->applyRequest($this->_request);
|
||||||
|
$this->inheritCurrentSortColumn();
|
||||||
|
}
|
||||||
|
|
||||||
protected function query($view, $columns)
|
protected function query($view, $columns)
|
||||||
{
|
{
|
||||||
$extra = preg_split(
|
$extra = preg_split(
|
||||||
@ -197,6 +224,11 @@ class Monitoring_ListController extends ModuleActionController
|
|||||||
'icon' => 'img/classic/server.png',
|
'icon' => 'img/classic/server.png',
|
||||||
'url' => 'monitoring/list/hosts',
|
'url' => 'monitoring/list/hosts',
|
||||||
));
|
));
|
||||||
|
$tabs->add('downtimes', array(
|
||||||
|
'title' => 'Downtimes',
|
||||||
|
'icon' => 'img/classic/downtime.gif',
|
||||||
|
'url' => 'monitoring/list/downtimes',
|
||||||
|
));
|
||||||
/*
|
/*
|
||||||
$tabs->add('hostgroups', array(
|
$tabs->add('hostgroups', array(
|
||||||
'title' => 'Hostgroups',
|
'title' => 'Hostgroups',
|
||||||
@ -221,4 +253,16 @@ class Monitoring_ListController extends ModuleActionController
|
|||||||
*/
|
*/
|
||||||
return $tabs;
|
return $tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Let the current response inherit the used sort column by applying it to the
|
||||||
|
* view property 'sort'
|
||||||
|
*/
|
||||||
|
private function inheritCurrentSortColumn()
|
||||||
|
{
|
||||||
|
if ($this->_getParam('sort')) {
|
||||||
|
$this->view->sort = $this->_getParam('sort');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,30 @@ class Monitoring_ShowController extends ModuleActionController
|
|||||||
->where('service_description', $this->view->service->service_description)
|
->where('service_description', $this->view->service->service_description)
|
||||||
->fetchAll();
|
->fetchAll();
|
||||||
|
|
||||||
|
$this->view->downtimes = $this->backend->select()
|
||||||
|
->from(
|
||||||
|
'downtime',
|
||||||
|
array(
|
||||||
|
'host_name',
|
||||||
|
'service_description',
|
||||||
|
'downtime_type',
|
||||||
|
'downtime_author_name',
|
||||||
|
'downtime_comment_data',
|
||||||
|
'downtime_is_fixed',
|
||||||
|
'downtime_duration',
|
||||||
|
'downtime_scheduled_start_time',
|
||||||
|
'downtime_scheduled_end_time',
|
||||||
|
'downtime_actual_start_time',
|
||||||
|
'downtime_was_started',
|
||||||
|
'downtime_is_in_effect',
|
||||||
|
'downtime_internal_downtime_id'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->where('host_name', $this->view->host->host_name)
|
||||||
|
->where('service_description', $this->view->service->service_description)
|
||||||
|
->where('object_type','service')
|
||||||
|
->fetchAll();
|
||||||
|
|
||||||
$this->view->customvars = $this->backend->select()
|
$this->view->customvars = $this->backend->select()
|
||||||
->from(
|
->from(
|
||||||
'customvar',
|
'customvar',
|
||||||
@ -236,6 +260,7 @@ class Monitoring_ShowController extends ModuleActionController
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
->where('host_name', $this->view->host->host_name)
|
->where('host_name', $this->view->host->host_name)
|
||||||
|
->where('object_type','host')
|
||||||
->fetchAll();
|
->fetchAll();
|
||||||
|
|
||||||
$this->view->customvars = $this->backend->select()
|
$this->view->customvars = $this->backend->select()
|
||||||
@ -368,7 +393,6 @@ class Monitoring_ShowController extends ModuleActionController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creating tabs for this controller
|
* Creating tabs for this controller
|
||||||
* @return \Icinga\Web\Widget\AbstractWidget
|
* @return \Icinga\Web\Widget\AbstractWidget
|
||||||
|
@ -0,0 +1,159 @@
|
|||||||
|
<?= $this->tabs ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Create a DateTime from a string and use the util helper to
|
||||||
|
* format it
|
||||||
|
*
|
||||||
|
* @param $self Reference to the current view that contains the helper.
|
||||||
|
* @param $dateString The String that will be converted.
|
||||||
|
* @return String The formatted string.
|
||||||
|
*/
|
||||||
|
function formatDateString($self,$dateString){
|
||||||
|
$d = new DateTime($dateString);
|
||||||
|
return $self->util()->showTime($d->getTimestamp());
|
||||||
|
}
|
||||||
|
$paginator = $downtimes->paginate();
|
||||||
|
$downtimes = $downtimes->fetchAll();
|
||||||
|
?>
|
||||||
|
<form method="get" action="<?= $this->qUrl(
|
||||||
|
'monitoring/list/downtimes?',
|
||||||
|
array(
|
||||||
|
'action' => 'downtimes'
|
||||||
|
));
|
||||||
|
?>">
|
||||||
|
Sort by <?= $this->formSelect(
|
||||||
|
'sort',
|
||||||
|
$this->sort,
|
||||||
|
array('class' => 'autosubmit'),
|
||||||
|
array(
|
||||||
|
'downtime_is_in_effect' => 'Is In Effect',
|
||||||
|
'object_type' => 'Service/Host',
|
||||||
|
'host_name' => 'Host Name',
|
||||||
|
'service_description' => 'Service Name',
|
||||||
|
'downtime_entry_time' => 'Entry Time',
|
||||||
|
'downtime_author_name' => 'Author',
|
||||||
|
'downtime_comment_data' => 'Comment',
|
||||||
|
'downtime_scheduled_start_time' => 'Start',
|
||||||
|
'downtime_scheduled_end_time' => 'End',
|
||||||
|
'downtime_trigger_time' => 'Trigger Time',
|
||||||
|
'downtime_internal_downtime_id' => 'Downtime ID',
|
||||||
|
'downtime_duration' => 'Duration',
|
||||||
|
)
|
||||||
|
) ?>
|
||||||
|
<input type="search" name="filter" placeholder="Type to filter" />
|
||||||
|
<button class="btn btn-small"><i class="icon-refresh"></i></button>
|
||||||
|
</form>
|
||||||
|
<?=
|
||||||
|
$this->paginationControl(
|
||||||
|
$paginator,
|
||||||
|
null,
|
||||||
|
array(
|
||||||
|
'mixedPagination.phtml',
|
||||||
|
'default'),
|
||||||
|
array('preserve' => $this->preserve))
|
||||||
|
?>
|
||||||
|
|
||||||
|
<table class="statustable action">
|
||||||
|
<thead>
|
||||||
|
<th> Is In Effect </th>
|
||||||
|
<th> Object </th>
|
||||||
|
<th> Host Name </th>
|
||||||
|
<th> Service Name </th>
|
||||||
|
<th> Entry Time </th>
|
||||||
|
<th> Author </th>
|
||||||
|
<th> Comment </th>
|
||||||
|
<th> Start Time </th>
|
||||||
|
<th> End Time </th>
|
||||||
|
<th> Type </th>
|
||||||
|
<th> Trigger Time </th>
|
||||||
|
<th> Downtime ID </th>
|
||||||
|
<th> Trigger ID </th>
|
||||||
|
<th> Duration </th>
|
||||||
|
</thead>
|
||||||
|
<?php foreach ($downtimes as $downtime): ?>
|
||||||
|
<tr class="<?= $downtime->downtime_is_in_effect == 0 ? 'ok' : 'warning' ?>">
|
||||||
|
<td>
|
||||||
|
<?= $downtime->downtime_is_in_effect == 0 ? 'False' : '<b>True</b>'; ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="img-box">
|
||||||
|
<?php if ($downtime->object_type == 'service'): ?>
|
||||||
|
<img title="Service" src="<?='../../img/classic/service.png'?>"/>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($downtime->object_type == 'host'): ?>
|
||||||
|
<img title="Host" src="<?='../../img/classic/server.png'?>"/>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= $downtime->host_name ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= $downtime->service_description ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= formatDateString($this,$downtime->downtime_entry_time); ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= $downtime->downtime_author_name ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= $downtime->downtime_comment_data ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= formatDateString($this,$downtime->downtime_scheduled_start_time); ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= formatDateString($this,$downtime->downtime_scheduled_end_time); ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= $downtime->downtime_is_fixed == 1 ? 'Fixed' : 'Not Fixed' ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
$date = formatDateString($this,$downtime->downtime_trigger_time);
|
||||||
|
echo $date != 'undef' ? $date : 'N/A';
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= $downtime->downtime_internal_downtime_id ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= $downtime->downtime_triggered_by_id == 0 ?
|
||||||
|
'N/A' : $downtime->downtime_triggered_by_id ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= $this->util()->showHourMin(intval($downtime->downtime_duration)); ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
if (empty($downtime->service_description)) {
|
||||||
|
echo $this->qlink(
|
||||||
|
'',
|
||||||
|
'monitoring/show/host',
|
||||||
|
array(
|
||||||
|
'host' => $downtime->host_name
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'class' => 'row-action'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
echo $this->qlink(
|
||||||
|
'',
|
||||||
|
'monitoring/show/service',
|
||||||
|
array(
|
||||||
|
'host' => $downtime->host_name,
|
||||||
|
'service' => $downtime->service_description
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'class' => 'row-action'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</table>
|
@ -40,6 +40,7 @@ class DowntimeQuery extends AbstractQuery
|
|||||||
'downtime_type' => 'sd.downtime_type',
|
'downtime_type' => 'sd.downtime_type',
|
||||||
'downtime_author_name' => 'sd.author_name',
|
'downtime_author_name' => 'sd.author_name',
|
||||||
'downtime_comment_data' => 'sd.comment_data',
|
'downtime_comment_data' => 'sd.comment_data',
|
||||||
|
'downtime_entry_time' => 'sd.entry_time',
|
||||||
'downtime_is_fixed' => 'sd.is_fixed',
|
'downtime_is_fixed' => 'sd.is_fixed',
|
||||||
'downtime_duration' => 'sd.duration',
|
'downtime_duration' => 'sd.duration',
|
||||||
'downtime_scheduled_start_time' => 'sd.scheduled_start_time',
|
'downtime_scheduled_start_time' => 'sd.scheduled_start_time',
|
||||||
@ -49,14 +50,14 @@ class DowntimeQuery extends AbstractQuery
|
|||||||
'downtime_actual_start_time_usec' => 'sd.actual_start_time_usec',
|
'downtime_actual_start_time_usec' => 'sd.actual_start_time_usec',
|
||||||
'downtime_is_in_effect' => 'sd.is_in_effect',
|
'downtime_is_in_effect' => 'sd.is_in_effect',
|
||||||
'downtime_trigger_time' => 'sd.trigger_time',
|
'downtime_trigger_time' => 'sd.trigger_time',
|
||||||
|
'downtime_triggered_by_id' => 'sd.triggered_by_id',
|
||||||
'downtime_internal_downtime_id' => 'sd.internal_downtime_id'
|
'downtime_internal_downtime_id' => 'sd.internal_downtime_id'
|
||||||
),
|
),
|
||||||
'hosts' => array(
|
'objects' => array(
|
||||||
'host_name' => 'ho.name1',
|
'host_name' => 'o.name1 COLLATE latin1_general_ci',
|
||||||
),
|
'service_host_name' => 'o.name1 COLLATE latin1_general_ci',
|
||||||
'services' => array(
|
'service_description' => 'o.name2 COLLATE latin1_general_ci',
|
||||||
'service_host_name' => 'so.name1',
|
'object_type' => "CASE o.objecttype_id WHEN 1 THEN 'host' ELSE 'service' END",
|
||||||
'service_description' => 'so.name2',
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -70,29 +71,17 @@ class DowntimeQuery extends AbstractQuery
|
|||||||
array()
|
array()
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->joinedVirtualTables = array('downtime' => true);
|
$this->joinedVirtualTables = array('downtime' => true, 'services' => true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Join if host needed
|
* Join if host needed
|
||||||
*/
|
*/
|
||||||
protected function joinHosts()
|
protected function joinObjects()
|
||||||
{
|
{
|
||||||
$this->baseQuery->join(
|
$this->baseQuery->join(
|
||||||
array('ho' => $this->prefix . 'objects'),
|
array('o' => $this->prefix . 'objects'),
|
||||||
'sd.object_id = ho.object_id AND ho.is_active = 1 AND ho.objecttype_id = 1',
|
'sd.object_id = o.object_id AND o.is_active = 1 AND o.objecttype_id IN (1, 2)',
|
||||||
array()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Join if services needed
|
|
||||||
*/
|
|
||||||
protected function joinServices()
|
|
||||||
{
|
|
||||||
$this->baseQuery->join(
|
|
||||||
array('so' => $this->prefix . 'objects'),
|
|
||||||
'so.object_id = ho.object_id AND ho.is_active = 1 AND ho.objecttype_id = 2',
|
|
||||||
array()
|
array()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -40,11 +40,16 @@ class DowntimeView extends MonitoringView
|
|||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected $availableColumns = array(
|
protected $availableColumns = array(
|
||||||
|
'host_name',
|
||||||
|
'object_type',
|
||||||
|
'service_host_name',
|
||||||
|
'service_description',
|
||||||
'downtime_type',
|
'downtime_type',
|
||||||
'downtime_author_name',
|
'downtime_author_name',
|
||||||
'downtime_comment_data',
|
'downtime_comment_data',
|
||||||
'downtime_is_fixed',
|
'downtime_is_fixed',
|
||||||
'downtime_duration',
|
'downtime_duration',
|
||||||
|
'downtime_entry_time',
|
||||||
'downtime_scheduled_start_time',
|
'downtime_scheduled_start_time',
|
||||||
'downtime_scheduled_end_time',
|
'downtime_scheduled_end_time',
|
||||||
'downtime_was_started',
|
'downtime_was_started',
|
||||||
@ -52,6 +57,7 @@ class DowntimeView extends MonitoringView
|
|||||||
'downtime_actual_start_time_usec',
|
'downtime_actual_start_time_usec',
|
||||||
'downtime_is_in_effect',
|
'downtime_is_in_effect',
|
||||||
'downtime_trigger_time',
|
'downtime_trigger_time',
|
||||||
|
'downtime_triggered_by_id',
|
||||||
'downtime_internal_downtime_id'
|
'downtime_internal_downtime_id'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user