Merge branch 'master' into feature/user-and-group-management-8826
Conflicts: library/Icinga/Authentication/Backend/LdapUserBackend.php library/Icinga/Protocol/Ldap/Query.php
This commit is contained in:
commit
fb07f0b94c
|
@ -12,7 +12,6 @@ class FilterExpression extends Filter
|
|||
public function __construct($column, $sign, $expression)
|
||||
{
|
||||
$column = trim($column);
|
||||
$expression = is_array($expression) ? array_map('trim', $expression) : trim($expression);
|
||||
$this->column = $column;
|
||||
$this->sign = $sign;
|
||||
$this->expression = $expression;
|
||||
|
|
|
@ -9,7 +9,8 @@ namespace Icinga\Protocol\Ldap;
|
|||
* Provides information about the available encryption mechanisms (StartTLS), the supported
|
||||
* LDAP protocol (v2/v3), vendor-specific extensions or protocols controls and extensions.
|
||||
*/
|
||||
class Capability {
|
||||
class Capability
|
||||
{
|
||||
|
||||
const LDAP_SERVER_START_TLS_OID = '1.3.6.1.4.1.1466.20037';
|
||||
|
||||
|
|
|
@ -6,7 +6,8 @@ namespace Icinga\Util;
|
|||
/**
|
||||
* Provide functions to change and convert colors.
|
||||
*/
|
||||
class Color {
|
||||
class Color
|
||||
{
|
||||
/**
|
||||
* Convert a given color string to an rgb-array containing
|
||||
* each color as a decimal value.
|
||||
|
|
|
@ -79,4 +79,59 @@ class String
|
|||
|
||||
return $matches;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a string ends with a different string
|
||||
*
|
||||
* @param $haystack The string to search for matches
|
||||
* @param $needle The string to match at the start of the haystack
|
||||
*
|
||||
* @return bool Whether or not needle is at the beginning of haystack
|
||||
*/
|
||||
public static function endsWith($haystack, $needle)
|
||||
{
|
||||
return $needle === '' ||
|
||||
(($temp = strlen($haystack) - strlen($needle)) >= 0 && false !== strpos($haystack, $needle, $temp));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an array of strings that constitutes the cartesian product of all passed sets, with all
|
||||
* string combinations concatenated using the passed join-operator.
|
||||
*
|
||||
* <pre>
|
||||
* cartesianProduct(
|
||||
* array(array('foo', 'bar'), array('mumble', 'grumble', null)),
|
||||
* '_'
|
||||
* );
|
||||
* => array('foo_mumble', 'foo_grumble', 'bar_mumble', 'bar_grumble', 'foo', 'bar')
|
||||
* </pre>
|
||||
*
|
||||
* @param array $sets An array of arrays containing all sets for which the cartesian
|
||||
* product should be calculated.
|
||||
* @param string $glue The glue used to join the strings, defaults to ''.
|
||||
*
|
||||
* @returns array The cartesian product in one array of strings.
|
||||
*/
|
||||
public static function cartesianProduct(array $sets, $glue = '')
|
||||
{
|
||||
$product = null;
|
||||
foreach ($sets as $set) {
|
||||
if (! isset($product)) {
|
||||
$product = $set;
|
||||
} else {
|
||||
$newProduct = array();
|
||||
foreach ($product as $strA) {
|
||||
foreach ($set as $strB) {
|
||||
if ($strB === null) {
|
||||
$newProduct []= $strA;
|
||||
} else {
|
||||
$newProduct []= $strA . $glue . $strB;
|
||||
}
|
||||
}
|
||||
}
|
||||
$product = $newProduct;
|
||||
}
|
||||
}
|
||||
return $product;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
|
||||
namespace Icinga\Web;
|
||||
|
||||
use Zend_Paginator;
|
||||
use Icinga\Data\Sortable;
|
||||
use Icinga\Data\QueryInterface;
|
||||
use Icinga\Web\Paginator\Adapter\QueryAdapter;
|
||||
use Icinga\Web\Controller\ModuleActionController;
|
||||
use Icinga\Web\Widget\Limiter;
|
||||
use Icinga\Web\Widget\Paginator;
|
||||
use Icinga\Web\Widget\SortBox;
|
||||
|
||||
/**
|
||||
|
@ -115,12 +114,11 @@ class Controller extends ModuleActionController
|
|||
$request = $this->getRequest();
|
||||
$limit = $request->getParam('limit', $itemsPerPage);
|
||||
$page = $request->getParam('page', $pageNumber);
|
||||
$query->limit($limit, $page * $limit);
|
||||
$query->limit($limit, $page > 0 ? ($page - 1) * $limit : 0);
|
||||
|
||||
if (! $this->view->compact) {
|
||||
$paginator = new Zend_Paginator(new QueryAdapter($query));
|
||||
$paginator->setItemCountPerPage($limit);
|
||||
$paginator->setCurrentPageNumber($page);
|
||||
$paginator = new Paginator();
|
||||
$paginator->setQuery($query);
|
||||
$this->view->paginator = $paginator;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,11 +5,13 @@ namespace Icinga\Web\Widget\Chart;
|
|||
|
||||
use Icinga\Chart\PieChart;
|
||||
use Icinga\Module\Monitoring\Plugin\PerfdataSet;
|
||||
use Icinga\Util\String;
|
||||
use Icinga\Web\Widget\AbstractWidget;
|
||||
use Icinga\Web\Url;
|
||||
use Icinga\Util\Format;
|
||||
use Icinga\Application\Logger;
|
||||
use Icinga\Exception\IcingaException;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* A SVG-PieChart intended to be displayed as a small icon next to labels, to offer a better visualization of the
|
||||
|
@ -27,6 +29,45 @@ class InlinePie extends AbstractWidget
|
|||
const NUMBER_FORMAT_BYTES = 'bytes';
|
||||
const NUMBER_FORMAT_RATIO = 'ratio';
|
||||
|
||||
public static $colorsHostStates = array(
|
||||
'#44bb77', // up
|
||||
'#ff99aa', // down
|
||||
'#cc77ff', // unreachable
|
||||
'#77aaff' // pending
|
||||
);
|
||||
|
||||
public static $colorsHostStatesHandledUnhandled = array(
|
||||
'#44bb77', // up
|
||||
'#44bb77',
|
||||
'#ff99aa', // down
|
||||
'#ff5566',
|
||||
'#cc77ff', // unreachable
|
||||
'#aa44ff',
|
||||
'#77aaff', // pending
|
||||
'#77aaff'
|
||||
);
|
||||
|
||||
public static $colorsServiceStates = array(
|
||||
'#44bb77', // Ok
|
||||
'#ffaa44', // Warning
|
||||
'#ff99aa', // Critical
|
||||
'#aa44ff', // Unknown
|
||||
'#77aaff' // Pending
|
||||
);
|
||||
|
||||
public static $colorsServiceStatesHandleUnhandled = array(
|
||||
'#44bb77', // Ok
|
||||
'#44bb77',
|
||||
'#ffaa44', // Warning
|
||||
'#ffcc66',
|
||||
'#ff99aa', // Critical
|
||||
'#ff5566',
|
||||
'#cc77ff', // Unknown
|
||||
'#aa44ff',
|
||||
'#77aaff', // Pending
|
||||
'#77aaff'
|
||||
);
|
||||
|
||||
/**
|
||||
* The template string used for rendering this widget
|
||||
*
|
||||
|
@ -231,4 +272,19 @@ EOD;
|
|||
$template = str_replace('{data}', htmlspecialchars(implode(',', $data)), $template);
|
||||
return $template;
|
||||
}
|
||||
|
||||
public static function createFromStateSummary(stdClass $states, $title, array $colors)
|
||||
{
|
||||
$handledUnhandledStates = array();
|
||||
foreach ($states as $key => $value) {
|
||||
if (String::endsWith($key, '_handled') || String::endsWith($key, '_unhandled')) {
|
||||
$handledUnhandledStates[$key] = $value;
|
||||
}
|
||||
}
|
||||
$chart = new self(array_values($handledUnhandledStates), $title, $colors);
|
||||
return $chart
|
||||
->setSize(50)
|
||||
->setTitle('')
|
||||
->setSparklineClass('sparkline-multi');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,6 +76,13 @@ class FilterEditor extends AbstractWidget
|
|||
return $this->filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set columns to search in
|
||||
*
|
||||
* @param array $searchColumns
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setSearchColumns(array $searchColumns)
|
||||
{
|
||||
$this->searchColumns = $searchColumns;
|
||||
|
@ -231,10 +238,11 @@ class FilterEditor extends AbstractWidget
|
|||
if ($searchCol === null) {
|
||||
throw new Exception('Cannot search here');
|
||||
}
|
||||
$search = ltrim($search);
|
||||
$filter = $this->mergeRootExpression($filter, $searchCol, '=', "*$search*");
|
||||
} else {
|
||||
list($k, $v) = preg_split('/=/', $search);
|
||||
$filter = $this->mergeRootExpression($filter, $k, '=', $v);
|
||||
$filter = $this->mergeRootExpression($filter, trim($k), '=', ltrim($v));
|
||||
}
|
||||
} else {
|
||||
if (false === $this->resetSearchColumns($filter)) {
|
||||
|
@ -242,6 +250,7 @@ class FilterEditor extends AbstractWidget
|
|||
}
|
||||
|
||||
$filters = array();
|
||||
$search = ltrim($search);
|
||||
foreach ($this->searchColumns as $searchColumn) {
|
||||
$filters[] = Filter::expression($searchColumn, '=', "*$search*");
|
||||
}
|
||||
|
@ -445,10 +454,10 @@ class FilterEditor extends AbstractWidget
|
|||
if ($this->addTo && $this->addTo === $filter->getId()) {
|
||||
return
|
||||
preg_replace(
|
||||
'/ class="autosubmit"/',
|
||||
' class="autofocus"',
|
||||
$this->selectOperator()
|
||||
)
|
||||
'/ class="autosubmit"/',
|
||||
' class="autofocus"',
|
||||
$this->selectOperator()
|
||||
)
|
||||
. '<ul><li>'
|
||||
. $this->selectColumn($filter)
|
||||
. $this->selectSign($filter)
|
||||
|
@ -695,7 +704,7 @@ class FilterEditor extends AbstractWidget
|
|||
. t('Search...')
|
||||
. '" /></form>';
|
||||
|
||||
if ($this->filter->isEmpty()) {
|
||||
if ($this->filter->isEmpty()) {
|
||||
$title = t('Filter this list');
|
||||
} else {
|
||||
$title = t('Modify this filter');
|
||||
|
|
|
@ -0,0 +1,168 @@
|
|||
<?php
|
||||
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||
|
||||
namespace Icinga\Web\Widget;
|
||||
|
||||
use Icinga\Data\QueryInterface;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
|
||||
/**
|
||||
* Paginator
|
||||
*/
|
||||
class Paginator extends AbstractWidget
|
||||
{
|
||||
/**
|
||||
* The query the paginator widget is created for
|
||||
*
|
||||
* @var QueryInterface
|
||||
*/
|
||||
protected $query;
|
||||
|
||||
/**
|
||||
* The view script in use
|
||||
*
|
||||
* @var string|array
|
||||
*/
|
||||
protected $viewScript = array('mixedPagination.phtml', 'default');
|
||||
|
||||
/**
|
||||
* Set the query to create the paginator widget for
|
||||
*
|
||||
* @param QueryInterface $query
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setQuery(QueryInterface $query)
|
||||
{
|
||||
$this->query = $query;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the view script to use
|
||||
*
|
||||
* @param string|array $script
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setViewScript($script)
|
||||
{
|
||||
$this->viewScript = $script;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render this paginator
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
if ($this->query === null) {
|
||||
throw new ProgrammingError('Need a query to create the paginator widget for');
|
||||
}
|
||||
|
||||
$itemCountPerPage = $this->query->getLimit();
|
||||
if (! $itemCountPerPage) {
|
||||
return ''; // No pagination required
|
||||
}
|
||||
|
||||
$totalItemCount = count($this->query);
|
||||
$pageCount = (int) ceil($totalItemCount / $itemCountPerPage);
|
||||
$currentPage = $this->query->hasOffset() ? ($this->query->getOffset() / $itemCountPerPage) + 1 : 1;
|
||||
$pagesInRange = $this->getPages($pageCount, $currentPage);
|
||||
$variables = array(
|
||||
'totalItemCount' => $totalItemCount,
|
||||
'pageCount' => $pageCount,
|
||||
'itemCountPerPage' => $itemCountPerPage,
|
||||
'first' => 1,
|
||||
'current' => $currentPage,
|
||||
'last' => $pageCount,
|
||||
'pagesInRange' => $pagesInRange,
|
||||
'firstPageInRange' => min($pagesInRange),
|
||||
'lastPageInRange' => max($pagesInRange)
|
||||
);
|
||||
|
||||
if ($currentPage > 1) {
|
||||
$variables['previous'] = $currentPage - 1;
|
||||
}
|
||||
|
||||
if ($currentPage < $pageCount) {
|
||||
$variables['next'] = $currentPage + 1;
|
||||
}
|
||||
|
||||
if (is_array($this->viewScript)) {
|
||||
if ($this->viewScript[1] !== null) {
|
||||
return $this->view()->partial($this->viewScript[0], $this->viewScript[1], $variables);
|
||||
}
|
||||
|
||||
return $this->view()->partial($this->viewScript[0], $variables);
|
||||
}
|
||||
|
||||
return $this->view()->partial($this->viewScript, $variables);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of "local" pages given the page count and current page number
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getPages($pageCount, $currentPage)
|
||||
{
|
||||
$range = array();
|
||||
|
||||
if ($pageCount < 10) {
|
||||
// Show all pages if we have less than 10
|
||||
for ($i = 1; $i < 10; $i++) {
|
||||
if ($i > $pageCount) {
|
||||
break;
|
||||
}
|
||||
|
||||
$range[$i] = $i;
|
||||
}
|
||||
} else {
|
||||
// More than 10 pages:
|
||||
foreach (array(1, 2) as $i) {
|
||||
$range[$i] = $i;
|
||||
}
|
||||
|
||||
if ($currentPage < 6 ) {
|
||||
// We are on page 1-5 from
|
||||
for ($i = 1; $i <= 7; $i++) {
|
||||
$range[$i] = $i;
|
||||
}
|
||||
} else {
|
||||
// Current page > 5
|
||||
$range[] = '...';
|
||||
|
||||
if (($pageCount - $currentPage) < 5) {
|
||||
// Less than 5 pages left
|
||||
$start = 5 - ($pageCount - $currentPage);
|
||||
} else {
|
||||
$start = 1;
|
||||
}
|
||||
|
||||
for ($i = $currentPage - $start; $i < ($currentPage + (4 - $start)); $i++) {
|
||||
if ($i > $pageCount) {
|
||||
break;
|
||||
}
|
||||
|
||||
$range[$i] = $i;
|
||||
}
|
||||
}
|
||||
|
||||
if ($currentPage < ($pageCount - 2)) {
|
||||
$range[] = '...';
|
||||
}
|
||||
|
||||
foreach (array($pageCount - 1, $pageCount) as $i) {
|
||||
$range[$i] = $i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (empty($range)) {
|
||||
$range[] = 1;
|
||||
}
|
||||
|
||||
return $range;
|
||||
}
|
||||
}
|
|
@ -55,8 +55,8 @@ class Monitoring_CommentsController extends Controller
|
|||
'title' => $this->translate(
|
||||
'Display detailed information about multiple comments.'
|
||||
),
|
||||
'icon' => 'comment',
|
||||
'label' => $this->translate('Comments'),
|
||||
'icon' => 'comment',
|
||||
'label' => $this->translate('Comments') . sprintf(' (%d)', count($this->comments)),
|
||||
'url' =>'monitoring/comments/show'
|
||||
)
|
||||
)->activate('comments');
|
||||
|
|
|
@ -75,8 +75,8 @@ class Monitoring_DowntimesController extends Controller
|
|||
'title' => $this->translate(
|
||||
'Display detailed information about multiple downtimes.'
|
||||
),
|
||||
'icon' => 'plug',
|
||||
'label' => $this->translate('Downtimes'),
|
||||
'icon' => 'plug',
|
||||
'label' => $this->translate('Downtimes') . sprintf(' (%d)', count($this->downtimes)),
|
||||
'url' =>'monitoring/downtimes/show'
|
||||
)
|
||||
)->activate('downtimes');
|
||||
|
|
|
@ -49,6 +49,11 @@ class Monitoring_HostController extends MonitoredObjectController
|
|||
$this->getTabs()->activate('host');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get host actions from hook
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getHostActions()
|
||||
{
|
||||
$urls = array();
|
||||
|
@ -67,7 +72,7 @@ class Monitoring_HostController extends MonitoredObjectController
|
|||
*/
|
||||
public function showAction()
|
||||
{
|
||||
$this->view->hostActions = $this->getHostActions();
|
||||
$this->view->actions = $this->getHostActions();
|
||||
parent::showAction();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||
|
||||
use Icinga\Data\Filter\Filter;
|
||||
use Icinga\Data\Filter\FilterEqual;
|
||||
use Icinga\Module\Monitoring\Controller;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\AcknowledgeProblemCommandForm;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\CheckNowCommandForm;
|
||||
|
@ -10,11 +11,10 @@ use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm;
|
|||
use Icinga\Module\Monitoring\Forms\Command\Object\RemoveAcknowledgementCommandForm;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleHostCheckCommandForm;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleHostDowntimeCommandForm;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\AddCommentCommandForm;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\SendCustomNotificationCommandForm;
|
||||
use Icinga\Module\Monitoring\Object\Host;
|
||||
use Icinga\Module\Monitoring\Object\HostList;
|
||||
use Icinga\Web\Url;
|
||||
use Icinga\Web\Widget\Chart\InlinePie;
|
||||
use Icinga\Web\Widget\Tabextension\DashboardAction;
|
||||
|
||||
class Monitoring_HostsController extends Controller
|
||||
|
@ -26,9 +26,28 @@ class Monitoring_HostsController extends Controller
|
|||
|
||||
public function init()
|
||||
{
|
||||
// Support switching from service-view using the host and service selection. The filter would error
|
||||
// on any occurrence of a filter based on service.
|
||||
$filterString = preg_replace('/(service=[^)&]*)/', '', (string)$this->params);
|
||||
|
||||
$hostList = new HostList($this->backend);
|
||||
$hostList->setFilter(Filter::fromQueryString((string) $this->params->without('view')));
|
||||
$this->hostList = $hostList;
|
||||
|
||||
$this->getTabs()->add(
|
||||
'show',
|
||||
array(
|
||||
'title' => sprintf(
|
||||
$this->translate('Show summarized information for %u hosts'),
|
||||
count($this->hostList)
|
||||
),
|
||||
'label' => $this->translate('Hosts') . sprintf(' (%d)', count($this->hostList)),
|
||||
'url' => Url::fromRequest(),
|
||||
'icon' => 'host'
|
||||
)
|
||||
)->extend(new DashboardAction())->activate('show');
|
||||
|
||||
$this->view->listAllLink = Url::fromRequest()->setPath('monitoring/list/hosts')->setQueryString($filterString);
|
||||
}
|
||||
|
||||
protected function handleCommandForm(ObjectsCommandForm $form)
|
||||
|
@ -39,7 +58,14 @@ class Monitoring_HostsController extends Controller
|
|||
'host_problem',
|
||||
'host_handled',
|
||||
'host_acknowledged',
|
||||
'host_in_downtime'
|
||||
'host_in_downtime',
|
||||
'host_last_ack',
|
||||
'host_is_flapping',
|
||||
'host_last_comment',
|
||||
'host_output',
|
||||
'host_notifications_enabled',
|
||||
'host_active_checks_enabled',
|
||||
'host_passive_checks_enabled'
|
||||
));
|
||||
|
||||
$form
|
||||
|
@ -47,23 +73,13 @@ class Monitoring_HostsController extends Controller
|
|||
->setRedirectUrl(Url::fromPath('monitoring/hosts/show')->setParams($this->params))
|
||||
->handleRequest();
|
||||
|
||||
$hostStates = array(
|
||||
Host::getStateText(Host::STATE_UP) => 0,
|
||||
Host::getStateText(Host::STATE_DOWN) => 0,
|
||||
Host::getStateText(Host::STATE_UNREACHABLE) => 0,
|
||||
Host::getStateText(Host::STATE_PENDING) => 0,
|
||||
);
|
||||
foreach ($this->hostList as $host) {
|
||||
++$hostStates[$host::getStateText($host->state)];
|
||||
}
|
||||
|
||||
$this->view->form = $form;
|
||||
$this->view->objects = $this->hostList;
|
||||
$this->view->hostStates = $hostStates;
|
||||
$this->view->hostStatesPieChart = $this->createPieChart(
|
||||
$hostStates,
|
||||
$this->view->stats = $this->hostList->getStateSummary();
|
||||
$this->view->hostStatesPieChart = InlinePie::createFromStateSummary(
|
||||
$this->view->stats,
|
||||
$this->translate('Host State'),
|
||||
array('#44bb77', '#FF5566', '#E066FF', '#77AAFF')
|
||||
InlinePie::$colorsHostStatesHandledUnhandled
|
||||
);
|
||||
$this->_helper->viewRenderer('partials/command/objects-command-form', null, true);
|
||||
return $form;
|
||||
|
@ -71,17 +87,6 @@ class Monitoring_HostsController extends Controller
|
|||
|
||||
public function showAction()
|
||||
{
|
||||
$this->getTabs()->add(
|
||||
'show',
|
||||
array(
|
||||
'title' => sprintf(
|
||||
$this->translate('Show summarized information for %u hosts'),
|
||||
count($this->hostList)
|
||||
),
|
||||
'label' => $this->translate('Hosts'),
|
||||
'url' => Url::fromRequest()
|
||||
)
|
||||
)->extend(new DashboardAction())->activate('show');
|
||||
$this->setAutorefreshInterval(15);
|
||||
$checkNowForm = new CheckNowCommandForm();
|
||||
$checkNowForm
|
||||
|
@ -94,40 +99,20 @@ class Monitoring_HostsController extends Controller
|
|||
'host_problem',
|
||||
'host_handled',
|
||||
'host_acknowledged',
|
||||
'host_in_downtime'/*,
|
||||
'host_passive_checks_enabled',
|
||||
'host_in_downtime',
|
||||
'host_last_ack',
|
||||
'host_is_flapping',
|
||||
'host_last_comment',
|
||||
'host_output',
|
||||
'host_notifications_enabled',
|
||||
'host_event_handler_enabled',
|
||||
'host_flap_detection_enabled',
|
||||
'host_active_checks_enabled',
|
||||
'host_passive_checks_enabled'
|
||||
/*'host_event_handler_enabled',
|
||||
'host_flap_detection_enabled',
|
||||
'host_obsessing'*/
|
||||
));
|
||||
$unhandledObjects = array();
|
||||
$unhandledFilterExpressions = array();
|
||||
$acknowledgedObjects = array();
|
||||
$objectsInDowntime = array();
|
||||
$downtimeFilterExpressions = array();
|
||||
$hostStates = array(
|
||||
Host::getStateText(Host::STATE_UP) => 0,
|
||||
Host::getStateText(Host::STATE_DOWN) => 0,
|
||||
Host::getStateText(Host::STATE_UNREACHABLE) => 0,
|
||||
Host::getStateText(Host::STATE_PENDING) => 0,
|
||||
);
|
||||
foreach ($this->hostList as $host) {
|
||||
/** @var Host $host */
|
||||
if ((bool) $host->problem === true && (bool) $host->handled === false) {
|
||||
$unhandledObjects[] = $host;
|
||||
$unhandledFilterExpressions[] = Filter::where('host', $host->getName());
|
||||
}
|
||||
if ((bool) $host->acknowledged === true) {
|
||||
$acknowledgedObjects[] = $host;
|
||||
}
|
||||
if ((bool) $host->in_downtime === true) {
|
||||
$objectsInDowntime[] = $host;
|
||||
$downtimeFilterExpressions[] = Filter::where('host_name', $host->getName());
|
||||
}
|
||||
++$hostStates[$host::getStateText($host->state)];
|
||||
}
|
||||
|
||||
$acknowledgedObjects = $this->hostList->getAcknowledgedObjects();
|
||||
if (! empty($acknowledgedObjects)) {
|
||||
$removeAckForm = new RemoveAcknowledgementCommandForm();
|
||||
$removeAckForm
|
||||
|
@ -135,43 +120,68 @@ class Monitoring_HostsController extends Controller
|
|||
->handleRequest();
|
||||
$this->view->removeAckForm = $removeAckForm;
|
||||
}
|
||||
|
||||
$hostStates = (object)$this->hostList->getStateSummary();
|
||||
|
||||
$this->setAutorefreshInterval(15);
|
||||
$this->view->listAllLink = Url::fromRequest()->setPath('monitoring/list/hosts');
|
||||
$this->view->rescheduleAllLink = Url::fromRequest()->setPath('monitoring/hosts/reschedule-check');
|
||||
$this->view->downtimeAllLink = Url::fromRequest()->setPath('monitoring/hosts/schedule-downtime');
|
||||
$this->view->processCheckResultAllLink = Url::fromRequest()->setPath('monitoring/hosts/process-check-result');
|
||||
$this->view->hostStates = $hostStates;
|
||||
$this->view->addCommentLink = Url::fromRequest()->setPath('monitoring/hosts/add-comment');
|
||||
$this->view->stats = $hostStates;
|
||||
$this->view->objects = $this->hostList;
|
||||
$this->view->unhandledObjects = $unhandledObjects;
|
||||
$unhandledFilterQueryString = Filter::matchAny($unhandledFilterExpressions)->toQueryString();
|
||||
$this->view->unhandledObjects = $this->hostList->getUnhandledObjects();
|
||||
$this->view->problemObjects = $this->hostList->getProblemObjects();
|
||||
|
||||
$this->view->acknowledgeUnhandledLink = Url::fromPath('monitoring/hosts/acknowledge-problem')
|
||||
->setQueryString($unhandledFilterQueryString);
|
||||
->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter());
|
||||
$this->view->downtimeUnhandledLink = Url::fromPath('monitoring/hosts/schedule-downtime')
|
||||
->setQueryString($unhandledFilterQueryString);
|
||||
$this->view->acknowledgedObjects = $acknowledgedObjects;
|
||||
$this->view->objectsInDowntime = $objectsInDowntime;
|
||||
$this->view->inDowntimeLink = Url::fromPath('monitoring/list/downtimes')
|
||||
->setQueryString(Filter::matchAny($downtimeFilterExpressions)->toQueryString());
|
||||
$this->view->commentsLink = Url::fromRequest()
|
||||
->setPath('monitoring/list/comments');
|
||||
$this->view->hostStatesPieChart = $this->createPieChart(
|
||||
$hostStates,
|
||||
$this->translate('Host State'),
|
||||
array('#44bb77', '#FF5566', '#E066FF', '#77AAFF')
|
||||
);
|
||||
$this->view->sendCustomNotificationLink =
|
||||
Url::fromRequest()->setPath(
|
||||
'monitoring/hosts/send-custom-notification'
|
||||
->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter());
|
||||
$this->view->downtimeLink = Url::fromPath('monitoring/hosts/schedule-downtime')
|
||||
->setQueryString($this->hostList->getProblemObjects()->objectsFilter());
|
||||
$this->view->acknowledgedObjects = $this->hostList->getAcknowledgedObjects();
|
||||
$this->view->objectsInDowntime = $this->hostList->getObjectsInDowntime();
|
||||
$this->view->inDowntimeLink = Url::fromPath('monitoring/list/hosts')
|
||||
->setQueryString(
|
||||
$this->hostList
|
||||
->getObjectsInDowntime()
|
||||
->objectsFilter()
|
||||
->toQueryString()
|
||||
);
|
||||
$this->view->showDowntimesLink = Url::fromPath('monitoring/list/downtimes')
|
||||
->setQueryString(
|
||||
$this->hostList
|
||||
->objectsFilter()
|
||||
->andFilter(FilterEqual::where('downtime_objecttype', 'host'))
|
||||
->toQueryString()
|
||||
);
|
||||
$this->view->commentsLink = Url::fromRequest()->setPath('monitoring/list/comments');
|
||||
$this->view->baseFilter = $this->hostList->getFilter();
|
||||
$this->view->sendCustomNotificationLink = Url::fromRequest()->setPath('monitoring/hosts/send-custom-notification');
|
||||
}
|
||||
|
||||
protected function createPieChart(array $states, $title, array $colors)
|
||||
/**
|
||||
* Add a host comments
|
||||
*/
|
||||
public function addCommentAction()
|
||||
{
|
||||
$chart = new InlinePie(array_values($states), $title, $colors);
|
||||
return $chart
|
||||
->setSize(75)
|
||||
->setTitle('')
|
||||
->setSparklineClass('sparkline-multi');
|
||||
$this->assertPermission('monitoring/command/comment/add');
|
||||
|
||||
$form = new AddCommentCommandForm();
|
||||
$form->setTitle($this->translate('Add Host Comments'));
|
||||
$this->handleCommandForm($form);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a comment
|
||||
*/
|
||||
public function deleteCommentAction()
|
||||
{
|
||||
$this->assertPermission('monitoring/command/comment/delete');
|
||||
|
||||
$form = new DeleteCommentCommandForm();
|
||||
$form->setTitle($this->translate('Delete Host Comments'));
|
||||
$this->handleCommandForm($form);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,6 +12,7 @@ use Icinga\Web\Widget\Tabs;
|
|||
use Icinga\Data\Filter\Filter;
|
||||
use Icinga\Web\Widget;
|
||||
use Icinga\Module\Monitoring\Forms\StatehistoryForm;
|
||||
use Icinga\Data\Filterable;
|
||||
|
||||
class Monitoring_ListController extends Controller
|
||||
{
|
||||
|
@ -94,8 +95,8 @@ class Monitoring_ListController extends Controller
|
|||
'host_passive_checks_enabled',
|
||||
'host_current_check_attempt',
|
||||
'host_max_check_attempts'
|
||||
), $this->extraColumns()));
|
||||
$this->filterQuery($query);
|
||||
), $this->addColumns()));
|
||||
$this->filterQuery($query, array('host', 'host_display_name'));
|
||||
$this->applyRestriction('monitoring/hosts/filter', $query);
|
||||
$this->view->hosts = $query;
|
||||
|
||||
|
@ -177,9 +178,9 @@ class Monitoring_ListController extends Controller
|
|||
'service_passive_checks_enabled',
|
||||
'current_check_attempt' => 'service_current_check_attempt',
|
||||
'max_check_attempts' => 'service_max_check_attempts'
|
||||
), $this->extraColumns());
|
||||
), $this->addColumns());
|
||||
$query = $this->backend->select()->from('serviceStatus', $columns);
|
||||
$this->filterQuery($query);
|
||||
$this->filterQuery($query, array('service', 'service_display_name'));
|
||||
$this->applyRestriction('monitoring/services/filter', $query);
|
||||
$this->view->services = $query;
|
||||
|
||||
|
@ -497,7 +498,7 @@ class Monitoring_ListController extends Controller
|
|||
))->order('services_severity')->order('servicegroup_alias');
|
||||
// TODO(el): Can't default to the sort rules of the data view because it's meant for both host groups and
|
||||
// service groups. We should separate them.
|
||||
$this->filterQuery($query);
|
||||
$this->filterQuery($query, array('servicegroup', 'servicegroup_alias'));
|
||||
$this->view->servicegroups = $query;
|
||||
|
||||
$this->setupLimitControl();
|
||||
|
@ -554,7 +555,7 @@ class Monitoring_ListController extends Controller
|
|||
))->order('services_severity')->order('hostgroup_alias');
|
||||
// TODO(el): Can't default to the sort rules of the data view because it's meant for both host groups and
|
||||
// service groups. We should separate them.
|
||||
$this->filterQuery($query);
|
||||
$this->filterQuery($query, array('hostgroup', 'hostgroup_alias'));
|
||||
$this->view->hostgroups = $query;
|
||||
|
||||
$this->setupLimitControl();
|
||||
|
@ -625,7 +626,15 @@ class Monitoring_ListController extends Controller
|
|||
$this->view->verticalPaginator = $pivot->paginateYAxis();
|
||||
}
|
||||
|
||||
protected function filterQuery($query)
|
||||
/**
|
||||
* Apply filters on a query
|
||||
*
|
||||
* @param Filterable $query The query to apply filters on
|
||||
* @param array $searchColumns Columns to search in
|
||||
*
|
||||
* @return Filterable $query
|
||||
*/
|
||||
protected function filterQuery(Filterable $query, array $searchColumns = null)
|
||||
{
|
||||
$editor = Widget::create('filterEditor')
|
||||
->setQuery($query)
|
||||
|
@ -633,8 +642,11 @@ class Monitoring_ListController extends Controller
|
|||
'limit', 'sort', 'dir', 'format', 'view', 'backend',
|
||||
'stateType', 'addColumns', '_dev'
|
||||
)
|
||||
->ignoreParams('page')
|
||||
->handleRequest($this->getRequest());
|
||||
->ignoreParams('page');
|
||||
if ($searchColumns !== null) {
|
||||
$editor->setSearchColumns($searchColumns);
|
||||
}
|
||||
$editor->handleRequest($this->getRequest());
|
||||
$query->applyFilter($editor->getFilter());
|
||||
|
||||
$this->setupFilterControl($editor);
|
||||
|
@ -644,7 +656,13 @@ class Monitoring_ListController extends Controller
|
|||
return $query;
|
||||
}
|
||||
|
||||
protected function extraColumns()
|
||||
/**
|
||||
* Get columns to be added from URL parameter 'addColumns'
|
||||
* and assign to $this->view->addColumns (as array)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function addColumns()
|
||||
{
|
||||
$columns = preg_split(
|
||||
'~,~',
|
||||
|
@ -652,7 +670,7 @@ class Monitoring_ListController extends Controller
|
|||
-1,
|
||||
PREG_SPLIT_NO_EMPTY
|
||||
);
|
||||
$this->view->extraColumns = $columns;
|
||||
$this->view->addColumns = $columns;
|
||||
return $columns;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleServiceDowntimeCommand
|
|||
use Icinga\Module\Monitoring\Forms\Command\Object\SendCustomNotificationCommandForm;
|
||||
use Icinga\Module\Monitoring\Object\Service;
|
||||
use Icinga\Module\Monitoring\Web\Controller\MonitoredObjectController;
|
||||
use Icinga\Web\Hook;
|
||||
|
||||
class Monitoring_ServiceController extends MonitoredObjectController
|
||||
{
|
||||
|
@ -48,6 +49,34 @@ class Monitoring_ServiceController extends MonitoredObjectController
|
|||
$this->getTabs()->activate('service');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get service actions from hook
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getServiceActions()
|
||||
{
|
||||
$urls = array();
|
||||
|
||||
foreach (Hook::all('Monitoring\\ServiceActions') as $hook) {
|
||||
foreach ($hook->getActionsForService($this->object) as $id => $url) {
|
||||
$urls[$id] = $url;
|
||||
}
|
||||
}
|
||||
|
||||
return $urls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a service
|
||||
*/
|
||||
public function showAction()
|
||||
{
|
||||
$this->view->actions = $this->getServiceActions();
|
||||
parent::showAction();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Acknowledge a service problem
|
||||
*/
|
||||
|
|
|
@ -10,12 +10,11 @@ use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm;
|
|||
use Icinga\Module\Monitoring\Forms\Command\Object\RemoveAcknowledgementCommandForm;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleServiceCheckCommandForm;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleServiceDowntimeCommandForm;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\AddCommentCommandForm;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\SendCustomNotificationCommandForm;
|
||||
use Icinga\Module\Monitoring\Object\Host;
|
||||
use Icinga\Module\Monitoring\Object\Service;
|
||||
use Icinga\Module\Monitoring\Object\ServiceList;
|
||||
use Icinga\Web\Url;
|
||||
use Icinga\Web\Widget\Chart\InlinePie;
|
||||
use Icinga\Web\Widget\Tabextension\DashboardAction;
|
||||
|
||||
class Monitoring_ServicesController extends Controller
|
||||
|
@ -32,68 +31,8 @@ class Monitoring_ServicesController extends Controller
|
|||
(string) $this->params->without(array('service_problem', 'service_handled', 'view'))
|
||||
));
|
||||
$this->serviceList = $serviceList;
|
||||
}
|
||||
$this->view->listAllLink = Url::fromRequest()->setPath('monitoring/list/services');
|
||||
|
||||
protected function handleCommandForm(ObjectsCommandForm $form)
|
||||
{
|
||||
$this->serviceList->setColumns(array(
|
||||
'host_name',
|
||||
'host_state',
|
||||
'service_description',
|
||||
'service_state',
|
||||
'service_problem',
|
||||
'service_handled',
|
||||
'service_acknowledged',
|
||||
'service_in_downtime'
|
||||
));
|
||||
|
||||
$form
|
||||
->setObjects($this->serviceList)
|
||||
->setRedirectUrl(Url::fromPath('monitoring/services/show')->setParams($this->params))
|
||||
->handleRequest();
|
||||
|
||||
$serviceStates = array(
|
||||
Service::getStateText(Service::STATE_OK) => 0,
|
||||
Service::getStateText(Service::STATE_WARNING) => 0,
|
||||
Service::getStateText(Service::STATE_CRITICAL) => 0,
|
||||
Service::getStateText(Service::STATE_UNKNOWN) => 0,
|
||||
Service::getStateText(Service::STATE_PENDING) => 0
|
||||
);
|
||||
$knownHostStates = array();
|
||||
$hostStates = array(
|
||||
Host::getStateText(Host::STATE_UP) => 0,
|
||||
Host::getStateText(Host::STATE_DOWN) => 0,
|
||||
Host::getStateText(Host::STATE_UNREACHABLE) => 0,
|
||||
Host::getStateText(Host::STATE_PENDING) => 0,
|
||||
);
|
||||
foreach ($this->serviceList as $service) {
|
||||
++$serviceStates[$service::getStateText($service->state)];
|
||||
if (! isset($knownHostStates[$service->getHost()->getName()])) {
|
||||
$knownHostStates[$service->getHost()->getName()] = true;
|
||||
++$hostStates[$service->getHost()->getStateText($service->host_state)];
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->form = $form;
|
||||
$this->view->objects = $this->serviceList;
|
||||
$this->view->serviceStates = $serviceStates;
|
||||
$this->view->hostStates = $hostStates;
|
||||
$this->view->serviceStatesPieChart = $this->createPieChart(
|
||||
$serviceStates,
|
||||
$this->translate('Service State'),
|
||||
array('#44bb77', '#FFCC66', '#FF5566', '#E066FF', '#77AAFF')
|
||||
);
|
||||
$this->view->hostStatesPieChart = $this->createPieChart(
|
||||
$hostStates,
|
||||
$this->translate('Host State'),
|
||||
array('#44bb77', '#FF5566', '#E066FF', '#77AAFF')
|
||||
);
|
||||
$this->_helper->viewRenderer('partials/command/objects-command-form', null, true);
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function showAction()
|
||||
{
|
||||
$this->getTabs()->add(
|
||||
'show',
|
||||
array(
|
||||
|
@ -101,10 +40,52 @@ class Monitoring_ServicesController extends Controller
|
|||
$this->translate('Show summarized information for %u services'),
|
||||
count($this->serviceList)
|
||||
),
|
||||
'label' => $this->translate('Services'),
|
||||
'url' => Url::fromRequest()
|
||||
'label' => $this->translate('Services') . sprintf(' (%d)', count($this->serviceList)),
|
||||
'url' => Url::fromRequest(),
|
||||
'icon' => 'services'
|
||||
)
|
||||
)->extend(new DashboardAction())->activate('show');
|
||||
}
|
||||
|
||||
protected function handleCommandForm(ObjectsCommandForm $form)
|
||||
{
|
||||
$this->serviceList->setColumns(array(
|
||||
'host_name',
|
||||
'host_output',
|
||||
'host_state',
|
||||
'host_problem',
|
||||
'host_handled',
|
||||
'service_description',
|
||||
'service_state',
|
||||
'service_problem',
|
||||
'service_handled',
|
||||
'service_acknowledged',
|
||||
'service_in_downtime',
|
||||
'service_is_flapping',
|
||||
'service_output',
|
||||
'service_last_ack',
|
||||
'service_last_comment',
|
||||
'service_notifications_enabled',
|
||||
'service_active_checks_enabled',
|
||||
'service_passive_checks_enabled'
|
||||
));
|
||||
|
||||
$form
|
||||
->setObjects($this->serviceList)
|
||||
->setRedirectUrl(Url::fromPath('monitoring/services/show')->setParams($this->params))
|
||||
->handleRequest();
|
||||
|
||||
$this->view->form = $form;
|
||||
$this->view->objects = $this->serviceList;
|
||||
$this->view->stats = $this->serviceList->getServiceStateSummary();
|
||||
$this->view->serviceStates = true;
|
||||
$this->view->hostStates = $this->serviceList->getHostStateSummary();
|
||||
$this->_helper->viewRenderer('partials/command/objects-command-form', null, true);
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function showAction()
|
||||
{
|
||||
$this->setAutorefreshInterval(15);
|
||||
$checkNowForm = new CheckNowCommandForm();
|
||||
$checkNowForm
|
||||
|
@ -113,64 +94,30 @@ class Monitoring_ServicesController extends Controller
|
|||
$this->view->checkNowForm = $checkNowForm;
|
||||
$this->serviceList->setColumns(array(
|
||||
'host_name',
|
||||
'host_output',
|
||||
'host_state',
|
||||
'host_problem',
|
||||
'host_handled',
|
||||
'service_output',
|
||||
'service_description',
|
||||
'service_state',
|
||||
'service_problem',
|
||||
'service_handled',
|
||||
'service_acknowledged',
|
||||
'service_in_downtime'/*,
|
||||
'service_passive_checks_enabled',
|
||||
'service_in_downtime',
|
||||
'service_is_flapping',
|
||||
'service_last_comment',
|
||||
'service_last_ack',
|
||||
'service_notifications_enabled',
|
||||
'service_active_checks_enabled',
|
||||
'service_passive_checks_enabled'
|
||||
/*
|
||||
'service_event_handler_enabled',
|
||||
'service_flap_detection_enabled',
|
||||
'service_active_checks_enabled',
|
||||
'service_obsessing'*/
|
||||
));
|
||||
$unhandledObjects = array();
|
||||
$unhandledFilterExpressions = array();
|
||||
$acknowledgedObjects = array();
|
||||
$objectsInDowntime = array();
|
||||
$downtimeFilterExpressions = array();
|
||||
$serviceStates = array(
|
||||
Service::getStateText(Service::STATE_OK) => 0,
|
||||
Service::getStateText(Service::STATE_WARNING) => 0,
|
||||
Service::getStateText(Service::STATE_CRITICAL) => 0,
|
||||
Service::getStateText(Service::STATE_UNKNOWN) => 0,
|
||||
Service::getStateText(Service::STATE_PENDING) => 0
|
||||
);
|
||||
$knownHostStates = array();
|
||||
$hostStates = array(
|
||||
Host::getStateText(Host::STATE_UP) => 0,
|
||||
Host::getStateText(Host::STATE_DOWN) => 0,
|
||||
Host::getStateText(Host::STATE_UNREACHABLE) => 0,
|
||||
Host::getStateText(Host::STATE_PENDING) => 0,
|
||||
);
|
||||
foreach ($this->serviceList as $service) {
|
||||
/** @var Service $service */
|
||||
if ((bool) $service->problem === true && (bool) $service->handled === false) {
|
||||
$unhandledObjects[] = $service;
|
||||
$unhandledFilterExpressions[] = Filter::matchAll(
|
||||
Filter::where('host', $service->getHost()->getName()),
|
||||
Filter::where('service', $service->getName())
|
||||
);
|
||||
}
|
||||
if ((bool) $service->acknowledged === true) {
|
||||
$acknowledgedObjects[] = $service;
|
||||
}
|
||||
if ((bool) $service->in_downtime === true) {
|
||||
$objectsInDowntime[] = $service;
|
||||
$downtimeFilterExpressions[] = Filter::matchAll(
|
||||
Filter::where('host_name', $service->getHost()->getName()),
|
||||
Filter::where('service_description', $service->getName())
|
||||
);
|
||||
}
|
||||
++$serviceStates[$service::getStateText($service->state)];
|
||||
if (! isset($knownHostStates[$service->getHost()->getName()])) {
|
||||
$knownHostStates[$service->getHost()->getName()] = true;
|
||||
++$hostStates[$service->getHost()->getStateText($service->host_state)];
|
||||
}
|
||||
}
|
||||
|
||||
$acknowledgedObjects = $this->serviceList->getAcknowledgedObjects();
|
||||
if (! empty($acknowledgedObjects)) {
|
||||
$removeAckForm = new RemoveAcknowledgementCommandForm();
|
||||
$removeAckForm
|
||||
|
@ -178,53 +125,70 @@ class Monitoring_ServicesController extends Controller
|
|||
->handleRequest();
|
||||
$this->view->removeAckForm = $removeAckForm;
|
||||
}
|
||||
|
||||
$this->setAutorefreshInterval(15);
|
||||
$this->view->listAllLink = Url::fromRequest()->setPath('monitoring/list/services');
|
||||
$this->view->rescheduleAllLink = Url::fromRequest()->setPath('monitoring/services/reschedule-check');
|
||||
$this->view->downtimeAllLink = Url::fromRequest()->setPath('monitoring/services/schedule-downtime');
|
||||
$this->view->processCheckResultAllLink = Url::fromRequest()->setPath(
|
||||
'monitoring/services/process-check-result'
|
||||
);
|
||||
$this->view->hostStates = $hostStates;
|
||||
$this->view->serviceStates = $serviceStates;
|
||||
$this->view->addCommentLink = Url::fromRequest()->setPath('monitoring/services/add-comment');
|
||||
$this->view->deleteCommentLink = Url::fromRequest()->setPath('monitoring/services/delete-comment');
|
||||
$this->view->stats = $this->serviceList->getServiceStateSummary();
|
||||
$this->view->hostStats = $this->serviceList->getHostStateSummary();
|
||||
$this->view->objects = $this->serviceList;
|
||||
$this->view->unhandledObjects = $unhandledObjects;
|
||||
$unhandledFilterQueryString = Filter::matchAny($unhandledFilterExpressions)->toQueryString();
|
||||
$this->view->unhandledObjects = $this->serviceList->getUnhandledObjects();
|
||||
$this->view->problemObjects = $this->serviceList->getProblemObjects();
|
||||
$this->view->acknowledgeUnhandledLink = Url::fromPath('monitoring/services/acknowledge-problem')
|
||||
->setQueryString($unhandledFilterQueryString);
|
||||
->setQueryString($this->serviceList->getUnhandledObjects()->objectsFilter()->toQueryString());
|
||||
$this->view->downtimeUnhandledLink = Url::fromPath('monitoring/services/schedule-downtime')
|
||||
->setQueryString($unhandledFilterQueryString);
|
||||
->setQueryString($this->serviceList->getUnhandledObjects()->objectsFilter()->toQueryString());
|
||||
$this->view->downtimeLink = Url::fromPath('monitoring/services/schedule-downtime')
|
||||
->setQueryString($this->serviceList->getProblemObjects()->objectsFilter()->toQueryString());
|
||||
$this->view->acknowledgedObjects = $acknowledgedObjects;
|
||||
$this->view->objectsInDowntime = $objectsInDowntime;
|
||||
$this->view->inDowntimeLink = Url::fromPath('monitoring/list/downtimes')
|
||||
->setQueryString(Filter::matchAny($downtimeFilterExpressions)->toQueryString());
|
||||
$this->view->objectsInDowntime = $this->serviceList->getObjectsInDowntime();
|
||||
$this->view->inDowntimeLink = Url::fromPath('monitoring/list/services')
|
||||
->setQueryString($this->serviceList->getObjectsInDowntime()
|
||||
->objectsFilter(array('host' => 'host_name', 'service' => 'service_description'))->toQueryString());
|
||||
$this->view->showDowntimesLink = Url::fromPath('monitoring/downtimes/show')
|
||||
->setQueryString(
|
||||
$this->serviceList->getObjectsInDowntime()
|
||||
->objectsFilter()->toQueryString()
|
||||
);
|
||||
$this->view->commentsLink = Url::fromRequest()
|
||||
->setPath('monitoring/list/comments');
|
||||
$this->view->serviceStatesPieChart = $this->createPieChart(
|
||||
$serviceStates,
|
||||
$this->translate('Service State'),
|
||||
array('#44bb77', '#FFCC66', '#FF5566', '#E066FF', '#77AAFF')
|
||||
$this->view->baseFilter = $this->serviceList->getFilter();
|
||||
$this->view->sendCustomNotificationLink = Url::fromRequest()->setPath(
|
||||
'monitoring/services/send-custom-notification'
|
||||
);
|
||||
$this->view->hostStatesPieChart = $this->createPieChart(
|
||||
$hostStates,
|
||||
$this->translate('Host State'),
|
||||
array('#44bb77', '#FF5566', '#E066FF', '#77AAFF')
|
||||
);
|
||||
$this->view->sendCustomNotificationLink =
|
||||
Url::fromRequest()->setPath(
|
||||
'monitoring/services/send-custom-notification'
|
||||
);
|
||||
}
|
||||
|
||||
protected function createPieChart(array $states, $title, array $colors)
|
||||
/**
|
||||
* Add a service comment
|
||||
*/
|
||||
public function addCommentAction()
|
||||
{
|
||||
$chart = new InlinePie(array_values($states), $title, $colors);
|
||||
return $chart
|
||||
->setSize(75)
|
||||
->setTitle('')
|
||||
->setSparklineClass('sparkline-multi');
|
||||
$this->assertPermission('monitoring/command/comment/add');
|
||||
|
||||
$form = new AddCommentCommandForm();
|
||||
$form->setTitle($this->translate('Add Service Comments'));
|
||||
$this->handleCommandForm($form);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a comment
|
||||
*/
|
||||
public function deleteCommentAction()
|
||||
{
|
||||
$this->assertPermission('monitoring/command/comment/delete');
|
||||
|
||||
$form = new DeleteCommentCommandForm();
|
||||
$form->setTitle($this->translate('Delete Service Comments'));
|
||||
$this->handleCommandForm($form);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Acknowledge service problems
|
||||
*/
|
||||
|
|
|
@ -85,7 +85,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
|
|||
'checkbox',
|
||||
ToggleInstanceFeatureCommand::FEATURE_ACTIVE_HOST_CHECKS,
|
||||
array(
|
||||
'label' => $this->translate('Active Host Checks Being Executed'),
|
||||
'label' => $this->translate('Active Host Checks'),
|
||||
'autosubmit' => true,
|
||||
'disabled' => $toggleDisabled
|
||||
)
|
||||
|
@ -94,7 +94,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
|
|||
'checkbox',
|
||||
ToggleInstanceFeatureCommand::FEATURE_ACTIVE_SERVICE_CHECKS,
|
||||
array(
|
||||
'label' => $this->translate('Active Service Checks Being Executed'),
|
||||
'label' => $this->translate('Active Service Checks'),
|
||||
'autosubmit' => true,
|
||||
'disabled' => $toggleDisabled
|
||||
)
|
||||
|
@ -103,7 +103,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
|
|||
'checkbox',
|
||||
ToggleInstanceFeatureCommand::FEATURE_EVENT_HANDLERS,
|
||||
array(
|
||||
'label' => $this->translate('Event Handlers Enabled'),
|
||||
'label' => $this->translate('Event Handlers'),
|
||||
'autosubmit' => true,
|
||||
'disabled' => $toggleDisabled
|
||||
)
|
||||
|
@ -112,7 +112,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
|
|||
'checkbox',
|
||||
ToggleInstanceFeatureCommand::FEATURE_FLAP_DETECTION,
|
||||
array(
|
||||
'label' => $this->translate('Flap Detection Enabled'),
|
||||
'label' => $this->translate('Flap Detection'),
|
||||
'autosubmit' => true,
|
||||
'disabled' => $toggleDisabled
|
||||
)
|
||||
|
@ -121,7 +121,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
|
|||
'checkbox',
|
||||
ToggleInstanceFeatureCommand::FEATURE_NOTIFICATIONS,
|
||||
array(
|
||||
'label' => $this->translate('Notifications Enabled'),
|
||||
'label' => $this->translate('Notifications'),
|
||||
'autosubmit' => true,
|
||||
'description' => $notificationDescription,
|
||||
'decorators' => array(
|
||||
|
@ -159,7 +159,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
|
|||
'checkbox',
|
||||
ToggleInstanceFeatureCommand::FEATURE_PASSIVE_HOST_CHECKS,
|
||||
array(
|
||||
'label' => $this->translate('Passive Host Checks Being Accepted'),
|
||||
'label' => $this->translate('Passive Host Checks'),
|
||||
'autosubmit' => true,
|
||||
'disabled' => $toggleDisabled
|
||||
)
|
||||
|
@ -168,7 +168,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
|
|||
'checkbox',
|
||||
ToggleInstanceFeatureCommand::FEATURE_PASSIVE_SERVICE_CHECKS,
|
||||
array(
|
||||
'label' => $this->translate('Passive Service Checks Being Accepted'),
|
||||
'label' => $this->translate('Passive Service Checks'),
|
||||
'autosubmit' => true,
|
||||
'disabled' => $toggleDisabled
|
||||
)
|
||||
|
@ -177,7 +177,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
|
|||
'checkbox',
|
||||
ToggleInstanceFeatureCommand::FEATURE_PERFORMANCE_DATA,
|
||||
array(
|
||||
'label' => $this->translate('Performance Data Being Processed'),
|
||||
'label' => $this->translate('Performance Data'),
|
||||
'autosubmit' => true,
|
||||
'disabled' => $toggleDisabled
|
||||
)
|
||||
|
@ -209,6 +209,50 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
|
|||
public function onSuccess()
|
||||
{
|
||||
$this->assertPermission('monitoring/command/feature/instance');
|
||||
|
||||
$notifications = array(
|
||||
ToggleInstanceFeatureCommand::FEATURE_ACTIVE_HOST_CHECKS => array(
|
||||
$this->translate('Enabling active host checks..'),
|
||||
$this->translate('Disabling active host checks..')
|
||||
),
|
||||
ToggleInstanceFeatureCommand::FEATURE_ACTIVE_SERVICE_CHECKS => array(
|
||||
$this->translate('Enabling active service checks..'),
|
||||
$this->translate('Disabling active service checks..')
|
||||
),
|
||||
ToggleInstanceFeatureCommand::FEATURE_EVENT_HANDLERS => array(
|
||||
$this->translate('Enabling event handlers..'),
|
||||
$this->translate('Disabling event handlers..')
|
||||
),
|
||||
ToggleInstanceFeatureCommand::FEATURE_FLAP_DETECTION => array(
|
||||
$this->translate('Enabling flap detection..'),
|
||||
$this->translate('Disabling flap detection..')
|
||||
),
|
||||
ToggleInstanceFeatureCommand::FEATURE_NOTIFICATIONS => array(
|
||||
$this->translate('Enabling notifications..'),
|
||||
$this->translate('Disabling notifications..')
|
||||
),
|
||||
ToggleInstanceFeatureCommand::FEATURE_HOST_OBSESSING => array(
|
||||
$this->translate('Enabling obsessing over hosts..'),
|
||||
$this->translate('Disabling obsessing over hosts..')
|
||||
),
|
||||
ToggleInstanceFeatureCommand::FEATURE_SERVICE_OBSESSING => array(
|
||||
$this->translate('Enabling obsessing over services..'),
|
||||
$this->translate('Disabling obsessing over services..')
|
||||
),
|
||||
ToggleInstanceFeatureCommand::FEATURE_PASSIVE_HOST_CHECKS => array(
|
||||
$this->translate('Enabling passive host checks..'),
|
||||
$this->translate('Disabling passive host checks..')
|
||||
),
|
||||
ToggleInstanceFeatureCommand::FEATURE_PASSIVE_SERVICE_CHECKS => array(
|
||||
$this->translate('Enabling passive service checks..'),
|
||||
$this->translate('Disabling passive service checks..')
|
||||
),
|
||||
ToggleInstanceFeatureCommand::FEATURE_PERFORMANCE_DATA => array(
|
||||
$this->translate('Enabling performance data..'),
|
||||
$this->translate('Disabling performance data..')
|
||||
)
|
||||
);
|
||||
|
||||
foreach ($this->getValues() as $feature => $enabled) {
|
||||
$toggleFeature = new ToggleInstanceFeatureCommand();
|
||||
$toggleFeature
|
||||
|
@ -216,10 +260,9 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
|
|||
->setEnabled($enabled);
|
||||
$this->getTransport($this->request)->send($toggleFeature);
|
||||
|
||||
if ($this->status->{$feature} != $enabled) {
|
||||
Notification::success($enabled
|
||||
? $this->translate('Enabling feature..')
|
||||
: $this->translate('Disabling feature..')
|
||||
if ((bool) $this->status->{$feature} !== (bool) $enabled) {
|
||||
Notification::success(
|
||||
$notifications[$feature][$enabled ? 0 : 1]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,6 +117,34 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
|
|||
public function onSuccess()
|
||||
{
|
||||
$this->assertPermission('monitoring/command/feature/object');
|
||||
|
||||
$notifications = array(
|
||||
ToggleObjectFeatureCommand::FEATURE_ACTIVE_CHECKS => array(
|
||||
$this->translate('Enabling active checks..'),
|
||||
$this->translate('Disabling active checks..')
|
||||
),
|
||||
ToggleObjectFeatureCommand::FEATURE_PASSIVE_CHECKS => array(
|
||||
$this->translate('Enabling passive checks..'),
|
||||
$this->translate('Disabling passive checks..')
|
||||
),
|
||||
ToggleObjectFeatureCommand::FEATURE_OBSESSING => array(
|
||||
$this->translate('Enabling obsessing..'),
|
||||
$this->translate('Disabling obsessing..')
|
||||
),
|
||||
ToggleObjectFeatureCommand::FEATURE_NOTIFICATIONS => array(
|
||||
$this->translate('Enabling notifications..'),
|
||||
$this->translate('Disabling notifications..')
|
||||
),
|
||||
ToggleObjectFeatureCommand::FEATURE_EVENT_HANDLER => array(
|
||||
$this->translate('Enabling event handler..'),
|
||||
$this->translate('Disabling event handler..')
|
||||
),
|
||||
ToggleObjectFeatureCommand::FEATURE_FLAP_DETECTION => array(
|
||||
$this->translate('Enabling flap detection..'),
|
||||
$this->translate('Disabling flap detection..')
|
||||
)
|
||||
);
|
||||
|
||||
foreach ($this->objects as $object) {
|
||||
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
|
||||
foreach ($this->getValues() as $feature => $enabled) {
|
||||
|
@ -127,10 +155,13 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
|
|||
->setObject($object)
|
||||
->setEnabled($enabled);
|
||||
$this->getTransport($this->request)->send($toggleFeature);
|
||||
|
||||
Notification::success(
|
||||
$notifications[$feature][$enabled ? 0 : 1]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Notification::success($this->translate('Toggling feature..'));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||
|
||||
/**
|
||||
* Generate icons to describe a given hosts state
|
||||
*/
|
||||
class Zend_View_Helper_HostFlags extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function hostFlags($host)
|
||||
{
|
||||
$icons = array();
|
||||
if (! $host->host_handled && $host->host_state > 0) {
|
||||
$icons[] = $this->view->icon('attention-alt', $this->view->translate('Unhandled'));
|
||||
}
|
||||
if ($host->host_acknowledged) {
|
||||
$icons[] = $this->view->icon('ok', $this->view->translate('Acknowledged'));
|
||||
}
|
||||
if ($host->host_is_flapping) {
|
||||
$icons[] = $this->view->icon('flapping', $this->view->translate('Flapping'));
|
||||
}
|
||||
if (! $host->host_notifications_enabled) {
|
||||
$icons[] = $this->view->icon('bell-off-empty', $this->view->translate('Notifications Disabled'));
|
||||
}
|
||||
if ($host->host_in_downtime) {
|
||||
$icons[] = $this->view->icon('plug', $this->view->translate('In Downtime'));
|
||||
}
|
||||
if (! $host->host_active_checks_enabled) {
|
||||
if (! $host->host_passive_checks_enabled) {
|
||||
$icons[] = $this->view->icon('eye-off', $this->view->translate('Active And Passive Checks Disabled'));
|
||||
} else {
|
||||
$icons[] = $this->view->icon('eye-off', $this->view->translate('Active Checks Disabled'));
|
||||
}
|
||||
}
|
||||
if (isset($host->host_last_comment) && $host->host_last_comment !== null) {
|
||||
$icons[] = $this->view->icon('comment', $this->view->translate('Last Comment: ') . $host->host_last_comment);
|
||||
}
|
||||
return $icons;
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||
|
||||
class Zend_View_Helper_SelectionToolbar extends Zend_View_Helper_Abstract
|
||||
{
|
||||
/**
|
||||
* Create a selection toolbar
|
||||
*
|
||||
* @param $type
|
||||
* @param null $target
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function selectionToolbar($type, $target = null)
|
||||
{
|
||||
return '';
|
||||
if ($type == 'multi') {
|
||||
return '<div class="selection-toolbar">'
|
||||
. '<a href="' . $target . '" data-base-target="_next"> Show All </a> </div>';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||
|
||||
class Zend_View_Helper_ServiceFlags extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function serviceFlags($service) {
|
||||
$icons = array();
|
||||
if (!$service->service_handled && $service->service_state > 0) {
|
||||
$icons[] = $this->view->icon('attention-alt', $this->view->translate('Unhandled'));
|
||||
}
|
||||
if ($service->service_acknowledged && !$service->service_in_downtime) {
|
||||
$icons[] = $this->view->icon('ok', $this->view->translate('Acknowledged') . (
|
||||
$service->service_last_ack ? ': ' . $service->service_last_ack : ''
|
||||
));
|
||||
}
|
||||
if ($service->service_is_flapping) {
|
||||
$icons[] = $this->view->icon('flapping', $this->view->translate('Flapping')) ;
|
||||
}
|
||||
if (!$service->service_notifications_enabled) {
|
||||
$icons[] = $this->view->icon('bell-off-empty', $this->view->translate('Notifications Disabled'));
|
||||
}
|
||||
if ($service->service_in_downtime) {
|
||||
$icons[] = $this->view->icon('plug', $this->view->translate('In Downtime'));
|
||||
}
|
||||
if (isset($service->service_last_comment) && $service->service_last_comment !== null) {
|
||||
$icons[] = $this->view->icon(
|
||||
'comment',
|
||||
$this->view->translate('Last Comment: ') . $service->service_last_comment
|
||||
);
|
||||
}
|
||||
if (!$service->service_active_checks_enabled) {
|
||||
if (!$service->service_passive_checks_enabled) {
|
||||
$icons[] = $this->view->icon('eye-off', $this->view->translate('Active And Passive Checks Disabled'));
|
||||
} else {
|
||||
$icons[] = $this->view->icon('eye-off', $this->view->translate('Active Checks Disabled'));
|
||||
}
|
||||
}
|
||||
return $icons;
|
||||
}
|
||||
}
|
|
@ -8,18 +8,11 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<div class="content multi-commands">
|
||||
<h3><?= $this->icon('reschedule') ?> <?= $this->translate('Commands') ?> </h3>
|
||||
<p>
|
||||
<?= sprintf(
|
||||
$this->translate('Issue commands to all %s selected comments.'),
|
||||
'<b>' . count($comments) . '</b>'
|
||||
)
|
||||
?>
|
||||
<div>
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translate('Remove all %d scheduled comments'),
|
||||
$this->translate('Remove %d comments'),
|
||||
count($comments)
|
||||
),
|
||||
$removeAllLink,
|
||||
|
@ -29,6 +22,4 @@
|
|||
'title' => $this->translate('Remove all selected comments.')
|
||||
)
|
||||
) ?>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -7,15 +7,8 @@
|
|||
<?= $this->render('partials/downtime/downtimes-header.phtml'); ?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h3><?= $this->icon('reschedule') ?> <?= $this->translate('Commands') ?> </h3>
|
||||
<p>
|
||||
<?= sprintf(
|
||||
$this->translate('Issue commands to all %s selected downtimes.'),
|
||||
'<b>' . count($downtimes) . '</b>'
|
||||
)
|
||||
?>
|
||||
<div>
|
||||
<div class="content multi-commands">
|
||||
<h3><?= $this->icon('reschedule') ?> <?= $this->translate('Commands') ?> </h3>
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translate('Remove all %d scheduled downtimes'),
|
||||
|
@ -28,6 +21,4 @@
|
|||
'title' => $this->translate('Remove all selected downtimes.')
|
||||
)
|
||||
) ?>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -1,127 +1,231 @@
|
|||
<div class="controls">
|
||||
<?php if (! $this->compact): ?>
|
||||
<?= $tabs; ?>
|
||||
<?php endif ?>
|
||||
<div data-base-target='_next' class="controls">
|
||||
<?php if (! $this->compact): ?>
|
||||
<?= $tabs; ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?= $this->render('list/components/hostssummary.phtml') ?>
|
||||
<?= $this->render('partials/host/objects-header.phtml'); ?>
|
||||
|
||||
</div>
|
||||
<div class="content">
|
||||
|
||||
<div class="content multi-commands">
|
||||
<h3>
|
||||
<?= $this->icon('reschedule') ?>
|
||||
<?= $this->translate('Commands') ?>
|
||||
</h3>
|
||||
|
||||
<p>
|
||||
<?= sprintf($this->translatePlural(
|
||||
'Issue commands to %s selected host:',
|
||||
'Issue commands to all %s selected hosts:',
|
||||
count($objects)
|
||||
), '<b>' . count($objects) . '</b>') ?>
|
||||
</p>
|
||||
|
||||
<?php if (($hostCount = count($objects)) === 0): ?>
|
||||
<?= $this->translate('No hosts found matching the filter'); ?>
|
||||
<?php else: ?>
|
||||
<h3><?= sprintf($this->translatePlural('%u Host', '%u Hosts', $hostCount), $hostCount); ?></h3>
|
||||
<div><?= $this->qlink(
|
||||
sprintf($this->translate('List all %u hosts'), $hostCount),
|
||||
$listAllLink
|
||||
); ?></div>
|
||||
<div>
|
||||
<?= $checkNowForm; ?>
|
||||
</div>
|
||||
<div><?= $this->qlink(
|
||||
sprintf($this->translate('Reschedule the next check for all %u hosts'), $hostCount),
|
||||
<?= $checkNowForm; ?>
|
||||
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
$this->translate('Reschedule next checks'),
|
||||
$rescheduleAllLink,
|
||||
null,
|
||||
array('icon' => 'reschedule')
|
||||
); ?></div>
|
||||
<div><?= $this->qlink(
|
||||
sprintf($this->translate('Schedule a downtime for all %u hosts'), $hostCount),
|
||||
); ?>
|
||||
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
$this->translate('Schedule downtimes'),
|
||||
$downtimeAllLink,
|
||||
null,
|
||||
array('icon' => 'plug')
|
||||
); ?></div>
|
||||
<div><?= $this->qlink(
|
||||
sprintf($this->translate('Submit a passive check result for all %u hosts'), $hostCount),
|
||||
); ?>
|
||||
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
$this->translate('Submit passive check results'),
|
||||
$processCheckResultAllLink,
|
||||
null,
|
||||
array('icon' => 'reply')
|
||||
); ?></div>
|
||||
); ?>
|
||||
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
$this->translate('Add comments'),
|
||||
$addCommentLink,
|
||||
null,
|
||||
array('icon' => 'comment')
|
||||
); ?>
|
||||
|
||||
<?php if ($this->hasPermission('monitoring/command/send-custom-notification')): ?>
|
||||
<div><?= $this->qlink(
|
||||
sprintf($this->translate('Send a custom notification for all %u hosts'), $hostCount),
|
||||
$sendCustomNotificationLink,
|
||||
null,
|
||||
array('icon' => 'comment')
|
||||
); ?></div>
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
sprintf($this->translate('Send a custom notification for all %u hosts'), $hostCount),
|
||||
$sendCustomNotificationLink,
|
||||
null,
|
||||
array('icon' => 'comment')
|
||||
); ?>
|
||||
<?php endif; ?>
|
||||
<?php if (($unhandledCount = count($unhandledObjects)) > 0): ?>
|
||||
<div>
|
||||
<h3><?= sprintf(
|
||||
$this->translatePlural(
|
||||
'%u Unhandled Host Problem',
|
||||
'%u Unhandled Host Problems',
|
||||
$unhandledCount
|
||||
),
|
||||
$unhandledCount
|
||||
); ?></h3>
|
||||
<div><?= $this->qlink(
|
||||
sprintf(
|
||||
|
||||
<?php
|
||||
$unhandledCount = count($unhandledObjects);
|
||||
$problemCount = count($problemObjects);
|
||||
?>
|
||||
|
||||
<?php if ($problemCount || $unhandledCount): ?>
|
||||
<h3>
|
||||
<?= $this->icon('attention-alt') ?>
|
||||
<?= $this->translatePlural(
|
||||
'Problem',
|
||||
'Problems',
|
||||
$unhandledCount + $problemCount
|
||||
) ?>
|
||||
</h3>
|
||||
|
||||
<?php if ($problemCount): ?>
|
||||
<p>
|
||||
<?= sprintf(
|
||||
$this->translatePlural(
|
||||
'Schedule a downtime for %u unhandled host problem',
|
||||
'Schedule a downtime for %u unhandled host problems',
|
||||
'There is %s problem.',
|
||||
'There are %s problems.',
|
||||
$problemCount
|
||||
),
|
||||
'<b>' . $problemCount . '</b>'
|
||||
); ?>
|
||||
</p>
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'Schedule a downtime for %u problem host',
|
||||
'Schedule a downtime for %u problem hosts',
|
||||
$problemCount
|
||||
),
|
||||
$problemCount
|
||||
),
|
||||
$downtimeLink,
|
||||
null,
|
||||
array('icon' => 'plug')
|
||||
); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($unhandledCount): ?>
|
||||
<p>
|
||||
<?= sprintf(
|
||||
$this->translatePlural(
|
||||
'There is %s unhandled problem host, issue commands to the problematic host:',
|
||||
'There are %s unhandled problem hosts, issue commands to the problematic hosts:',
|
||||
$unhandledCount
|
||||
),
|
||||
'<span class="badge badge-critical">' . $unhandledCount . '</span>'
|
||||
); ?>
|
||||
</p>
|
||||
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'Schedule a downtime for %u unhandled problem host',
|
||||
'Schedule a downtime for %u unhandled problem hosts',
|
||||
$unhandledCount
|
||||
),
|
||||
$unhandledCount
|
||||
),
|
||||
$downtimeUnhandledLink,
|
||||
null,
|
||||
array('icon' => 'plug')
|
||||
); ?>
|
||||
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'Acknowledge %u unhandled problem host',
|
||||
'Acknowledge %u unhandled problem hosts',
|
||||
$unhandledCount
|
||||
),
|
||||
$unhandledCount
|
||||
),
|
||||
$unhandledCount
|
||||
),
|
||||
$downtimeUnhandledLink,
|
||||
null,
|
||||
array('icon' => 'plug')
|
||||
); ?></div>
|
||||
<div><?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'Acknowledge %u unhandled host problem',
|
||||
'Acknowledge %u unhandled host problems',
|
||||
$unhandledCount
|
||||
),
|
||||
$unhandledCount
|
||||
),
|
||||
$acknowledgeUnhandledLink,
|
||||
null,
|
||||
array('icon' => 'ok')
|
||||
); ?></div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
$acknowledgeUnhandledLink,
|
||||
null,
|
||||
array('icon' => 'ok')
|
||||
); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php endif;?>
|
||||
|
||||
<?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?>
|
||||
<div>
|
||||
<h2><?= sprintf(
|
||||
<h3><?= $this->icon('ok', $this->translate('Acknowledgements')) ?> <?= $this->translate('Acknowledgements') ?></h3>
|
||||
|
||||
<?= sprintf(
|
||||
$this->translatePlural(
|
||||
'%u Acknowledged Host Problem',
|
||||
'%u Acknowledged Host Problems',
|
||||
'%s Acknowledged Host Problem',
|
||||
'%s Acknowledged Host Problems',
|
||||
$acknowledgedCount
|
||||
),
|
||||
$acknowledgedCount
|
||||
); ?></h2>
|
||||
'<b>' . $acknowledgedCount . '</b>'
|
||||
); ?>
|
||||
|
||||
<?= $removeAckForm ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php if (($inDowntimeCount = count($objectsInDowntime)) > 0): ?>
|
||||
<h2><?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'List %u host currently in downtime',
|
||||
'List %u hosts currently in downtime',
|
||||
$inDowntimeCount
|
||||
|
||||
<?php $scheduledDowntimeCount = count($objects->getScheduledDowntimes()) ?>
|
||||
|
||||
<?php if ($scheduledDowntimeCount): ?>
|
||||
<h3><?= $this->icon('plug', $this->translate('Downtimes'))?> <?=$this->translate('Downtimes')?></h3>
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'%s scheduled downtime',
|
||||
'%s scheduled downtimes',
|
||||
$scheduledDowntimeCount
|
||||
),
|
||||
$scheduledDowntimeCount
|
||||
),
|
||||
$inDowntimeCount
|
||||
),
|
||||
$inDowntimeLink,
|
||||
null,
|
||||
array('icon' => 'plug')
|
||||
); ?></h2>
|
||||
$showDowntimesLink,
|
||||
null,
|
||||
array('data-base-target' => '_next')
|
||||
);?>
|
||||
<?= sprintf($this->translate('on all selected hosts.')) ?>
|
||||
|
||||
<?php if (($inDowntimeCount = count($objectsInDowntime)) > 0): ?>
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'%s host',
|
||||
'%s hosts',
|
||||
$inDowntimeCount
|
||||
),
|
||||
$inDowntimeCount
|
||||
),
|
||||
$inDowntimeLink,
|
||||
null,
|
||||
array('data-base-target' => '_next')
|
||||
); ?>
|
||||
<?= $this->translate('are currently in downtime.') ?>
|
||||
<?php endif; ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (($commentCount = count($objects->getComments())) > 0): ?>
|
||||
<h2><?= $this->qlink(
|
||||
<h3> <?= $this->icon('comment', $this->translate('Comments'))?> <?=$this->translate('Comments') ?></h3>
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'List %u host comment',
|
||||
'List %u host comments',
|
||||
'%s comment',
|
||||
'%s comments',
|
||||
$commentCount
|
||||
),
|
||||
$commentCount
|
||||
),
|
||||
$commentsLink,
|
||||
null,
|
||||
array('icon' => 'comment')
|
||||
); ?></h2>
|
||||
array('data-base-target' => '_next')
|
||||
); ?>
|
||||
<?= $this->translate('on all selected hosts.') ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php endif ?>
|
||||
</div>
|
|
@ -1,7 +1,17 @@
|
|||
<?php
|
||||
|
||||
use Icinga\Web\Url;
|
||||
use Icinga\Data\Filter\Filter;
|
||||
|
||||
function urlAddFilterOptional($url, $filter, $optional) {
|
||||
$url = Url::fromPath($url);
|
||||
$f = $filter;
|
||||
if (isset($optional)) {
|
||||
$f = Filter::matchAll($filter, $optional);
|
||||
}
|
||||
return $url->setQueryString($f->toQueryString());
|
||||
}
|
||||
$this->baseFilter = isset($this->baseFilter) ? $this->baseFilter : null;
|
||||
$selfUrl = 'monitoring/list/hosts';
|
||||
$currentUrl = Url::fromRequest()->getRelativeUrl();
|
||||
?><div class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : ''; ?>>
|
||||
|
@ -10,17 +20,22 @@ $currentUrl = Url::fromRequest()->getRelativeUrl();
|
|||
<?php if ($this->stats->hosts_up): ?>
|
||||
<span class="state ok<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 0))->getRelativeUrl() ? ' active' : ''; ?>">
|
||||
<?= $this->qlink(
|
||||
$this->stats->hosts_up,
|
||||
$selfUrl,
|
||||
array('host_state' => 0),
|
||||
array('title' => sprintf(
|
||||
$this->translatePlural(
|
||||
'List %u host that is currently in state UP',
|
||||
'List %u hosts which are currently in state UP',
|
||||
$this->stats->hosts_up
|
||||
$this->stats->hosts_up,
|
||||
urlAddFilterOptional(
|
||||
$selfUrl,
|
||||
Filter::where('host_state', 0),
|
||||
$this->baseFilter
|
||||
),
|
||||
$this->stats->hosts_up
|
||||
))
|
||||
null,
|
||||
array('title' => sprintf(
|
||||
$this->translatePlural(
|
||||
'List %u host that is currently in state UP',
|
||||
'List %u hosts which are currently in state UP',
|
||||
$this->stats->hosts_up
|
||||
),
|
||||
$this->stats->hosts_up
|
||||
)
|
||||
)
|
||||
); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
@ -29,11 +44,12 @@ $currentUrl = Url::fromRequest()->getRelativeUrl();
|
|||
<span class="state critical<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 1, 'host_unhandled' => 1))->getRelativeUrl() ? ' active' : ''; ?>">
|
||||
<?= $this->qlink(
|
||||
$this->stats->hosts_down_unhandled,
|
||||
$selfUrl,
|
||||
array(
|
||||
'host_state' => 1,
|
||||
'host_unhandled' => 1
|
||||
urlAddFilterOptional(
|
||||
$selfUrl,
|
||||
Filter::matchAll(Filter::where('host_state', 1), Filter::where('host_unhandled', 1)),
|
||||
$this->baseFilter
|
||||
),
|
||||
null,
|
||||
array('title' => sprintf(
|
||||
$this->translatePlural(
|
||||
'List %u host that is currently in state DOWN',
|
||||
|
@ -49,11 +65,12 @@ $currentUrl = Url::fromRequest()->getRelativeUrl();
|
|||
<span class="state handled critical<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 1, 'host_unhandled' =>0))->getRelativeUrl() ? ' active' : ''; ?>">
|
||||
<?= $this->qlink(
|
||||
$this->stats->hosts_down_handled,
|
||||
$selfUrl,
|
||||
array(
|
||||
'host_state' => 1,
|
||||
'host_unhandled' => 0
|
||||
urlAddFilterOptional(
|
||||
$selfUrl,
|
||||
Filter::matchAll(Filter::where('host_state', 1), Filter::where('host_unhandled', 0)),
|
||||
$this->baseFilter
|
||||
),
|
||||
null,
|
||||
array('title' => sprintf(
|
||||
$this->translatePlural(
|
||||
'List %u host that is currently in state DOWN (Acknowledged)',
|
||||
|
@ -74,11 +91,12 @@ $currentUrl = Url::fromRequest()->getRelativeUrl();
|
|||
<span class="state unknown<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 2, 'host_unhandled' => 1))->getRelativeUrl() ? ' active' : ''; ?>">
|
||||
<?= $this->qlink(
|
||||
$this->stats->hosts_unreachable_unhandled,
|
||||
$selfUrl,
|
||||
array(
|
||||
'host_state' => 2,
|
||||
'host_unhandled' => 1
|
||||
urlAddFilterOptional(
|
||||
$selfUrl,
|
||||
Filter::matchAll(Filter::where('host_state', 2), Filter::where('host_unhandled', 1)),
|
||||
$this->baseFilter
|
||||
),
|
||||
null,
|
||||
array('title' => sprintf(
|
||||
$this->translatePlural(
|
||||
'List %u host that is currently in state UNREACHABLE',
|
||||
|
@ -94,11 +112,12 @@ $currentUrl = Url::fromRequest()->getRelativeUrl();
|
|||
<span class="state handled unknown<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 2, 'host_unhandled' => 0))->getRelativeUrl() ? ' active' : '' ?>">
|
||||
<?= $this->qlink(
|
||||
$this->stats->hosts_unreachable_handled,
|
||||
$selfUrl,
|
||||
array(
|
||||
'host_state' => 2,
|
||||
'host_unhandled' => 0
|
||||
urlAddFilterOptional(
|
||||
$selfUrl,
|
||||
Filter::matchAll(Filter::where('host_state', 2), Filter::where('host_unhandled', 0)),
|
||||
$this->baseFilter
|
||||
),
|
||||
null,
|
||||
array('title' => sprintf(
|
||||
$this->translatePlural(
|
||||
'List %u host that is currently in state UNREACHABLE (Acknowledged)',
|
||||
|
@ -119,8 +138,12 @@ $currentUrl = Url::fromRequest()->getRelativeUrl();
|
|||
<span class="state pending<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 99))->getRelativeUrl() ? ' active' : ''; ?>">
|
||||
<?= $this->qlink(
|
||||
$this->stats->hosts_pending,
|
||||
$selfUrl,
|
||||
array('host_state' => 99),
|
||||
urlAddFilterOptional(
|
||||
$selfUrl,
|
||||
Filter::where('host_state', 99),
|
||||
$this->baseFilter
|
||||
),
|
||||
null,
|
||||
array('title' => sprintf(
|
||||
$this->translatePlural(
|
||||
'List %u host that is currently in state PENDING',
|
||||
|
|
|
@ -1,8 +1,19 @@
|
|||
<?php
|
||||
|
||||
use Icinga\Data\Filter\Filter;
|
||||
use Icinga\Web\Url;
|
||||
use Icinga\Module\Monitoring\Object\Service;
|
||||
|
||||
function urlAddFilterOptional($url, $filter, $optional) {
|
||||
$url = Url::fromPath($url);
|
||||
$f = $filter;
|
||||
if (isset($optional)) {
|
||||
$f = Filter::matchAll($filter, $optional);
|
||||
}
|
||||
return $url->setQueryString($f->toQueryString());
|
||||
}
|
||||
$this->baseFilter = isset($this->baseFilter) ? $this->baseFilter : null;
|
||||
|
||||
$selfUrl = 'monitoring/list/services';
|
||||
$currentUrl = Url::fromRequest()->getRelativeUrl();
|
||||
?><div class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : ''; ?>>
|
||||
|
@ -10,19 +21,21 @@ $currentUrl = Url::fromRequest()->getRelativeUrl();
|
|||
<span class="badges">
|
||||
<?php if ($this->stats->services_ok): ?>
|
||||
<span class="state ok<?= $currentUrl === Url::fromPath($selfUrl, array('service_state' => 0))->getRelativeUrl() ? ' active' : ''; ?>">
|
||||
<?= $this->qlink(
|
||||
$this->stats->services_ok,
|
||||
$selfUrl,
|
||||
array('service_state' => 0),
|
||||
array('title' => sprintf(
|
||||
$this->translatePlural(
|
||||
'List %u service that is currently in state OK',
|
||||
'List %u services which are currently in state OK',
|
||||
<?=
|
||||
$this->qlink(
|
||||
$this->stats->services_ok,
|
||||
urlAddFilterOptional($selfUrl, Filter::where('service_state', 0), $this->baseFilter),
|
||||
null,
|
||||
array('title' => sprintf(
|
||||
$this->translatePlural(
|
||||
'List %u service that is currently in state OK',
|
||||
'List %u services which are currently in state OK',
|
||||
$this->stats->services_ok
|
||||
),
|
||||
$this->stats->services_ok
|
||||
),
|
||||
$this->stats->services_ok
|
||||
))
|
||||
); ?>
|
||||
))
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
<?php endif ?>
|
||||
<?php
|
||||
|
@ -31,12 +44,18 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $
|
|||
if ($this->stats->$pre) {
|
||||
$handled = $pre . '_handled';
|
||||
$unhandled = $pre . '_unhandled';
|
||||
$paramsHandled = array('service_state' => $stateId, 'service_handled' => 1);
|
||||
$paramsUnhandled = array('service_state' => $stateId, 'service_handled' => 0);
|
||||
$paramsHandled = Filter::matchAll(
|
||||
Filter::where('service_state', $stateId),
|
||||
Filter::where('service_handled', 1)
|
||||
);
|
||||
$paramsUnhandled = Filter::matchAll(
|
||||
Filter::where('service_state', $stateId),
|
||||
Filter::where('service_handled', 0)
|
||||
);
|
||||
if ($this->stats->$unhandled) {
|
||||
$compareUrl = Url::fromPath($selfUrl, $paramsUnhandled)->getRelativeUrl();
|
||||
$compareUrl = Url::fromPath($selfUrl)->setQueryString($paramsUnhandled->toQueryString())->getRelativeUrl();
|
||||
} else {
|
||||
$compareUrl = Url::fromPath($selfUrl, $paramsHandled)->getRelativeUrl();
|
||||
$compareUrl = Url::fromPath($selfUrl)->setQueryString($paramsUnhandled->toQueryString())->getRelativeUrl();
|
||||
}
|
||||
|
||||
if ($compareUrl === $currentUrl) {
|
||||
|
@ -50,8 +69,8 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $
|
|||
|
||||
echo $this->qlink(
|
||||
$this->stats->$unhandled,
|
||||
$selfUrl,
|
||||
$paramsUnhandled,
|
||||
urlAddFilterOptional($selfUrl, $paramsUnhandled, $this->baseFilter),
|
||||
null,
|
||||
array('title' => sprintf(
|
||||
$this->translatePlural(
|
||||
'List %u service that is currently in state %s',
|
||||
|
@ -65,7 +84,7 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $
|
|||
}
|
||||
if ($this->stats->$handled) {
|
||||
|
||||
if (Url::fromPath($selfUrl, $paramsHandled)->getRelativeUrl() === $currentUrl) {
|
||||
if (Url::fromPath($selfUrl)->setQueryString($paramsHandled->toQueryString())->getRelativeUrl() === $currentUrl) {
|
||||
$active = ' active';
|
||||
} else {
|
||||
$active = '';
|
||||
|
@ -75,8 +94,8 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $
|
|||
}
|
||||
echo $this->qlink(
|
||||
$this->stats->$handled,
|
||||
$selfUrl,
|
||||
$paramsHandled,
|
||||
urlAddFilterOptional($selfUrl, $paramsHandled, $this->baseFilter),
|
||||
null,
|
||||
array('title' => sprintf(
|
||||
$this->translatePlural(
|
||||
'List %u service that is currently in state %s (Acknowledged)',
|
||||
|
@ -99,8 +118,8 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $
|
|||
<span class="state pending<?= $currentUrl === Url::fromPath($selfUrl, array('service_state' => 99))->getRelativeUrl() ? ' active' : ''; ?>">
|
||||
<?= $this->qlink(
|
||||
$this->stats->services_pending,
|
||||
$selfUrl,
|
||||
array('service_state' => 99),
|
||||
urlAddFilterOptional($selfUrl, Filter::where('service_state', 99), $this->baseFilter),
|
||||
null,
|
||||
array('title' => sprintf(
|
||||
$this->translatePlural(
|
||||
'List %u service that is currently in state PENDING',
|
||||
|
|
|
@ -11,7 +11,6 @@ if (! $this->compact): ?>
|
|||
<?= $this->sortBox; ?>
|
||||
<?= $this->limiter; ?>
|
||||
<?= $this->paginator; ?>
|
||||
<?= $this->selectionToolbar('multi', $this->href('monitoring/hosts/show?' . $this->filter->toQueryString())); ?>
|
||||
<?= $this->filterEditor; ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
@ -36,38 +35,7 @@ if (count($hosts) === 0) {
|
|||
$hostStateName = Host::getStateText($host->host_state);
|
||||
$hostLink = $this->href('monitoring/host/show', array('host' => $host->host_name));
|
||||
|
||||
$icons = array();
|
||||
if (! $host->host_handled && $host->host_state > 0){
|
||||
$icons[] = $this->icon('attention-alt', $this->translate('Unhandled'));
|
||||
}
|
||||
|
||||
if ($host->host_acknowledged) {
|
||||
$icons[] = $this->icon('ok', $this->translate('Acknowledged'));
|
||||
}
|
||||
|
||||
if ($host->host_is_flapping) {
|
||||
$icons[] = $this->icon('flapping', $this->translate('Flapping'));
|
||||
}
|
||||
|
||||
if (! $host->host_notifications_enabled) {
|
||||
$icons[] = $this->icon('bell-off-empty', $this->translate('Notifications Disabled'));
|
||||
}
|
||||
|
||||
if ($host->host_in_downtime) {
|
||||
$icons[] = $this->icon('plug', $this->translate('In Downtime'));
|
||||
}
|
||||
|
||||
if (! $host->host_active_checks_enabled) {
|
||||
if (! $host->host_passive_checks_enabled) {
|
||||
$icons[] = $this->icon('eye-off', $this->translate('Active And Passive Checks Disabled'));
|
||||
} else {
|
||||
$icons[] = $this->icon('eye-off', $this->translate('Active Checks Disabled'));
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($host->host_last_comment) && $host->host_last_comment !== null) {
|
||||
$icons[] = $this->icon('comment', $this->translate('Last Comment: ') . $host->host_last_comment);
|
||||
}
|
||||
?>
|
||||
<tr class="state <?= $hostStateName ?><?= $host->host_handled ? ' handled' : '' ?>">
|
||||
<!-- State -->
|
||||
|
@ -87,7 +55,7 @@ if (count($hosts) === 0) {
|
|||
<?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) ?>
|
||||
<?= implode(' ', $this->hostFlags($host)) ?>
|
||||
<?= $this->qlink(
|
||||
$host->host_display_name,
|
||||
$hostLink,
|
||||
|
@ -124,7 +92,7 @@ if (count($hosts) === 0) {
|
|||
<?php endif ?>
|
||||
<p class="pluginoutput"><?= $this->escape($this->ellipsis($host->host_output, 10000)) ?></p>
|
||||
</td>
|
||||
<?php foreach($this->extraColumns as $col): ?>
|
||||
<?php foreach($this->addColumns as $col): ?>
|
||||
<td><?= $this->escape($host->$col) ?></td>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
|
|
|
@ -59,39 +59,7 @@ if (count($services) === 0) {
|
|||
<td>
|
||||
<div class="sparkline-box"><?= $this->perfdata($service->service_perfdata, true, 8) ?> </div>
|
||||
|
||||
<?php if (!$service->service_handled && $service->service_state > 0): ?>
|
||||
<?= $this->icon('attention-alt', $this->translate('Unhandled')) ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($service->service_acknowledged && !$service->service_in_downtime): ?>
|
||||
<?= $this->icon('ok', $this->translate('Acknowledged') . (
|
||||
$service->service_last_ack ? ': ' . $service->service_last_ack : ''
|
||||
)) ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($service->service_is_flapping): ?>
|
||||
<?= $this->icon('flapping', $this->translate('Flapping')) ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (!$service->service_notifications_enabled): ?>
|
||||
<?= $this->icon('bell-off-empty', $this->translate('Notifications Disabled')) ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($service->service_in_downtime): ?>
|
||||
<?= $this->icon('plug', $this->translate('In Downtime')) ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (isset($service->service_last_comment) && $service->service_last_comment !== null): ?>
|
||||
<?= $this->icon('comment', $this->translate('Last Comment: ') . $service->service_last_comment) ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (!$service->service_active_checks_enabled): ?>
|
||||
<?php if (!$service->service_passive_checks_enabled): ?>
|
||||
<?= $this->icon('eye-off', $this->translate('Active And Passive Checks Disabled')) ?>
|
||||
<?php else: ?>
|
||||
<?= $this->icon('eye-off', $this->translate('Active Checks Disabled')) ?>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
<?= implode(' ', $this->serviceFlags($service)); ?>
|
||||
|
||||
<?php if ($service->service_icon_image && ! preg_match('/[\'"]/', $service->service_icon_image)): ?>
|
||||
<?= $this->icon($this->resolveMacros($service->service_icon_image, $service)) ?>
|
||||
|
@ -113,7 +81,7 @@ if (count($services) === 0) {
|
|||
); ?><?php endif ?><br>
|
||||
<p class="pluginoutput"><?= $this->escape($this->ellipsis($service->service_output, 10000)); ?></p>
|
||||
</td>
|
||||
<?php foreach($this->extraColumns as $col): ?>
|
||||
<?php foreach($this->addColumns as $col): ?>
|
||||
<td><?= $this->escape($service->$col) ?></td>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
|
|
|
@ -1,31 +1,19 @@
|
|||
<div class="controls">
|
||||
|
||||
<?php if (! $this->compact): ?>
|
||||
<?= $tabs; ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (isset($serviceStates)): ?>
|
||||
<?= $this->render('list/components/servicesummary.phtml') ?>
|
||||
<?= $this->render('partials/service/objects-header.phtml'); ?>
|
||||
<?php else: ?>
|
||||
<?= $this->render('list/components/hostssummary.phtml') ?>
|
||||
<?= $this->render('partials/host/objects-header.phtml'); ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
<div class="content objects-command">
|
||||
<table class="objectlist">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= $this->icon('host'); ?> <?= $this->translate('Host'); ?></th>
|
||||
<th><?= $this->icon('conf'); ?> <?= $this->translate('Service'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($form->getObjects() as $object): /** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */ ?>
|
||||
<tr>
|
||||
<?php if ($object->getType() === $object::TYPE_HOST): ?>
|
||||
<td colspan="2"><?= $this->escape($object->getName()); ?></td>
|
||||
<?php else: ?>
|
||||
<td><?= $this->escape($object->getHost()->getName()); ?></td>
|
||||
<td><?= $this->escape($object->getName()); ?></td>
|
||||
<?php endif ?>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<hr class="command-separator">
|
||||
<?= $form; ?>
|
||||
</div>
|
||||
|
|
|
@ -18,13 +18,15 @@
|
|||
</table>
|
||||
|
||||
<p>
|
||||
<?php if ($i > 5): ?>
|
||||
<?= $this->qlink(
|
||||
sprintf($this->translate('List all %d comments …'), count($comments)),
|
||||
sprintf($this->translate('show all %d comments'), $i),
|
||||
$listAllLink,
|
||||
null,
|
||||
array(
|
||||
'title' => $this->translate('List all'),
|
||||
'icon' => $i > 5 ? 'down-open' : '',
|
||||
'data-base-target' => "_next"
|
||||
)
|
||||
) ?>
|
||||
<?php endif ?>
|
||||
</p>
|
||||
|
|
|
@ -79,14 +79,16 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<p>
|
||||
<?php if ($i > 5): ?>
|
||||
<?= $this->qlink(
|
||||
sprintf($this->translate('List all %d downtimes …'), count($downtimes)),
|
||||
sprintf($this->translate('show all %d downtimes'), $i),
|
||||
$listAllLink,
|
||||
null,
|
||||
array(
|
||||
'title' => $this->translate('List all'),
|
||||
'icon' => $i > 5 ? 'down-open' : '',
|
||||
'data-base-target' => "_next"
|
||||
)
|
||||
) ?>
|
||||
<?php endif ?>
|
||||
</p>
|
|
@ -1,13 +1,44 @@
|
|||
<?php
|
||||
use Icinga\Module\Monitoring\Object\Host;
|
||||
|
||||
$i = 0;
|
||||
?>
|
||||
|
||||
<?php if (($hostCount = count($objects)) > 0): ?>
|
||||
<div class="hbox-item">
|
||||
<strong><?= sprintf($this->translatePlural('Host (%u)', 'Hosts (%u)', $hostCount), $hostCount); ?></strong>
|
||||
</div>
|
||||
<div class="hbox-item">
|
||||
<?= $hostStatesPieChart; ?>
|
||||
</div>
|
||||
<div class="hbox-item" style="font-size: 14px">
|
||||
<?php foreach (array_filter($hostStates) as $text => $count): ?>
|
||||
<?= sprintf('%s: %u', $this->translate(strtoupper($text)), $count); ?><br>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<table class="action state statesummary">
|
||||
<tbody>
|
||||
<?php foreach ($objects as $host): /** @var Host $host */ ?>
|
||||
<?php
|
||||
if (++ $i > 5) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
|
||||
<tr class="state <?= Host::getStateText($host->host_state); ?><?= $host->host_handled ? ' handled' : '' ?>">
|
||||
<td class="state"><?= Host::getStateText($host->host_state, true); ?><br /></td>
|
||||
<td>
|
||||
<?= implode(' ', $this->hostFlags($host)) ?>
|
||||
<b><?= $this->escape($host->getName()); ?></b><br>
|
||||
<?= $this->escape($host->host_output) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="hbox-item multi-commands">
|
||||
<?php if ($i > 5): ?>
|
||||
<?=
|
||||
$this->qlink(
|
||||
sprintf($this->translate('show all %d hosts'), $i),
|
||||
$listAllLink,
|
||||
null,
|
||||
array(
|
||||
'icon' => 'down-open',
|
||||
'data-base-target' => '_next'
|
||||
)
|
||||
);
|
||||
?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
|
|
|
@ -3,6 +3,15 @@
|
|||
use Icinga\Web\Url;
|
||||
use Icinga\Module\Monitoring\Object\Service;
|
||||
|
||||
function urlAddFilterOptional($url, $filter, $optional) {
|
||||
$url = Url::fromPath($url);
|
||||
$f = $filter;
|
||||
if (isset($optional)) {
|
||||
$f = Filter::matchAll($filter, $optional);
|
||||
}
|
||||
return $url->setQueryString($f->toQueryString());
|
||||
}
|
||||
|
||||
$selfUrl = Url::fromPath('monitoring/show/services', array('host' => $object->host_name));
|
||||
$currentUrl = Url::fromRequest()->without('limit')->getRelativeUrl();
|
||||
?><div class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : ''; ?>>
|
||||
|
@ -31,6 +40,7 @@ $currentUrl = Url::fromRequest()->without('limit')->getRelativeUrl();
|
|||
<?php else: ?>
|
||||
<?= $this->translate('No services configured on this host'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<span class="badges">
|
||||
<?php if ($object->stats->services_ok): ?>
|
||||
<span class="state ok<?= $currentUrl === $selfUrl->with('service_state', 0)->getRelativeUrl() ? ' active' : ''; ?>">
|
||||
|
|
|
@ -1,29 +1,44 @@
|
|||
<?php
|
||||
use Icinga\Module\Monitoring\Object\Service;
|
||||
|
||||
$i = 0;
|
||||
?>
|
||||
<?php if (($serviceCount = count($objects)) > 0): ?>
|
||||
<div class="hbox">
|
||||
<div class="hbox-item" style="width: 6em;">
|
||||
<strong><?= sprintf($this->translatePlural('Service (%u)', 'Services (%u)', $serviceCount), $serviceCount); ?></strong>
|
||||
<table class='action state statesummary'>
|
||||
<tbody>
|
||||
<?php foreach ($objects as $service): /** @var Service $service */ ?>
|
||||
<?php
|
||||
if (++ $i > 5) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<tr class="state <?= Service::getStateText($service->service_state); ?><?= $service->service_handled ? ' handled' : '' ?>">
|
||||
<td class="state"><?= Service::getStateText($service->service_state, true); ?><br /></td>
|
||||
<td>
|
||||
<?= implode(' ', $this->serviceFlags($service)) ?>
|
||||
<b>
|
||||
<?= $this->escape($service->getName()); ?>
|
||||
<?= $this->translate('on') ?>
|
||||
<?= $this->escape($service->getHost()->getName()); ?><br>
|
||||
</b>
|
||||
<?= $this->escape($service->service_output) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="hbox-item multi-commands">
|
||||
<?php if ($i > 5): ?>
|
||||
<?= $this->qlink(
|
||||
sprintf($this->translate('show all %d services'), $i),
|
||||
$listAllLink,
|
||||
null,
|
||||
array(
|
||||
'icon' => 'down-open',
|
||||
'data-base-target' => '_next'
|
||||
)
|
||||
);
|
||||
?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<div class="hbox-item">
|
||||
<?= $serviceStatesPieChart; ?>
|
||||
</div>
|
||||
<div class="hbox-item" style="font-size: 14px">
|
||||
<?php foreach (array_filter($serviceStates) as $text => $count): ?>
|
||||
<?= sprintf('%s: %u', $this->translate(strtoupper($text)), $count); ?><br>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hbox">
|
||||
<div class="hbox-item" style="width: 6em;">
|
||||
<?php $hostCount = array_sum(array_values($hostStates)); ?>
|
||||
<strong><?= sprintf($this->translatePlural('Host (%u)', 'Hosts (%u)', $hostCount), $hostCount); ?></strong>
|
||||
</div>
|
||||
<div class="hbox-item">
|
||||
<?= $hostStatesPieChart; ?>
|
||||
</div>
|
||||
<div class="hbox-item" style="font-size: 14px">
|
||||
<?php foreach (array_filter($hostStates) as $text => $count): ?>
|
||||
<?= sprintf('%s: %u', $this->translate(strtoupper($text)), $count); ?><br>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
|
|
|
@ -1,127 +1,214 @@
|
|||
<div class="controls">
|
||||
<?php if (! $this->compact): ?>
|
||||
<?= $tabs; ?>
|
||||
<?php endif ?>
|
||||
<div data-base-target='_next' class="controls">
|
||||
|
||||
<?php if (! $this->compact): ?>
|
||||
<?= $tabs; ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?= $this->render('list/components/servicesummary.phtml') ?>
|
||||
<?= $this->render('partials/service/objects-header.phtml'); ?>
|
||||
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="content multi-commands">
|
||||
<h3>
|
||||
<?= $this->icon('reschedule') ?>
|
||||
<?= $this->translate('Commands') ?>
|
||||
</h3>
|
||||
|
||||
<?php if (($serviceCount = count($objects)) === 0): ?>
|
||||
<?= $this->translate('No services found matching the filter'); ?>
|
||||
<?php else: ?>
|
||||
<h3><?= sprintf($this->translatePlural('%u Service', '%u Services', $serviceCount), $serviceCount); ?></h3>
|
||||
<div><?= $this->qlink(
|
||||
sprintf($this->translate('List all %u services'), $serviceCount),
|
||||
$listAllLink
|
||||
); ?></div>
|
||||
<div>
|
||||
<?= $checkNowForm; ?>
|
||||
</div>
|
||||
<div><?= $this->qlink(
|
||||
sprintf($this->translate('Reschedule the next check for all %u services'), $serviceCount),
|
||||
<p>
|
||||
<?= sprintf($this->translatePlural(
|
||||
'Issue commands to %s selected service:',
|
||||
'Issue commands to all %s selected services:',
|
||||
count($objects)
|
||||
), '<b>' . count($objects) . '</b>') ?>
|
||||
</p>
|
||||
<?= $checkNowForm; ?>
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
$this->translate('Reschedule next checks'),
|
||||
$rescheduleAllLink,
|
||||
null,
|
||||
array('icon' => 'reschedule')
|
||||
); ?></div>
|
||||
<div><?= $this->qlink(
|
||||
sprintf($this->translate('Schedule a downtime for all %u services'), $serviceCount),
|
||||
); ?>
|
||||
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
$this->translate('Schedule downtimes'),
|
||||
$downtimeAllLink,
|
||||
null,
|
||||
array('icon' => 'plug')
|
||||
); ?></div>
|
||||
<div><?= $this->qlink(
|
||||
sprintf($this->translate('Submit a passive check result for all %u services'), $serviceCount),
|
||||
); ?>
|
||||
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
$this->translate('Submit passive check results'),
|
||||
$processCheckResultAllLink,
|
||||
null,
|
||||
array('icon' => 'reply')
|
||||
); ?></div>
|
||||
<?php if ($this->hasPermission('monitoring/command/send-custom-notification')): ?>
|
||||
<div><?= $this->qlink(
|
||||
sprintf($this->translate('Send a custom notification for all %u services'), $serviceCount),
|
||||
$sendCustomNotificationLink,
|
||||
null,
|
||||
array('icon' => 'comment')
|
||||
); ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if (($unhandledCount = count($unhandledObjects)) > 0): ?>
|
||||
<div>
|
||||
<h3><?= sprintf(
|
||||
$this->translatePlural(
|
||||
'%u Unhandled Service Problem',
|
||||
'%u Unhandled Service Problems',
|
||||
$unhandledCount
|
||||
),
|
||||
$unhandledCount
|
||||
); ?></h3>
|
||||
<div><?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'Schedule a downtime for %u unhandled service problem',
|
||||
'Schedule a downtime for %u unhandled service problems',
|
||||
$unhandledCount
|
||||
),
|
||||
$unhandledCount
|
||||
),
|
||||
$downtimeUnhandledLink,
|
||||
null,
|
||||
array('icon' => 'plug')
|
||||
); ?></div>
|
||||
<div><?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'Acknowledge %u unhandled service problem',
|
||||
'Acknowledge %u unhandled service problems',
|
||||
$unhandledCount
|
||||
),
|
||||
$unhandledCount
|
||||
),
|
||||
$acknowledgeUnhandledLink,
|
||||
null,
|
||||
array('icon' => 'ok')
|
||||
); ?></div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?>
|
||||
<div>
|
||||
<h2><?= sprintf(
|
||||
$this->translatePlural(
|
||||
'%u Acknowledged Service Problem',
|
||||
'%u Acknowledged Service Problems',
|
||||
$acknowledgedCount
|
||||
),
|
||||
$acknowledgedCount
|
||||
); ?></h2>
|
||||
<?= $removeAckForm ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php if (($inDowntimeCount = count($objectsInDowntime)) > 0): ?>
|
||||
<h2><?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'List %u service currently in downtime',
|
||||
'List %u services currently in downtime',
|
||||
$inDowntimeCount
|
||||
),
|
||||
$inDowntimeCount
|
||||
),
|
||||
$inDowntimeLink,
|
||||
null,
|
||||
array('icon' => 'plug')
|
||||
); ?></h2>
|
||||
<?php endif ?>
|
||||
<?php if (($commentCount = count($objects->getComments())) > 0): ?>
|
||||
<h2><?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'List %u service comment',
|
||||
'List %u service comments',
|
||||
$commentCount
|
||||
),
|
||||
$commentCount
|
||||
),
|
||||
$commentsLink,
|
||||
); ?>
|
||||
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
$this->translate('Add comments'),
|
||||
$addCommentLink,
|
||||
null,
|
||||
array('icon' => 'comment')
|
||||
); ?></h2>
|
||||
<?php endif ?>
|
||||
); ?>
|
||||
|
||||
<?php if ($this->hasPermission('monitoring/command/send-custom-notification')): ?>
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
sprintf($this->translate('Send a custom notification for all %u services'), $serviceCount),
|
||||
$sendCustomNotificationLink,
|
||||
null,
|
||||
array('icon' => 'comment')
|
||||
); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
$unhandledCount = count($unhandledObjects);
|
||||
$problemCount = count($problemObjects);
|
||||
?>
|
||||
|
||||
<?php if ($problemCount || $unhandledCount): ?>
|
||||
<div>
|
||||
<h3>
|
||||
<?= $this->icon('attention-alt') ?>
|
||||
<?= $this->translate('Problems') ?>
|
||||
</h3>
|
||||
|
||||
<?php if ($problemCount): ?>
|
||||
<p>
|
||||
<?= sprintf(
|
||||
$this->translatePlural(
|
||||
'There is %s problem, issue commands to the problem service',
|
||||
'There are %s problems, issue commands to the problem services',
|
||||
$problemCount
|
||||
),
|
||||
'<b>' . $problemCount . '</b>'
|
||||
); ?>
|
||||
</p>
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'Schedule a downtime for %s problem service',
|
||||
'Schedule downtimes for %s problem services',
|
||||
$problemCount
|
||||
),
|
||||
$problemCount
|
||||
),
|
||||
$downtimeLink,
|
||||
null,
|
||||
array('icon' => 'plug')
|
||||
); ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($unhandledCount): ?>
|
||||
<p>
|
||||
<?= sprintf($this->translate('There are %s unhandled problem services. ' .
|
||||
'Issue commands to the problematic services:'),
|
||||
'<span class="badge badge-critical">' . $unhandledCount . '</span>') ?>
|
||||
|
||||
</p>
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'Schedule a downtime for %u unhandled problem service',
|
||||
'Schedule a downtime for %u unhandled problem services',
|
||||
$unhandledCount
|
||||
),
|
||||
$unhandledCount
|
||||
),
|
||||
$downtimeUnhandledLink,
|
||||
null,
|
||||
array('icon' => 'plug')
|
||||
); ?>
|
||||
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'Acknowledge %u unhandled problem service',
|
||||
'Acknowledge %u unhandled problem services',
|
||||
$unhandledCount
|
||||
),
|
||||
$unhandledCount
|
||||
),
|
||||
$acknowledgeUnhandledLink,
|
||||
null,
|
||||
array('icon' => 'ok')
|
||||
); ?>
|
||||
<?php endif ?>
|
||||
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?>
|
||||
<h3><?= $this->icon('ok', $this->translate('Acknowledgements')) ?> <?= $this->translate('Acknowledgements') ?></h3>
|
||||
<p>
|
||||
<?= sprintf(
|
||||
$this->translatePlural(
|
||||
'%s Acknowledged Service Problem.',
|
||||
'%s Acknowledged Service Problems.',
|
||||
$acknowledgedCount
|
||||
),
|
||||
'<b>' . $acknowledgedCount . '</b>'
|
||||
); ?> <?= $removeAckForm ?>
|
||||
</p>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
<?php $scheduledDowntimeCount = count($objects->getScheduledDowntimes()) ?>
|
||||
|
||||
<?php if ($scheduledDowntimeCount): ?>
|
||||
<h3><?= $this->icon('plug', $this->translate('Downtimes')) ?> <?= $this->translate('Downtimes') ?></h3>
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'%s scheduled downtime',
|
||||
'%s scheduled downtimes',
|
||||
$scheduledDowntimeCount
|
||||
),
|
||||
$scheduledDowntimeCount
|
||||
),
|
||||
$showDowntimesLink,
|
||||
null,
|
||||
array('data-base-target' => '_next')
|
||||
);?>
|
||||
<?= sprintf($this->translate('on all selected services.')) ?>
|
||||
|
||||
<?php if (($inDowntimeCount = count($objectsInDowntime)) > 0): ?>
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
sprintf($this->translatePlural(
|
||||
'%s service',
|
||||
'%s services',
|
||||
$inDowntimeCount
|
||||
), $inDowntimeCount),
|
||||
$inDowntimeLink,
|
||||
null,
|
||||
array('data-base-target' => '_next')
|
||||
);?>
|
||||
<?= sprintf($this->translate('are currently in downtime.')) ?>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php $commentCount = count($objects->getComments()) ?>
|
||||
<?php if ($commentCount > 0): ?>
|
||||
<h3> <?= $this->icon('comment') ?> <?= $this->translate('Comments') ?> </h3>
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'%s comment.',
|
||||
'%s comments.',
|
||||
$commentCount
|
||||
), $commentCount),
|
||||
$commentsLink,
|
||||
null,
|
||||
array('data-base-target' => '_next')
|
||||
); ?>
|
||||
<?= $this->translate('on all selected services.') ?>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
|
|
@ -33,8 +33,8 @@ if ($object->action_url) {
|
|||
}
|
||||
}
|
||||
|
||||
if (isset($this->hostActions)) {
|
||||
foreach ($this->hostActions as $id => $action) {
|
||||
if (isset($this->actions)) {
|
||||
foreach ($this->actions as $id => $action) {
|
||||
$links[] = sprintf($localLinkText, $action, $id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,17 +68,8 @@ if ($object->getType() === $object::TYPE_HOST) {
|
|||
<?php if ($object->check_execution_time): ?>
|
||||
<tr>
|
||||
<th><?= $this->translate('Check execution time') ?></th>
|
||||
<td><?php
|
||||
$matches = array();
|
||||
if (preg_match(
|
||||
'/(?<!.)([0-9]+\.[0-9]{4,})(?!.)/ms',
|
||||
$object->check_execution_time,
|
||||
$matches
|
||||
)) {
|
||||
printf('%.3f', (float) $matches[1]);
|
||||
} else {
|
||||
echo $object->check_execution_time;
|
||||
}
|
||||
<td><?= $object->check_execution_time === null
|
||||
? '-' : round((float) $object->check_execution_time, 3)
|
||||
?>s</td>
|
||||
</tr>
|
||||
<?php endif ?>
|
||||
|
|
|
@ -389,22 +389,6 @@ abstract class DataView implements QueryInterface, IteratorAggregate
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paginate data
|
||||
*
|
||||
* @param int $itemsPerPage Number of items per page
|
||||
* @param int $pageNumber Current page number
|
||||
*
|
||||
* @return Zend_Paginator
|
||||
*/
|
||||
public function paginate($itemsPerPage = null, $pageNumber = null)
|
||||
{
|
||||
if (! $this->isSorted) {
|
||||
$this->order();
|
||||
}
|
||||
return $this->query->paginate($itemsPerPage, $pageNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count result set
|
||||
*
|
||||
|
@ -466,7 +450,7 @@ abstract class DataView implements QueryInterface, IteratorAggregate
|
|||
*/
|
||||
public function getOffset()
|
||||
{
|
||||
return $this->query->hasOffset();
|
||||
return $this->query->getOffset();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
|
||||
namespace Icinga\Module\Monitoring\Object;
|
||||
|
||||
use Icinga\Data\Filter\Filter;
|
||||
use Icinga\Data\Filter\FilterOr;
|
||||
use Icinga\Util\String;
|
||||
|
||||
/**
|
||||
* A host list
|
||||
*/
|
||||
|
@ -25,4 +29,74 @@ class HostList extends ObjectList
|
|||
}
|
||||
return $hosts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a state summary of all hosts that can be consumed by hostssummary.phtml
|
||||
*
|
||||
* @return object The summary
|
||||
*/
|
||||
public function getStateSummary()
|
||||
{
|
||||
$hostStates = array_fill_keys(self::getHostStatesSummaryEmpty(), 0);
|
||||
foreach ($this as $host) {
|
||||
$unhandled = (bool) $host->problem === true && (bool) $host->handled === false;
|
||||
|
||||
$stateName = 'hosts_' . $host::getStateText($host->state);
|
||||
++$hostStates[$stateName];
|
||||
++$hostStates[$stateName. ($unhandled ? '_unhandled' : '_handled')];
|
||||
}
|
||||
|
||||
$hostStates['hosts_total'] = count($this);
|
||||
|
||||
return (object)$hostStates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an empty array with all possible host state names
|
||||
*
|
||||
* @return array An array containing all possible host states as keys and 0 as values.
|
||||
*/
|
||||
public static function getHostStatesSummaryEmpty()
|
||||
{
|
||||
return String::cartesianProduct(
|
||||
array(
|
||||
array('hosts'),
|
||||
array(
|
||||
Host::getStateText(Host::STATE_UP),
|
||||
Host::getStateText(Host::STATE_DOWN),
|
||||
Host::getStateText(Host::STATE_UNREACHABLE),
|
||||
Host::getStateText(Host::STATE_PENDING)
|
||||
),
|
||||
array(null, 'handled', 'unhandled')
|
||||
),
|
||||
'_'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Filter that matches all hosts in this list
|
||||
*
|
||||
* @return Filter
|
||||
*/
|
||||
public function objectsFilter($columns = array('host' => 'host'))
|
||||
{
|
||||
$filterExpression = array();
|
||||
foreach ($this as $host) {
|
||||
$filterExpression[] = Filter::where($columns['host'], $host->getName());
|
||||
}
|
||||
return FilterOr::matchAny($filterExpression);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the scheduled downtimes
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getScheduledDowntimes()
|
||||
{
|
||||
return $this->backend->select()
|
||||
->from('downtime')
|
||||
->applyFilter(clone $this->filter)
|
||||
->where('downtime_objecttype', 'host');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,21 +5,40 @@ namespace Icinga\Module\Monitoring\Object;
|
|||
|
||||
use ArrayIterator;
|
||||
use Countable;
|
||||
use Icinga\Data\Filter\Filter;
|
||||
use IteratorAggregate;
|
||||
use Icinga\Module\Monitoring\Backend\MonitoringBackend;
|
||||
|
||||
abstract class ObjectList implements Countable, IteratorAggregate
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $dataViewName;
|
||||
|
||||
/**
|
||||
* @var MonitoringBackend
|
||||
*/
|
||||
protected $backend;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $columns;
|
||||
|
||||
/**
|
||||
* @var Filter
|
||||
*/
|
||||
protected $filter;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $objects;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $count;
|
||||
|
||||
public function __construct(MonitoringBackend $backend)
|
||||
|
@ -27,23 +46,39 @@ abstract class ObjectList implements Countable, IteratorAggregate
|
|||
$this->backend = $backend;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $columns
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setColumns(array $columns)
|
||||
{
|
||||
$this->columns = $columns;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getColumns()
|
||||
{
|
||||
return $this->columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $filter
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFilter($filter)
|
||||
{
|
||||
$this->filter = $filter;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Filter
|
||||
*/
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
|
@ -51,6 +86,9 @@ abstract class ObjectList implements Countable, IteratorAggregate
|
|||
|
||||
abstract protected function fetchObjects();
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function fetch()
|
||||
{
|
||||
if ($this->objects === null) {
|
||||
|
@ -59,6 +97,9 @@ abstract class ObjectList implements Countable, IteratorAggregate
|
|||
return $this->objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
if ($this->count === null) {
|
||||
|
@ -85,4 +126,94 @@ abstract class ObjectList implements Countable, IteratorAggregate
|
|||
{
|
||||
return $this->backend->select()->from('comment')->applyFilter($this->filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the scheduled downtimes
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getScheduledDowntimes()
|
||||
{
|
||||
return $this->backend->select()->from('downtime')->applyFilter($this->filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ObjectList
|
||||
*/
|
||||
public function getAcknowledgedObjects()
|
||||
{
|
||||
$acknowledgedObjects = array();
|
||||
foreach ($this as $object) {
|
||||
if ((bool) $object->acknowledged === true) {
|
||||
$acknowledgedObjects[] = $object;
|
||||
}
|
||||
}
|
||||
return $this->newFromArray($acknowledgedObjects);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ObjectList
|
||||
*/
|
||||
public function getObjectsInDowntime()
|
||||
{
|
||||
$objectsInDowntime = array();
|
||||
foreach ($this as $object) {
|
||||
if ((bool) $object->in_downtime === true) {
|
||||
$objectsInDowntime[] = $object;
|
||||
}
|
||||
}
|
||||
return $this->newFromArray($objectsInDowntime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ObjectList
|
||||
*/
|
||||
public function getUnhandledObjects()
|
||||
{
|
||||
$unhandledObjects = array();
|
||||
foreach ($this as $object) {
|
||||
if ((bool) $object->problem === true && (bool) $object->handled === false) {
|
||||
$unhandledObjects[] = $object;
|
||||
}
|
||||
}
|
||||
return $this->newFromArray($unhandledObjects);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ObjectList
|
||||
*/
|
||||
public function getProblemObjects()
|
||||
{
|
||||
$handledObjects = array();
|
||||
foreach ($this as $object) {
|
||||
if ((bool) $object->problem === true) {
|
||||
$handledObjects[] = $object;
|
||||
}
|
||||
}
|
||||
return $this->newFromArray($handledObjects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a ObjectList from an array of hosts without querying a backend
|
||||
*
|
||||
* @return ObjectList
|
||||
*/
|
||||
protected function newFromArray(array $objects)
|
||||
{
|
||||
$class = get_called_class();
|
||||
$list = new $class($this->backend);
|
||||
$list->objects = $objects;
|
||||
$list->count = count($objects);
|
||||
$list->filter = $list->objectsFilter();
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a filter that matches exactly the elements of this object list
|
||||
*
|
||||
* @param array $columns Override default column names.
|
||||
*
|
||||
* @return Filter
|
||||
*/
|
||||
abstract function objectsFilter($columns = array());
|
||||
}
|
||||
|
|
|
@ -3,11 +3,19 @@
|
|||
|
||||
namespace Icinga\Module\Monitoring\Object;
|
||||
|
||||
use Icinga\Data\Filter\Filter;
|
||||
use Icinga\Data\Filter\FilterOr;
|
||||
use Icinga\Util\String;
|
||||
|
||||
/**
|
||||
* A service list
|
||||
*/
|
||||
class ServiceList extends ObjectList
|
||||
{
|
||||
protected $hostStateSummary;
|
||||
|
||||
protected $serviceStateSummary;
|
||||
|
||||
protected $dataViewName = 'serviceStatus';
|
||||
|
||||
protected $columns = array('host_name', 'service_description');
|
||||
|
@ -25,4 +33,118 @@ class ServiceList extends ObjectList
|
|||
}
|
||||
return $services;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a state summary of all services that can be consumed by servicesummary.phtml
|
||||
*
|
||||
* @return object The summary
|
||||
*/
|
||||
public function getServiceStateSummary()
|
||||
{
|
||||
if (! $this->serviceStateSummary) {
|
||||
$this->initStateSummaries();
|
||||
}
|
||||
return (object)$this->serviceStateSummary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a state summary of all hosts that can be consumed by hostsummary.phtml
|
||||
*
|
||||
* @return object The summary
|
||||
*/
|
||||
public function getHostStateSummary()
|
||||
{
|
||||
if (! $this->hostStateSummary) {
|
||||
$this->initStateSummaries();
|
||||
}
|
||||
return (object)$this->hostStateSummary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the current state summary and populate hostStateSummary and serviceStateSummary
|
||||
* properties
|
||||
*/
|
||||
protected function initStateSummaries()
|
||||
{
|
||||
$serviceStates = array_fill_keys(self::getServiceStatesSummaryEmpty(), 0);
|
||||
$hostStates = array_fill_keys(HostList::getHostStatesSummaryEmpty(), 0);
|
||||
|
||||
foreach ($this as $service) {
|
||||
$unhandled = false;
|
||||
if ((bool) $service->problem === true && (bool) $service->handled === false) {
|
||||
$unhandled = true;
|
||||
}
|
||||
|
||||
$stateName = 'services_' . $service::getStateText($service->state);
|
||||
++$serviceStates[$stateName];
|
||||
++$serviceStates[$stateName . ($unhandled ? '_unhandled' : '_handled')];
|
||||
|
||||
if (! isset($knownHostStates[$service->getHost()->getName()])) {
|
||||
$unhandledHost = (bool) $service->host_problem === true && (bool) $service->host_handled === false;
|
||||
++$hostStates['hosts_' . $service->getHost()->getStateText($service->host_state)];
|
||||
++$hostStates['hosts_' . $service->getHost()->getStateText($service->host_state)
|
||||
. ($unhandledHost ? '_unhandled' : '_handled')];
|
||||
$knownHostStates[$service->getHost()->getName()] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$serviceStates['services_total'] = count($this);
|
||||
$this->hostStateSummary = $hostStates;
|
||||
$this->serviceStateSummary = $serviceStates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an empty array with all possible host state names
|
||||
*
|
||||
* @return array An array containing all possible host states as keys and 0 as values.
|
||||
*/
|
||||
public static function getServiceStatesSummaryEmpty()
|
||||
{
|
||||
return String::cartesianProduct(
|
||||
array(
|
||||
array('services'),
|
||||
array(
|
||||
Service::getStateText(Service::STATE_OK),
|
||||
Service::getStateText(Service::STATE_WARNING),
|
||||
Service::getStateText(Service::STATE_CRITICAL),
|
||||
Service::getStateText(Service::STATE_UNKNOWN),
|
||||
Service::getStateText(Service::STATE_PENDING)
|
||||
),
|
||||
array(null, 'handled', 'unhandled')
|
||||
),
|
||||
'_'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Filter that matches all hosts in this HostList
|
||||
*
|
||||
* @param array $columns Override filter column names
|
||||
*
|
||||
* @return Filter
|
||||
*/
|
||||
public function objectsFilter($columns = array('host' => 'host', 'service' => 'service'))
|
||||
{
|
||||
$filterExpression = array();
|
||||
foreach ($this as $service) {
|
||||
$filterExpression[] = Filter::matchAll(
|
||||
Filter::where($columns['host'], $service->getHost()->getName()),
|
||||
Filter::where($columns['service'], $service->getName())
|
||||
);
|
||||
}
|
||||
return FilterOr::matchAny($filterExpression);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the scheduled downtimes
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getScheduledDowntimes()
|
||||
{
|
||||
return $this->backend->select()
|
||||
->from('downtime')
|
||||
->applyFilter(clone $this->filter)
|
||||
->where('downtime_objecttype', 'service');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||
|
||||
namespace Icinga\Module\Monitoring\Web\Hook;
|
||||
|
||||
use Icinga\Module\Monitoring\Object\Service;
|
||||
|
||||
/**
|
||||
* Base class for host action hooks
|
||||
*/
|
||||
abstract class ServiceActionsHook
|
||||
{
|
||||
/**
|
||||
* Implementors of this method should return an array containing
|
||||
* additional action links for a specific host. You get a full Service
|
||||
* object, which allows you to return specific links only for nodes
|
||||
* with specific properties.
|
||||
*
|
||||
* The result array should be in the form title => url, where title will
|
||||
* be used as link caption. Url should be an Icinga\Web\Url object when
|
||||
* the link should point to an Icinga Web url - otherwise a string would
|
||||
* be fine.
|
||||
*
|
||||
* Mixed example:
|
||||
* <code>
|
||||
* return array(
|
||||
* 'Wiki' => 'http://my.wiki/host=' . rawurlencode($service->service_name),
|
||||
* 'Logstash' => Url::fromPath(
|
||||
* 'logstash/search/syslog',
|
||||
* array('service' => $service->host_name)
|
||||
* )
|
||||
* );
|
||||
* </code>
|
||||
*
|
||||
* One might also provide ssh:// or rdp:// urls if equipped with fitting
|
||||
* (safe) URL handlers for his browser(s).
|
||||
*
|
||||
* TODO: I'd love to see some kind of a Link/LinkSet object implemented
|
||||
* for this and similar hooks.
|
||||
*
|
||||
* @param Service $service Monitoring service object
|
||||
*
|
||||
* @return array An array containing a list of service action links
|
||||
*/
|
||||
abstract public function getActionsForService(Service $service);
|
||||
}
|
|
@ -90,7 +90,7 @@ div.contacts div.notification-periods {
|
|||
margin-top: 0.5em;
|
||||
}
|
||||
|
||||
div.tinystatesummary {
|
||||
.tinystatesummary {
|
||||
.page-header();
|
||||
font-size: 1em;
|
||||
margin-bottom: 0.5em;
|
||||
|
@ -99,6 +99,7 @@ div.tinystatesummary {
|
|||
display: inline-block;
|
||||
margin-bottom: 4px;
|
||||
margin-left: 1em;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.state > a {
|
||||
|
@ -130,14 +131,26 @@ span.state.ok {
|
|||
background: @colorOk;
|
||||
}
|
||||
|
||||
span.state.up {
|
||||
background: @colorOk;
|
||||
}
|
||||
|
||||
span.state.critical {
|
||||
background: @colorCritical;
|
||||
}
|
||||
|
||||
span.state.down {
|
||||
background: @colorCritical;
|
||||
}
|
||||
|
||||
span.state.handled.critical {
|
||||
background: @colorCriticalHandled;
|
||||
}
|
||||
|
||||
span.state.handled.down {
|
||||
background: @colorCriticalHandled;
|
||||
}
|
||||
|
||||
span.state.warning {
|
||||
background: @colorWarning;
|
||||
}
|
||||
|
@ -198,7 +211,7 @@ div.selection-info {
|
|||
.optionbox label {
|
||||
max-width: 6.5em;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
vertgical-align: middle;
|
||||
margin-right: 0em;
|
||||
}
|
||||
|
||||
|
|
|
@ -346,6 +346,7 @@ html {
|
|||
.hbox-item {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0.25em;
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
|
@ -371,3 +372,8 @@ html {
|
|||
position: absolute;
|
||||
width: 1px;
|
||||
}
|
||||
|
||||
.multi-commands {
|
||||
padding-top: 0em;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
|
|
@ -926,3 +926,39 @@ table.groupview {
|
|||
}
|
||||
|
||||
/* End of monitoring groupsummary styles */
|
||||
|
||||
/* compact table */
|
||||
table.statesummary {
|
||||
text-align: left;
|
||||
width: auto;
|
||||
border-collapse: separate;
|
||||
|
||||
tr.state td.state {
|
||||
width: auto;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
td {
|
||||
font-size: 0.9em;
|
||||
line-height: 1.2em;
|
||||
padding-left: 0.2em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
td.state {
|
||||
padding: 0.2em;
|
||||
min-width: 75px;
|
||||
font-size: 0.75em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
td.name {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
td a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -217,23 +217,13 @@ li li .badge-container {
|
|||
margin-right: 0.75em;
|
||||
}
|
||||
|
||||
/*
|
||||
#layout.hoveredmenu .active > .badge-container {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#layout.hoveredmenu .hover > .badge-container {
|
||||
//margin-right: 14.15em;
|
||||
display: none;
|
||||
}
|
||||
*/
|
||||
|
||||
.badge {
|
||||
position: relative;
|
||||
top: 0.3em;
|
||||
top: -0.15em;
|
||||
display: inline-block;
|
||||
min-width: 1em;
|
||||
padding: 3px 7px;
|
||||
margin: 0 0.2em 0 0.2em;
|
||||
font-size: 0.8em;
|
||||
font-weight: 700;
|
||||
line-height: 1.1em;
|
||||
|
@ -244,6 +234,11 @@ li li .badge-container {
|
|||
background-color: @colorInvalid;
|
||||
}
|
||||
|
||||
#menu nav ul .badge {
|
||||
margin-right: 0em;
|
||||
top: 0.3em;
|
||||
}
|
||||
|
||||
#menu nav > ul > li.active > .badge-container {
|
||||
display: none;
|
||||
}
|
||||
|
@ -279,6 +274,10 @@ li li .badge {
|
|||
background-color: @colorCritical;
|
||||
}
|
||||
|
||||
.badge-down {
|
||||
background-color: @colorCritical;
|
||||
}
|
||||
|
||||
.badge-warning {
|
||||
background-color: @colorWarning;
|
||||
}
|
||||
|
@ -287,11 +286,15 @@ li li .badge {
|
|||
background-color: @colorOk;
|
||||
}
|
||||
|
||||
.badge-up {
|
||||
background-color: @colorOk;
|
||||
}
|
||||
|
||||
.badge-pending {
|
||||
background-color: @colorPending;
|
||||
}
|
||||
|
||||
.badge-pending {
|
||||
.badge-unknown {
|
||||
background-color: @colorUnknown;
|
||||
}
|
||||
|
||||
|
@ -313,3 +316,25 @@ li li .badge {
|
|||
|
||||
margin: 0em 0em 0em 0.1em;
|
||||
}
|
||||
|
||||
.tipsy .tipsy-inner {
|
||||
// overwrite tooltip max width, we need them to grow bigger
|
||||
max-width: 300px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.color-box {
|
||||
position: relative;
|
||||
top: 2px;
|
||||
margin: 0px 3px 0px 3px;
|
||||
display: inline-block;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
.oneline {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
|
|
|
@ -198,16 +198,53 @@ class FilterTest extends BaseTestCase
|
|||
$this->assertNotEquals((string) $c, (string) $d);
|
||||
}
|
||||
|
||||
public function testLeadingAndTrailingWhitespacesSanitizing()
|
||||
public function testLeadingAndTrailingWhitespaces()
|
||||
{
|
||||
$columnHasWhitespaces = Filter::where(' host ', 'localhost');
|
||||
$expressionHasWhitespaces = Filter::where('host', ' localhost ');
|
||||
$bothHaveWhitespaces = Filter::fromQueryString(' host = localhost ');
|
||||
$withArray = Filter::where(' host ', array(' no match ', ' localhost '));
|
||||
$this->assertTrue($columnHasWhitespaces->matches($this->sampleData[0]));
|
||||
$this->assertTrue($expressionHasWhitespaces->matches($this->sampleData[0]));
|
||||
$this->assertTrue($bothHaveWhitespaces->matches($this->sampleData[0]));
|
||||
$this->assertTrue($withArray->matches($this->sampleData[0]));
|
||||
$columnWithWhitespaces = Filter::where(' host ', 'localhost');
|
||||
$this->assertTrue($columnWithWhitespaces->matches((object) array(
|
||||
'host' => 'localhost'
|
||||
)),
|
||||
'Filter doesn\'t remove leading and trailing whitespaces from columns'
|
||||
);
|
||||
$expressionWithLeadingWhitespaces = Filter::where('host', ' localhost');
|
||||
$this->assertTrue($expressionWithLeadingWhitespaces->matches((object) array(
|
||||
'host' => ' localhost'
|
||||
)),
|
||||
'Filter doesn\'t take leading whitespaces of expressions into account'
|
||||
);
|
||||
$this->assertFalse($expressionWithLeadingWhitespaces->matches((object) array(
|
||||
'host' => ' localhost '
|
||||
)),
|
||||
'Filter doesn\'t take trailing whitespaces of expressions into account'
|
||||
);
|
||||
$expressionWithTrailingWhitespaces = Filter::where('host', 'localhost ');
|
||||
$this->assertTrue($expressionWithTrailingWhitespaces->matches((object) array(
|
||||
'host' => 'localhost '
|
||||
)),
|
||||
'Filter doesn\'t take trailing whitespaces of expressions into account'
|
||||
);
|
||||
$this->assertFalse($expressionWithTrailingWhitespaces->matches((object) array(
|
||||
'host' => ' localhost '
|
||||
)),
|
||||
'Filter doesn\'t take leading whitespaces of expressions into account'
|
||||
);
|
||||
$expressionWithLeadingAndTrailingWhitespaces = Filter::where('host', ' localhost ');
|
||||
$this->assertTrue($expressionWithLeadingAndTrailingWhitespaces->matches((object) array(
|
||||
'host' => ' localhost '
|
||||
)),
|
||||
'Filter doesn\'t take leading and trailing whitespaces of expressions into account'
|
||||
);
|
||||
$this->assertFalse($expressionWithLeadingAndTrailingWhitespaces->matches((object) array(
|
||||
'host' => ' localhost '
|
||||
)),
|
||||
'Filter doesn\'t take leading and trailing whitespaces of expressions into account'
|
||||
);
|
||||
$queryStringWithWhitespaces = Filter::fromQueryString(' host = localhost ');
|
||||
$this->assertTrue($queryStringWithWhitespaces->matches((object) array(
|
||||
'host' => ' localhost '
|
||||
)),
|
||||
'Filter doesn\'t take leading and trailing whitespaces of expressions in query strings into account'
|
||||
);
|
||||
}
|
||||
|
||||
private function row($idx)
|
||||
|
|
Loading…
Reference in New Issue