2021-02-04 09:02:19 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/* Icinga DB Web | (c) 2021 Icinga GmbH | GPLv2 */
|
|
|
|
|
|
|
|
|
|
namespace Icinga\Module\Icingadb\Command\Object;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Acknowledge a host or service problem
|
|
|
|
|
*/
|
|
|
|
|
class AcknowledgeProblemCommand extends WithCommentCommand
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Whether the acknowledgement is sticky
|
|
|
|
|
*
|
|
|
|
|
* Sticky acknowledgements remain until the host or service recovers. Non-sticky acknowledgements will be
|
|
|
|
|
* automatically removed when the host or service state changes.
|
|
|
|
|
*
|
|
|
|
|
* @var bool
|
|
|
|
|
*/
|
|
|
|
|
protected $sticky = false;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether to send a notification about the acknowledgement
|
|
|
|
|
|
|
|
|
|
* @var bool
|
|
|
|
|
*/
|
|
|
|
|
protected $notify = false;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the comment associated with the acknowledgement is persistent
|
|
|
|
|
*
|
|
|
|
|
* Persistent comments are not lost the next time the monitoring host restarts.
|
|
|
|
|
*
|
|
|
|
|
* @var bool
|
|
|
|
|
*/
|
|
|
|
|
protected $persistent = false;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Optional time when the acknowledgement should expire
|
|
|
|
|
*
|
|
|
|
|
* @var int
|
|
|
|
|
*/
|
|
|
|
|
protected $expireTime;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set whether the acknowledgement is sticky
|
|
|
|
|
*
|
|
|
|
|
* @param bool $sticky
|
|
|
|
|
*
|
|
|
|
|
* @return $this
|
|
|
|
|
*/
|
2021-09-22 04:21:15 -04:00
|
|
|
public function setSticky(bool $sticky = true): self
|
2021-02-04 09:02:19 -05:00
|
|
|
{
|
2021-09-22 04:21:15 -04:00
|
|
|
$this->sticky = $sticky;
|
2021-02-04 09:02:19 -05:00
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Is the acknowledgement sticky?
|
|
|
|
|
*
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
2021-09-22 04:21:15 -04:00
|
|
|
public function getSticky(): bool
|
2021-02-04 09:02:19 -05:00
|
|
|
{
|
|
|
|
|
return $this->sticky;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set whether to send a notification about the acknowledgement
|
|
|
|
|
*
|
|
|
|
|
* @param bool $notify
|
|
|
|
|
*
|
|
|
|
|
* @return $this
|
|
|
|
|
*/
|
2021-09-22 04:21:15 -04:00
|
|
|
public function setNotify(bool $notify = true): self
|
2021-02-04 09:02:19 -05:00
|
|
|
{
|
2021-09-22 04:21:15 -04:00
|
|
|
$this->notify = $notify;
|
2021-02-04 09:02:19 -05:00
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get whether to send a notification about the acknowledgement
|
|
|
|
|
*
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
2021-09-22 04:21:15 -04:00
|
|
|
public function getNotify(): bool
|
2021-02-04 09:02:19 -05:00
|
|
|
{
|
|
|
|
|
return $this->notify;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set whether the comment associated with the acknowledgement is persistent
|
|
|
|
|
*
|
|
|
|
|
* @param bool $persistent
|
|
|
|
|
*
|
|
|
|
|
* @return $this
|
|
|
|
|
*/
|
2021-09-22 04:21:15 -04:00
|
|
|
public function setPersistent(bool $persistent = true): self
|
2021-02-04 09:02:19 -05:00
|
|
|
{
|
2021-09-22 04:21:15 -04:00
|
|
|
$this->persistent = $persistent;
|
2021-02-04 09:02:19 -05:00
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Is the comment associated with the acknowledgement is persistent?
|
|
|
|
|
*
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
2021-09-22 04:21:15 -04:00
|
|
|
public function getPersistent(): bool
|
2021-02-04 09:02:19 -05:00
|
|
|
{
|
|
|
|
|
return $this->persistent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the time when the acknowledgement should expire
|
|
|
|
|
*
|
|
|
|
|
* @param int $expireTime
|
|
|
|
|
*
|
|
|
|
|
* @return $this
|
|
|
|
|
*/
|
2021-09-22 04:21:15 -04:00
|
|
|
public function setExpireTime(int $expireTime): self
|
2021-02-04 09:02:19 -05:00
|
|
|
{
|
2021-09-22 04:21:15 -04:00
|
|
|
$this->expireTime = $expireTime;
|
2021-02-04 09:02:19 -05:00
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the time when the acknowledgement should expire
|
|
|
|
|
*
|
2021-09-22 04:21:15 -04:00
|
|
|
* @return ?int
|
2021-02-04 09:02:19 -05:00
|
|
|
*/
|
|
|
|
|
public function getExpireTime()
|
|
|
|
|
{
|
|
|
|
|
return $this->expireTime;
|
|
|
|
|
}
|
|
|
|
|
}
|