Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/modules-menu-provider-6639
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Fuhr committed Aug 22, 2014
2 parents aba5b1c + da821fd commit 20cead6
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 112 deletions.
2 changes: 1 addition & 1 deletion application/controllers/StaticController.php
Expand Up @@ -30,8 +30,8 @@ public function init()

public function gravatarAction()
{
header('Content-Type: image/jpg');
$img = file_get_contents('http://www.gravatar.com/avatar/' . md5(strtolower(trim($this->_request->getParam('email')))) . '?s=200&d=mm');
header('image/jpeg');
echo $img;
}

Expand Down
2 changes: 2 additions & 0 deletions library/Icinga/Application/Benchmark.php
Expand Up @@ -142,6 +142,7 @@ public static function renderToHtml($what = null)
// TODO: Move formatting to CSS file
$html = '<table class="benchmark">' . "\n" . '<tr>';
foreach ($data->columns as & $col) {
if ($col->title === 'Time') continue;
$html .= sprintf(
'<td align="%s">%s</td>',
$col->align,
Expand All @@ -153,6 +154,7 @@ public static function renderToHtml($what = null)
foreach ($data->rows as & $row) {
$html .= '<tr>';
foreach ($data->columns as $key => & $col) {
if ($col->title === 'Time') continue;
$html .= sprintf(
'<td align="%s">%s</td>',
$col->align,
Expand Down
6 changes: 3 additions & 3 deletions library/Icinga/Application/Loader.php
Expand Up @@ -40,9 +40,9 @@ public function registerNamespace($namespace, $directory)
{
if (!is_dir($directory)) {
throw new ProgrammingError(sprintf(
'Namespace directory "%s" for "%s" does not exist',
$namespace,
$directory
'Directory "%s" for namespace "%s" does not exist',
$directory,
$namespace
));
}

Expand Down
Expand Up @@ -87,6 +87,7 @@ public function hostsAction()
'host_address',
'host_acknowledged',
'host_output',
'host_attempt',
'host_in_downtime',
'host_is_flapping',
'host_state_type',
Expand Down
3 changes: 2 additions & 1 deletion modules/monitoring/application/forms/Config/SecurityForm.php
Expand Up @@ -21,13 +21,14 @@ class SecurityForm extends Form
*/
public function create()
{
$default = '*pw*,*pass*,community';
$this->addElement(
'text',
'protected_customvars',
array(
'label' => 'Protected Custom Variables',
'required' => true,
'value' => $this->config->protected_customvars,
'value' => $this->config ? $this->config->get('protected_customvars', $default) : $default,
'helptext' => 'Comma separated case insensitive list of protected custom variables.'
. ' Use * as a placeholder for zero or more wildcard characters.'
. ' Existance of those custom variables will be shown, but their values will be masked.'
Expand Down
201 changes: 94 additions & 107 deletions modules/monitoring/application/views/scripts/list/hosts.phtml
@@ -1,27 +1,31 @@
<?php
$helper = $this->getHelper('MonitoringState');

if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs ?>
<div style="margin: 1em;" class="dontprint">
<?= $this->translate('Sort by') ?> <?= $this->sortControl->render($this) ?>
<?php if (! $this->filterEditor): ?>
<?= $this->filterPreview ?>
<?php endif; ?>
</div>
if ($this->compact): ?>
<div class="content">
<?php else: ?>
<div class="controls">
<?= $this->tabs ?>
<div style="margin: 1em;" class="dontprint">
<?= $this->translate('Sort by') ?> <?= $this->sortControl->render($this) ?>
<?php if (! $this->filterEditor): ?>
<?= $this->filterPreview ?>
<?php endif; ?>
</div>

<?= $this->widget('limiter')->setMaxLimit($this->hosts->count()) ?>
<?= $this->paginationControl($hosts, null, null, array('preserve' => $this->preserve)) ?>
<?= $this->selectionToolbar('multi', $this->href('monitoring/multi/host?' . $this->filter->toQueryString())) ?>
</div>
<div class="content">
<?= $this->filterEditor ?>
<?= $this->widget('limiter')->setMaxLimit($this->hosts->count()) ?>
<?= $this->paginationControl($hosts, null, null, array('preserve' => $this->preserve)) ?>
<?= $this->selectionToolbar('multi', $this->href('monitoring/multi/host?' . $this->filter->toQueryString())) ?>
</div>

<div class="content">
<?= $this->filterEditor ?>
<?php

endif;

if ($hosts->count() === 0) {
echo t('No hosts matching the filter');
echo $this->translate('No hosts matching the filter');
if (! $this->compact) {
echo '</div>';
}
Expand All @@ -32,107 +36,90 @@ if ($hosts->count() === 0) {
<table
data-base-target="_next"
class="action multiselect"
data-icinga-multiselect-url="<?= $this->href("/monitoring/multi/host") ?>"
data-icinga-multiselect-url="<?= $this->href('/monitoring/multi/host') ?>"
data-icinga-multiselect-data="host"
>
<tbody>
<?php foreach($hosts as $host):
<tbody>
<?php foreach($hosts as $host):

$hostStateName = strtolower($this->util()->getHostStateName($host->host_state));
$hostLink = $this->href('/monitoring/show/host', array('host' => $host->host_name));
$hostStateName = strtolower($this->util()->getHostStateName($host->host_state));
$hostLink = $this->href('/monitoring/show/host', array('host' => $host->host_name));

if (! $this->compact) {
$icons = array();
if (! $host->host_handled && $host->host_state > 0){
$icons[] = $this->icon('unhandled.png', 'Unhandled');
}

if ($host->host_acknowledged) {
$icons[] = $this->icon('acknowledgement.png', 'Acknowledged');
}
$icons = array();
if (! $host->host_handled && $host->host_state > 0){
$icons[] = $this->icon('unhandled.png', 'Unhandled');
}

if ($host->host_is_flapping) {
$icons[] = $this->icon('flapping.png', 'Flapping');
}
if ($host->host_acknowledged) {
$icons[] = $this->icon('acknowledgement.png', 'Acknowledged');
}

if (! $host->host_notifications_enabled) {
$icons[] = $this->icon('notification_disabled.png', 'Notifications Disabled');
}
if ($host->host_is_flapping) {
$icons[] = $this->icon('flapping.png', 'Flapping');
}

if ($host->host_in_downtime) {
$icons[] = $this->icon('in_downtime.png', 'In Downtime');
}
if (! $host->host_notifications_enabled) {
$icons[] = $this->icon('notification_disabled.png', 'Notifications Disabled');
}

if (! $host->host_active_checks_enabled) {
if (! $host->host_passive_checks_enabled) {
$icons[] = $this->icon('active_passive_checks_disabled.png', 'Active And Passive Checks Disabled');
} else {
$icons[] = $this->icon('active_checks_disabled.png', 'Active Checks Disabled');
}
}
if ($host->host_in_downtime) {
$icons[] = $this->icon('in_downtime.png', 'In Downtime');
}

if (isset($host->host_last_comment) && $host->host_last_comment !== null) {
$icons[] = $this->icon('comment.png', 'Comment: ' . $host->host_last_comment);
}
if (! $host->host_active_checks_enabled) {
if (! $host->host_passive_checks_enabled) {
$icons[] = $this->icon('active_passive_checks_disabled.png', 'Active And Passive Checks Disabled');
} else {
$icons[] = $this->icon('active_checks_disabled.png', 'Active Checks Disabled');
}
?>
<tr class="state <?= $hostStateName ?><?= $host->host_handled ? ' handled' : '' ?>">
<!-- State -->
<td class="state" title="<?= $helper->getStateTitle($host, 'host') ?>">
<?php if (! $this->compact): ?>
<div>
<strong><?= ucfirst($helper->monitoringState($host, 'host')) ?></strong><br />
<div class="small-row">
<?php endif; ?>
<?= $this->prefixedTimeSince($host->host_last_state_change, true) ?>
<?php if (! $this->compact): ?>
<?php if ($host->host_state > 0): ?>
<br />
<strong><?= $this->translate(
($host->host_state_type === '1') ? 'Hard' : 'Soft'
) ?> </strong> <!--
--><?= $host->host_current_check_attempt ?>/<?= $host->host_max_check_attempts ?>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
</td>
}

if (isset($host->host_last_comment) && $host->host_last_comment !== null) {
$icons[] = $this->icon('comment.png', 'Comment: ' . $host->host_last_comment);
}
?>
<tr class="state <?= $hostStateName ?><?= $host->host_handled ? ' handled' : '' ?>">
<!-- State -->
<td class="state" title="<?= $helper->getStateTitle($host, 'host') ?>">
<?php if (! $this->compact): ?>
<strong><?= ucfirst($helper->monitoringState($host, 'host')) ?></strong><br />
<?php endif ?>
<?= $this->prefixedTimeSince($host->host_last_state_change, true) ?>
<?php if ($host->host_state > 0 && (int) $host->host_state_type === 0): ?>
<br />
<strong>Soft <?= $host->host_attempt ?></strong>
<?php endif ?>
</td>

<!-- Host / Status / Output -->
<td>
<?php if (! $this->compact): ?>
<?php if ($host->host_icon_image): ?>
<?= $this->img(
$this->resolveMacros($host->host_icon_image, $host),
array('align' => 'right')
) ?>
<?php endif; ?>
<?= implode(' ', $icons) ?>
<?php endif ?>
<a href="<?= $this->compact ? $hostLink : $this->href(
'monitoring/show/host',
array('host' => $host->host_name)
) ?>"><?= $host->host_name ?></a>
<?php if (isset($host->host_unhandled_services) && $host->host_unhandled_services > 0): ?>
<span style="font-weight: normal" title="<?=
$host->host_unhandled_services
?> Service Problems on Host"> (<?= $this->qlink(
sprintf($this->translate('%d unhandled services'), $host->host_unhandled_services),
'monitoring/show/services',
array(
'host' => $host->host_name,
'service_problem' => 1,
'service_acknowledged' => 0,
'service_in_downtime' => 0
),
array('style' => 'font-weight: normal')
) ?>)</span>
<?php endif ?>
<br />
<?= $this->escape(substr(strip_tags($host->host_output), 0, 10000)) ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
<!-- Host / Status / Output -->
<td>
<?php if ($host->host_icon_image && ! preg_match('/[\'"]/', $host->host_icon_image)): ?>
<?= $this->icon($this->resolveMacros($host->host_icon_image, $host)) ?>
<?php endif ?>
<?= implode(' ', $icons) ?>
<a href="<?= $hostLink ?>"><?= $host->host_name ?></a>
<?php if (isset($host->host_unhandled_services) && $host->host_unhandled_services > 0): ?>
<span title="<?=
$host->host_unhandled_services
?> Service Problems on Host"> (<?= $this->qlink(
sprintf($this->translate('%d unhandled services'), $host->host_unhandled_services),
'monitoring/show/services',
array(
'host' => $host->host_name,
'service_problem' => 1,
'service_acknowledged' => 0,
'service_in_downtime' => 0
),
array('style' => 'font-weight: normal')
) ?>)</span>
<?php endif ?>
<p class="pluginoutput"><?= $this->escape(substr(strip_tags($host->host_output), 0, 10000)) ?></p>
</td>
<?php foreach($this->extraColumns as $col): ?>
<td><?= $this->escape($host->$col) ?></td>
<?php endforeach ?>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>

0 comments on commit 20cead6

Please sign in to comment.