mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-20 23:00:16 -05:00
58 lines
1.3 KiB
PHP
58 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Icinga\Module\Businessprocess;
|
|
|
|
use Icinga\Module\Businessprocess\Web\Url;
|
|
|
|
class ServiceNode extends MonitoredNode
|
|
{
|
|
protected $hostname;
|
|
|
|
protected $service;
|
|
|
|
protected $className = 'service';
|
|
|
|
protected $icon = 'service';
|
|
|
|
public function __construct(BpConfig $bp, $object)
|
|
{
|
|
$this->name = $object->hostname . ';' . $object->service;
|
|
$this->hostname = $object->hostname;
|
|
$this->service = $object->service;
|
|
$this->bp = $bp;
|
|
if (isset($object->state)) {
|
|
$this->setState($object->state);
|
|
} else {
|
|
$this->setState(0)->setMissing();
|
|
}
|
|
}
|
|
|
|
public function getHostname()
|
|
{
|
|
return $this->hostname;
|
|
}
|
|
|
|
public function getServiceDescription()
|
|
{
|
|
return $this->service;
|
|
}
|
|
|
|
public function getAlias()
|
|
{
|
|
return $this->hostname . ': ' . $this->service;
|
|
}
|
|
|
|
public function getUrl()
|
|
{
|
|
$params = array(
|
|
'host' => $this->getHostname(),
|
|
'service' => $this->getServiceDescription()
|
|
);
|
|
|
|
if ($this->bp->hasBackendName()) {
|
|
$params['backend'] = $this->bp->getBackendName();
|
|
}
|
|
|
|
return Url::fromPath('businessprocess/service/show', $params);
|
|
}
|
|
}
|