Implement view to display stats about checks and monitored objects
refs #10033
This commit is contained in:
parent
daa23a4edd
commit
fff9bf7b2b
|
@ -11,7 +11,7 @@ use Icinga\Web\Widget\Tabextension\DashboardAction;
|
|||
/**
|
||||
* Display process and performance information of the monitoring host and program-wide commands
|
||||
*/
|
||||
class ProcessController extends Controller
|
||||
class HealthController extends Controller
|
||||
{
|
||||
/**
|
||||
* Add tabs
|
||||
|
@ -29,10 +29,21 @@ class ProcessController extends Controller
|
|||
'Show information about the current monitoring instance\'s process'
|
||||
. ' and it\'s performance as well as available features'
|
||||
),
|
||||
'label' => $this->translate('Monitoring Health'),
|
||||
'url' =>'monitoring/process/info'
|
||||
'label' => $this->translate('Process Information'),
|
||||
'url' =>'monitoring/health/info'
|
||||
)
|
||||
)->extend(new DashboardAction());
|
||||
)
|
||||
->add(
|
||||
'stats',
|
||||
array(
|
||||
'title' => $this->translate(
|
||||
'Show statistics about the monitored objects'
|
||||
),
|
||||
'label' => $this->translate('Stats'),
|
||||
'url' =>'monitoring/health/stats'
|
||||
)
|
||||
)
|
||||
->extend(new DashboardAction());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,7 +51,7 @@ class ProcessController extends Controller
|
|||
*/
|
||||
public function infoAction()
|
||||
{
|
||||
$this->view->title = $this->translate('Monitoring Health');
|
||||
$this->view->title = $this->translate('Process Information');
|
||||
$this->getTabs()->activate('info');
|
||||
$this->setAutorefreshInterval(10);
|
||||
$this->view->backendName = $this->backend->getName();
|
||||
|
@ -95,6 +106,53 @@ class ProcessController extends Controller
|
|||
->getQuery()->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Display stats about current checks and monitored objects
|
||||
*/
|
||||
public function statsAction()
|
||||
{
|
||||
$this->getTabs()->activate('stats');
|
||||
|
||||
$servicestats = $this->backend->select()->from('servicestatussummary', array(
|
||||
'services_critical',
|
||||
'services_critical_handled',
|
||||
'services_critical_unhandled',
|
||||
'services_ok',
|
||||
'services_pending',
|
||||
'services_total',
|
||||
'services_unknown',
|
||||
'services_unknown_handled',
|
||||
'services_unknown_unhandled',
|
||||
'services_warning',
|
||||
'services_warning_handled',
|
||||
'services_warning_unhandled'
|
||||
));
|
||||
$this->applyRestriction('monitoring/filter/objects', $servicestats);
|
||||
$this->view->servicestats = $servicestats->fetchRow();
|
||||
|
||||
$hoststats = $this->backend->select()->from('hoststatussummary', array(
|
||||
'hosts_total',
|
||||
'hosts_up',
|
||||
'hosts_down',
|
||||
'hosts_down_handled',
|
||||
'hosts_down_unhandled',
|
||||
'hosts_unreachable',
|
||||
'hosts_unreachable_handled',
|
||||
'hosts_unreachable_unhandled',
|
||||
'hosts_pending',
|
||||
));
|
||||
$this->applyRestriction('monitoring/filter/objects', $hoststats);
|
||||
$this->view->hoststats = $hoststats;
|
||||
|
||||
$this->view->runtimevariables = (object) $this->backend->select()
|
||||
->from('runtimevariables', array('varname', 'varvalue'))
|
||||
->getQuery()->fetchPairs();
|
||||
|
||||
$this->view->checkperformance = $this->backend->select()
|
||||
->from('runtimesummary')
|
||||
->getQuery()->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable notifications w/ an optional expire time
|
||||
*/
|
||||
|
@ -119,7 +177,7 @@ class ProcessController extends Controller
|
|||
} else {
|
||||
$form = new DisableNotificationsExpireCommandForm();
|
||||
$form
|
||||
->setRedirectUrl('monitoring/process/info')
|
||||
->setRedirectUrl('monitoring/health/info')
|
||||
->handleRequest();
|
||||
$this->view->form = $form;
|
||||
}
|
|
@ -65,7 +65,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
|
|||
$notificationDescription = sprintf(
|
||||
'<a aria-label="%1$s" title="%1$s" href="%2$s" data-base-target="_next">%3$s</a>',
|
||||
$this->translate('Disable notifications for a specific time on a program-wide basis'),
|
||||
$this->getView()->href('monitoring/process/disable-notifications'),
|
||||
$this->getView()->href('monitoring/health/disable-notifications'),
|
||||
$this->translate('Disable temporarily')
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
$rv = $this->runtimeVariables()->create($this->runtimevariables);
|
||||
$cp = $this->checkPerformance()->create($this->checkperformance);
|
||||
|
||||
if (! $this->compact): ?>
|
||||
<div class="controls">
|
||||
<?= $this->tabs; ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<div class="content processinfo">
|
||||
<div class="boxview">
|
||||
<div style="min-width: 30em;" class="box left">
|
||||
<h2><?= $this->translate('Process Info') ?></h2>
|
||||
<table class="avp">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?= $this->translate('Program Version') ?></th>
|
||||
<td><?= $this->programStatus->program_version
|
||||
? $this->programStatus->program_version
|
||||
: $this->translate('N/A') ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= $this->translate('Program Start Time') ?></th>
|
||||
<td><?= $this->formatDateTime($this->programStatus->program_start_time) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= $this->translate('Last Status Update'); ?></th>
|
||||
<td><?= $this->timeAgo($this->programStatus->status_update_time); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= $this->translate('Last External Command Check'); ?></th>
|
||||
<td><?= $this->timeAgo($this->programStatus->last_command_check); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= $this->translate('Last Log File Rotation'); ?></th>
|
||||
<td><?= $this->programStatus->last_log_rotation
|
||||
? $this->timeSince($this->programStatus->last_log_rotation)
|
||||
: $this->translate('N/A') ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= $this->translate('Global Service Event Handler'); ?></th>
|
||||
<td><?= $this->programStatus->global_service_event_handler
|
||||
? $this->programStatus->global_service_event_handler
|
||||
: $this->translate('N/A'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= $this->translate('Global Host Event Handler'); ?></th>
|
||||
<td><?= $this->programStatus->global_host_event_handler
|
||||
? $this->programStatus->global_host_event_handler
|
||||
: $this->translate('N/A'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= $this->translate('Active Endpoint'); ?></th>
|
||||
<td><?= $this->programStatus->endpoint_name
|
||||
? $this->programStatus->endpoint_name
|
||||
: $this->translate('N/A') ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if ((bool) $this->programStatus->is_currently_running === true): ?>
|
||||
<div class="backend-running">
|
||||
<?= sprintf(
|
||||
$this->translate(
|
||||
'%1$s has been up and running with PID %2$d %3$s',
|
||||
'Last format parameter represents the time running'
|
||||
),
|
||||
$this->backendName,
|
||||
$this->programStatus->process_id,
|
||||
$this->timeSince($this->programStatus->program_start_time)) ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="backend-not-running">
|
||||
<?= sprintf($this->translate('Backend %s is not running'), $this->backendName) ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div style="min-width: 30em;" class="box left">
|
||||
<?= $this->toggleFeaturesForm; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,106 @@
|
|||
<?php
|
||||
$rv = $this->runtimeVariables()->create($this->runtimevariables);
|
||||
$cp = $this->checkPerformance()->create($this->checkperformance);
|
||||
|
||||
if (! $this->compact): ?>
|
||||
<div class="controls">
|
||||
<?= $this->tabs ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<div class="content processinfo">
|
||||
|
||||
<div class="boxview">
|
||||
|
||||
<div class="box left">
|
||||
<h3 class="tinystatesummary" data-base-target="_next">
|
||||
<?php $this->stats = $hoststats ?>
|
||||
<?= $this->render('list/components/hostssummary.phtml') ?>
|
||||
</h3>
|
||||
|
||||
<table class="avp">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th> <?= $this->translate('Total') ?> </th>
|
||||
<td> <?= $rv->total_scheduled_hosts ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> <?= $this->translate('Scheduled') ?> </th>
|
||||
<td> <?= $rv->total_scheduled_hosts ?> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3 class="tinystatesummary" data-base-target="_next">
|
||||
<?php $this->stats = $servicestats ?>
|
||||
<?= $this->render('list/components/servicesummary.phtml') ?>
|
||||
</h3>
|
||||
|
||||
<table class="avp">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th><?= $this->translate('Amount') ?></th>
|
||||
<th><?= $this->translate('Per Host') ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th> <?= $this->translate('Total') ?> </th>
|
||||
<td> <?= $rv->total_services ?> </td>
|
||||
<td> <?= sprintf('%.2f', $rv->average_services_per_host) ?> </td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> <?= $this->translate('Scheduled') ?> </th>
|
||||
<td> <?= $rv->total_scheduled_services ?> </td>
|
||||
<td> <?= sprintf('%.2f', $rv->average_scheduled_services_per_host) ?> </td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><?= $this->translate('Active checks') ?></h3>
|
||||
<table class="avp">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th><?= $this->translate('Checks') ?></th>
|
||||
<th><?= $this->translate('Latency') ?></th>
|
||||
<th><?= $this->translate('Execution time') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?= $this->translate('Host Checks') ?></th>
|
||||
<td><?= $cp->host_active_count; ?></td>
|
||||
<td><?= sprintf('%.3f', $cp->host_active_latency_avg) ?>s</td>
|
||||
<td><?= sprintf('%.3f', $cp->host_active_execution_avg) ?>s</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= $this->translate('Service Checks') ?></th>
|
||||
<td><?= $cp->service_active_count; ?></td>
|
||||
<td><?= sprintf('%.3f', $cp->service_active_latency_avg) ?>s</td>
|
||||
<td><?= sprintf('%.3f', $cp->service_active_execution_avg) ?>s</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><?= $this->translate('Passive checks') ?></h3>
|
||||
<table class="avp">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?= $this->translate('Host Checks') ?></th>
|
||||
<td><?= $cp->host_passive_count ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= $this->translate('Service Checks') ?></th>
|
||||
<td><?= $cp->service_passive_count ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -1,185 +0,0 @@
|
|||
<?php
|
||||
$rv = $this->runtimeVariables()->create($this->runtimevariables);
|
||||
$cp = $this->checkPerformance()->create($this->checkperformance);
|
||||
|
||||
if (! $this->compact): ?>
|
||||
<div class="controls">
|
||||
<?= $this->tabs; ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<div class="content processinfo">
|
||||
<div class="boxview">
|
||||
|
||||
<div class="box left">
|
||||
<?= $this->toggleFeaturesForm; ?>
|
||||
</div>
|
||||
|
||||
<div class="box left">
|
||||
<h2><?= $this->translate('Process Info') ?></h2>
|
||||
<table class="avp">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?= $this->translate('Program Version') ?></th>
|
||||
<td><?= $this->programStatus->program_version
|
||||
? $this->programStatus->program_version
|
||||
: $this->translate('N/A') ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= $this->translate('Program Start Time') ?></th>
|
||||
<td><?= $this->formatDateTime($this->programStatus->program_start_time) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= $this->translate('Last Status Update'); ?></th>
|
||||
<td><?= $this->timeAgo($this->programStatus->status_update_time); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= $this->translate('Last External Command Check'); ?></th>
|
||||
<td><?= $this->timeAgo($this->programStatus->last_command_check); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= $this->translate('Last Log File Rotation'); ?></th>
|
||||
<td><?= $this->programStatus->last_log_rotation
|
||||
? $this->timeSince($this->programStatus->last_log_rotation)
|
||||
: $this->translate('N/A') ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= $this->translate('Global Service Event Handler'); ?></th>
|
||||
<td><?= $this->programStatus->global_service_event_handler
|
||||
? $this->programStatus->global_service_event_handler
|
||||
: $this->translate('N/A'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= $this->translate('Global Host Event Handler'); ?></th>
|
||||
<td><?= $this->programStatus->global_host_event_handler
|
||||
? $this->programStatus->global_host_event_handler
|
||||
: $this->translate('N/A'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= $this->translate('Active Endpoint'); ?></th>
|
||||
<td><?= $this->programStatus->endpoint_name
|
||||
? $this->programStatus->endpoint_name
|
||||
: $this->translate('N/A') ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if ((bool) $this->programStatus->is_currently_running === true): ?>
|
||||
<div class="backend-running">
|
||||
<?= sprintf(
|
||||
$this->translate(
|
||||
'%1$s has been up and running with PID %2$d %3$s',
|
||||
'Last format parameter represents the time running'
|
||||
),
|
||||
$this->backendName,
|
||||
$this->programStatus->process_id,
|
||||
$this->timeSince($this->programStatus->program_start_time)) ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="backend-not-running">
|
||||
<?= sprintf($this->translate('Backend %s is not running'), $this->backendName) ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
<div class="box left">
|
||||
<h2><?= $this->translate('Performance Info') ?></h2>
|
||||
|
||||
<h3><?= $this->translate('Object summaries') ?></h3>
|
||||
<table class="avp">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th><?= $this->translate('overall') ?></th>
|
||||
<th><?= $this->translate('scheduled') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><?= $this->translate('Hosts') ?></strong>
|
||||
</td>
|
||||
<td>
|
||||
<?= $rv->total_hosts; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $rv->total_scheduled_hosts; ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<strong><?= $this->translate('Services') ?></strong>
|
||||
</td>
|
||||
<td>
|
||||
<?= $rv->total_services; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $rv->total_scheduled_services; ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<strong><?= $this->translate('Average services per host') ?></strong>
|
||||
</td>
|
||||
<td>
|
||||
<?= sprintf('%.2f', $rv->average_services_per_host); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= sprintf('%.2f', $rv->average_scheduled_services_per_host); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><?= $this->translate('Active checks') ?></h3>
|
||||
<table class="avp">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th><?= $this->translate('Latency') ?></th>
|
||||
<th><?= $this->translate('Execution time') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><?= $this->translate('Host Checks') ?></strong>
|
||||
</td>
|
||||
<td><?= $cp->host_active_count; ?></td>
|
||||
<td><?= sprintf('%.3f', $cp->host_active_latency_avg); ?>s</td>
|
||||
<td><?= sprintf('%.3f', $cp->host_active_execution_avg); ?>s</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><?= $this->translate('Service Checks') ?></strong>
|
||||
</td>
|
||||
<td><?= $cp->service_active_count; ?></td>
|
||||
<td><?= sprintf('%.3f', $cp->service_active_latency_avg); ?>s</td>
|
||||
<td><?= sprintf('%.3f', $cp->service_active_execution_avg); ?>s</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><?= $this->translate('Passive checks') ?></h3>
|
||||
<table class="avp">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><?= $this->translate('Host Checks') ?></strong>
|
||||
</td>
|
||||
<td><?= $cp->host_passive_count; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><?= $this->translate('Service Checks') ?></strong>
|
||||
</td>
|
||||
<td><?= $cp->service_passive_count; ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -222,7 +222,7 @@ $section->add($this->translate('Alert Summary'), array(
|
|||
*/
|
||||
$section = $this->menuSection($this->translate('System'));
|
||||
$section->add($this->translate('Monitoring Health'), array(
|
||||
'url' => 'monitoring/process/info',
|
||||
'url' => 'monitoring/health/info',
|
||||
'priority' => 720,
|
||||
'renderer' => 'Icinga\Module\Monitoring\Web\Menu\BackendAvailabilityMenuItemRenderer'
|
||||
));
|
||||
|
|
Loading…
Reference in New Issue