snmp location field

  • 27 March 2023
  • 4 replies


We use snmp location field on cisco devices.  it is like this:

“snmp-server location B23 Floor1”

How can we make that show up in logicmonitor in a easy to find place?



Best answer by mnagel 27 March 2023, 21:59

View original

4 replies

Userlevel 6
Badge +11

I would first check the INFO tab to make sure it’s not already reported there. If not you should be able to create a PropertySource that report that information in the info tab. The basic SNMP example at can be easily modified to report the location (you will need to find the OID for Location).

Userlevel 7
Badge +18

I thought it was built in, but couldn’t find it. Just build a property source applied to devices that should have snmp (like ``, but that would only catch the v2 snmp devices). 

import com.santaba.agent.groovyapi.snmp.Snmp
def snmp_timeout = 10000
try {
println("auto.snmp.location=" + Snmp.get(hostProps.get('system.hostname'), '', hostProps.toProperties(), snmp_timeout))
return 0
catch (Exception e) {println e;return 1}


Userlevel 6
Badge +11

While it is a bit disappointing this is not something LM has support for out of the box, using that string is actually one of the least good ways to accomplish the goal.  Going “the LM way” we, we’ve developed a method using a per-client property source module to scan each device IP address looking for matches within known per-site networks, then we assign auto.locationtag accordingly (typically a short site code similar to how you’d name devices at the site). With auto.locationtag set, you then create a dynamic group and assign the location string once to that group. This does rely on knowing the network layout for your environment and that it be somewhat reasonable, but otherwise it is rock solid.  You can also create an “Unknown Location” group to identify devices without the auto.locationtag set to help find gaps.

Here is a sanitized version of one of our PS modules:

hostProps.get("system.ips").split(",").each { ip ->
    if (ip ==~ /(172\.(24|30)|10\.188)\..*/) {
        locationtag = "loc1"
    else if (ip ==~ /(172\.(20|23)|10\.178)\..*/) {
        locationtag = "loc2"
if (locationtag) {
    println "locationtag=$locationtag"


I have been watching one of our clients adding the SNMP location to devices since they are moving from LM to Datadog and it is one of the poorer solutions out there for network monitoring.  Kinda funny watching it happen :).

Userlevel 7
Badge +18

Yeah, we don’t do it that way either. We have custom stuff that sync’s in from our source of truth including a location tag. That location tag sets the actual location property (not auto property) so that location can be used on a google map widget. Don’t get me started on how long that feed has been sitting in the queue. The intelligence that @mnagel references lives outside our LM entirely.