Skip to content

Commit

Permalink
UnreachableParent: Only fetch responsible nodes
Browse files Browse the repository at this point in the history
A node is responsible if:

* it's a host which is reachable but has a problem
* it's a service which is reachable but has a problem
* it's a redundancy group which is reachable but has failed
  • Loading branch information
nilmerg committed Dec 11, 2024
1 parent f8f2023 commit e8d891d
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions library/Icingadb/Model/UnreachableParent.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,23 @@ public static function on(Connection $db, Model $root = null): Query
self::selectNodes($db, $root),
'unreachable_parent',
true
)->where([
'unreachable_parent.level > ?' => 0,
'unreachable_parent.is_group_member = ?' => 0
]);
);

$query->filter(Filter::all(
Filter::greaterThan('level', 0),
Filter::equal('is_group_member', 0),
Filter::any(
Filter::equal('service.state.affects_children', 'y'),
Filter::all(
Filter::unlike('service_id', '*'),
Filter::equal('host.state.affects_children', 'y')
),
Filter::all(
Filter::equal('redundancy_group.state.failed', 'y'),
Filter::equal('redundancy_group.state.is_reachable', 'y')
)
)
));

return $query;
}
Expand Down

0 comments on commit e8d891d

Please sign in to comment.