Forum Discussion

PDR_BM's avatar
4 months ago
Solved

Created custom properties when discovering devices

I'm trying to automate our onboarding process of resources a bit more because at the moment we are wasting a lot of time with custom properties and dynamic groups.

We are mainly working with dynamic groups that look at custom properties on the resource (Location of the resources, application the resources is used for, PRD or TST, etc ...) to decide which resources they have to use . Now because dynamic groups don't support inherited properties this creates a situation where we have to manually add these custom properties for each resource.

Is there a way to add these properties during the Netscan? Because we know that resources in a certain ip range are linked to a certain site/application/... 

Any other solutions to automate this as much as possible are also appreciated. 

  • I've not used Netscans much but thought it seemed like a fair straight forward requirement - putting some custom properties on a device discovered by a Netscan.  I can't see an option to do it though.  A scripted custom netscan would do it, but seems overkill having to write a groovy script to scan a range and discover devices so you can add some custom properties.

    Another option.. you could write some really simple property sources that output static values for the properties (like the location, application) and apply them based on the contents of system.ips.

    LM provide this example in the AppliesTo documentation (https://www.logicmonitor.com/support/terminology-syntax/scripting-support/what-is-lms)  so you could use this to set the applies to on each of your property sources

    join(system.ips,",")=~"192\\.168\\.100\\."

    Matches resources with an IP address on the subnet 192.168.100.X. The ability to match on the partial IP address of a resource is useful for grouping devices by 

    Then you need a script that writes out the properties you need, you could make those static, something like

    println "application=finance"
    println "location=london-datacentre"

3 Replies

  • I tried it out and PropertySources are working fine for what I need. Thank you for the info!

  • I've not used Netscans much but thought it seemed like a fair straight forward requirement - putting some custom properties on a device discovered by a Netscan.  I can't see an option to do it though.  A scripted custom netscan would do it, but seems overkill having to write a groovy script to scan a range and discover devices so you can add some custom properties.

    Another option.. you could write some really simple property sources that output static values for the properties (like the location, application) and apply them based on the contents of system.ips.

    LM provide this example in the AppliesTo documentation (https://www.logicmonitor.com/support/terminology-syntax/scripting-support/what-is-lms)  so you could use this to set the applies to on each of your property sources

    join(system.ips,",")=~"192\\.168\\.100\\."

    Matches resources with an IP address on the subnet 192.168.100.X. The ability to match on the partial IP address of a resource is useful for grouping devices by 

    Then you need a script that writes out the properties you need, you could make those static, something like

    println "application=finance"
    println "location=london-datacentre"

    • byronl's avatar
      byronl
      Icon for Neophyte rankNeophyte

      So, I do this, along with a few others.  I have my structure broken out per region and then the sites.  These are static folders.  Within each static site folder, there are 3 dynamic folders--Network, Power, and Server.  My apply to functions look for site name and IP subnet and then matches with system device properties. Example site called "Austin"

      Apply to function        join(system.ips,",")=~"10\\.92\\."|| site == "Austin"

      Apply to at the site "network" dynamic folder.           (isNetwork()) && isAustin()

      isNetwork maps back to hasCategory  which looks for Cisco, HP, Meraki, etc. 

       

      Was wondering if anyone could weigh in on this strategy.  I like this as it forces all devices into their correct site and folder--even if someone tries to drag a resource from a folder, it will automatically move it back.  This has been in place for a bit, but I question if there is an easier way to manage this without maintaining all these apply to functions.  Or, is this juice even worth the squeeze to have this in place. 

      Any thoughts would be appreciated as I keep going back and forth on this.