diff --git a/library/Icinga/Protocol/Commandpipe/CommandPipe.php b/library/Icinga/Protocol/Commandpipe/CommandPipe.php index 54f59fc10..065d727b7 100644 --- a/library/Icinga/Protocol/Commandpipe/CommandPipe.php +++ b/library/Icinga/Protocol/Commandpipe/CommandPipe.php @@ -145,7 +145,8 @@ class CommandPipe public function sendCommand(CommandType $command, array $objects) { foreach ($objects as $object) { - if (isset($object->service_description)) { + $objectType = $this->getObjectType($object); + if ($objectType === self::TYPE_SERVICE) { $this->transport->send($command->getServiceCommand($object->host_name, $object->service_description)); } else { $this->transport->send($command->getHostCommand($object->host_name)); diff --git a/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php b/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php index 2bb6db897..e0509c092 100644 --- a/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php +++ b/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php @@ -100,7 +100,7 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm )->fetchAll(); $options = array( - '0' => 'No Triggered Downtime ' + '0' => 'No Triggered Downtime' ); foreach ($downtimes as $downtime) { $dt = DateTimeFactory::create($downtime->downtime_scheduled_start_time); diff --git a/modules/monitoring/library/Monitoring/Command/AcknowledgeCommand.php b/modules/monitoring/library/Monitoring/Command/AcknowledgeCommand.php index 7003e6ec6..e3dc0668e 100644 --- a/modules/monitoring/library/Monitoring/Command/AcknowledgeCommand.php +++ b/modules/monitoring/library/Monitoring/Command/AcknowledgeCommand.php @@ -83,6 +83,7 @@ class AcknowledgeCommand extends BaseCommand * Set the time when this acknowledgement should expire * * @param int $expireTime The time as UNIX timestamp or -1 if it shouldn't expire + * * @return self */ public function setExpire($expireTime) @@ -95,6 +96,7 @@ class AcknowledgeCommand extends BaseCommand * Set the comment for this acknowledgement * * @param Comment $comment + * * @return self */ public function setComment(Comment $comment) @@ -107,6 +109,7 @@ class AcknowledgeCommand extends BaseCommand * Set whether the notify flag of this acknowledgment should be set * * @param bool $state + * * @return self */ public function setNotify($state) @@ -119,6 +122,7 @@ class AcknowledgeCommand extends BaseCommand * Set whether this acknowledgement is of type sticky * * @param bool $state + * * @return self */ public function setSticky($state) @@ -131,6 +135,8 @@ class AcknowledgeCommand extends BaseCommand * Return this command's parameters properly arranged in an array * * @return array + * + * @see BaseCommand::getParameters() */ public function getParameters() { @@ -150,9 +156,12 @@ class AcknowledgeCommand extends BaseCommand } /** - * @param String $hostname The name of the host to create the command for for + * Return the command as a string with the given host being inserted + * + * @param string $hostname The name of the host to insert + * + * @return string The string representation of the command * - * @return String The command string to return for the host * @see BaseCommand::getHostCommand() */ public function getHostCommand($hostname) @@ -163,10 +172,13 @@ class AcknowledgeCommand extends BaseCommand } /** - * @param String $hostname The name of the host to create the command for - * @param String $servicename The name of the service to create the command for + * Return the command as a string with the given host and service being inserted + * + * @param string $hostname The name of the host to insert + * @param string $servicename The name of the service to insert + * + * @return string The string representation of the command * - * @return String The command string to return for the service * @see BaseCommand::getServiceCommand() */ public function getServiceCommand($hostname, $servicename) diff --git a/modules/monitoring/library/Monitoring/Command/AddCommentCommand.php b/modules/monitoring/library/Monitoring/Command/AddCommentCommand.php index f9194a234..b8ccfc1c0 100644 --- a/modules/monitoring/library/Monitoring/Command/AddCommentCommand.php +++ b/modules/monitoring/library/Monitoring/Command/AddCommentCommand.php @@ -58,6 +58,7 @@ class AddCommentCommand extends BaseCommand * Set the comment for this command * * @param Comment $comment + * * @return self */ public function setComment(Comment $comment) @@ -67,9 +68,12 @@ class AddCommentCommand extends BaseCommand } /** - * @param String $hostname The name of the host to create the command for for + * Return the command as a string with the given host being inserted + * + * @param string $hostname The name of the host to insert + * + * @return string The string representation of the command * - * @return String The command string to return for the host * @see BaseCommand::getHostCommand() */ public function getHostCommand($hostname) @@ -78,10 +82,13 @@ class AddCommentCommand extends BaseCommand } /** - * @param String $hostname The name of the host to create the command for - * @param String $servicename The name of the service to create the command for + * Return the command as a string with the given host and service being inserted + * + * @param string $hostname The name of the host to insert + * @param string $servicename The name of the service to insert + * + * @return string The string representation of the command * - * @return String The command string to return for the service * @see BaseCommand::getServiceCommand() */ public function getServiceCommand($hostname, $servicename) diff --git a/modules/monitoring/library/Monitoring/Command/BaseCommand.php b/modules/monitoring/library/Monitoring/Command/BaseCommand.php index 6682fc66d..06f8979cc 100644 --- a/modules/monitoring/library/Monitoring/Command/BaseCommand.php +++ b/modules/monitoring/library/Monitoring/Command/BaseCommand.php @@ -40,7 +40,7 @@ use Icinga\Protocol\Commandpipe\CommandType; class BaseCommand implements CommandType { /** - * Return the parameters in the right order for this command + * Return this command's parameters properly arranged in an array * * @return array */ @@ -53,6 +53,7 @@ class BaseCommand implements CommandType * Return the command as a string with the given host being inserted * * @param string $hostname The name of the host to insert + * * @return string The string representation of the command */ public function getHostCommand($hostname) @@ -65,6 +66,7 @@ class BaseCommand implements CommandType * * @param string $hostname The name of the host to insert * @param string $servicename The name of the service to insert + * * @return string The string representation of the command */ public function getServiceCommand($hostname, $servicename) @@ -76,6 +78,7 @@ class BaseCommand implements CommandType * Return the command as a string with the given hostgroup being inserted * * @param string $hostgroup The name of the hostgroup to insert + * * @return string The string representation of the command */ public function getHostgroupCommand($hostgroup) @@ -87,6 +90,7 @@ class BaseCommand implements CommandType * Return the command as a string with the given servicegroup being inserted * * @param string $servicegroup The name of the servicegroup to insert + * * @return string The string representation of the command */ public function getServicegroupCommand($servicegroup)