2015-03-12 16:08:22 +01:00
|
|
|
<?php
|
2016-02-08 15:41:00 +01:00
|
|
|
/* Icinga Web 2 | (c) 2015 Icinga Development Team | GPLv2+ */
|
2015-03-12 16:08:22 +01:00
|
|
|
|
|
|
|
namespace Icinga\Module\Monitoring\Command\Object;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Send custom notifications for a host or service
|
|
|
|
*/
|
|
|
|
class SendCustomNotificationCommand extends WithCommentCommand
|
|
|
|
{
|
|
|
|
/**
|
2015-03-12 16:30:11 +01:00
|
|
|
* {@inheritdoc}
|
2015-03-12 16:08:22 +01:00
|
|
|
*/
|
|
|
|
protected $allowedObjects = array(
|
|
|
|
self::TYPE_HOST,
|
|
|
|
self::TYPE_SERVICE
|
|
|
|
);
|
2015-04-10 12:02:26 +02:00
|
|
|
|
2015-03-12 16:08:22 +01:00
|
|
|
/**
|
2015-04-10 12:02:26 +02:00
|
|
|
* Whether the notification is forced
|
2015-03-12 16:08:22 +01:00
|
|
|
*
|
2015-04-10 12:02:26 +02:00
|
|
|
* Forced notifications are sent out regardless of time restrictions and whether or not notifications are enabled.
|
2015-03-12 16:08:22 +01:00
|
|
|
*
|
2015-03-12 16:30:11 +01:00
|
|
|
* @var bool
|
2015-03-12 16:08:22 +01:00
|
|
|
*/
|
|
|
|
protected $forced;
|
|
|
|
|
|
|
|
/**
|
2015-04-10 12:02:26 +02:00
|
|
|
* Whether to broadcast the notification
|
2015-03-12 16:08:22 +01:00
|
|
|
*
|
2015-04-10 12:02:26 +02:00
|
|
|
* Broadcast notifications are sent out to all normal and escalated contacts.
|
2015-03-12 16:08:22 +01:00
|
|
|
*
|
2015-03-12 16:30:11 +01:00
|
|
|
* @var bool
|
2015-03-12 16:08:22 +01:00
|
|
|
*/
|
|
|
|
protected $broadcast;
|
|
|
|
|
|
|
|
/**
|
2015-04-10 12:02:26 +02:00
|
|
|
* Get whether to force the notification
|
2015-03-12 16:08:22 +01:00
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function getForced()
|
|
|
|
{
|
|
|
|
return $this->forced;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-04-10 12:02:26 +02:00
|
|
|
* Set whether to force the notification
|
|
|
|
*
|
|
|
|
* @param bool $forced
|
2015-03-12 16:08:22 +01:00
|
|
|
*
|
2015-04-10 12:02:26 +02:00
|
|
|
* @return $this
|
2015-03-12 16:08:22 +01:00
|
|
|
*/
|
|
|
|
public function setForced($forced = true)
|
|
|
|
{
|
|
|
|
$this->forced = $forced;
|
2015-04-10 12:02:26 +02:00
|
|
|
return $this;
|
2015-03-12 16:08:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-04-10 12:02:26 +02:00
|
|
|
* Get whether to broadcast the notification
|
2015-03-12 16:08:22 +01:00
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function getBroadcast()
|
|
|
|
{
|
|
|
|
return $this->broadcast;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-04-10 12:02:26 +02:00
|
|
|
* Set whether to broadcast the notification
|
|
|
|
*
|
|
|
|
* @param bool $broadcast
|
2015-03-12 16:08:22 +01:00
|
|
|
*
|
2015-04-10 12:02:26 +02:00
|
|
|
* @return $this
|
2015-03-12 16:08:22 +01:00
|
|
|
*/
|
|
|
|
public function setBroadcast($broadcast = true)
|
|
|
|
{
|
|
|
|
$this->broadcast = $broadcast;
|
2015-04-10 12:02:26 +02:00
|
|
|
return $this;
|
2015-03-12 16:08:22 +01:00
|
|
|
}
|
|
|
|
}
|