mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 15:24:05 +02:00
monitoring\CommandController: use new filters
This commit is contained in:
parent
f80b951cec
commit
fb18de1f42
@ -31,14 +31,13 @@
|
|||||||
use Icinga\Application\Icinga;
|
use Icinga\Application\Icinga;
|
||||||
use Icinga\Application\Config;
|
use Icinga\Application\Config;
|
||||||
use Icinga\Logger\Logger;
|
use Icinga\Logger\Logger;
|
||||||
use Icinga\Module\Monitoring\DataView\HostStatus;
|
|
||||||
use Icinga\Module\Monitoring\DataView\ServiceStatus;
|
|
||||||
use Icinga\Module\Monitoring\Form\Command\DisableNotificationWithExpireForm;
|
use Icinga\Module\Monitoring\Form\Command\DisableNotificationWithExpireForm;
|
||||||
use Icinga\Module\Monitoring\Form\Command\SingleArgumentCommandForm;
|
use Icinga\Module\Monitoring\Form\Command\SingleArgumentCommandForm;
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
use Icinga\Web\Url;
|
use Icinga\Web\Url;
|
||||||
|
use Icinga\Data\Filter\Filter;
|
||||||
use Icinga\Web\Notification;
|
use Icinga\Web\Notification;
|
||||||
use Icinga\Web\Controller\ActionController;
|
use Icinga\Module\Monitoring\Controller;
|
||||||
use Icinga\Protocol\Commandpipe\CommandPipe;
|
use Icinga\Protocol\Commandpipe\CommandPipe;
|
||||||
use Icinga\Exception\ConfigurationError;
|
use Icinga\Exception\ConfigurationError;
|
||||||
use Icinga\Exception\MissingParameterException;
|
use Icinga\Exception\MissingParameterException;
|
||||||
@ -58,7 +57,7 @@ use Icinga\Module\Monitoring\Form\Command\SubmitPassiveCheckResultForm;
|
|||||||
*
|
*
|
||||||
* Interface to send commands and display forms
|
* Interface to send commands and display forms
|
||||||
*/
|
*/
|
||||||
class Monitoring_CommandController extends ActionController
|
class Monitoring_CommandController extends Controller
|
||||||
{
|
{
|
||||||
const DEFAULT_VIEW_SCRIPT = 'renderform';
|
const DEFAULT_VIEW_SCRIPT = 'renderform';
|
||||||
|
|
||||||
@ -182,21 +181,21 @@ class Monitoring_CommandController extends ActionController
|
|||||||
$servicename = $this->getParam('service', null);
|
$servicename = $this->getParam('service', null);
|
||||||
|
|
||||||
if (!$hostname && !$servicename) {
|
if (!$hostname && !$servicename) {
|
||||||
throw new MissingParameterException("No target given for this command");
|
throw new MissingParameterException('No target given for this command');
|
||||||
}
|
|
||||||
|
|
||||||
if ($hostname) {
|
|
||||||
$view = HostStatus::fromRequest($this->_request);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($servicename && !$hostOnly) {
|
if ($servicename && !$hostOnly) {
|
||||||
$fields[] = 'service_description';
|
$fields[] = 'service_description';
|
||||||
$view = ServiceStatus::fromRequest($this->_request);
|
$query = $this->backend->select()
|
||||||
|
->from('serviceStatus', $fields)
|
||||||
|
->where('host', $hostname)
|
||||||
|
->where('service', $servicename);
|
||||||
|
} elseif ($hostname) {
|
||||||
|
$query = $this->backend->select()->from('hostStatus', $fields)->where('host', $hostname);
|
||||||
|
} else {
|
||||||
|
throw new MissingParameterException('hostOnly command got no hostname');
|
||||||
}
|
}
|
||||||
|
return $query->getQuery()->fetchAll();
|
||||||
$query = $view->getQuery()->from("status", $fields);
|
|
||||||
|
|
||||||
return $data = $query->fetchAll();
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Logger::error(
|
Logger::error(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user