mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 16:24:04 +02:00
MonitoredObject: Support host- and servicegroup filters in method matches()
refs #5600
This commit is contained in:
parent
e42548fc80
commit
40c2cb2d12
@ -229,8 +229,10 @@ abstract class MonitoredObject implements Filterable
|
||||
);
|
||||
}
|
||||
|
||||
$queryString = $filter->toQueryString();
|
||||
$row = clone $this->properties;
|
||||
|
||||
if (strpos($queryString, '_host_') !== false || strpos($queryString, '_service_') !== false) {
|
||||
if ($this->customvars === null) {
|
||||
$this->fetchCustomvars();
|
||||
}
|
||||
@ -240,6 +242,23 @@ abstract class MonitoredObject implements Filterable
|
||||
$row->{'_' . $this->getType() . '_' . strtolower(str_replace(' ', '_', $name))} = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($queryString, 'hostgroup_name') !== false) {
|
||||
if ($this->hostgroups === null) {
|
||||
$this->fetchHostgroups();
|
||||
}
|
||||
|
||||
$row->hostgroup_name = array_keys($this->hostgroups);
|
||||
}
|
||||
|
||||
if (strpos($queryString, 'servicegroup_name') !== false) {
|
||||
if ($this->servicegroups === null) {
|
||||
$this->fetchServicegroups();
|
||||
}
|
||||
|
||||
$row->servicegroup_name = array_keys($this->servicegroups);
|
||||
}
|
||||
|
||||
return $filter->matches($row);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user