2015-03-12 16:08:22 +01:00
|
|
|
<?php
|
|
|
|
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
|
|
|
|
|
|
|
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-03-12 16:30:11 +01:00
|
|
|
|
2015-03-12 16:08:22 +01:00
|
|
|
/**
|
|
|
|
* Whether a notification is forced to send
|
|
|
|
*
|
|
|
|
* Forced notifications are send regardless of time and if notifications
|
|
|
|
* are enabled.
|
|
|
|
*
|
2015-03-12 16:30:11 +01:00
|
|
|
* @var bool
|
2015-03-12 16:08:22 +01:00
|
|
|
*/
|
|
|
|
protected $forced;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Broadcast the notification
|
|
|
|
*
|
|
|
|
* If broadcast is true, the notification is send to all normal and
|
|
|
|
* escalated contacts for the object
|
|
|
|
*
|
2015-03-12 16:30:11 +01:00
|
|
|
* @var bool
|
2015-03-12 16:08:22 +01:00
|
|
|
*/
|
|
|
|
protected $broadcast;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get notification force flag
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function getForced()
|
|
|
|
{
|
|
|
|
return $this->forced;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set whether notification should be forced
|
|
|
|
*
|
|
|
|
* @param bool $forced
|
|
|
|
*/
|
|
|
|
public function setForced($forced = true)
|
|
|
|
{
|
|
|
|
$this->forced = $forced;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get notification broadcast flag
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function getBroadcast()
|
|
|
|
{
|
|
|
|
return $this->broadcast;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set notification to broadcast
|
|
|
|
*
|
|
|
|
* @param bool $broadcast
|
|
|
|
*/
|
|
|
|
public function setBroadcast($broadcast = true)
|
|
|
|
{
|
|
|
|
$this->broadcast = $broadcast;
|
|
|
|
}
|
|
|
|
}
|