2014-10-20 10:26:06 -04:00
|
|
|
<?php
|
|
|
|
|
|
2014-11-30 09:56:58 -05:00
|
|
|
namespace Icinga\Module\Businessprocess;
|
2014-10-20 10:26:06 -04:00
|
|
|
|
|
|
|
|
class ServiceNode extends Node
|
|
|
|
|
{
|
|
|
|
|
protected $hostname;
|
|
|
|
|
protected $service;
|
|
|
|
|
|
|
|
|
|
public function __construct(BusinessProcess $bp, $object)
|
|
|
|
|
{
|
|
|
|
|
$this->name = $object->hostname . ';' . $object->service;
|
|
|
|
|
$this->hostname = $object->hostname;
|
|
|
|
|
$this->service = $object->service;
|
|
|
|
|
$this->bp = $bp;
|
2015-01-28 14:04:45 -05:00
|
|
|
if (isset($object->state)) {
|
|
|
|
|
$this->setState($object->state);
|
|
|
|
|
} else {
|
|
|
|
|
$this->setState(0)->setMissing();
|
|
|
|
|
}
|
2014-10-20 10:26:06 -04:00
|
|
|
}
|
|
|
|
|
|
2014-11-30 05:30:59 -05:00
|
|
|
public function renderLink($view)
|
|
|
|
|
{
|
|
|
|
|
if ($this->bp->isSimulationMode()) {
|
2014-11-30 09:56:58 -05:00
|
|
|
return $view->qlink($this->getAlias(), 'businessprocess/node/simulate', array(
|
2014-12-02 05:37:32 -05:00
|
|
|
'node' => $this->name,
|
|
|
|
|
'processName' => $this->bp->getName()
|
2014-11-30 05:30:59 -05:00
|
|
|
));
|
|
|
|
|
} else {
|
2015-01-21 03:23:39 -05:00
|
|
|
return $view->qlink($this->getAlias(), 'monitoring/service/show', array(
|
2014-11-30 05:30:59 -05:00
|
|
|
'host' => $this->getHostname(),
|
2014-12-02 05:37:32 -05:00
|
|
|
'service' => $this->getServiceDescription(),
|
|
|
|
|
'processName' => $this->bp->getName()
|
2014-11-30 05:30:59 -05:00
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-20 10:26:06 -04:00
|
|
|
public function getHostname()
|
|
|
|
|
{
|
|
|
|
|
return $this->hostname;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getServiceDescription()
|
|
|
|
|
{
|
|
|
|
|
return $this->service;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getAlias()
|
|
|
|
|
{
|
|
|
|
|
return $this->hostname . ': ' . $this->service;
|
|
|
|
|
}
|
|
|
|
|
}
|