diff --git a/modules/monitoring/application/views/scripts/partials/command/object-command-form.phtml b/modules/monitoring/application/views/scripts/partials/command/object-command-form.phtml new file mode 100644 index 000000000..7f4314cbf --- /dev/null +++ b/modules/monitoring/application/views/scripts/partials/command/object-command-form.phtml @@ -0,0 +1,13 @@ +
+ getType() === $object::TYPE_HOST): ?> + render('partials/host/object-header.phtml'); ?> + render('partials/host/servicesummary.phtml'); ?> + + render('partials/service/object-header.phtml'); ?> +
+ +
+
+

icon('help', $form->getHelp()); ?>

+ +
\ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/partials/command/objects-command-form.phtml b/modules/monitoring/application/views/scripts/partials/command/objects-command-form.phtml new file mode 100644 index 000000000..da58fc9cb --- /dev/null +++ b/modules/monitoring/application/views/scripts/partials/command/objects-command-form.phtml @@ -0,0 +1,32 @@ +
+ + render('partials/service/objects-header.phtml'); ?> + + render('partials/host/objects-header.phtml'); ?> + +
+
+ + + + + + + + + getObjects() as $object): /** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */ ?> + + getType() === $object::TYPE_HOST): ?> + + + + + + + + +
icon('host'); ?> translate('Host'); ?>icon('conf'); ?> translate('Service'); ?>
escape($object->getName()); ?>escape($object->getHost()->getName()); ?>escape($object->getName()); ?>
+
+

icon('help', $form->getHelp()) ?>

+ +
diff --git a/modules/monitoring/application/views/scripts/partials/host/object-header.phtml b/modules/monitoring/application/views/scripts/partials/host/object-header.phtml new file mode 100644 index 000000000..69d0f62f5 --- /dev/null +++ b/modules/monitoring/application/views/scripts/partials/host/object-header.phtml @@ -0,0 +1,27 @@ + +compact): ?> + + + + + + + +
+ host_state, true); ?>
+ prefixedTimeSince($object->host_last_state_change, true); ?> +
+ escape($object->host_display_name); ?> + host_display_name !== $object->host_name): ?> + (escape($object->host_name); ?>) + + host_address && $object->host_address !== $object->host_name): ?> +
+ escape($object->host_address); ?> + + render('partials/host/statusicons.phtml'); ?> +
\ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml b/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml new file mode 100644 index 000000000..f5edd0213 --- /dev/null +++ b/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml @@ -0,0 +1,16 @@ +compact): ?> + + + 0): ?> +
+ translatePlural('Host (%u)', 'Hosts (%u)', $hostCount), $hostCount); ?> +
+
+   +
+
+ $count): ?> + translate(strtoupper($text)), $count); ?>
+ +
+ \ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/partials/host/servicesummary.phtml b/modules/monitoring/application/views/scripts/partials/host/servicesummary.phtml new file mode 100644 index 000000000..641dd026a --- /dev/null +++ b/modules/monitoring/application/views/scripts/partials/host/servicesummary.phtml @@ -0,0 +1,89 @@ + $this->object->host_name)); +$currentUrl = Url::fromRequest()->without('limit')->getRelativeUrl(); + +?> +

compact ? ' data-base-target="col1"' : '' ?>> +stats->services_total > 0): ?> +qlink(sprintf($this->translatePlural('%d configured service:', '%d configured services:', $object->stats->services_total), $object->stats->services_total), $selfUrl) ?> + +translate('No services configured on this host'); ?> + + +stats->services_ok > 0): ?> + qlink( + $object->stats->services_ok, + $selfUrl, + array('service_state' => 0), + array('title' => sprintf($this->translate('Services with state %s'), $this->translate('OK'))) +) ?> + + 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $state) { + $pre = 'services_' . $state; + if ($object->stats->$pre) { + $handled = $pre . '_handled'; + $unhandled = $pre . '_unhandled'; + $paramsHandled = array('service_state' => $stateId, 'service_handled' => 1); + $paramsUnhandled = array('service_state' => $stateId, 'service_handled' => 0); + if ($object->stats->$unhandled) { + $compareUrl = $selfUrl->with($paramsUnhandled)->getRelativeUrl(); + } else { + $compareUrl = $selfUrl->with($paramsHandled)->getRelativeUrl(); + } + + if ($compareUrl === $currentUrl) { + $active = ' active'; + } else { + $active = ''; + } + + echo ''; + if ($object->stats->$unhandled) { + + echo $this->qlink( + $object->stats->$unhandled, + $selfUrl, + $paramsUnhandled, + array('title' => sprintf($this->translate('Unhandled services with state %s'), $this->translate(strtoupper($state)))) + ); + } + if ($object->stats->$handled) { + + if ($selfUrl->with($paramsHandled)->getRelativeUrl() === $currentUrl) { + $active = ' active'; + } else { + $active = ''; + } + if ($object->stats->$unhandled) { + echo ''; + } + echo $this->qlink( + $object->stats->$handled, + $selfUrl, + $paramsHandled, + array('title' => sprintf($this->translate('Handled services with state %s'), $this->translate(strtoupper($state)))) + ); + if ($object->stats->$unhandled) { + echo "\n"; + } + } + echo "\n"; + } +} + +?> +stats->services_pending): ?> + qlink( + $object->stats->services_pending, + $selfUrl, + array('service_state' => 99), + array('title' => sprintf($this->translate('Services with state %s'), $this->translate('PENDING'))) +) ?> + + +

