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
|
|
|
|
2016-11-23 18:30:34 -05:00
|
|
|
use Icinga\Module\Businessprocess\Web\Url;
|
2015-03-16 04:08:00 -04:00
|
|
|
|
2016-11-22 11:57:46 -05:00
|
|
|
class ServiceNode extends MonitoredNode
|
2014-10-20 10:26:06 -04:00
|
|
|
{
|
|
|
|
|
protected $hostname;
|
2015-03-16 04:08:00 -04:00
|
|
|
|
2014-10-20 10:26:06 -04:00
|
|
|
protected $service;
|
|
|
|
|
|
2015-10-05 06:34:47 -04:00
|
|
|
protected $className = 'service';
|
|
|
|
|
|
2019-01-22 05:21:40 -05:00
|
|
|
protected $icon = 'service';
|
|
|
|
|
|
2019-02-04 02:37:36 -05:00
|
|
|
public function __construct($object)
|
2014-10-20 10:26:06 -04:00
|
|
|
{
|
|
|
|
|
$this->name = $object->hostname . ';' . $object->service;
|
|
|
|
|
$this->hostname = $object->hostname;
|
|
|
|
|
$this->service = $object->service;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getHostname()
|
|
|
|
|
{
|
|
|
|
|
return $this->hostname;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getServiceDescription()
|
|
|
|
|
{
|
|
|
|
|
return $this->service;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getAlias()
|
|
|
|
|
{
|
|
|
|
|
return $this->hostname . ': ' . $this->service;
|
|
|
|
|
}
|
2016-11-27 18:18:53 -05:00
|
|
|
|
|
|
|
|
public function getUrl()
|
|
|
|
|
{
|
|
|
|
|
$params = array(
|
|
|
|
|
'host' => $this->getHostname(),
|
|
|
|
|
'service' => $this->getServiceDescription()
|
|
|
|
|
);
|
|
|
|
|
|
2019-02-04 02:37:36 -05:00
|
|
|
if ($this->getBpConfig()->hasBackendName()) {
|
|
|
|
|
$params['backend'] = $this->getBpConfig()->getBackendName();
|
2016-11-27 18:18:53 -05:00
|
|
|
}
|
|
|
|
|
|
2017-12-04 12:05:07 -05:00
|
|
|
return Url::fromPath('businessprocess/service/show', $params);
|
2016-11-27 18:18:53 -05:00
|
|
|
}
|
2014-10-20 10:26:06 -04:00
|
|
|
}
|