Forum Discussion

Kelly's avatar
4 years ago

Dynamic Group Applies to scripting

When building a dynamic group how can you match on an device property that is being inherited from it's parent static group?

 

3 Replies

  • You can't, it's specifically blocked to prevent loops. What are you trying to implement? There might be some tricks like the system.staticgroups mentioned below.

    https://www.logicmonitor.com/support/devices/device-groups/device-groups-overview

    Quote

    Note: To avoid circular references, the criteria that determines which devices are auto-assigned to a dynamic group (i.e. the AppliesTo script) can only evaluate properties of the host itself, not any inherited properties from those groups of which it is a member. For similar reasons, the systems.group property is also excluded from use in a dynamic group’s AppliesTo script as the query itself could change the results of the query, potentially creating an endless loop. If you wish to create a dynamic group that is dependent on group membership, use the property system.staticgroups in your AppliesTo script: join(system.staticgroups,",") =~ "production".

     

  • Anonymous's avatar
    Anonymous

    The reason you can't do it is that the dynamic group membership may bring the resource into the group, which potentially causes new properties to be inherited, which may disqualify it for membership, ejecting it from the group. Upon ejection from the group, the inherited properties reset and the device qualifies to be a member again. This causes an infinite loop. There could and should be something built into the product that prevents that loop from causing issues, but it hasn't been built yet.

  • Thanks for the responses confirming what I was seeing. We worked around it and went another router.