mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 13:54:26 +02:00
parent
f8b3ffb3c8
commit
c8eaf66823
@ -5,26 +5,30 @@
|
|||||||
namespace Icinga\Web\Hook;
|
namespace Icinga\Web\Hook;
|
||||||
|
|
||||||
use Icinga\Exception\ProgrammingError;
|
use Icinga\Exception\ProgrammingError;
|
||||||
|
use Icinga\Module\Monitoring\Object\MonitoredObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Icinga Web Grapher Hook base class
|
* Icinga Web Grapher Hook base class
|
||||||
*
|
*
|
||||||
* Extend this class if you want to integrate your graphing solution nicely into
|
* Extend this class if you want to integrate your graphing solution nicely into
|
||||||
* Icinga Web
|
* Icinga Web.
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2013 Icinga-Web Team <info@icinga.org>
|
|
||||||
* @author Icinga-Web Team <info@icinga.org>
|
|
||||||
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
|
|
||||||
*/
|
*/
|
||||||
abstract class GrapherHook
|
abstract class GrapherHook extends WebBaseHook
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Whether this grapher provides preview images
|
* Whether this grapher provides previews
|
||||||
*
|
*
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $hasPreviews = false;
|
protected $hasPreviews = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this grapher provides tiny previews
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $hasTinyPreviews = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor must live without arguments right now
|
* Constructor must live without arguments right now
|
||||||
*
|
*
|
||||||
@ -36,16 +40,6 @@ abstract class GrapherHook
|
|||||||
$this->init();
|
$this->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether this grapher provides preview images
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function hasPreviews()
|
|
||||||
{
|
|
||||||
return $this->hasPreviews;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overwrite this function if you want to do some initialization stuff
|
* Overwrite this function if you want to do some initialization stuff
|
||||||
*
|
*
|
||||||
@ -56,75 +50,63 @@ abstract class GrapherHook
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether a graph for the given host[, service [, plot]] exists
|
* Whether this grapher provides previews
|
||||||
*
|
|
||||||
* @param string $host
|
|
||||||
* @param string $service
|
|
||||||
* @param string $plot
|
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function has($host, $service = null, $plot = null)
|
public function hasPreviews()
|
||||||
{
|
{
|
||||||
return false;
|
return $this->hasPreviews;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a preview image for the given host[, service [, plot]] exists
|
* Whether this grapher provides tiny previews
|
||||||
*
|
|
||||||
* @param string $host
|
|
||||||
* @param string $service
|
|
||||||
* @param string $plot
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
* @throws ProgrammingError
|
|
||||||
*/
|
|
||||||
public function getPreviewHtml($host, $service = null, $plot = null)
|
|
||||||
{
|
|
||||||
throw new ProgrammingError('This backend has no preview images');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether a tiny graph for the given host[, service [, plot]] exists
|
|
||||||
*
|
|
||||||
* @param string $host
|
|
||||||
* @param string $service
|
|
||||||
* @param string $plot
|
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasTinyPreview($host, $service = null, $plot = null)
|
public function hasTinyPreviews()
|
||||||
{
|
{
|
||||||
return false;
|
return $this->hasTinyPreviews;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a tiny preview image for the given host[, service [, plot]] exists
|
* Whether a graph for the monitoring object exist
|
||||||
*
|
*
|
||||||
* @param string $host
|
* @param MonitoredObject $object
|
||||||
* @param string $service
|
*
|
||||||
* @param string $plot
|
* @return bool
|
||||||
|
*/
|
||||||
|
abstract public function has(MonitoredObject $object);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a preview for the given object
|
||||||
|
*
|
||||||
|
* This function must return an empty string if no graph exists.
|
||||||
|
*
|
||||||
|
* @param MonitoredObject $object
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws ProgrammingError
|
||||||
*
|
*
|
||||||
|
*/
|
||||||
|
public function getPreviewHtml(MonitoredObject $object)
|
||||||
|
{
|
||||||
|
throw new ProgrammingError('This hook provide previews but it is not implemented');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a tiny preview for the given object
|
||||||
|
*
|
||||||
|
* This function must return an empty string if no graph exists.
|
||||||
|
*
|
||||||
|
* @param MonitoredObject $object
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
* @throws ProgrammingError
|
* @throws ProgrammingError
|
||||||
*/
|
*/
|
||||||
public function getTinyPreviewHtml($host, $service = null, $plot = null)
|
public function getTinyPreviewHtml(MonitoredObject $object)
|
||||||
{
|
{
|
||||||
throw new ProgrammingError('This backend has no tiny preview images');
|
throw new ProgrammingError('This hook provide tiny previews but it is not implemented');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get URL pointing to the grapher
|
|
||||||
*
|
|
||||||
* WARNING: We are not sure yet whether this will remain as is
|
|
||||||
*
|
|
||||||
* @param string $host
|
|
||||||
* @param string $service
|
|
||||||
* @param string $plot
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
abstract function getGraphUrl($host, $service = null, $plot = null);
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user