Merge branch 'master' into bugfix/time-formatting-6778
Conflicts: modules/monitoring/application/views/scripts/show/components/notifications.phtml
This commit is contained in:
commit
796cbffbd7
|
@ -8,7 +8,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
<a href="/monitoring/host/show?host=localhost"
|
||||
<a href="/monitoring/host/show?host_name=localhost"
|
||||
title="Show detailed information about the host localhost"
|
||||
aria-label="Show detailed information about the host localhost">localhost</a>
|
||||
</body>
|
||||
|
|
|
@ -506,12 +506,21 @@ abstract class ApplicationBootstrap
|
|||
protected function setupLogger()
|
||||
{
|
||||
if ($this->config->hasSection('logging')) {
|
||||
$loggingConfig = $this->config->getSection('logging');
|
||||
|
||||
try {
|
||||
Logger::create($this->config->getSection('logging'));
|
||||
Logger::create($loggingConfig);
|
||||
} catch (ConfigurationError $e) {
|
||||
Logger::error($e);
|
||||
Logger::getInstance()->registerConfigError($e->getMessage());
|
||||
|
||||
try {
|
||||
Logger::getInstance()->setLevel($loggingConfig->get('level', Logger::ERROR));
|
||||
} catch (ConfigurationError $e) {
|
||||
Logger::getInstance()->registerConfigError($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,13 @@ class Logger
|
|||
*/
|
||||
protected $level;
|
||||
|
||||
/**
|
||||
* Error messages to be displayed prior to any other log message
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $configErrors = array();
|
||||
|
||||
/**
|
||||
* Create a new logger object
|
||||
*
|
||||
|
@ -81,39 +88,71 @@ class Logger
|
|||
throw new ConfigurationError('Required logging configuration directive \'log\' missing');
|
||||
}
|
||||
|
||||
if (($level = $config->level) !== null) {
|
||||
if (is_numeric($level)) {
|
||||
$level = (int) $level;
|
||||
if (! isset(static::$levels[$level])) {
|
||||
throw new ConfigurationError(
|
||||
'Can\'t set logging level %d. Logging level is not defined. Use one of %s or one of the'
|
||||
. ' Logger\'s constants.',
|
||||
$level,
|
||||
implode(', ', array_keys(static::$levels))
|
||||
);
|
||||
}
|
||||
$this->level = $level;
|
||||
} else {
|
||||
$level = strtoupper($level);
|
||||
$levels = array_flip(static::$levels);
|
||||
if (! isset($levels[$level])) {
|
||||
throw new ConfigurationError(
|
||||
'Can\'t set logging level "%s". Logging level is not defined. Use one of %s.',
|
||||
$level,
|
||||
implode(', ', array_keys($levels))
|
||||
);
|
||||
}
|
||||
$this->level = $levels[$level];
|
||||
}
|
||||
} else {
|
||||
$this->level = static::ERROR;
|
||||
}
|
||||
$this->setLevel($config->get('level', static::ERROR));
|
||||
|
||||
if (strtolower($config->get('log', 'syslog')) !== 'none') {
|
||||
$this->writer = $this->createWriter($config);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the logging level to use
|
||||
*
|
||||
* @param mixed $level
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws ConfigurationError In case the given level is invalid
|
||||
*/
|
||||
public function setLevel($level)
|
||||
{
|
||||
if (is_numeric($level)) {
|
||||
$level = (int) $level;
|
||||
if (! isset(static::$levels[$level])) {
|
||||
throw new ConfigurationError(
|
||||
'Can\'t set logging level %d. Logging level is invalid. Use one of %s or one of the'
|
||||
. ' Logger\'s constants.',
|
||||
$level,
|
||||
implode(', ', array_keys(static::$levels))
|
||||
);
|
||||
}
|
||||
|
||||
$this->level = $level;
|
||||
} else {
|
||||
$level = strtoupper($level);
|
||||
$levels = array_flip(static::$levels);
|
||||
if (! isset($levels[$level])) {
|
||||
throw new ConfigurationError(
|
||||
'Can\'t set logging level "%s". Logging level is invalid. Use one of %s.',
|
||||
$level,
|
||||
implode(', ', array_keys($levels))
|
||||
);
|
||||
}
|
||||
|
||||
$this->level = $levels[$level];
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the given message as config error
|
||||
*
|
||||
* Config errors are logged every time a log message is being logged.
|
||||
*
|
||||
* @param mixed $arg,... A string, exception or format-string + substitutions
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function registerConfigError()
|
||||
{
|
||||
if (func_num_args() > 0) {
|
||||
$this->configErrors[] = static::formatMessage(func_get_args());
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new logger object
|
||||
*
|
||||
|
@ -156,6 +195,10 @@ class Logger
|
|||
public function log($level, $message)
|
||||
{
|
||||
if ($this->writer !== null && $this->level <= $level) {
|
||||
foreach ($this->configErrors as $error_message) {
|
||||
$this->writer->log(static::ERROR, $error_message);
|
||||
}
|
||||
|
||||
$this->writer->log($level, $message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
namespace Icinga\Web;
|
||||
|
||||
use Icinga\Web\Controller\ModuleActionController;
|
||||
use Icinga\Web\Widget\SortBox;
|
||||
|
||||
/**
|
||||
* This is the controller all modules should inherit from
|
||||
|
@ -12,4 +13,18 @@ use Icinga\Web\Controller\ModuleActionController;
|
|||
*/
|
||||
class Controller extends ModuleActionController
|
||||
{
|
||||
/**
|
||||
* Create a sort control box at the 'sortControl' view parameter
|
||||
*
|
||||
* @param array $columns An array containing the sort columns, with the
|
||||
* submit value as the key and the label as the value
|
||||
*/
|
||||
protected function setupSortControl(array $columns)
|
||||
{
|
||||
$req = $this->getRequest();
|
||||
$this->view->sortControl = SortBox::create(
|
||||
'sortbox-' . $req->getActionName(),
|
||||
$columns
|
||||
)->applyRequest($req);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -315,13 +315,18 @@ class ActionController extends Zend_Controller_Action
|
|||
if ($redirect !== null) {
|
||||
$login->setParam('redirect', '__SELF__');
|
||||
}
|
||||
|
||||
$this->_response->setHttpResponseCode(403);
|
||||
} elseif ($redirect !== null) {
|
||||
if (! $redirect instanceof Url) {
|
||||
$redirect = Url::fromPath($redirect);
|
||||
}
|
||||
$login->setParam('redirect', $redirect->getRelativeUrl());
|
||||
|
||||
if (($relativeUrl = $redirect->getRelativeUrl())) {
|
||||
$login->setParam('redirect', $relativeUrl);
|
||||
}
|
||||
}
|
||||
|
||||
$this->rerenderLayout()->redirectNow($login);
|
||||
}
|
||||
|
||||
|
|
|
@ -183,10 +183,10 @@ class FilterEditor extends AbstractWidget
|
|||
// TODO: Ask the view for (multiple) search columns
|
||||
switch($request->getActionName()) {
|
||||
case 'services':
|
||||
$searchCol = 'service_description';
|
||||
$searchCol = 'service';
|
||||
break;
|
||||
case 'hosts':
|
||||
$searchCol = 'host_name';
|
||||
$searchCol = 'host';
|
||||
break;
|
||||
case 'hostgroups':
|
||||
$searchCol = 'hostgroup';
|
||||
|
|
|
@ -5,9 +5,9 @@ namespace Icinga\Module\Doc;
|
|||
|
||||
use Icinga\Module\Doc\Renderer\DocSectionRenderer;
|
||||
use Icinga\Module\Doc\Renderer\DocTocRenderer;
|
||||
use Icinga\Web\Controller\ModuleActionController;
|
||||
use Icinga\Web\Controller;
|
||||
|
||||
class DocController extends ModuleActionController
|
||||
class DocController extends Controller
|
||||
{
|
||||
/**
|
||||
* Render a chapter
|
||||
|
|
|
@ -59,12 +59,12 @@ class Monitoring_AlertsummaryController extends Controller
|
|||
$query = $this->backend->select()->from(
|
||||
'notification',
|
||||
array(
|
||||
'host',
|
||||
'host_name',
|
||||
'host_display_name',
|
||||
'service',
|
||||
'service_description',
|
||||
'service_display_name',
|
||||
'notification_output',
|
||||
'notification_contact',
|
||||
'notification_contact_name',
|
||||
'notification_start_time',
|
||||
'notification_state'
|
||||
)
|
||||
|
@ -85,12 +85,7 @@ class Monitoring_AlertsummaryController extends Controller
|
|||
$query = $this->backend->select()->from(
|
||||
'notification',
|
||||
array(
|
||||
'host',
|
||||
'service',
|
||||
'notification_output',
|
||||
'notification_contact',
|
||||
'notification_start_time',
|
||||
'notification_state'
|
||||
'notification_start_time'
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -138,12 +133,7 @@ class Monitoring_AlertsummaryController extends Controller
|
|||
$query = $this->backend->select()->from(
|
||||
'notification',
|
||||
array(
|
||||
'host',
|
||||
'service',
|
||||
'notification_output',
|
||||
'notification_contact',
|
||||
'notification_start_time',
|
||||
'notification_state'
|
||||
'notification_start_time'
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -210,12 +200,7 @@ class Monitoring_AlertsummaryController extends Controller
|
|||
$query = $this->backend->select()->from(
|
||||
'notification',
|
||||
array(
|
||||
'host',
|
||||
'service',
|
||||
'notification_output',
|
||||
'notification_contact',
|
||||
'notification_start_time',
|
||||
'notification_state'
|
||||
'notification_start_time'
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -263,20 +248,9 @@ class Monitoring_AlertsummaryController extends Controller
|
|||
$interval = $this->getInterval();
|
||||
|
||||
$query = $this->backend->select()->from(
|
||||
'EventHistory',
|
||||
'eventHistory',
|
||||
array(
|
||||
'host_name',
|
||||
'service_description',
|
||||
'object_type',
|
||||
'timestamp',
|
||||
'state',
|
||||
'attempt',
|
||||
'max_attempts',
|
||||
'output',
|
||||
'type',
|
||||
'host',
|
||||
'service',
|
||||
'service_host_name'
|
||||
'timestamp'
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -338,11 +312,7 @@ class Monitoring_AlertsummaryController extends Controller
|
|||
$query = $this->backend->select()->from(
|
||||
'notification',
|
||||
array(
|
||||
'host',
|
||||
'service',
|
||||
'notification_object_id',
|
||||
'notification_output',
|
||||
'notification_contact',
|
||||
'notification_start_time',
|
||||
'notification_state',
|
||||
'acknowledgement_entry_time'
|
||||
|
@ -507,12 +477,12 @@ class Monitoring_AlertsummaryController extends Controller
|
|||
$query = $this->backend->select()->from(
|
||||
'notification',
|
||||
array(
|
||||
'host',
|
||||
'host_name',
|
||||
'host_display_name',
|
||||
'service',
|
||||
'service_description',
|
||||
'service_display_name',
|
||||
'notification_output',
|
||||
'notification_contact',
|
||||
'notification_contact_name',
|
||||
'notification_start_time',
|
||||
'notification_state'
|
||||
)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
use Icinga\Web\Notification;
|
||||
use Icinga\Data\ResourceFactory;
|
||||
use Icinga\Forms\ConfirmRemovalForm;
|
||||
use Icinga\Web\Controller\ModuleActionController;
|
||||
use Icinga\Web\Controller;
|
||||
use Icinga\Module\Monitoring\Forms\Config\BackendConfigForm;
|
||||
use Icinga\Module\Monitoring\Forms\Config\InstanceConfigForm;
|
||||
use Icinga\Module\Monitoring\Forms\Config\SecurityConfigForm;
|
||||
|
@ -12,7 +12,7 @@ use Icinga\Module\Monitoring\Forms\Config\SecurityConfigForm;
|
|||
/**
|
||||
* Configuration controller for editing monitoring resources
|
||||
*/
|
||||
class Monitoring_ConfigController extends ModuleActionController
|
||||
class Monitoring_ConfigController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a list of available backends and instances
|
||||
|
|
|
@ -26,7 +26,7 @@ class Monitoring_HostController extends MonitoredObjectController
|
|||
*/
|
||||
public function init()
|
||||
{
|
||||
$host = new Host($this->backend, $this->params->get('host'));
|
||||
$host = new Host($this->backend, $this->params->get('host_name'));
|
||||
|
||||
$this->applyRestriction('monitoring/hosts/filter', $host);
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ class Monitoring_HostsController extends Controller
|
|||
}
|
||||
if ((bool) $host->in_downtime === true) {
|
||||
$objectsInDowntime[] = $host;
|
||||
$downtimeFilterExpressions[] = Filter::where('downtime_host', $host->getName());
|
||||
$downtimeFilterExpressions[] = Filter::where('host_name', $host->getName());
|
||||
}
|
||||
++$hostStates[$host::getStateText($host->state)];
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ use Icinga\Web\Url;
|
|||
use Icinga\Web\Widget\Tabextension\DashboardAction;
|
||||
use Icinga\Web\Widget\Tabextension\OutputFormat;
|
||||
use Icinga\Web\Widget\Tabs;
|
||||
use Icinga\Web\Widget\SortBox;
|
||||
use Icinga\Data\Filter\Filter;
|
||||
use Icinga\Web\Widget;
|
||||
use Icinga\Module\Monitoring\Forms\StatehistoryForm;
|
||||
|
@ -170,10 +169,8 @@ class Monitoring_ListController extends Controller
|
|||
|
||||
$this->addTitleTab('services', $this->translate('Services'), $this->translate('List services'));
|
||||
$this->view->showHost = true;
|
||||
if ($host = $this->_getParam('host')) {
|
||||
if (strpos($host, '*') === false) {
|
||||
$this->view->showHost = false;
|
||||
}
|
||||
if (strpos($this->params->get('host_name', '*'), '*') === false) {
|
||||
$this->view->showHost = false;
|
||||
}
|
||||
$this->setAutorefreshInterval(10);
|
||||
|
||||
|
@ -272,7 +269,7 @@ class Monitoring_ListController extends Controller
|
|||
'id' => 'downtime_internal_id',
|
||||
'objecttype' => 'downtime_objecttype',
|
||||
'comment' => 'downtime_comment',
|
||||
'author' => 'downtime_author',
|
||||
'author_name' => 'downtime_author_name',
|
||||
'start' => 'downtime_start',
|
||||
'scheduled_start' => 'downtime_scheduled_start',
|
||||
'scheduled_end' => 'downtime_scheduled_end',
|
||||
|
@ -282,10 +279,10 @@ class Monitoring_ListController extends Controller
|
|||
'is_fixed' => 'downtime_is_fixed',
|
||||
'is_in_effect' => 'downtime_is_in_effect',
|
||||
'entry_time' => 'downtime_entry_time',
|
||||
'host' => 'host_name',
|
||||
'service' => 'service_description',
|
||||
'host_state' => 'downtime_host_state',
|
||||
'service_state' => 'downtime_service_state',
|
||||
'host_name',
|
||||
'service_description',
|
||||
'host_display_name',
|
||||
'service_display_name'
|
||||
));
|
||||
|
@ -327,10 +324,10 @@ class Monitoring_ListController extends Controller
|
|||
);
|
||||
$this->setAutorefreshInterval(15);
|
||||
$query = $this->backend->select()->from('notification', array(
|
||||
'host',
|
||||
'service',
|
||||
'host_name',
|
||||
'service_description',
|
||||
'notification_output',
|
||||
'notification_contact',
|
||||
'notification_contact_name',
|
||||
'notification_start_time',
|
||||
'notification_state',
|
||||
'host_display_name',
|
||||
|
@ -471,13 +468,13 @@ class Monitoring_ListController extends Controller
|
|||
'id' => 'comment_internal_id',
|
||||
'objecttype' => 'comment_objecttype',
|
||||
'comment' => 'comment_data',
|
||||
'author' => 'comment_author',
|
||||
'author' => 'comment_author_name',
|
||||
'timestamp' => 'comment_timestamp',
|
||||
'type' => 'comment_type',
|
||||
'persistent' => 'comment_is_persistent',
|
||||
'expiration' => 'comment_expiration',
|
||||
'host' => 'comment_host',
|
||||
'service' => 'comment_service',
|
||||
'host_name',
|
||||
'service_description',
|
||||
'host_display_name',
|
||||
'service_display_name'
|
||||
));
|
||||
|
@ -511,7 +508,7 @@ class Monitoring_ListController extends Controller
|
|||
);
|
||||
$this->setAutorefreshInterval(12);
|
||||
$query = $this->backend->select()->from('groupsummary', array(
|
||||
'servicegroup',
|
||||
'servicegroup_name',
|
||||
'servicegroup_alias',
|
||||
'hosts_up',
|
||||
'hosts_unreachable_handled',
|
||||
|
@ -561,7 +558,7 @@ class Monitoring_ListController extends Controller
|
|||
$this->addTitleTab('hostgroups', $this->translate('Host Groups'), $this->translate('List host groups'));
|
||||
$this->setAutorefreshInterval(12);
|
||||
$query = $this->backend->select()->from('groupsummary', array(
|
||||
'hostgroup',
|
||||
'hostgroup_name',
|
||||
'hostgroup_alias',
|
||||
'hosts_up',
|
||||
'hosts_unreachable_handled',
|
||||
|
@ -625,9 +622,7 @@ class Monitoring_ListController extends Controller
|
|||
'attempt',
|
||||
'max_attempts',
|
||||
'output',
|
||||
'type',
|
||||
'host',
|
||||
'service'
|
||||
'type'
|
||||
));
|
||||
|
||||
$this->filterQuery($query);
|
||||
|
@ -694,21 +689,6 @@ class Monitoring_ListController extends Controller
|
|||
return $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a sort control box at the 'sortControl' view parameter
|
||||
*
|
||||
* @param array $columns An array containing the sort columns, with the
|
||||
* submit value as the key and the value as the label
|
||||
*/
|
||||
private function setupSortControl(array $columns)
|
||||
{
|
||||
$this->view->sortControl = new SortBox(
|
||||
'sortbox-' . $this->getRequest()->getActionName(),
|
||||
$columns
|
||||
);
|
||||
$this->view->sortControl->applyRequest($this->getRequest());
|
||||
}
|
||||
|
||||
protected function addTitleTab($action, $title, $tip)
|
||||
{
|
||||
$this->getTabs()->add($action, array(
|
||||
|
|
|
@ -25,7 +25,11 @@ class Monitoring_ServiceController extends MonitoredObjectController
|
|||
*/
|
||||
public function init()
|
||||
{
|
||||
$service = new Service($this->backend, $this->params->get('host'), $this->params->get('service'));
|
||||
$service = new Service(
|
||||
$this->backend,
|
||||
$this->params->get('host_name'),
|
||||
$this->params->get('service_description')
|
||||
);
|
||||
|
||||
$this->applyRestriction('monitoring/services/filter', $service);
|
||||
|
||||
|
|
|
@ -158,8 +158,8 @@ class Monitoring_ServicesController extends Controller
|
|||
if ((bool) $service->in_downtime === true) {
|
||||
$objectsInDowntime[] = $service;
|
||||
$downtimeFilterExpressions[] = Filter::matchAll(
|
||||
Filter::where('downtime_host', $service->getHost()->getName()),
|
||||
Filter::where('downtime_service', $service->getName())
|
||||
Filter::where('host_name', $service->getHost()->getName()),
|
||||
Filter::where('service_description', $service->getName())
|
||||
);
|
||||
}
|
||||
++$serviceStates[$service::getStateText($service->state)];
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||
|
||||
use Icinga\Application\Benchmark;
|
||||
use Icinga\Module\Monitoring\Object\MonitoredObject;
|
||||
use Icinga\Web\Hook;
|
||||
use Icinga\Web\Url;
|
||||
|
@ -10,8 +9,6 @@ use Icinga\Web\Widget\Tabextension\OutputFormat;
|
|||
use Icinga\Web\Widget\Tabextension\DashboardAction;
|
||||
use Icinga\Module\Monitoring\Backend;
|
||||
use Icinga\Module\Monitoring\Controller;
|
||||
use Icinga\Module\Monitoring\Object\Host;
|
||||
use Icinga\Module\Monitoring\Object\Service;
|
||||
|
||||
/**
|
||||
* Class Monitoring_ShowController
|
||||
|
@ -115,11 +112,11 @@ class Monitoring_ShowController extends Controller
|
|||
|
||||
public function contactAction()
|
||||
{
|
||||
$contactName = $this->getParam('contact');
|
||||
$contactName = $this->getParam('contact_name');
|
||||
|
||||
if (! $contactName) {
|
||||
throw new Zend_Controller_Action_Exception(
|
||||
$this->translate('The parameter `contact\' is required'),
|
||||
$this->translate('The parameter `contact_name\' is required'),
|
||||
404
|
||||
);
|
||||
}
|
||||
|
@ -159,10 +156,10 @@ class Monitoring_ShowController extends Controller
|
|||
$this->view->commands = $commands->paginate();
|
||||
|
||||
$notifications = $this->backend->select()->from('notification', array(
|
||||
'host',
|
||||
'service',
|
||||
'host_name',
|
||||
'service_description',
|
||||
'notification_output',
|
||||
'notification_contact',
|
||||
'notification_contact_name',
|
||||
'notification_start_time',
|
||||
'notification_state',
|
||||
'host_display_name',
|
||||
|
@ -191,13 +188,13 @@ class Monitoring_ShowController extends Controller
|
|||
if ($object->getType() === $object::TYPE_HOST) {
|
||||
$isService = false;
|
||||
$params = array(
|
||||
'host' => $object->getName()
|
||||
'host_name' => $object->getName()
|
||||
);
|
||||
} else {
|
||||
$isService = true;
|
||||
$params = array(
|
||||
'host' => $object->getHost()->getName(),
|
||||
'service' => $object->getName()
|
||||
'host_name' => $object->getHost()->getName(),
|
||||
'service_description' => $object->getName()
|
||||
);
|
||||
}
|
||||
$tabs = $this->getTabs();
|
||||
|
@ -210,7 +207,7 @@ class Monitoring_ShowController extends Controller
|
|||
),
|
||||
'label' => $this->translate('Host'),
|
||||
'icon' => 'host',
|
||||
'url' => 'monitoring/show/host',
|
||||
'url' => 'monitoring/host/show',
|
||||
'urlParams' => $params,
|
||||
)
|
||||
);
|
||||
|
@ -225,7 +222,7 @@ class Monitoring_ShowController extends Controller
|
|||
),
|
||||
'label' => $this->translate('Service'),
|
||||
'icon' => 'service',
|
||||
'url' => 'monitoring/show/service',
|
||||
'url' => 'monitoring/service/show',
|
||||
'urlParams' => $params,
|
||||
)
|
||||
);
|
||||
|
|
|
@ -17,29 +17,20 @@ class SendCustomNotificationCommandForm extends ObjectsCommandForm
|
|||
public function init()
|
||||
{
|
||||
$this->addDescription(
|
||||
$this->translate(
|
||||
'This command is used to send custom notifications for hosts or'
|
||||
. ' services.'
|
||||
)
|
||||
$this->translate('This command is used to send custom notifications about hosts or services.')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPDoc)
|
||||
* @see \Icinga\Web\Form::getSubmitLabel() For the method documentation.
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSubmitLabel()
|
||||
{
|
||||
return $this->translatePlural(
|
||||
'Send custom notification',
|
||||
'Send custom notifications',
|
||||
count($this->objects)
|
||||
);
|
||||
return $this->translatePlural('Send custom notification', 'Send custom notifications', count($this->objects));
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPDoc)
|
||||
* @see \Icinga\Web\Form::createElements() For the method documentation.
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createElements(array $formData = array())
|
||||
{
|
||||
|
@ -64,9 +55,8 @@ class SendCustomNotificationCommandForm extends ObjectsCommandForm
|
|||
'label' => $this->translate('Forced'),
|
||||
'value' => false,
|
||||
'description' => $this->translate(
|
||||
'If you check this option, a notification is sent'
|
||||
. 'regardless of the current time and whether'
|
||||
. ' notifications are enabled.'
|
||||
'If you check this option, the notification is sent out regardless of time restrictions and'
|
||||
. ' whether or not notifications are enabled.'
|
||||
)
|
||||
)
|
||||
),
|
||||
|
@ -77,8 +67,7 @@ class SendCustomNotificationCommandForm extends ObjectsCommandForm
|
|||
'label' => $this->translate('Broadcast'),
|
||||
'value' => false,
|
||||
'description' => $this->translate(
|
||||
'If you check this option, a notification is sent to'
|
||||
. ' all normal and escalated contacts.'
|
||||
'If you check this option, the notification is sent out to all normal and escalated contacts.'
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -87,24 +76,24 @@ class SendCustomNotificationCommandForm extends ObjectsCommandForm
|
|||
}
|
||||
|
||||
/**
|
||||
* (non-PHPDoc)
|
||||
* @see \Icinga\Web\Form::onSuccess() For the method documentation.
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function onSuccess()
|
||||
{
|
||||
foreach ($this->objects as $object) {
|
||||
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
|
||||
$comment = new SendCustomNotificationCommand();
|
||||
$comment->setObject($object);
|
||||
$comment->setComment($this->getElement('comment')->getValue());
|
||||
$comment->setAuthor($this->request->getUser()->getUsername());
|
||||
$comment->setForced($this->getElement('forced')->isChecked());
|
||||
$comment->setBroadcast($this->getElement('broadcast')->isChecked());
|
||||
$this->getTransport($this->request)->send($comment);
|
||||
$notification = new SendCustomNotificationCommand();
|
||||
$notification
|
||||
->setObject($object)
|
||||
->setComment($this->getElement('comment')->getValue())
|
||||
->setAuthor($this->request->getUser()->getUsername())
|
||||
->setForced($this->getElement('forced')->isChecked())
|
||||
->setBroadcast($this->getElement('broadcast')->isChecked());
|
||||
$this->getTransport($this->request)->send($notification);
|
||||
}
|
||||
Notification::success($this->translatePlural(
|
||||
'Send custom notification..',
|
||||
'Send custom notifications..',
|
||||
'Sending custom notification..',
|
||||
'Sending custom notifications..',
|
||||
count($this->objects)
|
||||
));
|
||||
return true;
|
||||
|
|
|
@ -33,7 +33,7 @@ class Zend_View_Helper_Link extends Zend_View_Helper_Abstract
|
|||
return $this->view->qlink(
|
||||
$linkText,
|
||||
'monitoring/host/show',
|
||||
array('host' => $host),
|
||||
array('host_name' => $host),
|
||||
array('title' => sprintf($this->view->translate('Show detailed information for host %s'), $host))
|
||||
);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class Zend_View_Helper_Link extends Zend_View_Helper_Abstract
|
|||
$this->view->qlink(
|
||||
$serviceLinkText,
|
||||
'monitoring/service/show',
|
||||
array('host' => $host, 'service' => $service),
|
||||
array('host_name' => $host, 'service_description' => $service),
|
||||
array('title' => sprintf(
|
||||
$this->view->translate('Show detailed information for service %s on host %s'),
|
||||
$service,
|
||||
|
|
|
@ -65,7 +65,7 @@ class Zend_View_Helper_PluginOutput extends Zend_View_Helper_Abstract
|
|||
parse_str($m[1], $params);
|
||||
if (isset($params['host'])) {
|
||||
$tag->setAttribute('href', $this->view->baseUrl(
|
||||
'/monitoring/host/show?host=' . urlencode($params['host']
|
||||
'/monitoring/host/show?host_name=' . urlencode($params['host']
|
||||
)));
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -34,10 +34,12 @@
|
|||
$icon = 'plug';
|
||||
$title = $this->translate('Downtime');
|
||||
$tooltip = $this->translate('Comment was caused by a downtime.');
|
||||
break;
|
||||
case 'ack':
|
||||
$icon = 'ok';
|
||||
$title = $this->translate('Acknowledgement');
|
||||
$tooltip = $this->translate('Comment was caused by an acknowledgement.');
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<tr class="state invalid">
|
||||
|
@ -52,11 +54,14 @@
|
|||
<?php if ($comment->objecttype === 'service'): ?>
|
||||
<?= $this->icon('service', $this->translate('Service')); ?>
|
||||
<?= $this->link()->service(
|
||||
$comment->service, $comment->service_display_name, $comment->host, $comment->host_display_name
|
||||
) ?>
|
||||
$comment->service_description,
|
||||
$comment->service_display_name,
|
||||
$comment->host_name,
|
||||
$comment->host_display_name
|
||||
); ?>
|
||||
<?php else: ?>
|
||||
<?= $this->icon('host', $this->translate('Host')); ?>
|
||||
<?= $this->link()->host($comment->host, $comment->host_display_name) ?>
|
||||
<?= $this->link()->host($comment->host_name, $comment->host_display_name); ?>
|
||||
<?php endif ?>
|
||||
<br>
|
||||
<?= $this->icon('comment', $this->translate('Comment')); ?> <?= isset($comment->author)
|
||||
|
@ -80,9 +85,14 @@
|
|||
$delCommentForm = clone $delCommentForm;
|
||||
$delCommentForm->populate(array('comment_id' => $comment->id, 'redirect' => $this->url));
|
||||
if ($comment->objecttype === 'host') {
|
||||
$delCommentForm->setAction($this->url('monitoring/host/delete-comment', array('host' => $comment->host)));
|
||||
$delCommentForm->setAction(
|
||||
$this->url('monitoring/host/delete-comment', array('host_name' => $comment->host_name))
|
||||
);
|
||||
} else {
|
||||
$delCommentForm->setAction($this->url('monitoring/service/delete-comment', array('host' => $comment->host, 'service' => $comment->service)));
|
||||
$delCommentForm->setAction($this->url('monitoring/service/delete-comment', array(
|
||||
'host_name' => $comment->host_name,
|
||||
'service_description' => $comment->service_description
|
||||
)));
|
||||
}
|
||||
echo $delCommentForm;
|
||||
?>
|
||||
|
|
|
@ -24,7 +24,7 @@ foreach ($groupData as $groupName => $groupInfo): ?>
|
|||
<?= $this->qlink(
|
||||
$c->contact_alias,
|
||||
'monitoring/show/contact',
|
||||
array('contact' => $c->contact_name),
|
||||
array('contact_name' => $c->contact_name),
|
||||
array('title' => sprintf(
|
||||
$this->translate('Show detailed information about %s'),
|
||||
$c->contact_alias
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<strong><?= $this->qlink(
|
||||
$contact->contact_name,
|
||||
'monitoring/show/contact',
|
||||
array('contact' => $contact->contact_name),
|
||||
array('contact_name' => $contact->contact_name),
|
||||
array('title' => sprintf(
|
||||
$this->translate('Show detailed information about %s'),
|
||||
$contact->contact_alias
|
||||
|
|
|
@ -30,7 +30,7 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
<tbody>
|
||||
<?php foreach ($downtimes as $downtime): ?>
|
||||
<?php
|
||||
if (isset($downtime->service)) {
|
||||
if (isset($downtime->service_description)) {
|
||||
$isService = true;
|
||||
$stateName = Service::getStateText($downtime->service_state);
|
||||
} else {
|
||||
|
@ -57,20 +57,20 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
<?php if ($isService): ?>
|
||||
<?= $this->icon('service', $this->translate('Service')); ?>
|
||||
<?= $this->link()->service(
|
||||
$downtime->service, $downtime->service_display_name, $downtime->host, $downtime->host_display_name
|
||||
$downtime->service_description, $downtime->service_display_name, $downtime->host_name, $downtime->host_display_name
|
||||
) ?>
|
||||
<?php else: ?>
|
||||
<?= $this->icon('host', $this->translate('Host')); ?>
|
||||
<?= $this->link()->host($downtime->host, $downtime->host_display_name) ?>
|
||||
<?= $this->link()->host($downtime->host_name, $downtime->host_display_name) ?>
|
||||
<?php endif ?>
|
||||
<br>
|
||||
<?= $this->icon('comment', $this->translate('Comment')); ?> [<?= $this->escape($downtime->author) ?>] <?= $this->escape($downtime->comment) ?>
|
||||
<?= $this->icon('comment', $this->translate('Comment')); ?> [<?= $this->escape($downtime->author_name) ?>] <?= $this->escape($downtime->comment) ?>
|
||||
<br>
|
||||
<small>
|
||||
<?php if ($downtime->is_flexible): ?>
|
||||
<?php if ($downtime->is_in_effect): ?>
|
||||
<?= sprintf(
|
||||
isset($downtime->service)
|
||||
$isService
|
||||
? $this->translate('This flexible service downtime was started on %s at %s and lasts for %s until %s at %s.')
|
||||
: $this->translate('This flexible host downtime was started on %s at %s and lasts for %s until %s at %s.'),
|
||||
date('d.m.y', $downtime->start),
|
||||
|
@ -81,7 +81,7 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
); ?>
|
||||
<?php else: ?>
|
||||
<?= sprintf(
|
||||
isset($downtime->service)
|
||||
$isService
|
||||
? $this->translate('This flexible service downtime has been scheduled to start between %s - %s and to last for %s.')
|
||||
: $this->translate('This flexible host downtime has been scheduled to start between %s - %s and to last for %s.'),
|
||||
date('d.m.y H:i', $downtime->scheduled_start),
|
||||
|
@ -92,7 +92,7 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
<?php else: ?>
|
||||
<?php if ($downtime->is_in_effect): ?>
|
||||
<?= sprintf(
|
||||
isset($downtime->service)
|
||||
$isService
|
||||
? $this->translate('This fixed service downtime was started on %s at %s and expires on %s at %s.')
|
||||
: $this->translate('This fixed host downtime was started on %s at %s and expires on %s at %s.'),
|
||||
date('d.m.y', $downtime->start),
|
||||
|
@ -102,7 +102,7 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
); ?>
|
||||
<?php else: ?>
|
||||
<?= sprintf(
|
||||
isset($downtime->service)
|
||||
$isService
|
||||
? $this->translate('This fixed service downtime has been scheduled to start on %s at %s and to end on %s at %s.')
|
||||
: $this->translate('This fixed host downtime has been scheduled to start on %s at %s and to end on %s at %s.'),
|
||||
date('d.m.y', $downtime->scheduled_start),
|
||||
|
@ -119,10 +119,13 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
<?php
|
||||
$delDowntimeForm = clone $delDowntimeForm;
|
||||
$delDowntimeForm->populate(array('downtime_id' => $downtime->id, 'redirect' => $this->url));
|
||||
if (! isset($downtime->service)) {
|
||||
$delDowntimeForm->setAction($this->url('monitoring/host/delete-downtime', array('host' => $downtime->host)));
|
||||
if (! $isService) {
|
||||
$delDowntimeForm->setAction($this->url('monitoring/host/delete-downtime', array('host_name' => $downtime->host_name)));
|
||||
} else {
|
||||
$delDowntimeForm->setAction($this->url('monitoring/service/delete-downtime', array('host' => $downtime->host, 'service' => $downtime->service)));
|
||||
$delDowntimeForm->setAction($this->url('monitoring/service/delete-downtime', array(
|
||||
'host_name' => $downtime->host_name,
|
||||
'service_description' => $downtime->service_description
|
||||
)));
|
||||
}
|
||||
echo $delDowntimeForm;
|
||||
?>
|
||||
|
|
|
@ -22,7 +22,7 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
|
||||
<div class="content">
|
||||
<?= $this->filterEditor ?>
|
||||
<?php if (empty($history)): ?>
|
||||
<?php if (count($history) === 0): ?>
|
||||
<?= $this->translate('No history events matching the filter') ?>
|
||||
</div>
|
||||
<?php return; endif ?>
|
||||
|
@ -34,7 +34,7 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
$icon = 'help';
|
||||
$title = $event->type;
|
||||
$stateName = 'invalid';
|
||||
$isService = isset($event->service);
|
||||
$isService = isset($event->service_description);
|
||||
switch ($event->type) {
|
||||
case 'notify':
|
||||
$icon = 'bell';
|
||||
|
@ -99,10 +99,10 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
<td>
|
||||
<?php if ($isService): ?>
|
||||
<?= $this->link()->service(
|
||||
$event->service, $event->service_display_name, $event->host, $event->host_display_name
|
||||
$event->service_description, $event->service_display_name, $event->host_name, $event->host_display_name
|
||||
) ?>
|
||||
<?php else: ?>
|
||||
<?= $this->link()->host($event->host, $event->host_display_name) ?>
|
||||
<?= $this->link()->host($event->host_name, $event->host_display_name) ?>
|
||||
<?php endif ?>
|
||||
<br>
|
||||
<div>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($hostgroups as $h): ?>
|
||||
<tr href="<?= $this->href('monitoring/list/hosts', array('hostgroup' => $h->hostgroup)) ?>">
|
||||
<tr href="<?= $this->href('monitoring/list/hosts', array('hostgroup_name' => $h->hostgroup_name)) ?>">
|
||||
<?php if ($h->services_critical_last_state_change_unhandled): ?>
|
||||
<td class="state change critical unhandled">
|
||||
<strong><?= $this->translate('CRITICAL'); ?></strong>
|
||||
|
@ -82,7 +82,7 @@
|
|||
<?= $this->qlink(
|
||||
$h->hostgroup_alias,
|
||||
'monitoring/list/hosts',
|
||||
array('hostgroup' => $h->hostgroup),
|
||||
array('hostgroup_name' => $h->hostgroup_name),
|
||||
array('title' => sprintf($this->translate('List all hosts in the group "%s"'), $h->hostgroup_alias))
|
||||
); ?>
|
||||
</td>
|
||||
|
@ -90,7 +90,7 @@
|
|||
<?= $this->qlink(
|
||||
$h->services_total,
|
||||
'monitoring/list/services',
|
||||
array('hostgroup' => $h->hostgroup),
|
||||
array('hostgroup_name' => $h->hostgroup_name),
|
||||
array('title' => sprintf(
|
||||
$this->translate('List all services of all hosts in host group "%s"'),
|
||||
$h->hostgroup_alias
|
||||
|
@ -104,9 +104,9 @@
|
|||
$h->services_ok,
|
||||
'monitoring/list/services',
|
||||
array(
|
||||
'service_state' => 0,
|
||||
'hostgroup' => $h->hostgroup,
|
||||
'sort' => 'service_severity'
|
||||
'service_state' => 0,
|
||||
'hostgroup_name' => $h->hostgroup_name,
|
||||
'sort' => 'service_severity'
|
||||
),
|
||||
array(
|
||||
'title' => sprintf(
|
||||
|
@ -132,7 +132,7 @@
|
|||
'service_acknowledged' => 0,
|
||||
'service_in_downtime' => 0,
|
||||
'host_problem' => 0,
|
||||
'hostgroup' => $h->hostgroup,
|
||||
'hostgroup_name' => $h->hostgroup_name,
|
||||
'sort' => 'service_severity'
|
||||
),
|
||||
array(
|
||||
|
@ -156,7 +156,7 @@
|
|||
array(
|
||||
'service_state' => 2,
|
||||
'service_handled' => 1,
|
||||
'hostgroup' => $h->hostgroup,
|
||||
'hostgroup_name' => $h->hostgroup_name,
|
||||
'sort' => 'service_severity'
|
||||
),
|
||||
array(
|
||||
|
@ -186,7 +186,7 @@
|
|||
'service_acknowledged' => 0,
|
||||
'service_in_downtime' => 0,
|
||||
'host_problem' => 0,
|
||||
'hostgroup' => $h->hostgroup,
|
||||
'hostgroup_name' => $h->hostgroup_name,
|
||||
'sort' => 'service_severity'
|
||||
),
|
||||
array(
|
||||
|
@ -210,7 +210,7 @@
|
|||
array(
|
||||
'service_state' => 3,
|
||||
'service_handled' => 1,
|
||||
'hostgroup' => $h->hostgroup,
|
||||
'hostgroup_name' => $h->hostgroup_name,
|
||||
'sort' => 'service_severity'
|
||||
),
|
||||
array(
|
||||
|
@ -240,7 +240,7 @@
|
|||
'service_acknowledged' => 0,
|
||||
'service_in_downtime' => 0,
|
||||
'host_problem' => 0,
|
||||
'hostgroup' => $h->hostgroup,
|
||||
'hostgroup_name' => $h->hostgroup_name,
|
||||
'sort' => 'service_severity'
|
||||
),
|
||||
array(
|
||||
|
@ -264,7 +264,7 @@
|
|||
array(
|
||||
'service_state' => 1,
|
||||
'service_handled' => 1,
|
||||
'hostgroup' => $h->hostgroup,
|
||||
'hostgroup_name' => $h->hostgroup_name,
|
||||
'sort' => 'service_severity'
|
||||
),
|
||||
array(
|
||||
|
@ -290,9 +290,9 @@
|
|||
$h->services_pending,
|
||||
'monitoring/list/services',
|
||||
array(
|
||||
'service_state' => 99,
|
||||
'hostgroup' => $h->hostgroup,
|
||||
'sort' => 'service_severity'
|
||||
'service_state' => 99,
|
||||
'hostgroup_name' => $h->hostgroup_name,
|
||||
'sort' => 'service_severity'
|
||||
),
|
||||
array(
|
||||
'title' => sprintf(
|
||||
|
|
|
@ -36,13 +36,13 @@ if ($hosts->count() === 0) {
|
|||
data-base-target="_next"
|
||||
class="action multiselect"
|
||||
data-icinga-multiselect-url="<?= $this->href('monitoring/hosts/show') ?>"
|
||||
data-icinga-multiselect-data="host"
|
||||
data-icinga-multiselect-data="host_name"
|
||||
>
|
||||
<tbody>
|
||||
<?php foreach($hosts as $host):
|
||||
|
||||
$hostStateName = Host::getStateText($host->host_state);
|
||||
$hostLink = $this->href('monitoring/host/show', array('host' => $host->host_name));
|
||||
$hostLink = $this->href('monitoring/host/show', array('host_name' => $host->host_name));
|
||||
|
||||
$icons = array();
|
||||
if (! $host->host_handled && $host->host_state > 0){
|
||||
|
@ -113,7 +113,7 @@ if ($hosts->count() === 0) {
|
|||
),
|
||||
'monitoring/show/services',
|
||||
array(
|
||||
'host' => $host->host_name,
|
||||
'host_name' => $host->host_name,
|
||||
'service_problem' => 1,
|
||||
'service_handled' => 0
|
||||
),
|
||||
|
|
|
@ -24,7 +24,7 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
<table data-base-target="_next" class="action">
|
||||
<tbody>
|
||||
<?php foreach ($notifications as $notification):
|
||||
if (isset($notification->service)) {
|
||||
if (isset($notification->service_description)) {
|
||||
$isService = true;
|
||||
$stateName = Service::getStateText($notification->notification_state);
|
||||
} else {
|
||||
|
@ -44,14 +44,14 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
<?php if ($isService): ?>
|
||||
<?= $this->icon('service', $this->translate('Service')); ?>
|
||||
<?= $this->link()->service(
|
||||
$notification->service,
|
||||
$notification->service_description,
|
||||
$notification->service_display_name,
|
||||
$notification->host,
|
||||
$notification->host_name,
|
||||
$notification->host_display_name
|
||||
) ?>
|
||||
<?php else: ?>
|
||||
<?= $this->icon('host', $this->translate('Host')); ?>
|
||||
<?= $this->link()->host($notification->host, $notification->host_display_name) ?>
|
||||
<?= $this->link()->host($notification->host_name, $notification->host_display_name) ?>
|
||||
<?php endif ?>
|
||||
<br>
|
||||
<?= $this->escape($this->ellipsis($notification->notification_output, 10000)) ?>
|
||||
|
@ -61,9 +61,9 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
<?= sprintf(
|
||||
$this->translate('Sent to %s'),
|
||||
$this->qlink(
|
||||
$notification->notification_contact,
|
||||
$notification->notification_contact_name,
|
||||
'monitoring/show/contact',
|
||||
array('contact' => $notification->notification_contact)
|
||||
array('contact_name' => $notification->notification_contact_name)
|
||||
)
|
||||
) ?>
|
||||
</small>
|
||||
|
|
|
@ -68,7 +68,7 @@ foreach ($serviceDescriptions as $service_description): ?>
|
|||
<?= $this->qlink(
|
||||
$host_name,
|
||||
'monitoring/show/services?' . $serviceFilter,
|
||||
array('host' => $host_name),
|
||||
array('host_name' => $host_name),
|
||||
array('title' => sprintf($this->translate('List all reported services on host %s'), $host_name))
|
||||
); ?>
|
||||
</th>
|
||||
|
@ -80,10 +80,10 @@ foreach ($serviceDescriptions as $service_description): ?>
|
|||
</span>
|
||||
<?= $this->qlink(
|
||||
'',
|
||||
'monitoring/show/service',
|
||||
'monitoring/service/show',
|
||||
array(
|
||||
'host' => $service->host_name,
|
||||
'service' => $service->service_description
|
||||
'host_name' => $service->host_name,
|
||||
'service_description' => $service->service_description
|
||||
),
|
||||
array(
|
||||
'aria-describedby' => $service->host_name . '_' . $service->service_description . '_desc',
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($servicegroups as $s): ?>
|
||||
<tr href="<?= $this->href('monitoring/list/services', array('servicegroup' => $s->servicegroup)); ?>">
|
||||
<tr href="<?= $this->href('monitoring/list/services', array('servicegroup_name' => $s->servicegroup_name)); ?>">
|
||||
<?php if ($s->services_critical_last_state_change_unhandled): ?>
|
||||
<td class="state change critical unhandled">
|
||||
<strong><?= $this->translate('CRITICAL'); ?></strong>
|
||||
|
@ -82,7 +82,7 @@
|
|||
<?= $this->qlink(
|
||||
$s->servicegroup_alias,
|
||||
'monitoring/list/services',
|
||||
array('servicegroup' => $s->servicegroup),
|
||||
array('servicegroup_name' => $s->servicegroup_name),
|
||||
array('title' => sprintf($this->translate('List all services in the group "%s"'), $s->servicegroup_alias))
|
||||
); ?>
|
||||
</td>
|
||||
|
@ -96,9 +96,9 @@
|
|||
$s->services_ok,
|
||||
'monitoring/list/services',
|
||||
array(
|
||||
'service_state' => 0,
|
||||
'servicegroup' => $s->servicegroup,
|
||||
'sort' => 'service_severity'
|
||||
'service_state' => 0,
|
||||
'servicegroup_name' => $s->servicegroup_name,
|
||||
'sort' => 'service_severity'
|
||||
),
|
||||
array(
|
||||
'title' => sprintf(
|
||||
|
@ -124,7 +124,7 @@
|
|||
'service_acknowledged' => 0,
|
||||
'service_in_downtime' => 0,
|
||||
'host_problem' => 0,
|
||||
'servicegroup' => $s->servicegroup,
|
||||
'servicegroup_name' => $s->servicegroup_name,
|
||||
'sort' => 'service_severity'
|
||||
),
|
||||
array(
|
||||
|
@ -148,7 +148,7 @@
|
|||
array(
|
||||
'service_state' => 2,
|
||||
'service_handled' => 1,
|
||||
'servicegroup' => $s->servicegroup,
|
||||
'servicegroup_name' => $s->servicegroup_name,
|
||||
'sort' => 'service_severity'
|
||||
),
|
||||
array(
|
||||
|
@ -178,7 +178,7 @@
|
|||
'service_acknowledged' => 0,
|
||||
'service_in_downtime' => 0,
|
||||
'host_problem' => 0,
|
||||
'servicegroup' => $s->servicegroup,
|
||||
'servicegroup_name' => $s->servicegroup_name,
|
||||
'sort' => 'service_severity'
|
||||
),
|
||||
array(
|
||||
|
@ -202,7 +202,7 @@
|
|||
array(
|
||||
'service_state' => 3,
|
||||
'service_handled' => 1,
|
||||
'servicegroup' => $s->servicegroup,
|
||||
'servicegroup_name' => $s->servicegroup_name,
|
||||
'sort' => 'service_severity'
|
||||
),
|
||||
array(
|
||||
|
@ -232,7 +232,7 @@
|
|||
'service_acknowledged' => 0,
|
||||
'service_in_downtime' => 0,
|
||||
'host_problem' => 0,
|
||||
'servicegroup' => $s->servicegroup,
|
||||
'servicegroup_name' => $s->servicegroup_name,
|
||||
'sort' => 'service_severity'
|
||||
),
|
||||
array(
|
||||
|
@ -256,7 +256,7 @@
|
|||
array(
|
||||
'service_state' => 1,
|
||||
'service_handled' => 1,
|
||||
'servicegroup' => $s->servicegroup,
|
||||
'servicegroup_name' => $s->servicegroup_name,
|
||||
'sort' => 'service_severity'
|
||||
),
|
||||
array(
|
||||
|
@ -282,9 +282,9 @@
|
|||
$s->services_pending,
|
||||
'monitoring/list/services',
|
||||
array(
|
||||
'service_state' => 99,
|
||||
'servicegroup' => $s->servicegroup,
|
||||
'sort' => 'service_severity'
|
||||
'service_state' => 99,
|
||||
'servicegroup_name' => $s->servicegroup_name,
|
||||
'sort' => 'service_severity'
|
||||
),
|
||||
array(
|
||||
'title' => sprintf(
|
||||
|
|
|
@ -31,7 +31,7 @@ if (!$this->compact): ?>
|
|||
<table data-base-target="_next"
|
||||
class="action multiselect <?php if ($this->compact): ?> compact<?php endif ?>" style="table-layout: auto;"
|
||||
data-icinga-multiselect-url="<?= $this->href("monitoring/services/show") ?>"
|
||||
data-icinga-multiselect-data="service,host">
|
||||
data-icinga-multiselect-data="service_description,host_name">
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
|
@ -42,14 +42,14 @@ foreach ($services as $service):
|
|||
$serviceLink = $this->href(
|
||||
'monitoring/service/show',
|
||||
array(
|
||||
'host' => $service->host_name,
|
||||
'service' => $service->service_description
|
||||
'host_name' => $service->host_name,
|
||||
'service_description' => $service->service_description
|
||||
)
|
||||
);
|
||||
$hostLink = $this->href(
|
||||
'monitoring/show/host',
|
||||
'monitoring/host/show',
|
||||
array(
|
||||
'host' => $service->host_name,
|
||||
'host_name' => $service->host_name,
|
||||
)
|
||||
);
|
||||
$serviceStateName = Service::getStateText($service->service_state);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use Icinga\Web\Url;
|
||||
use Icinga\Module\Monitoring\Object\Service;
|
||||
|
||||
$selfUrl = Url::fromPath('monitoring/show/services', array('host' => $object->host_name));
|
||||
$selfUrl = Url::fromPath('monitoring/show/services', array('host_name' => $object->host_name));
|
||||
$currentUrl = Url::fromRequest()->without('limit')->getRelativeUrl();
|
||||
?><div class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : ''; ?>>
|
||||
<?php if ($object->stats->services_total): ?>
|
||||
|
|
|
@ -26,12 +26,12 @@ if ($object->acknowledged): ?>
|
|||
if ($object->getType() === $object::TYPE_HOST) {
|
||||
$ackLink = $this->href(
|
||||
'monitoring/host/acknowledge-problem',
|
||||
array('host' => $object->getName())
|
||||
array('host_name' => $object->getName())
|
||||
);
|
||||
} else {
|
||||
$ackLink = $this->href(
|
||||
'monitoring/service/acknowledge-problem',
|
||||
array('host' => $object->getHost()->getName(), 'service' => $object->getName())
|
||||
array('host_name' => $object->getHost()->getName(), 'service_description' => $object->getName())
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -31,7 +31,7 @@ if ($object->getType() === $object::TYPE_HOST) {
|
|||
echo $this->qlink(
|
||||
$this->translate('Reschedule'),
|
||||
'monitoring/service/reschedule-check',
|
||||
array('host' => $object->getHost()->getName(), 'service' => $object->getName()),
|
||||
array('host_name' => $object->getHost()->getName(), 'service_description' => $object->getName()),
|
||||
array(
|
||||
'icon' => 'reschedule',
|
||||
'data-base-target' => '_self',
|
||||
|
@ -44,7 +44,7 @@ if ($object->getType() === $object::TYPE_HOST) {
|
|||
echo $this->qlink(
|
||||
$this->translate('Reschedule'),
|
||||
'monitoring/host/reschedule-check',
|
||||
array('host' => $object->getName()),
|
||||
array('host_name' => $object->getName()),
|
||||
array(
|
||||
'icon' => 'reschedule',
|
||||
'data-base-target' => '_self',
|
||||
|
|
|
@ -15,7 +15,7 @@ $command = array_shift($parts);
|
|||
echo $this->qlink(
|
||||
$this->translate('Process check result'),
|
||||
'monitoring/host/process-check-result',
|
||||
array('host' => $object->getName()),
|
||||
array('host_name' => $object->getName()),
|
||||
array(
|
||||
'icon' => 'reply',
|
||||
'data-base-target' => '_self',
|
||||
|
@ -26,7 +26,7 @@ $command = array_shift($parts);
|
|||
echo $this->qlink(
|
||||
$this->translate('Process check result'),
|
||||
'monitoring/service/process-check-result',
|
||||
array('host' => $object->getHost()->getName(), 'service' => $object->getName()),
|
||||
array('host_name' => $object->getHost()->getName(), 'service_description' => $object->getName()),
|
||||
array(
|
||||
'icon' => 'reply',
|
||||
'data-base-target' => '_self',
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
echo $this->qlink(
|
||||
$this->translate('Add comment'),
|
||||
'monitoring/host/add-comment',
|
||||
array('host' => $object->getName()),
|
||||
array('host_name' => $object->getName()),
|
||||
array(
|
||||
'icon' => 'comment',
|
||||
'data-base-target' => '_self',
|
||||
|
@ -18,7 +18,7 @@
|
|||
echo $this->qlink(
|
||||
$this->translate('Add comment'),
|
||||
'monitoring/service/add-comment',
|
||||
array('host' => $object->getHost()->getName(), 'service' => $object->getName()),
|
||||
array('host_name' => $object->getHost()->getName(), 'service_description' => $object->getName()),
|
||||
array(
|
||||
'icon' => 'comment',
|
||||
'data-base-target' => '_self',
|
||||
|
|
|
@ -7,7 +7,7 @@ if (! empty($object->contacts)) {
|
|||
$list[] = $this->qlink(
|
||||
$contact->contact_alias,
|
||||
'monitoring/show/contact',
|
||||
array('contact' => $contact->contact_name),
|
||||
array('contact_name' => $contact->contact_name),
|
||||
array('title' => sprintf($this->translate('Show detailed information about %s'), $contact->contact_alias))
|
||||
);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ if (! empty($object->contactgroups)) {
|
|||
$list[] = $this->qlink(
|
||||
$contactgroup->contactgroup_alias,
|
||||
'monitoring/list/contactgroups',
|
||||
array('contactgroup' => $contactgroup->contactgroup_name),
|
||||
array('contactgroup_name' => $contactgroup->contactgroup_name),
|
||||
array('title' => sprintf($this->translate('List contacts in contact-group "%s"'), $contactgroup->contactgroup_alias))
|
||||
);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
echo $this->qlink(
|
||||
$this->translate('Schedule downtime'),
|
||||
'monitoring/host/schedule-downtime',
|
||||
array('host' => $object->getName()),
|
||||
array('host_name' => $object->getName()),
|
||||
array(
|
||||
'icon' => 'plug',
|
||||
'data-base-target' => '_self',
|
||||
|
@ -20,7 +20,7 @@
|
|||
echo $this->qlink(
|
||||
$this->translate('Schedule downtime'),
|
||||
'monitoring/service/schedule-downtime',
|
||||
array('host' => $object->getHost()->getName(), 'service' => $object->getName()),
|
||||
array('host_name' => $object->getHost()->getName(), 'service_description' => $object->getName()),
|
||||
array(
|
||||
'icon' => 'plug',
|
||||
'data-base-target' => '_self',
|
||||
|
@ -58,14 +58,14 @@ foreach ($object->downtimes as $downtime) {
|
|||
|
||||
?>
|
||||
<tr>
|
||||
<th><?= $this->escape($downtime->author); ?></th>
|
||||
<th><?= $this->escape($downtime->author_name); ?></th>
|
||||
<td data-base-target="_self">
|
||||
<?php if (isset($delDowntimeForm)) { // Form is unset if the current user lacks the respective permission
|
||||
$delDowntimeForm = clone $delDowntimeForm;
|
||||
$delDowntimeForm->populate(array('downtime_id' => $downtime->id));
|
||||
echo $delDowntimeForm;
|
||||
} ?>
|
||||
<span class="sr-only"><?= $this->translate('Downtime'); ?></span><?= $state; ?><?= str_replace(array('\r\n', '\n'), '<br>', $commentText); ?>
|
||||
<span class="sr-only"><?= $this->translate('Downtime'); ?></span><?= $state; ?> - <?= str_replace(array('\r\n', '\n'), '<br>', $commentText); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } // endforeach ?>
|
||||
|
|
|
@ -7,7 +7,7 @@ foreach ($object->hostgroups as $name => $alias) {
|
|||
$list[] = $this->qlink(
|
||||
$alias,
|
||||
'monitoring/list/hosts',
|
||||
array('hostgroup' => $name),
|
||||
array('hostgroup_name' => $name),
|
||||
array('title' => sprintf($this->translate('List all hosts in the group "%s"'), $alias))
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
echo $this->qlink(
|
||||
$this->translate('Send notification'),
|
||||
'monitoring/host/send-custom-notification',
|
||||
array('host' => $object->getName()),
|
||||
array('host_name' => $object->getName()),
|
||||
array(
|
||||
'icon' => 'bell',
|
||||
'data-base-target' => '_self',
|
||||
|
@ -23,7 +23,7 @@
|
|||
echo $this->qlink(
|
||||
$this->translate('Send notification'),
|
||||
'monitoring/service/send-custom-notification',
|
||||
array('host' => $object->getHost()->getName(), 'service' => $object->getName()),
|
||||
array('host_name' => $object->getHost()->getName(), 'service_description' => $object->getName()),
|
||||
array(
|
||||
'icon' => 'bell',
|
||||
'data-base-target' => '_self',
|
||||
|
|
|
@ -7,7 +7,7 @@ foreach ($object->servicegroups as $name => $alias) {
|
|||
$list[] = $this->qlink(
|
||||
$alias,
|
||||
'monitoring/list/services',
|
||||
array('servicegroup' => $name),
|
||||
array('servicegroup_name' => $name),
|
||||
array('title' => sprintf($this->translate('List all services in the group "%s"'), $alias))
|
||||
);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ $hostContext = $object->getType() === 'host';
|
|||
</div>
|
||||
|
||||
<div class="content">
|
||||
<?php if (empty($history)): ?>
|
||||
<?php if (count($history) === 0): ?>
|
||||
<?= $this->translate('No history available for this object'); ?>
|
||||
</div>
|
||||
<?php return; endif ?>
|
||||
|
@ -32,7 +32,7 @@ function contactsLink($match, $view) {
|
|||
$links[] = $view->qlink(
|
||||
$contact,
|
||||
'monitoring/show/contact',
|
||||
array('contact' => $contact),
|
||||
array('contact_name' => $contact),
|
||||
array('title' => sprintf($view->translate('Show detailed information about %s'), $contact))
|
||||
);
|
||||
}
|
||||
|
@ -142,10 +142,10 @@ $output = $this->tickets ? preg_replace_callback(
|
|||
$this->translate('%s on %s', 'Service running on host'),
|
||||
$hostContext ? $this->qlink(
|
||||
$event->service_display_name,
|
||||
'monitoring/show/service',
|
||||
'monitoring/service/show',
|
||||
array(
|
||||
'host' => $event->host_name,
|
||||
'service' => $event->service_description
|
||||
'host_name' => $event->host_name,
|
||||
'service_description' => $event->service_description
|
||||
),
|
||||
array('title' => sprintf(
|
||||
$this->translate('Show detailed information for service %s on host %s'),
|
||||
|
|
|
@ -13,17 +13,17 @@ class CommentQuery extends IdoQuery
|
|||
'comment_internal_id' => 'cm.internal_comment_id',
|
||||
'comment_data' => 'cm.comment_data',
|
||||
'comment_author' => 'cm.author_name COLLATE latin1_general_ci',
|
||||
'comment_author_name' => 'cm.author_name',
|
||||
'comment_timestamp' => 'UNIX_TIMESTAMP(cm.comment_time)',
|
||||
'comment_type' => "CASE cm.entry_type WHEN 1 THEN 'comment' WHEN 2 THEN 'downtime' WHEN 3 THEN 'flapping' WHEN 4 THEN 'ack' END",
|
||||
'comment_is_persistent' => 'cm.is_persistent',
|
||||
'comment_expiration' => 'CASE cm.expires WHEN 1 THEN UNIX_TIMESTAMP(cm.expiration_time) ELSE NULL END',
|
||||
'comment_host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci',
|
||||
'host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci', // #7278, #7279
|
||||
'comment_service' => 'so.name2 COLLATE latin1_general_ci',
|
||||
'service' => 'so.name2 COLLATE latin1_general_ci', // #7278, #7279
|
||||
'comment_objecttype' => "CASE WHEN ho.object_id IS NOT NULL THEN 'host' ELSE CASE WHEN so.object_id IS NOT NULL THEN 'service' ELSE NULL END END",
|
||||
'service_description' => 'so.name2',
|
||||
'host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci',
|
||||
'host_name' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END',
|
||||
'service' => 'so.name2 COLLATE latin1_general_ci',
|
||||
'service_description' => 'so.name2',
|
||||
'service_host' => 'so.name1 COLLATE latin1_general_ci',
|
||||
'service_host_name' => 'so.name1'
|
||||
),
|
||||
'hosts' => array(
|
||||
|
|
|
@ -7,24 +7,22 @@ class CommentdeletionhistoryQuery extends IdoQuery
|
|||
{
|
||||
protected $columnMap = array(
|
||||
'commenthistory' => array(
|
||||
'state_time' => 'h.deletion_time',
|
||||
'timestamp' => 'UNIX_TIMESTAMP(h.deletion_time)',
|
||||
'raw_timestamp' => 'h.deletion_time',
|
||||
'object_id' => 'h.object_id',
|
||||
'type' => "(CASE h.entry_type WHEN 1 THEN 'comment_deleted' WHEN 2 THEN 'dt_comment_deleted' WHEN 3 THEN 'flapping_deleted' WHEN 4 THEN 'ack_deleted' END)",
|
||||
'state' => '(NULL)',
|
||||
'state_type' => '(NULL)',
|
||||
'output' => "('[' || h.author_name || '] ' || h.comment_data)",
|
||||
'attempt' => '(NULL)',
|
||||
'max_attempts' => '(NULL)',
|
||||
'state_time' => 'h.deletion_time',
|
||||
'timestamp' => 'UNIX_TIMESTAMP(h.deletion_time)',
|
||||
'raw_timestamp' => 'h.deletion_time',
|
||||
'object_id' => 'h.object_id',
|
||||
'type' => "(CASE h.entry_type WHEN 1 THEN 'comment_deleted' WHEN 2 THEN 'dt_comment_deleted' WHEN 3 THEN 'flapping_deleted' WHEN 4 THEN 'ack_deleted' END)",
|
||||
'state' => '(NULL)',
|
||||
'state_type' => '(NULL)',
|
||||
'output' => "('[' || h.author_name || '] ' || h.comment_data)",
|
||||
'attempt' => '(NULL)',
|
||||
'max_attempts' => '(NULL)',
|
||||
|
||||
'host' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'host_name' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'service_host_name' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'object_type' => "CASE WHEN o.objecttype_id = 1 THEN 'host' ELSE 'service' END"
|
||||
'host' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'host_name' => 'o.name1',
|
||||
'service_description' => 'o.name2',
|
||||
'object_type' => "CASE WHEN o.objecttype_id = 1 THEN 'host' ELSE 'service' END"
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -7,24 +7,22 @@ class CommenthistoryQuery extends IdoQuery
|
|||
{
|
||||
protected $columnMap = array(
|
||||
'commenthistory' => array(
|
||||
'state_time' => 'h.comment_time',
|
||||
'timestamp' => 'UNIX_TIMESTAMP(h.comment_time)',
|
||||
'raw_timestamp' => 'h.comment_time',
|
||||
'object_id' => 'h.object_id',
|
||||
'type' => "(CASE h.entry_type WHEN 1 THEN 'comment' WHEN 2 THEN 'dt_comment' WHEN 3 THEN 'flapping' WHEN 4 THEN 'ack' END)",
|
||||
'state' => '(NULL)',
|
||||
'state_type' => '(NULL)',
|
||||
'output' => "('[' || h.author_name || '] ' || h.comment_data)",
|
||||
'attempt' => '(NULL)',
|
||||
'max_attempts' => '(NULL)',
|
||||
'state_time' => 'h.comment_time',
|
||||
'timestamp' => 'UNIX_TIMESTAMP(h.comment_time)',
|
||||
'raw_timestamp' => 'h.comment_time',
|
||||
'object_id' => 'h.object_id',
|
||||
'type' => "(CASE h.entry_type WHEN 1 THEN 'comment' WHEN 2 THEN 'dt_comment' WHEN 3 THEN 'flapping' WHEN 4 THEN 'ack' END)",
|
||||
'state' => '(NULL)',
|
||||
'state_type' => '(NULL)',
|
||||
'output' => "('[' || h.author_name || '] ' || h.comment_data)",
|
||||
'attempt' => '(NULL)',
|
||||
'max_attempts' => '(NULL)',
|
||||
|
||||
'host' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'host_name' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'service_host_name' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'object_type' => "CASE WHEN o.objecttype_id = 1 THEN 'host' ELSE 'service' END"
|
||||
'host' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'host_name' => 'o.name1',
|
||||
'service_description' => 'o.name2',
|
||||
'object_type' => "CASE WHEN o.objecttype_id = 1 THEN 'host' ELSE 'service' END"
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@ class ContactQuery extends IdoQuery
|
|||
protected $columnMap = array(
|
||||
'contacts' => array(
|
||||
'contact_id' => 'c.contact_id',
|
||||
'contact_name' => 'co.name1 COLLATE latin1_general_ci',
|
||||
'contact' => 'co.name1 COLLATE latin1_general_ci',
|
||||
'contact_name' => 'co.name1',
|
||||
'contact_alias' => 'c.alias COLLATE latin1_general_ci',
|
||||
'contact_email' => 'c.email_address COLLATE latin1_general_ci',
|
||||
'contact_pager' => 'c.pager_address',
|
||||
|
@ -34,12 +35,13 @@ class ContactQuery extends IdoQuery
|
|||
),
|
||||
'hosts' => array(
|
||||
'host' => 'ho.name1 COLLATE latin1_general_ci',
|
||||
'host_name' => 'ho.name1',
|
||||
'host_name' => 'ho.name1'
|
||||
),
|
||||
'services' => array(
|
||||
'service' => 'so.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'so.name2 COLLATE latin1_general_ci',
|
||||
'service_description' => 'so.name2',
|
||||
'service_host_name' => 'so.name1',
|
||||
'service_host' => 'so.name1 COLLATE latin1_general_ci',
|
||||
'service_host_name' => 'so.name1'
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -8,14 +8,14 @@ class ContactgroupQuery extends IdoQuery
|
|||
protected $columnMap = array(
|
||||
'contactgroups' => array(
|
||||
'contactgroup' => 'cgo.name1 COLLATE latin1_general_ci',
|
||||
'contactgroup_name' => 'cgo.name1 COLLATE latin1_general_ci',
|
||||
'contactgroup_alias' => 'cg.alias',
|
||||
'contactgroup_name' => 'cgo.name1',
|
||||
'contactgroup_alias' => 'cg.alias COLLATE latin1_general_ci'
|
||||
),
|
||||
'contacts' => array(
|
||||
'contact' => 'co.name1 COLLATE latin1_general_ci',
|
||||
'contact_name' => 'co.name1 COLLATE latin1_general_ci',
|
||||
'contact_alias' => 'c.alias',
|
||||
'contact_email' => 'c.email_address',
|
||||
'contact_name' => 'co.name1',
|
||||
'contact_alias' => 'c.alias COLLATE latin1_general_ci',
|
||||
'contact_email' => 'c.email_address COLLATE latin1_general_ci',
|
||||
'contact_pager' => 'c.pager_address',
|
||||
'contact_has_host_notfications' => 'c.host_notifications_enabled',
|
||||
'contact_has_service_notfications' => 'c.service_notifications_enabled',
|
||||
|
@ -39,6 +39,7 @@ class ContactgroupQuery extends IdoQuery
|
|||
'services' => array(
|
||||
'service' => 'so.name2 COLLATE latin1_general_ci',
|
||||
'service_description' => 'so.name2',
|
||||
'service_host' => 'so.name1 COLLATE latin1_general_ci',
|
||||
'service_host_name' => 'so.name1'
|
||||
)
|
||||
);
|
||||
|
|
|
@ -13,14 +13,14 @@ class CustomvarQuery extends IdoQuery
|
|||
),
|
||||
'objects' => array(
|
||||
'host' => 'cvo.name1 COLLATE latin1_general_ci',
|
||||
'host_name' => 'cvo.name1 COLLATE latin1_general_ci',
|
||||
'service_host_name' => 'cvo.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'cvo.name2 COLLATE latin1_general_ci',
|
||||
'service_description' => 'cvo.name2 COLLATE latin1_general_ci',
|
||||
'contact_name' => 'cvo.name1 COLLATE latin1_general_ci',
|
||||
'host_name' => 'cvo.name1',
|
||||
'service' => 'cvo.name2 COLLATE latin1_general_ci',
|
||||
'service_description' => 'cvo.name2',
|
||||
'contact' => 'cvo.name1 COLLATE latin1_general_ci',
|
||||
'contact_name' => 'cvo.name1',
|
||||
'object_type' => "CASE cvo.objecttype_id WHEN 1 THEN 'host' WHEN 2 THEN 'service' WHEN 10 THEN 'contact' ELSE 'invalid' END",
|
||||
'object_type_id' => 'cvo.objecttype_id'
|
||||
// 'object_type' => "CASE cvo.objecttype_id WHEN 1 THEN 'host' WHEN 2 THEN 'service' WHEN 3 THEN 'hostgroup' WHEN 4 THEN 'servicegroup' WHEN 5 THEN 'hostescalation' WHEN 6 THEN 'serviceescalation' WHEN 7 THEN 'hostdependency' WHEN 8 THEN 'servicedependency' WHEN 9 THEN 'timeperiod' WHEN 10 THEN 'contact' WHEN 11 THEN 'contactgroup' WHEN 12 THEN 'command' ELSE 'other' END"
|
||||
// 'object_type' => "CASE cvo.objecttype_id WHEN 1 THEN 'host' WHEN 2 THEN 'service' WHEN 3 THEN 'hostgroup' WHEN 4 THEN 'servicegroup' WHEN 5 THEN 'hostescalation' WHEN 6 THEN 'serviceescalation' WHEN 7 THEN 'hostdependency' WHEN 8 THEN 'servicedependency' WHEN 9 THEN 'timeperiod' WHEN 10 THEN 'contact' WHEN 11 THEN 'contactgroup' WHEN 12 THEN 'command' ELSE 'other' END"
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ class DowntimeQuery extends IdoQuery
|
|||
*/
|
||||
protected $columnMap = array(
|
||||
'downtime' => array(
|
||||
'downtime_author' => 'sd.author_name',
|
||||
'author' => 'sd.author_name',
|
||||
'downtime_author_name' => 'sd.author_name',
|
||||
'author' => 'sd.author_name COLLATE latin1_general_ci',
|
||||
'downtime_comment' => 'sd.comment_data',
|
||||
'downtime_entry_time' => 'UNIX_TIMESTAMP(sd.entry_time)',
|
||||
'downtime_is_fixed' => 'sd.is_fixed',
|
||||
|
@ -28,12 +28,11 @@ class DowntimeQuery extends IdoQuery
|
|||
'downtime_is_in_effect' => 'sd.is_in_effect',
|
||||
'downtime_internal_id' => 'sd.internal_downtime_id',
|
||||
'downtime_objecttype' => "CASE WHEN ho.object_id IS NULL THEN 'service' ELSE 'host' END",
|
||||
'downtime_host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci', // #7278, #7279
|
||||
'host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci',
|
||||
'host_name' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END',
|
||||
'downtime_service' => 'so.name2 COLLATE latin1_general_ci',
|
||||
'service' => 'so.name2 COLLATE latin1_general_ci', // #7278, #7279
|
||||
'service' => 'so.name2 COLLATE latin1_general_ci',
|
||||
'service_description' => 'so.name2',
|
||||
'service_host' => 'so.name1 COLLATE latin1_general_ci',
|
||||
'service_host_name' => 'so.name1'
|
||||
),
|
||||
'hosts' => array(
|
||||
|
|
|
@ -7,24 +7,22 @@ class DowntimeendhistoryQuery extends IdoQuery
|
|||
{
|
||||
protected $columnMap = array(
|
||||
'downtimehistory' => array(
|
||||
'state_time' => 'h.actual_end_time',
|
||||
'timestamp' => 'UNIX_TIMESTAMP(h.actual_end_time)',
|
||||
'raw_timestamp' => 'h.actual_end_time',
|
||||
'object_id' => 'h.object_id',
|
||||
'type' => "('dt_end')",
|
||||
'state' => '(NULL)',
|
||||
'state_type' => '(NULL)',
|
||||
'output' => "('[' || h.author_name || '] ' || h.comment_data)",
|
||||
'attempt' => '(NULL)',
|
||||
'max_attempts' => '(NULL)',
|
||||
'state_time' => 'h.actual_end_time',
|
||||
'timestamp' => 'UNIX_TIMESTAMP(h.actual_end_time)',
|
||||
'raw_timestamp' => 'h.actual_end_time',
|
||||
'object_id' => 'h.object_id',
|
||||
'type' => "('dt_end')",
|
||||
'state' => '(NULL)',
|
||||
'state_type' => '(NULL)',
|
||||
'output' => "('[' || h.author_name || '] ' || h.comment_data)",
|
||||
'attempt' => '(NULL)',
|
||||
'max_attempts' => '(NULL)',
|
||||
|
||||
'host' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'host_name' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'service_host_name' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'object_type' => "CASE WHEN o.objecttype_id = 1 THEN 'host' ELSE 'service' END"
|
||||
'host' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'host_name' => 'o.name1',
|
||||
'service_description' => 'o.name2',
|
||||
'object_type' => "CASE WHEN o.objecttype_id = 1 THEN 'host' ELSE 'service' END"
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -7,24 +7,22 @@ class DowntimestarthistoryQuery extends IdoQuery
|
|||
{
|
||||
protected $columnMap = array(
|
||||
'downtimehistory' => array(
|
||||
'state_time' => 'h.actual_start_time',
|
||||
'timestamp' => 'UNIX_TIMESTAMP(h.actual_start_time)',
|
||||
'raw_timestamp' => 'h.actual_start_time',
|
||||
'object_id' => 'h.object_id',
|
||||
'type' => "('dt_start')",
|
||||
'state' => '(NULL)',
|
||||
'state_type' => '(NULL)',
|
||||
'output' => "('[' || h.author_name || '] ' || h.comment_data)",
|
||||
'attempt' => '(NULL)',
|
||||
'max_attempts' => '(NULL)',
|
||||
'state_time' => 'h.actual_start_time',
|
||||
'timestamp' => 'UNIX_TIMESTAMP(h.actual_start_time)',
|
||||
'raw_timestamp' => 'h.actual_start_time',
|
||||
'object_id' => 'h.object_id',
|
||||
'type' => "('dt_start')",
|
||||
'state' => '(NULL)',
|
||||
'state_type' => '(NULL)',
|
||||
'output' => "('[' || h.author_name || '] ' || h.comment_data)",
|
||||
'attempt' => '(NULL)',
|
||||
'max_attempts' => '(NULL)',
|
||||
|
||||
'host' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'host_name' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'service_host_name' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'object_type' => "CASE WHEN o.objecttype_id = 1 THEN 'host' ELSE 'service' END"
|
||||
'host' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'host_name' => 'o.name1',
|
||||
'service_description' => 'o.name2',
|
||||
'object_type' => "CASE WHEN o.objecttype_id = 1 THEN 'host' ELSE 'service' END"
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -32,19 +32,19 @@ class EventHistoryQuery extends IdoQuery
|
|||
'cnt_downtime_end' => "SUM(CASE eh.type WHEN 'dt_end' THEN 1 ELSE 0 END)",
|
||||
'host' => 'eho.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'eho.name2 COLLATE latin1_general_ci',
|
||||
'host_name' => 'eho.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'eho.name2 COLLATE latin1_general_ci',
|
||||
'host_name' => 'eho.name1',
|
||||
'service_description' => 'eho.name2',
|
||||
'object_type' => 'eh.object_type',
|
||||
'timestamp' => 'eh.timestamp',
|
||||
'state' => 'eh.state',
|
||||
'attempt' => 'eh.attempt',
|
||||
'max_attempts' => 'eh.max_attempts',
|
||||
'output' => 'eh.output', // we do not want long_output
|
||||
'type' => 'eh.type',
|
||||
'service_host_name' => 'eho.name1 COLLATE latin1_general_ci'
|
||||
'type' => 'eh.type'
|
||||
),
|
||||
'hostgroups' => array(
|
||||
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
||||
'hostgroup_name' => 'hgo.name1'
|
||||
),
|
||||
'hosts' => array(
|
||||
'host_display_name' => 'CASE WHEN sh.display_name IS NOT NULL THEN sh.display_name ELSE h.display_name END'
|
||||
|
|
|
@ -25,17 +25,19 @@ class EventgridQuery extends IdoQuery
|
|||
'cnt_ok' => 'SUM(CASE WHEN sho.objecttype_id = 2 AND sh.state = 0 THEN 1 ELSE 0 END)',
|
||||
'host' => 'sho.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'sho.name2 COLLATE latin1_general_ci',
|
||||
'host_name' => 'sho.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'sho.name2 COLLATE latin1_general_ci',
|
||||
'host_name' => 'sho.name1',
|
||||
'service_description' => 'sho.name2',
|
||||
'timestamp' => 'UNIX_TIMESTAMP(sh.state_time)'
|
||||
),
|
||||
|
||||
'servicegroups' => array(
|
||||
'servicegroup' => 'sgo.name1'
|
||||
'servicegroup' => 'sgo.name1 COLLATE latin1_general_ci',
|
||||
'servicegroup_name' => 'sgo.name1'
|
||||
),
|
||||
|
||||
'hostgroups' => array(
|
||||
'hostgroup' => 'hgo.name1'
|
||||
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
||||
'hostgroup_name' => 'hgo.name1'
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@ class GroupSummaryQuery extends IdoQuery
|
|||
'hosts_down_handled' => 'SUM(CASE WHEN object_type = \'host\' AND state = 1 AND acknowledged + in_downtime != 0 THEN 1 ELSE 0 END)',
|
||||
'hosts_down_unhandled' => 'SUM(CASE WHEN object_type = \'host\' AND state = 1 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)',
|
||||
'hosts_pending' => 'SUM(CASE WHEN object_type = \'host\' AND state = 99 THEN 1 ELSE 0 END)',
|
||||
'hostgroup' => 'hostgroup',
|
||||
'hostgroup_alias' => 'hostgroup_alias'
|
||||
'hostgroup_name' => 'hostgroup_name',
|
||||
'hostgroup_alias' => 'hostgroup_alias',
|
||||
'hostgroup' => 'hostgroup'
|
||||
),
|
||||
'servicestatussummary' => array(
|
||||
'services_total' => 'SUM(CASE WHEN object_type = \'service\' THEN 1 ELSE 0 END)',
|
||||
|
@ -44,8 +45,9 @@ class GroupSummaryQuery extends IdoQuery
|
|||
'services_warning_last_state_change_unhandled' => 'MAX(CASE WHEN object_type = \'service\' AND state = 1 AND acknowledged + in_downtime + host_state = 0 THEN state_change ELSE 0 END)',
|
||||
'services_critical_last_state_change_unhandled' => 'MAX(CASE WHEN object_type = \'service\' AND state = 2 AND acknowledged + in_downtime + host_state = 0 THEN state_change ELSE 0 END)',
|
||||
'services_unknown_last_state_change_unhandled' => 'MAX(CASE WHEN object_type = \'service\' AND state = 3 AND acknowledged + in_downtime + host_state = 0 THEN state_change ELSE 0 END)',
|
||||
'servicegroup' => 'servicegroup',
|
||||
'servicegroup_alias' => 'servicegroup_alias'
|
||||
'servicegroup_name' => 'servicegroup_name',
|
||||
'servicegroup_alias' => 'servicegroup_alias',
|
||||
'servicegroup' => 'servicegroup'
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -56,14 +58,16 @@ class GroupSummaryQuery extends IdoQuery
|
|||
'host_state'
|
||||
);
|
||||
|
||||
if (in_array('servicegroup', $this->desiredColumns)) {
|
||||
if (in_array('servicegroup', $this->desiredColumns) || in_array('servicegroup_name', $this->desiredColumns)) {
|
||||
$columns[] = 'servicegroup';
|
||||
$columns[] = 'servicegroup_name';
|
||||
$columns[] = 'servicegroup_alias';
|
||||
$groupColumns = array('servicegroup', 'servicegroup_alias');
|
||||
$groupColumns = array('servicegroup_name', 'servicegroup_alias');
|
||||
} else {
|
||||
$columns[] = 'hostgroup';
|
||||
$columns[] = 'hostgroup_name';
|
||||
$columns[] = 'hostgroup_alias';
|
||||
$groupColumns = array('hostgroup', 'hostgroup_alias');
|
||||
$groupColumns = array('hostgroup_name', 'hostgroup_alias');
|
||||
}
|
||||
$hosts = $this->createSubQuery(
|
||||
'Hoststatus',
|
||||
|
@ -75,7 +79,7 @@ class GroupSummaryQuery extends IdoQuery
|
|||
'severity' => 'host_severity'
|
||||
)
|
||||
);
|
||||
if (in_array('servicegroup', $this->desiredColumns)) {
|
||||
if (in_array('servicegroup_name', $this->desiredColumns)) {
|
||||
$hosts->group(array(
|
||||
'sgo.name1',
|
||||
'ho.object_id',
|
||||
|
|
|
@ -8,13 +8,13 @@ class HostgroupQuery extends IdoQuery
|
|||
protected $columnMap = array(
|
||||
'hostgroups' => array(
|
||||
'hostgroups' => 'hgo.name1 COLLATE latin1_general_ci',
|
||||
'hostgroup_name' => 'hgo.name1 COLLATE latin1_general_ci',
|
||||
'hostgroup_name' => 'hgo.name1',
|
||||
'hostgroup_alias' => 'hg.alias',
|
||||
'id' => 'hg.hostgroup_id',
|
||||
'hostgroup_id' => 'hg.hostgroup_id'
|
||||
),
|
||||
'hosts' => array(
|
||||
'host' => 'ho.name1 COLLATE latin1_general_ci',
|
||||
'host_name' => 'ho.name1 COLLATE latin1_general_ci'
|
||||
'host_name' => 'ho.name1'
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -84,10 +84,12 @@ class HoststatusQuery extends IdoQuery
|
|||
),
|
||||
'hostgroups' => array(
|
||||
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
||||
'hostgroup_name' => 'hgo.name1',
|
||||
'hostgroup_alias' => 'hg.alias'
|
||||
),
|
||||
'servicegroups' => array(
|
||||
'servicegroup' => 'sgo.name1 COLLATE latin1_general_ci',
|
||||
'servicegroup_name' => 'sgo.name1',
|
||||
'servicegroup_alias' => 'sg.alias'
|
||||
),
|
||||
'contactgroups' => array(
|
||||
|
|
|
@ -13,11 +13,14 @@ class NotificationQuery extends IdoQuery
|
|||
'notification_object_id' => 'n.object_id'
|
||||
),
|
||||
'objects' => array(
|
||||
'host' => 'o.name1',
|
||||
'service' => 'o.name2'
|
||||
'host' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'host_name' => 'o.name1',
|
||||
'service' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'service_description' => 'o.name2'
|
||||
),
|
||||
'contact' => array(
|
||||
'notification_contact' => 'c_o.name1',
|
||||
'contact' => 'c_o.name1 COLLATE latin1_general_ci',
|
||||
'notification_contact_name' => 'c_o.name1',
|
||||
'contact_object_id' => 'c_o.object_id'
|
||||
),
|
||||
'command' => array(
|
||||
|
|
|
@ -7,24 +7,22 @@ class NotificationhistoryQuery extends IdoQuery
|
|||
{
|
||||
protected $columnMap = array(
|
||||
'history' => array(
|
||||
'timestamp' => 'UNIX_TIMESTAMP(n.start_time)',
|
||||
'raw_timestamp' => 'n.start_time',
|
||||
'state_time' => 'n.start_time',
|
||||
'object_id' => 'n.object_id',
|
||||
'type' => "('notify')",
|
||||
'state' => 'n.state',
|
||||
'state_type' => '(NULL)',
|
||||
'output' => null,
|
||||
'attempt' => '(NULL)',
|
||||
'max_attempts' => '(NULL)',
|
||||
'state_time' => 'n.start_time',
|
||||
'timestamp' => 'UNIX_TIMESTAMP(n.start_time)',
|
||||
'raw_timestamp' => 'n.start_time',
|
||||
'object_id' => 'n.object_id',
|
||||
'type' => "('notify')",
|
||||
'state' => 'n.state',
|
||||
'state_type' => '(NULL)',
|
||||
'output' => null,
|
||||
'attempt' => '(NULL)',
|
||||
'max_attempts' => '(NULL)',
|
||||
|
||||
'host' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'host_name' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'service_host_name' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'object_type' => "CASE WHEN o.objecttype_id = 1 THEN 'host' ELSE 'service' END"
|
||||
'host' => 'o.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'o.name2 COLLATE latin1_general_ci',
|
||||
'host_name' => 'o.name1',
|
||||
'service_description' => 'o.name2',
|
||||
'object_type' => "CASE WHEN o.objecttype_id = 1 THEN 'host' ELSE 'service' END"
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -7,15 +7,16 @@ class ServicegroupQuery extends IdoQuery
|
|||
{
|
||||
protected $columnMap = array(
|
||||
'servicegroups' => array(
|
||||
'servicegroup_name' => 'sgo.name1 COLLATE latin1_general_ci',
|
||||
'servicegroup_alias' => 'sg.alias',
|
||||
'servicegroup' => 'sgo.name1 COLLATE latin1_general_ci',
|
||||
'servicegroup_name' => 'sgo.name1',
|
||||
'servicegroup_alias' => 'sg.alias COLLATE latin1_general_ci'
|
||||
),
|
||||
'services' => array(
|
||||
'host' => 'so.name1 COLLATE latin1_general_ci',
|
||||
'host_name' => 'so.name1 COLLATE latin1_general_ci',
|
||||
'host_name' => 'so.name1',
|
||||
'service' => 'so.name2 COLLATE latin1_general_ci',
|
||||
'service_host_name' => 'so.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'so.name2 COLLATE latin1_general_ci'
|
||||
'service_host_name' => 'so.name1',
|
||||
'service_description' => 'so.name2'
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ class StatehistoryQuery extends IdoQuery
|
|||
|
||||
protected $columnMap = array(
|
||||
'statehistory' => array(
|
||||
'raw_timestamp' => 'sh.state_time',
|
||||
'timestamp' => 'UNIX_TIMESTAMP(sh.state_time)',
|
||||
'state_time' => 'sh.state_time',
|
||||
'timestamp' => 'UNIX_TIMESTAMP(sh.state_time)',
|
||||
'raw_timestamp' => 'sh.state_time',
|
||||
'object_id' => 'sho.object_id',
|
||||
'type' => "(CASE WHEN sh.state_type = 1 THEN 'hard_state' ELSE 'soft_state' END)",
|
||||
'state' => 'sh.state',
|
||||
|
@ -22,11 +22,11 @@ class StatehistoryQuery extends IdoQuery
|
|||
'output' => 'sh.output',
|
||||
'attempt' => 'sh.current_check_attempt',
|
||||
'max_attempts' => 'sh.max_check_attempts',
|
||||
|
||||
'host' => 'sho.name1 COLLATE latin1_general_ci',
|
||||
'host_name' => 'sho.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'sho.name2 COLLATE latin1_general_ci',
|
||||
'service_description' => 'sho.name2 COLLATE latin1_general_ci',
|
||||
'service_host_name' => 'sho.name1 COLLATE latin1_general_ci',
|
||||
'host_name' => 'sho.name1',
|
||||
'service_description' => 'sho.name2',
|
||||
'object_type' => "CASE WHEN sho.objecttype_id = 1 THEN 'host' ELSE 'service' END"
|
||||
)
|
||||
);
|
||||
|
|
|
@ -35,7 +35,7 @@ class StatusQuery extends IdoQuery
|
|||
protected $columnMap = array(
|
||||
'hosts' => array(
|
||||
'host' => 'ho.name1 COLLATE latin1_general_ci',
|
||||
'host_name' => 'ho.name1 COLLATE latin1_general_ci',
|
||||
'host_name' => 'ho.name1',
|
||||
'host_display_name' => 'h.display_name',
|
||||
'host_alias' => 'h.alias',
|
||||
'host_address' => 'h.address',
|
||||
|
@ -161,16 +161,19 @@ class StatusQuery extends IdoQuery
|
|||
),
|
||||
'hostgroups' => array(
|
||||
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
||||
'hostgroup_name' => 'hgo.name1',
|
||||
'hostgroup_alias' => 'hg.alias'
|
||||
),
|
||||
'servicegroups' => array(
|
||||
'servicegroup' => 'sgo.name1 COLLATE latin1_general_ci',
|
||||
'servicegroup_name' => 'sgo.name1',
|
||||
'servicegroup_alias' => 'sg.alias'
|
||||
),
|
||||
'services' => array(
|
||||
'service_host_name' => 'so.name1 COLLATE latin1_general_ci',
|
||||
'service_host' => 'so.name1 COLLATE latin1_general_ci',
|
||||
'service_host_name' => 'so.name1',
|
||||
'service' => 'so.name2 COLLATE latin1_general_ci',
|
||||
'service_description' => 'so.name2 COLLATE latin1_general_ci',
|
||||
'service_description' => 'so.name2',
|
||||
'service_display_name' => 's.display_name',
|
||||
'service_icon_image' => 's.icon_image',
|
||||
'service_action_url' => 's.action_url',
|
||||
|
|
|
@ -9,8 +9,7 @@ namespace Icinga\Module\Monitoring\Command\Object;
|
|||
class ScheduleServiceCheckCommand extends ObjectCommand
|
||||
{
|
||||
/**
|
||||
* (non-PHPDoc)
|
||||
* @see \Icinga\Module\Monitoring\Command\Object\ObjectCommand::$allowedObjects For the property documentation.
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $allowedObjects = array(
|
||||
self::TYPE_SERVICE
|
||||
|
@ -74,7 +73,7 @@ class ScheduleServiceCheckCommand extends ObjectCommand
|
|||
}
|
||||
|
||||
/**
|
||||
* Is the check forced?
|
||||
* Get whether the check is forced
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -84,8 +83,7 @@ class ScheduleServiceCheckCommand extends ObjectCommand
|
|||
}
|
||||
|
||||
/**
|
||||
* (non-PHPDoc)
|
||||
* @see \Icinga\Module\Monitoring\Command\Object\IcingaCommand::getName() For the method documentation.
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
|
|
|
@ -15,29 +15,27 @@ class SendCustomNotificationCommand extends WithCommentCommand
|
|||
self::TYPE_HOST,
|
||||
self::TYPE_SERVICE
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Whether a notification is forced to send
|
||||
* Whether the notification is forced
|
||||
*
|
||||
* Forced notifications are send regardless of time and if notifications
|
||||
* are enabled.
|
||||
* Forced notifications are sent out regardless of time restrictions and whether or not notifications are enabled.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $forced;
|
||||
|
||||
/**
|
||||
* Broadcast the notification
|
||||
* Whether to broadcast the notification
|
||||
*
|
||||
* If broadcast is true, the notification is send to all normal and
|
||||
* escalated contacts for the object
|
||||
* Broadcast notifications are sent out to all normal and escalated contacts.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $broadcast;
|
||||
|
||||
/**
|
||||
* Get notification force flag
|
||||
* Get whether to force the notification
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -47,17 +45,20 @@ class SendCustomNotificationCommand extends WithCommentCommand
|
|||
}
|
||||
|
||||
/**
|
||||
* Set whether notification should be forced
|
||||
* Set whether to force the notification
|
||||
*
|
||||
* @param bool $forced
|
||||
* @param bool $forced
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setForced($forced = true)
|
||||
{
|
||||
$this->forced = $forced;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get notification broadcast flag
|
||||
* Get whether to broadcast the notification
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -67,12 +68,15 @@ class SendCustomNotificationCommand extends WithCommentCommand
|
|||
}
|
||||
|
||||
/**
|
||||
* Set notification to broadcast
|
||||
* Set whether to broadcast the notification
|
||||
*
|
||||
* @param bool $broadcast
|
||||
* @param bool $broadcast
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBroadcast($broadcast = true)
|
||||
{
|
||||
$this->broadcast = $broadcast;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,13 +6,13 @@ namespace Icinga\Module\Monitoring;
|
|||
use Icinga\Data\Filter\Filter;
|
||||
use Icinga\Data\Filterable;
|
||||
use Icinga\File\Csv;
|
||||
use Icinga\Web\Controller\ModuleActionController;
|
||||
use Icinga\Web\Controller as IcingaWebController;
|
||||
use Icinga\Web\Url;
|
||||
|
||||
/**
|
||||
* Base class for all monitoring action controller
|
||||
*/
|
||||
class Controller extends ModuleActionController
|
||||
class Controller extends IcingaWebController
|
||||
{
|
||||
/**
|
||||
* The backend used for this controller
|
||||
|
|
|
@ -17,17 +17,16 @@ class Comment extends DataView
|
|||
'comment_objecttype',
|
||||
'comment_internal_id',
|
||||
'comment_data',
|
||||
'comment_author',
|
||||
'comment_author_name',
|
||||
'comment_timestamp',
|
||||
'comment_type',
|
||||
'comment_is_persistent',
|
||||
'comment_expiration',
|
||||
'comment_host',
|
||||
'comment_service',
|
||||
'host',
|
||||
'service',
|
||||
'host_name',
|
||||
'service_description',
|
||||
'host_display_name',
|
||||
'service_display_name'
|
||||
'service_display_name',
|
||||
'service_host_name'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -56,4 +55,12 @@ class Comment extends DataView
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFilterColumns()
|
||||
{
|
||||
return array('comment_author', 'host', 'service', 'service_host');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ namespace Icinga\Module\Monitoring\DataView;
|
|||
*/
|
||||
class Contact extends DataView
|
||||
{
|
||||
|
||||
/**
|
||||
* Retrieve columns provided by this view
|
||||
*
|
||||
|
@ -17,7 +16,7 @@ class Contact extends DataView
|
|||
public function getColumns()
|
||||
{
|
||||
return array(
|
||||
'contact',
|
||||
'contact_id',
|
||||
'contact_name',
|
||||
'contact_alias',
|
||||
'contact_email',
|
||||
|
@ -44,8 +43,8 @@ class Contact extends DataView
|
|||
'service_object_id',
|
||||
'service_host_name',
|
||||
'service_description',
|
||||
'service',
|
||||
'host',
|
||||
'contact_notify_host_timeperiod',
|
||||
'contact_notify_service_timeperiod'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -62,4 +61,9 @@ class Contact extends DataView
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getFilterColumns()
|
||||
{
|
||||
return array('contact', 'alias', 'email', 'host', 'service', 'service_host');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ namespace Icinga\Module\Monitoring\DataView;
|
|||
*/
|
||||
class Contactgroup extends DataView
|
||||
{
|
||||
|
||||
/**
|
||||
* Retrieve columns provided by this view
|
||||
*
|
||||
|
@ -17,13 +16,29 @@ class Contactgroup extends DataView
|
|||
public function getColumns()
|
||||
{
|
||||
return array(
|
||||
'contact',
|
||||
'contact_name',
|
||||
'contactgroup',
|
||||
'contactgroup_name',
|
||||
'contactgroup_alias',
|
||||
'host',
|
||||
'service'
|
||||
'contact_name',
|
||||
'contact_alias',
|
||||
'contact_email',
|
||||
'contact_pager',
|
||||
'contact_has_host_notfications',
|
||||
'contact_has_service_notfications',
|
||||
'contact_can_submit_commands',
|
||||
'contact_notify_service_recovery',
|
||||
'contact_notify_service_warning',
|
||||
'contact_notify_service_critical',
|
||||
'contact_notify_service_unknown',
|
||||
'contact_notify_service_flapping',
|
||||
'contact_notify_service_downtime',
|
||||
'contact_notify_host_recovery',
|
||||
'contact_notify_host_down',
|
||||
'contact_notify_host_unreachable',
|
||||
'contact_notify_host_flapping',
|
||||
'contact_notify_host_downtime',
|
||||
'host_name',
|
||||
'service_description',
|
||||
'service_host_name'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -43,4 +58,9 @@ class Contactgroup extends DataView
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getFilterColumns()
|
||||
{
|
||||
return array('contactgroup', 'contact', 'host', 'service', 'service_host');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,11 @@ class Customvar extends DataView
|
|||
'varname',
|
||||
'varvalue',
|
||||
'is_json',
|
||||
'object_type'
|
||||
'host_name',
|
||||
'service_description',
|
||||
'contact_name',
|
||||
'object_type',
|
||||
'object_type_id'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -37,4 +41,9 @@ class Customvar extends DataView
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getFilterColumns()
|
||||
{
|
||||
return array('host', 'service', 'contact');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,8 +14,7 @@ class Downtime extends DataView
|
|||
{
|
||||
return array(
|
||||
'downtime_objecttype',
|
||||
'downtime_author',
|
||||
'author',
|
||||
'downtime_author_name',
|
||||
'downtime_comment',
|
||||
'downtime_entry_time',
|
||||
'downtime_is_fixed',
|
||||
|
@ -28,8 +27,6 @@ class Downtime extends DataView
|
|||
'downtime_is_in_effect',
|
||||
'downtime_triggered_by_id',
|
||||
'downtime_internal_id',
|
||||
'downtime_host',
|
||||
'downtime_service',
|
||||
'downtime_host_state',
|
||||
'downtime_service_state',
|
||||
'host_display_name',
|
||||
|
@ -69,4 +66,9 @@ class Downtime extends DataView
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getFilterColumns()
|
||||
{
|
||||
return array('author', 'host', 'service', 'service_host');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,16 +22,14 @@ class EventHistory extends DataView
|
|||
'host_display_name',
|
||||
'service_description',
|
||||
'service_display_name',
|
||||
'hostgroup_name',
|
||||
'object_type',
|
||||
'timestamp',
|
||||
'state',
|
||||
'attempt',
|
||||
'max_attempts',
|
||||
'output',
|
||||
'type',
|
||||
'host',
|
||||
'service',
|
||||
'service_host_name'
|
||||
'type'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -47,8 +45,6 @@ class EventHistory extends DataView
|
|||
|
||||
public function getFilterColumns()
|
||||
{
|
||||
return array(
|
||||
'hostgroups'
|
||||
);
|
||||
return array('host', 'service', 'hostgroup');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ class Eventgrid extends DataView
|
|||
return array(
|
||||
'day',
|
||||
'cnt_events',
|
||||
'objecttype_id',
|
||||
'cnt_up',
|
||||
'cnt_down_hard',
|
||||
'cnt_down',
|
||||
|
@ -22,12 +23,16 @@ class Eventgrid extends DataView
|
|||
'cnt_unreachable',
|
||||
'cnt_unknown_hard',
|
||||
'cnt_unknown',
|
||||
'cnt_unknown_hard',
|
||||
'cnt_critical',
|
||||
'cnt_critical_hard',
|
||||
'cnt_warning',
|
||||
'cnt_warning_hard',
|
||||
'cnt_ok',
|
||||
'host_name',
|
||||
'service_description',
|
||||
'timestamp',
|
||||
'servicegroup_name',
|
||||
'hostgroup_name'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -39,4 +44,9 @@ class Eventgrid extends DataView
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getFilterColumns()
|
||||
{
|
||||
return array('host', 'service', 'hostgroup', 'servicegroup');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,9 +13,9 @@ class Groupsummary extends DataView
|
|||
public function getColumns()
|
||||
{
|
||||
return array(
|
||||
'servicegroup',
|
||||
'servicegroup_name',
|
||||
'servicegroup_alias',
|
||||
'hostgroup',
|
||||
'hostgroup_name',
|
||||
'hostgroup_alias',
|
||||
'hosts_up',
|
||||
'hosts_unreachable',
|
||||
|
@ -58,4 +58,9 @@ class Groupsummary extends DataView
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getFilterColumns()
|
||||
{
|
||||
return array('hostgroup', 'servicegroup');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ class HostStatus extends DataView
|
|||
public function getColumns()
|
||||
{
|
||||
return array(
|
||||
'host',
|
||||
'host_name',
|
||||
'host_display_name',
|
||||
'host_alias',
|
||||
|
@ -114,7 +113,7 @@ class HostStatus extends DataView
|
|||
|
||||
public function getFilterColumns()
|
||||
{
|
||||
return array('hostgroup', 'service_problems', 'servicegroup');
|
||||
return array('host', 'hostgroup', 'hostgroup_name', 'service', 'servicegroup', 'servicegroup_name');
|
||||
}
|
||||
|
||||
public function isValidFilterTarget($column)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||
|
||||
|
||||
namespace Icinga\Module\Monitoring\DataView;
|
||||
|
||||
/**
|
||||
|
@ -17,9 +16,10 @@ class Hostgroup extends DataView
|
|||
public function getColumns()
|
||||
{
|
||||
return array(
|
||||
'host',
|
||||
'hostgroup_name',
|
||||
'hostgroup_alias'
|
||||
'hostgroup_alias',
|
||||
'hostgroup_id',
|
||||
'host_name'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,15 @@ class Hostgroup extends DataView
|
|||
return array(
|
||||
'hostgroup_name' => array(
|
||||
'order' => self::SORT_ASC
|
||||
),
|
||||
'hostgroup_alias' => array(
|
||||
'order' => self::SORT_ASC
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getFilterColumns()
|
||||
{
|
||||
return array('hostgroup', 'host');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,11 +13,11 @@ class Notification extends DataView
|
|||
public function getColumns()
|
||||
{
|
||||
return array(
|
||||
'host',
|
||||
'service',
|
||||
'host_name',
|
||||
'service_description',
|
||||
'notification_state',
|
||||
'notification_start_time',
|
||||
'notification_contact',
|
||||
'notification_contact_name',
|
||||
'notification_output',
|
||||
'notification_command',
|
||||
'host_display_name',
|
||||
|
@ -34,4 +34,9 @@ class Notification extends DataView
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getFilterColumns()
|
||||
{
|
||||
return array('host', 'service', 'contact');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,6 @@ class ServiceStatus extends DataView
|
|||
'host_action_url',
|
||||
'host_notes_url',
|
||||
'host_last_comment',
|
||||
'host',
|
||||
'host_display_name',
|
||||
'host_alias',
|
||||
'host_ipv4',
|
||||
|
@ -87,7 +86,6 @@ class ServiceStatus extends DataView
|
|||
'host_last_time_down',
|
||||
'host_last_time_unreachable',
|
||||
'host_modified_host_attributes',
|
||||
'service',
|
||||
'service_hard_state',
|
||||
'service_problem',
|
||||
'service_perfdata',
|
||||
|
@ -165,7 +163,15 @@ class ServiceStatus extends DataView
|
|||
|
||||
public function getFilterColumns()
|
||||
{
|
||||
return array('hostgroup', 'servicegroup', 'service_problems');
|
||||
return array(
|
||||
'host',
|
||||
'hostgroup',
|
||||
'hostgroup_name',
|
||||
'service',
|
||||
'service_host',
|
||||
'servicegroup',
|
||||
'servicegroup_name'
|
||||
);
|
||||
}
|
||||
|
||||
public function isValidFilterTarget($column)
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
<?php
|
||||
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||
|
||||
|
||||
namespace Icinga\Module\Monitoring\DataView;
|
||||
|
||||
|
||||
class Servicegroup extends DataView
|
||||
{
|
||||
/**
|
||||
|
@ -15,10 +13,11 @@ class Servicegroup extends DataView
|
|||
public function getColumns()
|
||||
{
|
||||
return array(
|
||||
'service',
|
||||
'host',
|
||||
'servicegroup_name',
|
||||
'servicegroup_alias'
|
||||
'servicegroup_alias',
|
||||
'host_name',
|
||||
'service_host_name',
|
||||
'service_description'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -32,7 +31,15 @@ class Servicegroup extends DataView
|
|||
return array(
|
||||
'servicegroup_name' => array(
|
||||
'order' => self::SORT_ASC
|
||||
),
|
||||
'servicegroup_alias' => array(
|
||||
'order' => self::SORT_ASC
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getFilterColumns()
|
||||
{
|
||||
return array('servicegroup', 'host', 'service');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -248,7 +248,7 @@ abstract class MonitoredObject implements Filterable
|
|||
$comments = $this->backend->select()->from('comment', array(
|
||||
'id' => 'comment_internal_id',
|
||||
'timestamp' => 'comment_timestamp',
|
||||
'author' => 'comment_author',
|
||||
'author' => 'comment_author_name',
|
||||
'comment' => 'comment_data',
|
||||
'type' => 'comment_type',
|
||||
))
|
||||
|
@ -276,7 +276,7 @@ abstract class MonitoredObject implements Filterable
|
|||
'id' => 'downtime_internal_id',
|
||||
'objecttype' => 'downtime_objecttype',
|
||||
'comment' => 'downtime_comment',
|
||||
'author' => 'downtime_author',
|
||||
'author_name' => 'downtime_author_name',
|
||||
'start' => 'downtime_start',
|
||||
'scheduled_start' => 'downtime_scheduled_start',
|
||||
'end' => 'downtime_end',
|
||||
|
@ -556,11 +556,14 @@ abstract class MonitoredObject implements Filterable
|
|||
*/
|
||||
public static function fromParams(UrlParams $params)
|
||||
{
|
||||
if ($params->has('service') && $params->has('host')) {
|
||||
return new Service(MonitoringBackend::instance(), $params->get('host'), $params->get('service'));
|
||||
} elseif ($params->has('host')) {
|
||||
return new Host(MonitoringBackend::instance(), $params->get('host'));
|
||||
if ($params->has('service_description') && $params->has('host_name')) {
|
||||
return new Service(
|
||||
MonitoringBackend::instance(),
|
||||
$params->get('host_name'),
|
||||
$params->get('service_description')
|
||||
);
|
||||
} elseif ($params->has('host_name')) {
|
||||
return new Host(MonitoringBackend::instance(), $params->get('host_name'));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,13 +167,13 @@ abstract class MonitoredObjectController extends Controller
|
|||
if ($object->getType() === $object::TYPE_HOST) {
|
||||
$isService = false;
|
||||
$params = array(
|
||||
'host' => $object->getName()
|
||||
'host_name' => $object->getName()
|
||||
);
|
||||
} else {
|
||||
$isService = true;
|
||||
$params = array(
|
||||
'host' => $object->getHost()->getName(),
|
||||
'service' => $object->getName()
|
||||
'host_name' => $object->getHost()->getName(),
|
||||
'service_description' => $object->getName()
|
||||
);
|
||||
}
|
||||
$tabs->add(
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||
|
||||
use Icinga\Web\Controller\ModuleActionController;
|
||||
use Icinga\Web\Controller;
|
||||
use Icinga\Module\Setup\WebWizard;
|
||||
|
||||
class Setup_IndexController extends ModuleActionController
|
||||
class Setup_IndexController extends Controller
|
||||
{
|
||||
/**
|
||||
* Whether the controller requires the user to be authenticated
|
||||
|
|
|
@ -78,7 +78,7 @@ class DbTool
|
|||
'INSERT' => 29,
|
||||
'LOCK TABLES' => 5,
|
||||
'PROCESS' => 1,
|
||||
'REFERENCES' => 0,
|
||||
'REFERENCES' => 12,
|
||||
'RELOAD' => 1,
|
||||
'REPLICATION CLIENT' => 1,
|
||||
'REPLICATION SLAVE' => 1,
|
||||
|
@ -629,10 +629,6 @@ EOD;
|
|||
$mysqlPrivileges = array_intersect($privileges, array_keys($this->mysqlGrantContexts));
|
||||
list($_, $host) = explode('@', $this->query('select current_user()')->fetchColumn());
|
||||
$grantee = "'" . ($username === null ? $this->config['username'] : $username) . "'@'" . $host . "'";
|
||||
$privilegeCondition = sprintf(
|
||||
'privilege_type IN (%s)',
|
||||
join(',', array_map(array($this, 'quote'), $mysqlPrivileges))
|
||||
);
|
||||
|
||||
if (isset($this->config['dbname'])) {
|
||||
$dbPrivileges = array();
|
||||
|
@ -653,7 +649,7 @@ EOD;
|
|||
. ' FROM information_schema.schema_privileges'
|
||||
. ' WHERE grantee = :grantee'
|
||||
. ' AND table_schema = :dbname'
|
||||
. ' AND ' . $privilegeCondition
|
||||
. ' AND privilege_type IN (' . join(',', array_map(array($this, 'quote'), $dbPrivileges)) . ')'
|
||||
. ($requireGrants ? " AND is_grantable = 'YES'" : ''),
|
||||
array(':grantee' => $grantee, ':dbname' => $this->config['dbname'])
|
||||
);
|
||||
|
@ -666,14 +662,13 @@ EOD;
|
|||
!$dbPrivilegesGranted || array_intersect($dbPrivileges, $tablePrivileges) != $tablePrivileges
|
||||
)
|
||||
) {
|
||||
$tableCondition = 'table_name IN (' . join(',', array_map(array($this, 'quote'), $context)) . ')';
|
||||
$query = $this->query(
|
||||
'SELECT COUNT(*) as matches'
|
||||
. ' FROM information_schema.table_privileges'
|
||||
. ' WHERE grantee = :grantee'
|
||||
. ' AND table_schema = :dbname'
|
||||
. ' AND ' . $tableCondition
|
||||
. ' AND ' . $privilegeCondition
|
||||
. ' AND table_name IN (' . join(',', array_map(array($this, 'quote'), $context)) . ')'
|
||||
. ' AND privilege_type IN (' . join(',', array_map(array($this, 'quote'), $tablePrivileges)) . ')'
|
||||
. ($requireGrants ? " AND is_grantable = 'YES'" : ''),
|
||||
array(':grantee' => $grantee, ':dbname' => $this->config['dbname'])
|
||||
);
|
||||
|
@ -688,10 +683,11 @@ EOD;
|
|||
|
||||
$query = $this->query(
|
||||
'SELECT COUNT(*) as matches FROM information_schema.user_privileges WHERE grantee = :grantee'
|
||||
. ' AND ' . $privilegeCondition . ($requireGrants ? " AND is_grantable = 'YES'" : ''),
|
||||
. ' AND privilege_type IN (' . join(',', array_map(array($this, 'quote'), $mysqlPrivileges)) . ')'
|
||||
. ($requireGrants ? " AND is_grantable = 'YES'" : ''),
|
||||
array(':grantee' => $grantee)
|
||||
);
|
||||
return $query->fetchObject()->matches === count($mysqlPrivileges);
|
||||
return (int) $query->fetchObject()->matches === count($mysqlPrivileges);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -721,7 +717,8 @@ EOD;
|
|||
foreach (array_intersect($privileges, array_keys($this->pgsqlGrantContexts)) as $privilege) {
|
||||
if (false === empty($context) && $this->pgsqlGrantContexts[$privilege] & static::TABLE_LEVEL) {
|
||||
$tablePrivileges[] = $privilege;
|
||||
} elseif ($this->pgsqlGrantContexts[$privilege] & static::DATABASE_LEVEL) {
|
||||
}
|
||||
if ($this->pgsqlGrantContexts[$privilege] & static::DATABASE_LEVEL) {
|
||||
$dbPrivileges[] = $privilege;
|
||||
}
|
||||
}
|
||||
|
@ -760,14 +757,14 @@ EOD;
|
|||
// connected to the database defined in the resource configuration it is safe to just ignore them
|
||||
// as the chances are very high that the database is created later causing the current user being
|
||||
// the owner with ALL privileges. (Which in turn can be granted to others.)
|
||||
}
|
||||
|
||||
if (array_search('CREATE', $privileges) !== false) {
|
||||
$query = $this->query(
|
||||
'select rolcreatedb from pg_roles where rolname = :user',
|
||||
array(':user' => $username !== null ? $username : $this->config['username'])
|
||||
);
|
||||
$privilegesGranted &= $query->fetchColumn() !== false;
|
||||
if (array_search('CREATE', $privileges) !== false) {
|
||||
$query = $this->query(
|
||||
'select rolcreatedb from pg_roles where rolname = :user',
|
||||
array(':user' => $username !== null ? $username : $this->config['username'])
|
||||
);
|
||||
$privilegesGranted &= $query->fetchColumn() !== false;
|
||||
}
|
||||
}
|
||||
|
||||
if (array_search('CREATEROLE', $privileges) !== false) {
|
||||
|
|
|
@ -17,7 +17,7 @@ use Icinga\Module\Setup\Forms\PreferencesPage;
|
|||
use Icinga\Module\Setup\Forms\AuthBackendPage;
|
||||
use Icinga\Module\Setup\Forms\AdminAccountPage;
|
||||
use Icinga\Module\Setup\Forms\LdapDiscoveryPage;
|
||||
use Icinga\Module\Setup\Forms\LdapDiscoveryConfirmPage;
|
||||
//use Icinga\Module\Setup\Forms\LdapDiscoveryConfirmPage;
|
||||
use Icinga\Module\Setup\Forms\LdapResourcePage;
|
||||
use Icinga\Module\Setup\Forms\RequirementsPage;
|
||||
use Icinga\Module\Setup\Forms\GeneralConfigPage;
|
||||
|
@ -41,6 +41,17 @@ use Icinga\Module\Setup\Requirement\ConfigDirectoryRequirement;
|
|||
*/
|
||||
class WebWizard extends Wizard implements SetupWizard
|
||||
{
|
||||
/**
|
||||
* The privileges required by Icinga Web 2 to create the database and a login
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $databaseCreationPrivileges = array(
|
||||
'CREATE',
|
||||
'CREATE USER', // MySQL
|
||||
'CREATEROLE' // PostgreSQL
|
||||
);
|
||||
|
||||
/**
|
||||
* The privileges required by Icinga Web 2 to setup the database
|
||||
*
|
||||
|
@ -48,10 +59,8 @@ class WebWizard extends Wizard implements SetupWizard
|
|||
*/
|
||||
protected $databaseSetupPrivileges = array(
|
||||
'CREATE',
|
||||
'ALTER',
|
||||
'REFERENCES',
|
||||
'CREATE USER', // MySQL
|
||||
'CREATEROLE' // PostgreSQL
|
||||
'ALTER', // MySQL only
|
||||
'REFERENCES'
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -148,7 +157,9 @@ class WebWizard extends Wizard implements SetupWizard
|
|||
$page->setResourceConfig($this->getPageData('setup_ldap_resource'));
|
||||
}
|
||||
} elseif ($page->getName() === 'setup_database_creation') {
|
||||
$page->setDatabaseSetupPrivileges($this->databaseSetupPrivileges);
|
||||
$page->setDatabaseSetupPrivileges(
|
||||
array_unique(array_merge($this->databaseCreationPrivileges, $this->databaseSetupPrivileges))
|
||||
);
|
||||
$page->setDatabaseUsagePrivileges($this->databaseUsagePrivileges);
|
||||
$page->setResourceConfig($this->getPageData('setup_db_resource'));
|
||||
} elseif ($page->getName() === 'setup_summary') {
|
||||
|
@ -211,8 +222,8 @@ class WebWizard extends Wizard implements SetupWizard
|
|||
try {
|
||||
$db->connectToDb(); // Are we able to login on the database?
|
||||
if (array_search(key($this->databaseTables), $db->listTables()) === false) {
|
||||
// In case the database schema does not yet exist the user
|
||||
// needs the privileges to create and setup the database
|
||||
// In case the database schema does not yet exist the
|
||||
// user needs the privileges to setup the database
|
||||
$skip = $db->checkPrivileges($this->databaseSetupPrivileges, $this->databaseTables);
|
||||
} else {
|
||||
// In case the database schema exists the user needs the required privileges
|
||||
|
@ -224,7 +235,12 @@ class WebWizard extends Wizard implements SetupWizard
|
|||
$db->connectToHost(); // Are we able to login on the server?
|
||||
// It is not possible to reliably determine whether a database exists or not if a user can't
|
||||
// log in to the database, so we just require the user to be able to create the database
|
||||
$skip = $db->checkPrivileges($this->databaseSetupPrivileges, $this->databaseTables);
|
||||
$skip = $db->checkPrivileges(
|
||||
array_unique(
|
||||
array_merge($this->databaseCreationPrivileges, $this->databaseSetupPrivileges)
|
||||
),
|
||||
$this->databaseTables
|
||||
);
|
||||
} catch (PDOException $_) {
|
||||
// We are NOT able to login on the server..
|
||||
}
|
||||
|
|
|
@ -17,12 +17,6 @@
|
|||
|
||||
Icinga.Events.prototype = {
|
||||
|
||||
keyboard: {
|
||||
ctrlKey: false,
|
||||
altKey: false,
|
||||
shiftKey: false
|
||||
},
|
||||
|
||||
/**
|
||||
* Icinga will call our initialize() function once it's ready
|
||||
*/
|
||||
|
@ -106,7 +100,6 @@
|
|||
|
||||
// Destroy Icinga, clean up and interrupt pending requests on unload
|
||||
$( window ).on('unload', { self: this }, this.onUnload);
|
||||
$( window ).on('beforeunload', { self: this }, this.onUnload);
|
||||
|
||||
// We catch scroll events in our containers
|
||||
$('.container').on('scroll', { self: this }, this.icinga.events.onContainerScroll);
|
||||
|
@ -467,6 +460,9 @@
|
|||
} else {
|
||||
icinga.ui.layout1col();
|
||||
}
|
||||
$('table tr[href].active').removeClass('active');
|
||||
icinga.ui.storeSelectionData(null);
|
||||
icinga.ui.loadSelectionData();
|
||||
icinga.history.pushCurrentState();
|
||||
}
|
||||
}
|
||||
|
@ -559,7 +555,6 @@
|
|||
$(window).off('resize', this.onWindowResize);
|
||||
$(window).off('load', this.onLoad);
|
||||
$(window).off('unload', this.onUnload);
|
||||
$(window).off('beforeunload', this.onUnload);
|
||||
$(document).off('scroll', '.container', this.onContainerScroll);
|
||||
$(document).off('click', 'a', this.linkClicked);
|
||||
$(document).off('click', 'table.action tr[href]', this.rowSelected);
|
||||
|
|
Loading…
Reference in New Issue