the documentation describes the filtering of a json call via php
$data = array(
"attrs" => array('name','state','last_check_result','last_state_change'),
"filter" => 'match("1", host.state)',
);
i also want to filter, if the check is active. how can i add another filter?
dnsmichi
(Michael Friedrich)
March 18, 2019, 8:26am
2
Hi,
please pick the correct category for topics, #icinga-2-core is better than #howto .
The filter
is just a string, similar to what you know from assign where
expressions.
Using match
for the host state is very expensive compared to a simple equality comparison btw. I’d rewrite it like so:
"filter" => 'host.state == 1'
What exactly do you mean with check is active
… should it be actively executed on this specific cluster endpoint, or just for active checks enabled?
Cheers,
Michael
I want to add another filter criteria.
for example :
'host.state == 1 & host.active == true
dnsmichi
(Michael Friedrich)
March 18, 2019, 11:55am
4
Ok, active
is an internal object attribute, and should only be used in combination with paused
. This indicates whether the host is actively checked on this cluster endpoint.
"filter" => 'host.state == 1 && host.active == true && host.paused == false'
Filter expressions can be joined with logical operators .
Cheers,
Michael