parent
a58c933a29
commit
c9c5e6ef3c
|
@ -33,7 +33,6 @@ use \Icinga\Protocol\Commandpipe\Comment;
|
|||
|
||||
/**
|
||||
* Container for a host/service Acknowledgement
|
||||
*
|
||||
*/
|
||||
class Acknowledgement implements IComment
|
||||
{
|
||||
|
@ -54,9 +53,9 @@ class Acknowledgement implements IComment
|
|||
/**
|
||||
* The comment text of this acknowledgment
|
||||
*
|
||||
* @var Comment|null
|
||||
* @var Comment
|
||||
*/
|
||||
private $comment = null;
|
||||
private $comment;
|
||||
|
||||
/**
|
||||
* true if this is a sticky acknowledgment
|
||||
|
@ -90,7 +89,7 @@ class Acknowledgement implements IComment
|
|||
*
|
||||
* @param Comment $comment The comment to use for the acknowledgement
|
||||
* @param bool $notify Whether to set the notify flag
|
||||
* @param $expire The expire time or -1 of not expiring
|
||||
* @param int $expire The expire time or -1 of not expiring
|
||||
* @param bool $sticky Whether to set the sticky flag
|
||||
*/
|
||||
public function __construct(Comment $comment, $notify = false, $expire = -1, $sticky = false)
|
||||
|
@ -104,8 +103,9 @@ class Acknowledgement implements IComment
|
|||
/**
|
||||
* Return the ACKNOWLEDGE_?_PROBLEM string to be used for submitting an external icinga command
|
||||
*
|
||||
* @param $type Either CommandPipe::TYPE_HOST or CommandPipe:: TYPE_SERVICE
|
||||
* @return string The command string to be submitted to the command pipe
|
||||
* @param string $type Either CommandPipe::TYPE_HOST or CommandPipe::TYPE_SERVICE
|
||||
* @return string The command string to be submitted to the command pipe
|
||||
* @throws InvalidCommandException
|
||||
*/
|
||||
public function getFormatString($type)
|
||||
{
|
||||
|
|
|
@ -194,7 +194,9 @@ class CommandPipe
|
|||
}
|
||||
foreach ($objects as $object) {
|
||||
if (isset($object->service_description)) {
|
||||
$this->send("PROCESS_SERVICE_CHECK_RESULT;$object->host_name;$object->service_description;$state;$output");
|
||||
$this->send(
|
||||
"PROCESS_SERVICE_CHECK_RESULT;$object->host_name;$object->service_description;$state;$output"
|
||||
);
|
||||
} else {
|
||||
$this->send("PROCESS_HOST_CHECK_RESULT;$object->host_name;$state;$output");
|
||||
}
|
||||
|
@ -799,7 +801,7 @@ class CommandPipe
|
|||
}
|
||||
|
||||
/**
|
||||
* Rest modified attributes for all provided objects
|
||||
* Reset modified attributes for all provided objects
|
||||
*
|
||||
* @param array $objects An array of hosts and services
|
||||
*/
|
||||
|
|
|
@ -42,7 +42,7 @@ class Downtime
|
|||
/**
|
||||
* Propagate this downtime for all child objects as triggered downtime
|
||||
*/
|
||||
const TYPE_WITH_CHILDREN_TRIGERRED = 'AND_PROPAGATE_TRIGGERED_';
|
||||
const TYPE_WITH_CHILDREN_TRIGGERED = 'AND_PROPAGATE_TRIGGERED_';
|
||||
|
||||
/**
|
||||
* Schedule downtime for the services of the given hos
|
||||
|
@ -92,7 +92,9 @@ class Downtime
|
|||
public $trigger_id = 0;
|
||||
|
||||
/**
|
||||
* Internal information for the exact type of the downtime (with children, with children and triggered, services etc.)
|
||||
* Internal information for the exact type of the downtime
|
||||
*
|
||||
* E.g. with children, with children and triggered, services etc.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
@ -104,8 +106,10 @@ class Downtime
|
|||
* @param int $start A timestamp that defines the downtime's start time
|
||||
* @param int $end A timestamp that defines the downtime's end time
|
||||
* @param Comment $comment A comment that will be used when scheduling the downtime
|
||||
* @param int $duration The duration of this downtime in seconds. Duration > 0 will make this a flexible downtime
|
||||
* @param int $trigger_id An id of the downtime that triggers this downtime. 0 means this is not a triggered downtime
|
||||
* @param int $duration The duration of this downtime in seconds.
|
||||
* Duration > 0 will make this a flexible downtime
|
||||
* @param int $trigger_id An id of the downtime that triggers this downtime.
|
||||
* 0 means this is not a triggered downtime
|
||||
*/
|
||||
public function __construct($start, $end, Comment $comment, $duration = 0, $trigger_id = 0)
|
||||
{
|
||||
|
|
|
@ -1,11 +1,37 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Protocol\Commandpipe\Transport;
|
||||
|
||||
use Icinga\Application\Logger;
|
||||
|
||||
/**
|
||||
* CommandPipe Transport class that writes to a file accessible by the filesystem
|
||||
*
|
||||
*/
|
||||
class LocalPipe implements Transport
|
||||
{
|
||||
|
@ -55,4 +81,4 @@ class LocalPipe implements Transport
|
|||
{
|
||||
$this->openMode = $mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,30 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Protocol\Commandpipe\Transport;
|
||||
|
||||
|
@ -69,7 +95,8 @@ class SecureShell implements Transport
|
|||
);
|
||||
$hostConnector = $this->user ? $this->user . "@" . $this->host : $this->host;
|
||||
exec(
|
||||
'ssh -o BatchMode=yes -o KbdInteractiveAuthentication=no'.$hostConnector.' -p'.$this->port.' "echo \'['. time() .'] '
|
||||
'ssh -o BatchMode=yes -o KbdInteractiveAuthentication=no'
|
||||
. $hostConnector.' -p'.$this->port.' "echo \'['. time() .'] '
|
||||
. escapeshellcmd(
|
||||
$command
|
||||
)
|
||||
|
@ -87,9 +114,11 @@ class SecureShell implements Transport
|
|||
Logger::debug("Return code %s: %s ", $retCode, $output);
|
||||
|
||||
if ($retCode != 0) {
|
||||
$msg = 'Could not send command to remote icinga host: '. implode("\n",$output). " (returncode $retCode)";
|
||||
$msg = 'Could not send command to remote icinga host: '
|
||||
. implode(PHP_EOL, $output)
|
||||
. " (returncode $retCode)";
|
||||
Logger::error($msg);
|
||||
throw new \RuntimeException($msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,30 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Protocol\Commandpipe\Transport;
|
||||
|
||||
|
@ -21,4 +47,4 @@ interface Transport
|
|||
* @param string $message The command to send, without the timestamp (this will be added here)
|
||||
*/
|
||||
public function send($message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -305,7 +305,7 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
|
|||
if (! $this->getWithChildren()) {
|
||||
switch ($this->getValue('childobjects')) {
|
||||
case 1:
|
||||
$downtime->setType(Downtime::TYPE_WITH_CHILDREN_TRIGERRED);
|
||||
$downtime->setType(Downtime::TYPE_WITH_CHILDREN_TRIGGERED);
|
||||
break;
|
||||
case 2:
|
||||
$downtime->setType(Downtime::TYPE_WITH_CHILDREN);
|
||||
|
|
Loading…
Reference in New Issue