+ diff --git a/modules/monitoring/application/views/scripts/partials/host/statusicons.phtml b/modules/monitoring/application/views/scripts/partials/host/statusicons.phtml new file mode 100644 index 000000000..4421c301f --- /dev/null +++ b/modules/monitoring/application/views/scripts/partials/host/statusicons.phtml @@ -0,0 +1,28 @@ +object->host_handled && $this->object->host_state > 0) { + $icons[] = $this->icon('attention-alt', $this->translate('Unhandled')); +} + +if ($this->object->host_acknowledged && !$this->object->host_in_downtime) { + $icons[] = $this->icon('ok', $this->translate('Acknowledged')); +} + +if (! $this->object->host_notifications_enabled) { + $icons[] = $this->icon('bell-off-empty', $this->translate('Notifications Disabled')); +} + +if ($this->object->host_in_downtime) { + $icons[] = $this->icon('plug', $this->translate('In Downtime')); +} + +if (! $this->object->host_active_checks_enabled) { + if ($this->object->host_passive_checks_enabled) { + $icons[] = $this->icon('eye-off', $this->translate('Active Checks Disabled')); + } else { + $icons[] = $this->icon('eye-off', $this->translate('Active And Passive Checks Disabled')); + } +} + +?> \ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/partials/service/object-header.phtml b/modules/monitoring/application/views/scripts/partials/service/object-header.phtml new file mode 100644 index 000000000..5f3ccb70f --- /dev/null +++ b/modules/monitoring/application/views/scripts/partials/service/object-header.phtml @@ -0,0 +1,41 @@ + +compact): ?> + + + + + + + + + + + +
+ host_state, true); ?>
+ prefixedTimeSince($object->host_last_state_change, true); ?> +
+ escape($object->host_display_name); ?> + host_display_name !== $object->host_name): ?> + (escape($object->host_name); ?>) + + host_address && $object->host_address !== $object->host_name): ?> +
+ escape($object->host_address); ?> + + render('partials/host/statusicons.phtml'); ?> +
+ service_state, true); ?>
+ prefixedTimeSince($object->service_last_state_change, true); ?> +
+ translate('Service'); ?>: escape($object->service_display_name); ?> + service_display_name !== $object->service_description): ?> + (escape($object->service_description); ?>) + + render('partials/service/statusicons.phtml'); ?> +
diff --git a/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml b/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml new file mode 100644 index 000000000..1ac27b934 --- /dev/null +++ b/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml @@ -0,0 +1,32 @@ +compact): ?> + + + 0): ?> +
+
+ translatePlural('Service (%u)', 'Services (%u)', $serviceCount), $serviceCount); ?> +
+
+   +
+
+ $count): ?> + translate(strtoupper($text)), $count); ?>
+ +
+
+
+
+ + translatePlural('Host (%u)', 'Hosts (%u)', $hostCount), $hostCount); ?> +
+
+   +
+
+ $count): ?> + translate(strtoupper($text)), $count); ?>
+ +
+
+ \ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/partials/service/statusicons.phtml b/modules/monitoring/application/views/scripts/partials/service/statusicons.phtml new file mode 100644 index 000000000..8859bf189 --- /dev/null +++ b/modules/monitoring/application/views/scripts/partials/service/statusicons.phtml @@ -0,0 +1,28 @@ +object->service_handled && $this->object->service_state > 0) { + $icons[] = $this->icon('attention-alt', $this->translate('Unhandled')); +} + +if ($this->object->service_acknowledged && !$this->object->service_in_downtime) { + $icons[] = $this->icon('ok', $this->translate('Acknowledged')); +} + +if (! $this->object->service_notifications_enabled) { + $icons[] = $this->icon('bell-off-empty', $this->translate('Notifications Disabled')); +} + +if ($this->object->service_in_downtime) { + $icons[] = $this->icon('plug', $this->translate('In Downtime')); +} + +if (! $this->object->service_active_checks_enabled) { + if ($this->object->service_passive_checks_enabled) { + $icons[] = $this->icon('eye-off', $this->translate('Active Checks Disabled')); + } else { + $icons[] = $this->icon('eye-off', $this->translate('Active And Passive Checks Disabled')); + } +} + +?> \ No newline at end of file