icingaweb2-module-businessp.../library/Businessprocess/ServiceNode.php

58 lines
1.3 KiB
PHP
Raw Normal View History

<?php
2014-11-30 09:56:58 -05:00
namespace Icinga\Module\Businessprocess;
use Icinga\Module\Businessprocess\Web\Url;
2015-03-16 04:08:00 -04:00
class ServiceNode extends MonitoredNode
{
protected $hostname;
2015-03-16 04:08:00 -04:00
protected $service;
protected $className = 'service';
2019-01-22 05:21:40 -05:00
protected $icon = 'service';
public function __construct($object)
{
$this->name = $object->hostname . ';' . $object->service;
$this->hostname = $object->hostname;
$this->service = $object->service;
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->getBpConfig()->hasBackendName()) {
$params['backend'] = $this->getBpConfig()->getBackendName();
}
2017-12-04 12:05:07 -05:00
return Url::fromPath('businessprocess/service/show', $params);
}
}