• 0

Dynamic Group Applies to scripting


Question

2 answers to this question

Recommended Posts

  • 0

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".

 

Link to post
Share on other sites
  • 0
  • Administrators

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.

  • Upvote 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.