mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-02-10 14:33:04 -05:00
BusinessProcess: add new helper functions
Will make code easier to read
This commit is contained in:
parent
47b8f00900
commit
b0492484fa
1 changed files with 26 additions and 0 deletions
|
|
@ -191,6 +191,26 @@ class BusinessProcess
|
|||
return array_key_exists($name, $this->nodes);
|
||||
}
|
||||
|
||||
public function createService($host, $service)
|
||||
{
|
||||
$node = new ServiceNode(
|
||||
$this,
|
||||
(object) array(
|
||||
'hostname' => $host,
|
||||
'service' => $service
|
||||
)
|
||||
);
|
||||
$this->nodes[$host . ';' . $service] = $node;
|
||||
return $node;
|
||||
}
|
||||
|
||||
public function createHost($host)
|
||||
{
|
||||
$node = new HostNode($this, (object) array('hostname' => $host));
|
||||
$this->nodes[$host . ';Hoststatus'] = $node;
|
||||
return $node;
|
||||
}
|
||||
|
||||
public function getNode($name)
|
||||
{
|
||||
if (array_key_exists($name, $this->nodes)) {
|
||||
|
|
@ -221,6 +241,12 @@ class BusinessProcess
|
|||
);
|
||||
}
|
||||
|
||||
public function addObjectName($name)
|
||||
{
|
||||
$this->all_checks[$name] = 1;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addNode($name, Node $node)
|
||||
{
|
||||
if (array_key_exists($name, $this->nodes)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue